/* ============================================================
   CardXchange — Auth pages (Sign In split · Sign Up wizard)
   ============================================================ */

/* ================= Sign In: split screen ================= */
.auth-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  min-height: 100vh;
}

/* ---- Brand panel (dark) ---- */
.auth-brand-panel {
  position: relative;
  overflow: clip;
  display: flex; flex-direction: column; justify-content: space-between;
  gap: 48px;
  padding: clamp(28px, 4vw, 56px);
  background:
    radial-gradient(ellipse 640px 480px at 88% 108%, rgba(124, 58, 237, 0.4), transparent 65%),
    radial-gradient(ellipse 520px 380px at -10% -10%, rgba(124, 58, 237, 0.22), transparent 65%),
    var(--navy);
  color: rgba(255, 255, 255, 0.78);
}
.auth-brand-panel .grain {
  position: absolute; inset: 0;
  pointer-events: none;
  opacity: 0.55;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='0.05'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.auth-brand-panel .grid-dots {
  position: absolute; inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.11) 1px, transparent 1.4px);
  background-size: 26px 26px;
  mask-image: radial-gradient(ellipse 70% 55% at 30% 25%, #000 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 70% 55% at 30% 25%, #000 0%, transparent 70%);
}
.auth-brand-panel > * { position: relative; }

.auth-headline {
  font-family: var(--font-display);
  font-size: clamp(32px, 3.4vw, 48px);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: #fff;
  max-width: 15ch;
}
.auth-headline .hl {
  font-style: italic;
  background: linear-gradient(100deg, #c4b5fd, #e879f9);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.testimonial {
  margin-top: 28px;
  padding: 24px 26px;
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  max-width: 520px;
}
.testimonial .quote { font-size: 15.5px; line-height: 1.65; color: rgba(255, 255, 255, 0.85); }
.testimonial .who { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
.testimonial .avatar {
  width: 42px; height: 42px;
  border-radius: 13px;
  display: grid; place-items: center;
  background: var(--grad-brand-tile);
  color: #fff;
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.testimonial .name { font-weight: 700; color: #fff; font-size: 14.5px; }
.testimonial .role { font-size: 12.5px; color: rgba(255, 255, 255, 0.5); }

.back-home { font-size: 13.5px; color: rgba(255, 255, 255, 0.55); }
.back-home:hover { color: #fff; text-decoration: none; }

/* ---- Form panel ---- */
.auth-form-panel {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(24px, 4vw, 56px);
  background:
    radial-gradient(ellipse 560px 300px at 80% -60px, rgba(139, 92, 246, 0.09), transparent 68%),
    var(--bg);
}
.auth-form { width: min(444px, 100%); }
.auth-form > h1 { font-size: clamp(30px, 3vw, 40px); }
.auth-form .sub { margin: 10px 0 30px; color: var(--ink-2); }

.auth-form .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.or-divider {
  display: flex; align-items: center; gap: 14px;
  margin: 22px 0;
  color: var(--ink-3); font-size: 13px;
}
.or-divider::before, .or-divider::after {
  content: "";
  flex: 1; height: 1px;
  background: var(--line-2);
}

.btn-google {
  background: var(--surface);
  color: var(--ink);
  border: 1.5px solid var(--line-2);
  font-family: var(--font-body); font-weight: 600;
}
.btn-google:hover { border-color: #c4bdd9; box-shadow: var(--shadow-sm); }

.secure-note {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 22px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: var(--violet-50);
  border: 1px solid rgba(124, 58, 237, 0.1);
  font-size: 13px; color: var(--ink-2);
}

/* Password peek toggle */
.peek {
  position: absolute; right: 6px; top: 50%;
  transform: translateY(-50%);
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 13px; font-weight: 600;
  color: var(--ink-3);
}
.peek:hover { color: var(--accent); background: var(--accent-soft); }

/* Password strength meter */
.strength { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.strength .seg {
  flex: 1; height: 4px;
  border-radius: 4px;
  background: #e6e2f0;
  transition: background 0.2s ease;
}
.strength[data-score="1"] .seg:nth-child(-n+1) { background: var(--red-600); }
.strength[data-score="2"] .seg:nth-child(-n+2) { background: #f59e0b; }
.strength[data-score="3"] .seg:nth-child(-n+3) { background: var(--violet-500); }
.strength[data-score="4"] .seg:nth-child(-n+4) { background: var(--green-600); }
.strength .lbl { font-size: 12px; color: var(--ink-3); min-width: 46px; text-align: right; }

/* ================= Sign Up: wizard ================= */
.signup-shell { min-height: 100vh; display: flex; flex-direction: column; }

.signup-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px var(--gutter);
}
.signup-topbar .aside { font-size: 14px; color: var(--ink-2); }

.signup-main {
  flex: 1;
  width: min(1080px, 100%);
  margin-inline: auto;
  padding: clamp(8px, 2vw, 28px) var(--gutter) clamp(40px, 5vw, 72px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 28px;
  align-items: start;
}

.wizard-card {
  border-radius: var(--r-xl);
  padding: clamp(24px, 3vw, 36px);
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(160deg, rgba(139, 92, 246, 0.35), rgba(139, 92, 246, 0.05) 40%, rgba(192, 38, 211, 0.15)) border-box;
  border: 1.5px solid transparent;
}

/* Stepper */
.stepper { display: flex; align-items: center; gap: 12px; margin: 26px 0 30px; }
.stepper .step { display: flex; align-items: center; gap: 10px; }
.stepper .n {
  width: 32px; height: 32px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 10px;
  background: #edeaf5;
  color: var(--ink-3);
  font-family: var(--font-display); font-weight: 700; font-size: 14.5px;
  transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}
.stepper .lbl { font-size: 13.5px; font-weight: 600; color: var(--ink-3); white-space: nowrap; }
.stepper .step.is-active .n {
  background: var(--grad-accent);
  color: #fff;
  box-shadow: 0 4px 12px rgba(109, 40, 217, 0.35);
}
.stepper .step.is-active .lbl { color: var(--ink); }
.stepper .step.is-done .n { background: var(--green-bg); color: var(--green-700); }
.stepper .step.is-done .lbl { color: var(--ink-2); }
.stepper .line {
  flex: 1; height: 2px;
  border-radius: 2px;
  background: var(--line);
  transition: background 0.25s ease;
}
.stepper .line.is-done { background: var(--violet-300); }

/* Steps */
.wizard-step { display: none; }
.wizard-step.is-current { display: block; animation: stepIn 0.4s var(--ease-out); }
@keyframes stepIn {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: none; }
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.wizard-step .field + .field, .wizard-step .grid-2 + .field, .wizard-step .field + .grid-2 { margin-top: 16px; }

/* Phone: country code + number */
.phone-row { display: grid; grid-template-columns: 128px 1fr; gap: 10px; }

.field.has-error .input, .field.has-error .select { border-color: var(--red-600); }
.field .err {
  display: none;
  font-size: 12.5px; color: var(--red-600);
}
.field.has-error .err { display: block; }

/* OTP step */
.otp-sub { color: var(--ink-2); margin: 8px 0 24px; }
.otp-sub b { color: var(--ink); }
.otp-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; font-size: 13.5px; }
.otp-meta .expires { color: var(--ink-2); }
.otp-meta .expires b { font-variant-numeric: tabular-nums; }
.resend[disabled] { color: var(--ink-3); cursor: not-allowed; }

/* PIN */
.pin-note {
  margin-top: 8px;
  font-size: 12.5px; color: var(--ink-3);
}

/* Success */
.success-wrap { text-align: center; padding: 26px 8px 10px; }
.success-check {
  width: 88px; height: 88px;
  margin: 0 auto 24px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #22c55e, #15803d);
  color: #fff; font-size: 38px;
  box-shadow: 0 14px 34px rgba(22, 163, 74, 0.35);
  animation: popIn 0.5s var(--ease-spring);
}
@keyframes popIn {
  from { transform: scale(0.4); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.success-wrap h2 { margin-bottom: 10px; }
.success-wrap .sub { color: var(--ink-2); max-width: 40ch; margin: 0 auto 26px; }

/* ---- Right rail (why we verify · saved quote) ---- */
.side-rail { display: grid; gap: 20px; }

.why-verify .item { display: flex; gap: 12px; align-items: flex-start; padding: 9px 0; }
.why-verify .tick {
  width: 24px; height: 24px; flex: 0 0 auto;
  margin-top: 1px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: var(--grad-accent);
  color: #fff; font-size: 12px;
}

.saved-quote { display: none; }
.saved-quote.is-visible { display: block; }
.saved-quote .row { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.saved-quote .t { font-weight: 700; }
.saved-quote .s { font-size: 13px; color: var(--ink-3); }

/* ---------------- Responsive ---------------- */
@media (max-width: 980px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-brand-panel { gap: 26px; }
  .auth-headline { font-size: clamp(26px, 6vw, 34px); }
  .testimonial { display: none; }
  .signup-main { grid-template-columns: 1fr; }
  .side-rail { order: 2; }
}

@media (max-width: 560px) {
  .grid-2 { grid-template-columns: 1fr; }
  .stepper .lbl { display: none; }
  .stepper .step.is-active .lbl { display: block; }
  .code-box { width: 44px; height: 54px; }
}

/* ============================================================
   QA pass — responsive polish (visual QA sweep)
   ============================================================ */

/* min(444px, 100%) inflates the panel's intrinsic width to 444px,
   which forced horizontal scroll on phones. max-width shrinks fine. */
.auth-form { width: 100%; max-width: 444px; }

/* "Last name" sat 16px lower than "First name": the generic
   `.field + .field` spacing rule leaked into the 2-col name grid */
.wizard-step .grid-2 .field + .field { margin-top: 0; }

/* Stop grid rows stretching apart (phantom gap between the wizard
   card and the side rail when the columns stack) */
.signup-main { align-content: start; }

/* Phone inputs may shrink below their default intrinsic width */
.phone-row { grid-template-columns: 128px minmax(0, 1fr); }
.wizard-card .input, .wizard-card .select { min-width: 0; }

@media (max-width: 980px) {
  /* Brand panel hugs its content; the form panel takes the rest */
  .auth-split { grid-template-rows: auto 1fr; }
}

/* Signup topbar: let the "Already have an account?" aside drop to its
   own right-aligned row instead of overlapping the logo on phones */
.signup-topbar { flex-wrap: wrap; }
.signup-topbar .aside { margin-left: auto; text-align: right; }

@media (max-width: 560px) {
  /* 6 OTP boxes + gaps must fit a 390px card */
  .code-row { gap: 8px; }
}

@media (max-width: 400px) {
  .code-box { width: 40px; height: 52px; }
  .code-row { gap: 7px; }
  /* Wide enough for "🇳🇬 +234" with a tighter chevron gutter */
  .phone-row { grid-template-columns: 118px minmax(0, 1fr); }
  .phone-row .select { padding-right: 30px; background-position: right 10px center; }
}
