/* ── Auth pages ─────────────────────────────────────────────────
   Shared styles for login, signup, forgot, reset, register.
   Uses CSS variables from app.css (--bg, --surface, --accent…).
   Page-specific tweaks use body class modifiers.
   ------------------------------------------------------------- */

.auth-body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans, -apple-system, 'Inter', 'Segoe UI', sans-serif);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.auth-body *, .auth-body *::before, .auth-body *::after { box-sizing: border-box; }

/* ── Card container ──────────────────────────────────────────── */
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 44px 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-auth-card);
}
.auth-card--wide { max-width: 460px; }
.auth-card--xwide { max-width: 520px; }

/* ── Logo / header ───────────────────────────────────────────── */
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo h1 {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
}
.auth-logo h1 span { color: var(--accent); }
.auth-logo p {
  font-size: 13px;
  color: var(--muted);
  margin-top: 5px;
  line-height: 1.5;
}
.auth-logo .badge {
  display: inline-block;
  background: var(--accent-bg-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  padding: 4px 12px;
  margin-bottom: 12px;
}
.auth-logo strong { color: var(--text); }

/* ── Form layout ─────────────────────────────────────────────── */
.field { margin-bottom: 18px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; margin-bottom: 0; }
.field-row--mt4 { margin-top: 4px; }

.auth-body label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 7px;
  /* Reserve two-line height so a long label ("CONFIRM PASSWORD") that wraps
     doesn't push its input lower than the paired short-label input
     ("PASSWORD") in the same .field-row. Guarantees row alignment at any
     viewport width, without forcing nowrap (which would overflow narrow
     columns). 2.6em ≈ two lines at the 11.5px font + 1.1 line-height. */
  min-height: 2.6em;
  line-height: 1.2;
}
.auth-body input[type=text],
.auth-body input[type=email],
.auth-body input[type=password] {
  width: 100%;
  padding: 11px 14px;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color .15s, background .15s;
  font-family: inherit;
}
.auth-body input:focus {
  border-color: var(--accent);
  background: var(--accent-bg-input);
}
.auth-body input.err,
.auth-body input.err-field { border-color: var(--error-border-strong); }
.auth-body input[readonly] { opacity:0.65; cursor:not-allowed; background:var(--raised) !important; }

/* Password show/hide toggle */
.field--pw { position: relative; }
.field--pw input { padding-right: 54px; }
.pw-toggle {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  padding: 4px 8px;
}
.pw-toggle:hover { filter: brightness(1.2); }

/* Hint text under fields */
.hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; }

/* ── Submit button ───────────────────────────────────────────── */
.auth-body button[type=submit],
.auth-body .btn-submit {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, transform .1s, filter .15s;
  font-family: inherit;
  margin-top: 8px;
}
.auth-body button[type=submit]:hover,
.auth-body .btn-submit:hover { filter: brightness(1.1); }
.auth-body button[type=submit]:active { transform: scale(.98); }
.auth-body button[type=submit]:disabled { opacity: .6; cursor: wait; }

/* ── Status messages ─────────────────────────────────────────── */
.error, .errors {
  background: var(--error-soft);
  border: 1px solid var(--error-border);
  color: var(--error);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.errors ul { padding-left: 18px; margin: 0; }
.errors li { margin-bottom: 3px; line-height: 1.4; list-style: disc; }
.errors li:last-child { margin-bottom: 0; }

.success-notice {
  background: var(--success-soft);
  border: 1px solid var(--success-border-strong);
  color: var(--success);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 13px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Generic status message (forgot / reset pages) */
.msg {
  border-radius: var(--radius-sm);
  padding: 11px 15px;
  font-size: 13.5px;
  margin-bottom: 20px;
  line-height: 1.5;
}
.msg.ok  { background: var(--success-soft); border: 1px solid var(--success-border-strong); color: var(--success); }
.msg.err { background: var(--error-soft);   border: 1px solid var(--error-border);  color: var(--error); }

/* ── Footer links ────────────────────────────────────────────── */
.auth-footer,
.footnote,
.back {
  text-align: center;
  margin-top: 18px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}
.auth-footer a,
.footnote a,
.back a {
  color: var(--accent);
  text-decoration: none;
}
.auth-footer a:hover,
.footnote a:hover,
.back a:hover { text-decoration: underline; }

/* ── Signup-specific: plan card selector ─────────────────────── */
.plans { display: flex; gap: 10px; margin-bottom: 28px; }
.plan {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.plan.free { border-color: var(--border); }
.plan.pro  { border-color: var(--accent-border-strong); background: var(--accent-bg-tint); }
.plan.team { border-color: var(--auth-violet-border); background: var(--auth-violet-soft); }
.plan-name {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 4px;
}
.plan.free .plan-name { color: var(--muted); }
.plan.pro  .plan-name { color: var(--accent); }
.plan.team .plan-name { color: var(--auth-violet-fg); }
.plan-price { font-size: 18px; font-weight: 800; color: var(--text); }
.plan-price span { font-size: 11px; font-weight: 400; color: var(--muted); }
.plan-features { font-size: 10.5px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.plan-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 10px;
  margin-bottom: 6px;
}
.plan.pro  .plan-badge { background: var(--accent-bg-soft-2); color: var(--accent); }
.plan.team .plan-badge { background: var(--auth-violet-bg-soft); color: var(--auth-violet-fg); }

.invite-email { color: var(--text); }

/* Divider */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }


/* ── Mobile — touch targets, iOS zoom prevention, narrow screens ────── */
@media (max-width: 768px) {
  .auth-card { padding: 32px 24px; }
  .auth-card--wide { max-width: 420px; }

  /* Prevent iOS auto-zoom on focus (triggered when font-size < 16px) */
  .auth-body input[type=text],
  .auth-body input[type=email],
  .auth-body input[type=password] {
    font-size: 16px;
    min-height: 44px;
    padding: 12px 14px;
  }
  .field--pw input { padding-right: 60px !important; }
  .pw-toggle {
    right: 10px !important;
    bottom: auto !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    font-size: 14px !important;
    padding: 8px 10px !important;
    min-height: 44px !important;
    min-width: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .auth-body label {
    font-size: 12.5px !important;
    margin-bottom: 8px !important;
  }

  /* Touch-friendly submit button */
  .auth-body button[type=submit],
  .auth-body .btn-submit {
    min-height: 48px;
    font-size: 15px;
  }

  /* Stack field-row on narrow screens so inputs don't get cramped */
  .field-row {
    flex-direction: column !important;
    gap: 0 !important;
  }
  .field-row .field { margin-bottom: 16px !important; }
  .field-row--mt4 { margin-top: 12px !important; }

  /* Plan selector cards: stack vertically */
  .plans { flex-direction: column; gap: 8px; }
}

@media (max-width: 480px) {
  .auth-card { padding: 28px 18px; }
  .auth-logo h1 { font-size: 20px; }
}

/* ── Signup: Terms + Privacy consent ────────────────────────────
   Explicit checkbox (not passive click-through prose) so we have
   a recorded affirmative consent per v49 migration. Styled compact
   to fit between the password row and the submit button without
   shouting. .field--terms.err flips the bounding box red when the
   checkbox is missing on submit. */
.field--terms {
  margin: 14px 0 18px;
}
.auth-terms {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-muted, var(--text));
  cursor: pointer;
}
.auth-terms input[type="checkbox"] {
  margin: 2px 0 0 0;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--accent, #0095ff);
}
.auth-terms span { flex: 1; }
.auth-terms a { color: var(--accent, #0095ff); text-decoration: underline; }
.field--terms.err .auth-terms {
  color: #b80000;
}
.field--terms.err input[type="checkbox"] {
  outline: 2px solid #b80000;
  outline-offset: 2px;
}
