/* ── Success Modal ── */

#success-modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 18, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

#success-modal[hidden] { display: none !important; }

#success-modal.is-closing {
  animation: modalOverlayOut 0.35s cubic-bezier(0.4, 0, 1, 1) both;
}

#success-modal.is-closing .modal {
  animation: modalSlideDown 0.35s cubic-bezier(0.4, 0, 1, 1) both;
}

@keyframes modalOverlayOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

@keyframes modalSlideDown {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(16px) scale(0.97); }
}

#success-modal .modal {
  --blue-ribbon:    #0172fd;
  --surface-card:   #1f2430;
  --surface-raised: #252b38;
  --border-subtle:  rgba(255,255,255,0.07);
  --border-mid:     rgba(255,255,255,0.1);
  --text-primary:   #eceef6;
  --text-secondary: #a8b2c8;
  --text-muted:     #7282a0;

  font-family: var(--font-raleway), sans-serif;

  position: relative;
  background: var(--surface-card);
  border: 1px solid var(--border-mid);
  border-radius: 20px;
  max-width: min(680px, 100%);
  width: 100%;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  animation: modalSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
  box-shadow:
    0 0 0 1px rgba(1, 114, 253, 0.06),
    0 20px 60px rgba(0, 0, 0, 0.45),
    0 4px 16px rgba(0, 0, 0, 0.25);
}

@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Top shimmer accent line ── */
#success-modal .modal::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    #0172fd 25%,
    #4fa3ff 50%,
    #0172fd 75%,
    transparent 100%
  );
  background-size: 250% 100%;
  border-radius: 20px 20px 0 0;
  animation: shimmerLine 3s 0.6s ease-in-out infinite;
}

@keyframes shimmerLine {
  0%   { background-position: -100% 0; }
  100% { background-position: 200% 0; }
}

#success-modal .modal::after {
  content: '';
  position: absolute;
  top: -50px; right: -50px;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(1, 114, 253, 0.08) 0%, transparent 65%);
  pointer-events: none;
}

/* ── Header ── */

#success-modal .modal-header {
  padding: 44px 44px 0;
  position: relative;
  z-index: 1;
}

#success-modal .success-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(1, 114, 253, 0.1);
  border: 1px solid rgba(1, 114, 253, 0.22);
  border-radius: 100px;
  padding: 5px 13px 5px 10px;
  margin-bottom: 18px;
  animation: modalFadeUp 0.4s 0.25s both;
}

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

#success-modal .badge-icon {
  width: 20px; height: 20px;
  background: #0172fd;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

#success-modal .badge-icon svg { display: block; }

/* ── Animated checkmark ── */
#success-modal .check-path {
  stroke-dasharray: 18;
  stroke-dashoffset: 18;
  animation: drawCheck 0.45s 0.55s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes drawCheck {
  to { stroke-dashoffset: 0; }
}

#success-modal .badge-text {
  font-family: var(--font-montserrat), sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #4fa3ff;
}

#success-modal .modal-title {
  font-family: var(--font-montserrat), sans-serif;
  font-size: 25px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  animation: modalFadeUp 0.4s 0.35s both;
}

#success-modal .modal-subtitle {
  margin-top: 12px;
  font-size: 17px;
  color: var(--text-secondary);
  line-height: 1.7;
  animation: modalFadeUp 0.4s 0.45s both;
}

/* ── Divider ── */

#success-modal .divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 28px 44px;
  animation: modalFadeUp 0.4s 0.5s both;
}

/* ── Body ── */

#success-modal .modal-body {
  padding: 0 44px;
  position: relative;
  z-index: 1;
}

#success-modal .next-label {
  font-family: var(--font-montserrat), sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
  animation: modalFadeUp 0.4s 0.55s both;
}

/* ── Timeline steps ── */

#success-modal .steps {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Connecting vertical line from center of first step-num to center of last */
#success-modal .steps::before {
  content: '';
  position: absolute;
  left: 29px; /* 16px step padding-left + 14px (half of 28px num) - 1px */
  top: 28px;  /* 14px step padding-top + 14px half circle = center of first num */
  bottom: 28px;
  width: 2px;
  background: linear-gradient(
    to bottom,
    rgba(1, 114, 253, 0.55),
    rgba(1, 114, 253, 0.12)
  );
  border-radius: 2px;
  animation: modalFadeUp 0.4s 0.75s both;
}

#success-modal .step {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface-raised);
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  animation: modalFadeUp 0.4s both;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 10px;
}

#success-modal .step:last-child {
  margin-bottom: 0;
}

#success-modal .step:hover {
  border-color: rgba(1, 114, 253, 0.25);
  background: rgba(37, 43, 56, 0.9);
}

#success-modal .step:nth-child(1) { animation-delay: 0.6s; }
#success-modal .step:nth-child(2) { animation-delay: 0.7s; }
#success-modal .step:nth-child(3) { animation-delay: 0.8s; }

#success-modal .step-num {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #0172fd;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-montserrat), sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  margin-top: 1px;
  /* Ring to sit cleanly over the connector line */
  box-shadow: 0 0 0 3px var(--surface-raised);
  position: relative;
}

#success-modal .step-text {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.65;
  padding-top: 5px;
}

/* ── Footer ── */

#success-modal .modal-footer {
  padding: 26px 44px 38px;
  position: relative;
  z-index: 1;
  animation: modalFadeUp 0.4s 0.85s both;
}

#success-modal .btn-modal {
  display: block;
  width: 100%;
  padding: 15px 28px;
  background: #0172fd;
  border: none;
  border-radius: 12px;
  font-family: var(--font-montserrat), sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: background 0.18s, transform 0.15s, box-shadow 0.18s;
  box-shadow: 0 2px 16px rgba(1, 114, 253, 0.35);
}

#success-modal .btn-modal:hover {
  background: #0161dc;
  transform: translateY(-1px);
  box-shadow: 0 4px 24px rgba(1, 114, 253, 0.5);
}

#success-modal .btn-modal:active { transform: translateY(0); }

/* ── Close button ── */

#success-modal .close-btn {
  position: absolute;
  top: 16px; right: 16px;
  width: 34px; height: 34px;
  background: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 0.15s, border-color 0.15s;
  color: var(--text-muted);
}

#success-modal .close-btn:hover {
  background: rgba(255,255,255,0.07);
  border-color: var(--border-mid);
  color: var(--text-secondary);
}

/* ── Low viewport height — align top so modal doesn't clip ── */
@media (max-height: 640px) {
  #success-modal {
    align-items: flex-start;
    padding-top: 12px;
  }
}

/* ── Mobile ≤ 600px — all phones (iPhone 16 Pro Max 440px, SE 375px etc.) ── */
@media (max-width: 600px) {
  #success-modal {
    padding: 16px;
  }

  #success-modal .modal {
    border-radius: 20px;
  }

  #success-modal .modal-header {
    padding: 28px 24px 0;
  }

  #success-modal .success-badge {
    margin-bottom: 14px;
  }

  #success-modal .modal-title {
    font-size: 20px;
  }

  #success-modal .modal-subtitle {
    font-size: 14px;
    line-height: 1.55;
    margin-top: 10px;
  }

  #success-modal .divider {
    margin: 20px 24px;
  }

  #success-modal .modal-body {
    padding: 0 24px;
  }

  #success-modal .next-label {
    margin-bottom: 12px;
  }

  #success-modal .step {
    padding: 10px 12px;
    margin-bottom: 8px;
    gap: 12px;
  }

  #success-modal .step-text {
    font-size: 13px;
    line-height: 1.5;
    padding-top: 4px;
  }

  #success-modal .modal-footer {
    padding: 20px 24px 26px;
  }

  #success-modal .btn-modal {
    padding: 13px 24px;
    font-size: 14px;
  }
}

/* ── Mobile ≤ 375px — small phones ── */
@media (max-width: 375px) {
  #success-modal {
    padding: 12px;
  }

  #success-modal .modal-header {
    padding: 22px 20px 0;
  }

  #success-modal .modal-title {
    font-size: 18px;
  }

  #success-modal .modal-subtitle {
    font-size: 13px;
  }

  #success-modal .divider {
    margin: 16px 20px;
  }

  #success-modal .modal-body {
    padding: 0 20px;
  }

  #success-modal .step {
    padding: 9px 10px;
  }

  #success-modal .step-text {
    font-size: 12px;
  }

  #success-modal .modal-footer {
    padding: 16px 20px 22px;
  }
}
