/* ══════════════════════════════════════════════════════════════════════════
   AI Chat Console — Auth pages (login, forgot, reset, verify, resend-verify,
   login-2fa) + shared bits reused by register.php.
   Load order: tokens.css → app.css → ui.css → auth.css
   ══════════════════════════════════════════════════════════════════════════ */

html, body { height: 100%; }

/* Same scroll-lock escape hatch landing.css and pages.css carry: app.css pins
   `body, html { width:100vw; height:100vh; overflow:hidden !important }`
   (two blocks — "LAYOUT/FLEXBOX OVERFLOW FIXES") for the dashboard's fixed
   app shell, written with NO media query — confirmed by inspecting the live
   parsed stylesheet, so it locks scrolling at every width, not just mobile.
   A short card (login) fits either way; a tall one (register's multi-step
   billing form) would overflow with no way to reach the submit button —
   register.css already carries an unscoped reset for exactly this reason
   ("stop app.css auth rules from centering/locking the page"), which is the
   pattern this mirrors. height stays auto so body.auth-page's
   min-height:100dvh centring still applies when there IS spare room. */
html, body {
  width: auto !important;
  height: auto !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

body.auth-page {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 70% 50% at 50% 0%,  var(--accent-soft), transparent),
    radial-gradient(ellipse 40% 40% at 85% 85%, var(--accent-softer), transparent),
    var(--bg-mesh);
  background-attachment: fixed;
}
/* Subtle dot grid overlay */
body.auth-page::before {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: radial-gradient(circle, var(--accent-softer) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* Floating theme toggle (top-right) */
.auth-theme-toggle {
  position: fixed; top: 16px; right: 16px; z-index: 100;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--border-glass);
  background: var(--surface-glass);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  transition: transform var(--t-fast) var(--ease-out), color var(--t-fast) ease;
}
.auth-theme-toggle:hover { transform: scale(1.08); color: var(--text); }
.auth-theme-toggle .icon-sun  { display: none; }
.auth-theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .auth-theme-toggle .icon-sun,
[data-theme="oled"] .auth-theme-toggle .icon-sun  { display: block; }
[data-theme="dark"] .auth-theme-toggle .icon-moon,
[data-theme="oled"] .auth-theme-toggle .icon-moon { display: none; }

/* ── Card ────────────────────────────────────────────────────────────────── */
.auth-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 420px;
  background: var(--surface-glass);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border: 1px solid var(--border-glass);
  border-radius: var(--r-xl);
  padding: 44px 40px 36px;
  box-shadow: var(--shadow-4);
}
/* Gradient hairline shimmer along the top edge */
.auth-card::before {
  content: ''; position: absolute; top: 0; left: 18%; right: 18%; height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  border-radius: 100%;
}
.auth-card-wide { max-width: 480px; }

/* ── Logo header ─────────────────────────────────────────────────────────── */
.auth-logo {
  display: flex; flex-direction: column; align-items: center;
  margin-bottom: 32px; text-align: center;
}
.auth-logo-icon {
  width: 60px; height: 60px; border-radius: var(--r-md);
  background: var(--grad-brand); color: var(--on-accent);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
  box-shadow: var(--shadow-accent);
}
/* The mark is stroke="currentColor" — pin it to white explicitly rather than
   relying on inheritance, so it stays legible on the accent tile even if a
   broader `.auth-logo svg` rule is (re)introduced elsewhere. */
.auth-logo-icon svg { color: var(--on-accent); }
.auth-logo h1 {
  font-size: var(--fs-xl); font-weight: 800; color: var(--text-strong);
  letter-spacing: -.03em; padding: 0;
}
.auth-logo p { font-size: var(--fs-sm); color: var(--muted); margin-top: 5px; }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.auth-alert {
  display: flex; align-items: flex-start; gap: 9px;
  border-radius: var(--r-sm); padding: 11px 14px;
  font-size: var(--fs-sm); line-height: 1.5; margin-bottom: 20px;
  background: var(--danger-soft); border: 1px solid rgba(239,68,68,.3);
  color: var(--danger);
}
.auth-alert a { color: inherit; font-weight: var(--fw-semibold); }
.auth-alert.success {
  background: var(--success-soft); border-color: rgba(5,150,105,.3);
  color: var(--success);
}
.auth-alert.info {
  background: var(--info-soft); border-color: rgba(2,132,199,.3);
  color: var(--info);
}
.auth-alert svg { flex-shrink: 0; margin-top: 1px; }

/* ── Form fields ─────────────────────────────────────────────────────────── */
.auth-field { margin-bottom: 18px; }
.auth-field-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 7px;
}
.auth-field label, .auth-field-top label {
  font-size: .72rem; font-weight: var(--fw-bold); color: var(--muted);
  letter-spacing: .07em; text-transform: uppercase;
}
.auth-field-top a {
  font-size: .75rem; color: var(--primary); text-decoration: none;
  font-weight: var(--fw-medium);
}
.auth-field-top a:hover { text-decoration: underline; }

.auth-card input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
.auth-card select {
  width: 100%; padding: 12px 15px;
  background: var(--surface-2); border: 1.5px solid var(--border);
  border-radius: var(--r-sm); color: var(--text);
  font-size: var(--fs-base); font-family: inherit; outline: none;
  transition: border-color var(--t-fast) ease, box-shadow var(--t-fast) ease, background-color var(--t-fast) ease;
}
.auth-card input::placeholder { color: var(--muted-2); }
.auth-card input:focus, .auth-card select:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

/* ── Submit button ───────────────────────────────────────────────────────── */
.btn-submit {
  width: 100%; padding: 13px;
  background: var(--grad-brand); border: none; border-radius: var(--r-sm);
  color: var(--on-accent); font-size: var(--fs-base); font-weight: var(--fw-bold);
  font-family: inherit; cursor: pointer; margin-top: 6px;
  box-shadow: var(--shadow-accent);
  transition: filter var(--t-fast) ease, transform var(--t-fast) var(--ease-out), box-shadow var(--t-base) ease;
}
.btn-submit:hover  { filter: brightness(1.06); box-shadow: var(--shadow-accent), var(--shadow-2); }
.btn-submit:active { transform: scale(.98); }
.btn-submit:disabled { opacity: .55; cursor: not-allowed; }

/* ── Divider + footer ────────────────────────────────────────────────────── */
.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 22px 0; color: var(--muted); font-size: .75rem;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.auth-foot { text-align: center; font-size: var(--fs-sm); color: var(--muted); }
.auth-foot a { color: var(--primary); text-decoration: none; font-weight: var(--fw-semibold); }
.auth-foot a:hover { text-decoration: underline; }

/* Secondary links under the form (2FA "use backup code", back-to-login, …) */
.alt-link { text-align: center; margin-top: 16px; font-size: .8rem; color: var(--muted); }
.alt-link a { color: var(--primary); font-weight: var(--fw-semibold); text-decoration: none; }
.alt-link a:hover { text-decoration: underline; }
.back-link { display: block; text-align: center; margin-top: 12px; font-size: .78rem; color: var(--muted); text-decoration: none; }
.back-link:hover { color: var(--text); }

/* Code-input (2FA) */
.auth-code-input {
  text-align: center; letter-spacing: .5em; font-size: 1.3rem !important;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 440px) {
  .auth-card { padding: 36px 24px 28px; border-radius: var(--r-lg); }
}

@media (prefers-reduced-motion: reduce) {
  .auth-theme-toggle, .btn-submit { transition: none; }
  .auth-theme-toggle:hover, .btn-submit:active { transform: none; }
}
