/* ============================================================
   VHSSIGNUP — wizard styling for the public signup modal
   ============================================================
   The public site renders in the LIGHT purple theme
   (web-page/warm-theme.css: violet #8b5cf6 on cream/lavender).
   This stylesheet therefore declares its own scoped tokens
   instead of relying on --secondary / --text-dim / --error,
   which are either violet or undefined in that theme — that is
   what previously produced muddy purple-grey fills and
   unreadable labels.

   Restrained on purpose: no glass, no decorative motion, no
   gradients of its own — the progress rail, the four panels,
   the character counters and the inline field errors.

   v1.1.0
   ============================================================ */

#signupWizard {
  /* VHS purple system (matches warm-theme.css) */
  --sw-purple: #6d4ab1;
  --sw-violet: #8b5cf6;
  --sw-lavender: #b79cf9;
  --sw-ink: #3b2d4a;
  --sw-muted: #7a6a8f;
  --sw-faint: #a89ab8;
  --sw-line: rgba(109, 74, 177, 0.16);
  --sw-line-strong: rgba(109, 74, 177, 0.3);
  --sw-surface: #fffdfe;
  --sw-tint: #f5eefc;
  --sw-danger: #b91c1c;
  --sw-danger-line: rgba(220, 38, 38, 0.5);
  --sw-ok: #15803d;
}

/* ── Progress rail ─────────────────────────────────────────────────── */
.sw-progress {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  list-style: none;
  margin: 0 0 0.85rem;
  padding: 0;
}

.sw-progress-step {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  position: relative;
  text-align: center;
}

/* Connector line between two dots. */
.sw-progress-step::before {
  content: '';
  position: absolute;
  top: 0.85rem;
  right: 50%;
  left: -50%;
  height: 2px;
  background: var(--sw-line);
}

.sw-progress-step:first-child::before {
  display: none;
}

.sw-progress-dot {
  position: relative;
  z-index: 1;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--sw-muted);
  background: var(--sw-surface);
  border: 2px solid var(--sw-line-strong);
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.sw-progress-step.is-active .sw-progress-dot {
  border-color: var(--sw-purple);
  background: var(--sw-purple);
  color: #fff;
}

.sw-progress-step.is-done .sw-progress-dot {
  border-color: var(--sw-ok);
  color: var(--sw-ok);
}

.sw-progress-step.is-done::before {
  background: var(--sw-ok);
}

.sw-progress-label {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--sw-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.sw-progress-step.is-active .sw-progress-label {
  color: var(--sw-purple);
  font-weight: 700;
}

/* ── Step panels ───────────────────────────────────────────────────── */
/* The site modal is sized for forms that scroll. The wizard's own steps can
   fit a 768–900px desktop, so trim this modal's padding only (scoped through
   :has so no other modal changes) rather than shrinking any text. */
.modal-content:has(#signupWizard) {
  padding: 26px 32px;
}

/* Just enough to stop the modal jumping between steps, without leaving a
   visible gap under the shorter panels (Review / Verify). */
.sw-body {
  min-height: 11rem;
}

.sw-panel[hidden] {
  display: none !important;
}

.sw-step-head {
  margin-bottom: 0.6rem;
}

.sw-step-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--sw-purple);
  margin: 0 0 0.15rem;
  outline: none;
  padding: 0;
}

.sw-step-note {
  font-size: 0.85rem;
  color: var(--sw-muted);
  margin: 0;
}

/* Row spacing comes from .form-group's own bottom margin, so the grid must
   not add a second one. */
.sw-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1rem;
}

.sw-span-2 {
  grid-column: 1 / -1;
}

/* Tighten the inherited form rhythm so the wizard fits without scrolling.
   Only spacing changes — no text is shrunk. */
#signupWizard .form-group {
  margin-bottom: 0.8rem;
}

#signupWizard .form-group label {
  color: var(--sw-ink);
  font-weight: 600;
  margin-bottom: 0.3rem;
}

#signupWizard .form-group input,
#signupWizard .form-group textarea {
  padding: 0.7rem 0.85rem;
}

#signupWizard .form-hint {
  color: var(--sw-faint);
  font-style: normal;
  margin-top: 0.25rem;
}

/* Names are short enough to sit three across on desktop. */
.sw-grid-names {
  grid-template-columns: repeat(3, 1fr);
}

/* ── Character counters ────────────────────────────────────────────── */
.sw-counter {
  display: block;
  text-align: right;
  margin-top: 0.2rem;
  font-size: 0.7rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--sw-faint);
  transition: color 0.2s ease;
}

.sw-counter.is-near {
  color: #b45309;
}

.sw-counter.is-full {
  color: var(--sw-danger);
}

/* ── Inline field errors ───────────────────────────────────────────── */
.sw-field-error {
  display: block;
  margin: 0.3rem 0 0;
  font-size: 0.79rem;
  font-weight: 600;
  color: var(--sw-danger);
}

.sw-field-error[hidden] {
  display: none !important;
}

#signupWizard .form-group input[aria-invalid='true'],
#signupWizard .form-group textarea[aria-invalid='true'],
#signupWizard .form-group select[aria-invalid='true'] {
  border-color: var(--sw-danger-line);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

#signupWizard .terms-checkbox input[type='checkbox'][aria-invalid='true'] {
  outline: 2px solid var(--sw-danger);
  outline-offset: 2px;
}

/* ── Review ────────────────────────────────────────────────────────── */
.sw-review-intro {
  font-size: 0.85rem;
  color: var(--sw-muted);
  margin: 0 0 0.55rem;
}

.sw-review {
  margin: 0 0 0.7rem;
  background: var(--sw-surface);
  border: 1px solid var(--sw-line);
  border-radius: 0.6rem;
  overflow: hidden;
}

.sw-review-row {
  display: grid;
  grid-template-columns: 8.5rem 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.35rem 0.85rem;
  border-bottom: 1px solid var(--sw-line);
}

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

.sw-review-row dt {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sw-purple);
}

.sw-review-row dd {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--sw-ink);
  overflow-wrap: anywhere;
}

.sw-review-edit {
  background: var(--sw-tint);
  border: 1px solid var(--sw-line);
  color: var(--sw-purple);
  border-radius: 0.35rem;
  padding: 0.25rem 0.7rem;
  font-size: 0.76rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.sw-review-edit:hover,
.sw-review-edit:focus-visible {
  background: #ece1fb;
  border-color: var(--sw-line-strong);
}

/* Terms stay inside the wizard's visual language and stay visible. */
#signupWizard .sw-terms {
  margin: 0;
  padding: 0.6rem 0.85rem;
  background: var(--sw-tint);
  border: 1px solid var(--sw-line);
  border-radius: 0.6rem;
}

#signupWizard .sw-terms .terms-checkbox label {
  color: var(--sw-ink);
  font-size: 0.85rem;
  line-height: 1.5;
}

#signupWizard .sw-terms .required {
  color: var(--sw-danger);
}

.sw-no-pet {
  font-size: 0.78rem;
  color: var(--sw-muted);
  margin: 0.35rem 0 0;
}

/* ── Verify step ───────────────────────────────────────────────────── */
#signupWizard .verification-method-group {
  margin-bottom: 1rem;
}

#signupWizard .verification-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

#signupWizard .choice-container {
  display: block;
  cursor: pointer;
}

#signupWizard .choice-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 100%;
  padding: 0.7rem 0.85rem;
  border: 2px solid var(--sw-line-strong);
  border-radius: 0.6rem;
  background: var(--sw-surface);
  color: var(--sw-ink);
  font-size: 0.88rem;
  font-weight: 600;
  text-align: left;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

/* Selected state is solid VHS purple — never the old pale amber. */
#signupWizard .choice-container input:checked + .choice-label {
  border-color: var(--sw-purple);
  background: var(--sw-purple);
  color: #fff;
}

#signupWizard .choice-container:hover .choice-label {
  border-color: var(--sw-purple);
}

#signupWizard .choice-container input:focus-visible + .choice-label {
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.3);
}

#signupWizard .choice-container input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

/* OTP panel reads as part of the same wizard. */
#signupWizard #otpVerificationContainer {
  margin: 0;
  padding: 0.85rem 0.95rem;
  background: var(--sw-tint);
  border: 1px solid var(--sw-line);
  border-radius: 0.6rem;
}

#signupWizard #otpVerificationContainer label {
  color: var(--sw-ink);
}

#signupWizard .otp-input-wrapper {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

/* web-page/style.css forces its dark `.otp-input-wrapper input` colours with
   !important, which outranks any normal declaration here — so these must be
   !important too or the OTP box stays dark inside the light purple wizard.
   Scoped to #signupWizard, so the login OTP is untouched. */
#signupWizard .otp-input-wrapper input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.7rem 0.85rem;
  border: 2px solid var(--sw-line-strong) !important;
  border-radius: 0.5rem;
  background: var(--sw-surface) !important;
  color: var(--sw-ink) !important;
  font-size: 1rem;
  letter-spacing: 0.25em;
}

#signupWizard .otp-input-wrapper input:focus {
  outline: none;
  padding: 0;
  border-color: var(--sw-purple) !important;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15) !important;
}

#signupWizard .resend-btn {
  flex: 0 0 auto;
  padding: 0 0.9rem;
  border: 1px solid var(--sw-line-strong);
  border-radius: 0.5rem;
  background: var(--sw-surface);
  color: var(--sw-purple);
  font-size: 0.8rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}

#signupWizard .resend-btn:hover:not(:disabled) {
  border-color: var(--sw-purple);
  background: #ece1fb;
}

#signupWizard .resend-btn:disabled {
  color: var(--sw-faint);
  cursor: default;
  opacity: 0.75;
}

/* ── Navigation ────────────────────────────────────────────────────── */
.sw-nav {
  margin-top: 0.8rem;
  margin-bottom: 0;
  gap: 0.6rem;
}

.sw-nav .btn[hidden] {
  display: none !important;
}

#signupWizard .sw-nav .btn-secondary {
  color: var(--sw-purple);
  border: 2px solid var(--sw-line-strong);
  background: var(--sw-surface);
}

/* ── Mobile ────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .sw-progress-label {
    display: none;
  }

  .sw-progress {
    gap: 0.35rem;
    margin-bottom: 0.75rem;
  }

  .sw-grid,
  .sw-grid-names {
    grid-template-columns: 1fr;
  }

  .sw-span-2 {
    grid-column: auto;
  }

  .sw-review-row {
    grid-template-columns: 1fr auto;
    gap: 0.15rem 0.75rem;
    padding: 0.45rem 0.75rem;
  }

  .sw-review-row dt {
    grid-column: 1 / -1;
  }

  #signupWizard .verification-choices {
    grid-template-columns: 1fr;
  }

  #signupWizard .otp-input-wrapper {
    flex-direction: column;
  }

  .sw-nav .btn {
    flex: 1 1 0;
  }
}
/* Six-box OTP inputs */
#signupWizard .otp-inputs {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
}

#signupWizard .otp-box {
  width: 40px;
  height: 48px;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  font-family: 'SF Mono', 'Consolas', monospace;
  border: 2px solid var(--sw-line-strong);
  border-radius: 0.5rem;
  background: var(--sw-surface);
  color: var(--sw-ink);
  outline: none;
  padding: 0;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-text-size-adjust: 100%;
}

#signupWizard .otp-box:focus {
  border-color: var(--sw-purple);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

#signupWizard .otp-box[aria-invalid="true"] {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

@media (max-width: 640px) {
  #signupWizard .otp-box {
    width: 38px;
    height: 46px;
    font-size: 1.15rem;
  }
}
