/* ===== Reset ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ===== Base ===== */
html { font-size: 16px; }

body {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  background: #EEF1FB;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  color: #1A1D3B;
  position: relative;
}

/* ===== Decorative BG blobs ===== */
.page-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.page-bg::before,
.page-bg::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
}

.page-bg::before {
  width: 500px;
  height: 500px;
  background: #4C5FD5;
  top: -150px;
  right: -100px;
}

.page-bg::after {
  width: 400px;
  height: 400px;
  background: #22D3A5;
  bottom: -100px;
  left: -80px;
}

/* ===== Container ===== */
.container {
  width: 100%;
  max-width: 580px;
  position: relative;
  z-index: 1;
}

/* ===== Card ===== */
.form-card {
  background: #ffffff;
  border-radius: 28px;
  box-shadow:
    0 2px 4px rgba(76, 95, 213, 0.06),
    0 12px 40px rgba(76, 95, 213, 0.13);
  overflow: hidden;
}

/* ===== Card Header ===== */
.card-header {
  padding: 36px 40px 0;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.brand-dot {
  width: 10px;
  height: 10px;
  min-width: 10px;
  background: linear-gradient(135deg, #4C5FD5, #22D3A5);
  border-radius: 50%;
  margin-top: 8px;
}

.card-header h1 {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: #1A1D3B;
  line-height: 1.2;
}

.subtitle {
  font-size: 0.875rem;
  color: #7B84AD;
  margin-top: 5px;
  font-weight: 400;
}

/* ===== Progress Section ===== */
.progress-section {
  padding: 32px 40px 0;
}

.steps-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  position: relative;
}

/* ===== Track ===== */
.track-wrapper {
  position: absolute;
  top: 20px; /* half of circle height (40px / 2) */
  left: 20px; /* half of first circle width */
  right: 20px;
  height: 3px;
  z-index: 0;
}

.track-bg {
  position: absolute;
  inset: 0;
  background: #DDE1F0;
  border-radius: 99px;
}

.track-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4C5FD5 0%, #22D3A5 100%);
  border-radius: 99px;
  transition: width 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Step Nodes ===== */
.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 1;
}

.step-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #EEF1FB;
  border: 2.5px solid #DDE1F0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
  color: #9BA3C9;
  transition:
    background 0.3s ease,
    border-color 0.3s ease,
    color 0.3s ease,
    box-shadow 0.3s ease,
    transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.step-label {
  font-size: 0.7rem;
  font-weight: 500;
  color: #9BA3C9;
  white-space: nowrap;
  transition: color 0.3s ease, font-weight 0.2s ease;
}

/* Active Step */
.step.active .step-circle {
  background: #4C5FD5;
  border-color: #4C5FD5;
  color: #ffffff;
  box-shadow: 0 0 0 5px rgba(76, 95, 213, 0.18);
  transform: scale(1.12);
}

.step.active .step-label {
  color: #4C5FD5;
  font-weight: 600;
}

/* Completed Step */
.step.completed .step-circle {
  background: #22D3A5;
  border-color: #22D3A5;
  color: #ffffff;
  transform: scale(1);
}

.step.completed .step-label {
  color: #22D3A5;
  font-weight: 500;
}

/* ===== Fieldsets Wrapper ===== */
.fieldsets-wrapper {
  padding: 32px 40px;
  min-height: 300px;
}

.form-step {
  display: none;
  border: none;
  padding: 0;
  animation: stepIn 0.38s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.form-step.active {
  display: block;
}

.form-step.slide-back {
  animation: stepInBack 0.38s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes stepIn {
  from {
    opacity: 0;
    transform: translateX(24px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes stepInBack {
  from {
    opacity: 0;
    transform: translateX(-24px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ===== Step Headers ===== */
.step-header {
  margin-bottom: 24px;
}

.step-header h2 {
  font-size: 1.18rem;
  font-weight: 700;
  color: #1A1D3B;
  letter-spacing: -0.2px;
}

.step-desc {
  font-size: 0.84rem;
  color: #7B84AD;
  margin-top: 4px;
}

/* ===== Form Groups ===== */
.form-group {
  margin-bottom: 18px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #1A1D3B;
  margin-bottom: 7px;
  letter-spacing: 0.01em;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="tel"],
.form-group input[type="date"] {
  width: 100%;
  padding: 11px 15px;
  border: 1.5px solid #DDE1F0;
  border-radius: 11px;
  font-family: inherit;
  font-size: 0.9rem;
  color: #1A1D3B;
  background: #F8F9FE;
  outline: none;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
  -webkit-appearance: none;
}

.form-group input:focus {
  border-color: #4C5FD5;
  background: #ffffff;
  box-shadow: 0 0 0 3.5px rgba(76, 95, 213, 0.12);
}

.form-group input::placeholder {
  color: #B0B8D9;
}

/* ===== Radio Group ===== */
.radio-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.radio-option { cursor: pointer; }

.radio-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.radio-box {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 16px;
  border: 1.5px solid #DDE1F0;
  border-radius: 11px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #7B84AD;
  background: #F8F9FE;
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease;
  user-select: none;
}

.radio-icon { font-size: 1rem; line-height: 1; }

.radio-option input[type="radio"]:checked + .radio-box {
  border-color: #4C5FD5;
  color: #4C5FD5;
  background: #EEF1FB;
  font-weight: 600;
}

/* ===== Toggle Switches ===== */
.toggle-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toggle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  background: #F8F9FE;
  border: 1.5px solid #DDE1F0;
  border-radius: 11px;
  gap: 12px;
}

.toggle-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toggle-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1A1D3B;
}

.toggle-sub {
  font-size: 0.75rem;
  color: #7B84AD;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
  cursor: pointer;
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #C8D0E7;
  border-radius: 99px;
  transition: background 0.3s ease;
}

.slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toggle-switch input:checked + .slider {
  background: #4C5FD5;
}

.toggle-switch input:checked + .slider::before {
  transform: translateX(20px);
}

/* ===== Review Card ===== */
.review-card {
  border: 1.5px solid #DDE1F0;
  border-radius: 14px;
  overflow: hidden;
}

.review-section {
  padding: 14px 18px;
  border-bottom: 1px solid #EEF1FB;
}

.review-section:last-child {
  border-bottom: none;
}

.review-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #4C5FD5;
  background: #EEF1FB;
  padding: 3px 8px;
  border-radius: 6px;
  margin-bottom: 10px;
}

.review-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
  gap: 12px;
}

.review-key {
  font-size: 0.84rem;
  color: #7B84AD;
  white-space: nowrap;
}

.review-val {
  font-size: 0.84rem;
  font-weight: 600;
  color: #1A1D3B;
  text-align: right;
  word-break: break-all;
  max-width: 220px;
}

/* ===== Success State ===== */
.success-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 16px 20px 8px;
}

.success-ring {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(76,95,213,0.12), rgba(34,211,165,0.12));
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 22px;
  animation: ringPulse 0.6s ease both;
}

.success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4C5FD5, #22D3A5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: #ffffff;
  animation: iconPop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s both;
}

@keyframes ringPulse {
  from { opacity: 0; transform: scale(0.7); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes iconPop {
  from { transform: scale(0) rotate(-30deg); }
  to   { transform: scale(1) rotate(0deg); }
}

.success-state h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: #1A1D3B;
  margin-bottom: 10px;
  animation: fadeUp 0.4s ease 0.25s both;
}

.success-state p {
  font-size: 0.9rem;
  color: #7B84AD;
  line-height: 1.65;
  margin-bottom: 28px;
  animation: fadeUp 0.4s ease 0.35s both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.btn-restart {
  padding: 10px 26px;
  background: #F0F4FF;
  color: #4C5FD5;
  border: none;
  border-radius: 11px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
  animation: fadeUp 0.4s ease 0.45s both;
}

.btn-restart:hover {
  background: #DDE4FB;
}

/* ===== Navigation Footer ===== */
.nav-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px 36px;
}

.step-counter {
  font-size: 0.78rem;
  font-weight: 500;
  color: #9BA3C9;
  letter-spacing: 0.01em;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 11px 22px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  outline: none;
}

.btn-prev {
  background: #F0F4FF;
  color: #4C5FD5;
}

.btn-prev:hover:not(:disabled) {
  background: #DDE4FB;
}

.btn-prev:disabled {
  opacity: 0.38;
  cursor: default;
  pointer-events: none;
}

.btn-next {
  background: #4C5FD5;
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(76, 95, 213, 0.3);
}

.btn-next:hover {
  background: #3D4EC4;
  box-shadow: 0 6px 20px rgba(76, 95, 213, 0.42);
  transform: translateY(-1px);
}

.btn-next:active {
  transform: translateY(0);
}

.btn-next.submit-mode {
  background: linear-gradient(135deg, #4C5FD5, #22D3A5);
  box-shadow: 0 4px 16px rgba(34, 211, 165, 0.28);
}

.btn-next.submit-mode:hover {
  box-shadow: 0 6px 22px rgba(34, 211, 165, 0.38);
  filter: brightness(1.05);
}

/* ===== Responsive ===== */
@media (max-width: 520px) {
  .card-header,
  .progress-section,
  .fieldsets-wrapper,
  .nav-footer {
    padding-left: 24px;
    padding-right: 24px;
  }

  .card-header {
    padding-top: 28px;
  }

  .card-header h1 {
    font-size: 1.4rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .step-label {
    font-size: 0.62rem;
  }

  .step-circle {
    width: 34px;
    height: 34px;
    font-size: 0.8rem;
  }

  .track-wrapper {
    top: 17px;
    left: 17px;
    right: 17px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}