/* ============================================================
   auth.css — Itinera auth pages
   Itinera design tokens (imported) + split-screen layout
   ============================================================ */

@import url("tokens.css?v=3");
@import url("glass.css?v=1");

/* ---------- base ---------- */
* { box-sizing: border-box; }

html { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
}

/* single soft runway glow — quiet, not AI blobs */
body::before {
  content: "";
  position: fixed;
  z-index: -1;
  width: 70vw;
  height: 70vw;
  max-width: 900px;
  max-height: 900px;
  top: -30%;
  left: -20%;
  border-radius: 50%;
  background: radial-gradient(circle, hsl(var(--accent) / 0.08), transparent 65%);
  pointer-events: none;
}

/* ---------- Accessibility Skip Link ---------- */
.skip-link {
  position: fixed;
  top: 1rem;
  left: 1.5rem;
  z-index: 99999;
  padding: 0.6rem 1.2rem;
  background: hsl(var(--card));
  color: hsl(var(--foreground));
  border: 1px solid hsl(var(--accent));
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  transform: translateY(-250%);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
  pointer-events: auto;
  outline: 2px solid hsl(var(--accent));
  outline-offset: 2px;
}

/* ---------- Top Navigation Header ---------- */
/* Full glassmorphism navbar is canonically defined in tokens.css */
.auth-main-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: calc(85px + 1.5rem);
  padding-bottom: 2.5rem;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
  width: 100%;
}

.auth-footer {
  width: 100%;
  padding: 1.25rem 1.5rem 1.75rem;
  text-align: center;
  font-size: 0.8rem;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

html.dark .auth-footer {
  color: #a1a1aa;
}

@media (max-width: 768px) {
  .auth-nav-header {
    padding: 0.75rem 1rem 0;
  }
  .auth-nav-links {
    display: none;
  }
  .auth-nav-container {
    padding: 0.35rem 0.75rem;
  }
}

/* ---------- split-screen layout ---------- */
.auth-shell {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  width: min(1080px, 94vw);
  min-height: min(620px, 80vh);
  border-radius: 24px;
  overflow: hidden;
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 20px 60px -15px rgba(0, 0, 0, 0.08) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

html.dark .auth-shell {
  background: #121215 !important;
  border: 1px solid #27272a !important;
  box-shadow: 0 24px 70px -20px rgba(0, 0, 0, 0.7) !important;
}

.auth-visual {
  position: relative;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2.75rem;
  overflow: hidden;
}

.auth-slides {
  position: absolute !important;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 0;
  overflow: hidden;
  z-index: 0 !important;
}

.auth-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transform: scale(1.06);
  transition: opacity 1.5s ease-in-out, transform 1.5s ease-in-out;
}

.auth-slide.active {
  opacity: 1;
  transform: scale(1);
}

.auth-visual::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 0;
  background: linear-gradient(180deg, rgba(10, 10, 10, 0.2) 0%, rgba(10, 10, 10, 0.85) 100%);
  pointer-events: none;
  z-index: 1;
}

.auth-visual > * {
  position: relative;
  z-index: 2;
}

.auth-visual h1 { font-size: 2.1rem; font-weight: 800; line-height: 1.2; margin: 0 0 0.5rem; letter-spacing: -0.02em; }
.auth-visual p { margin: 0; opacity: 0.92; max-width: 34ch; font-size: 1rem; line-height: 1.5; }
.auth-visual .brand { font-weight: 800; letter-spacing: -0.02em; font-size: 1.15rem; display: inline-flex; width: fit-content; align-items: center; gap: 0.5rem; padding: 0.5rem 1.1rem; border-radius: 9999px; background: rgba(255, 255, 255, 0.15); border: 1px solid rgba(255, 255, 255, 0.25); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }

.auth-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 3rem;
  background: transparent !important;
}

/* ---------- card ---------- */
.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.auth-card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #0f172a;
}

html.dark .auth-card h2 {
  color: #f8fafc;
}

.auth-card .sub {
  margin: 0 0 1.75rem;
  color: #64748b;
  font-size: 0.92rem;
  line-height: 1.5;
}

html.dark .auth-card .sub {
  color: #94a3b8;
}

/* ---------- fields ---------- */
.field { margin-bottom: 1.25rem; }

.field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.45rem;
}

html.dark .field label {
  color: #e2e8f0;
}

.field input {
  width: 100%;
  padding: 0.78rem 1rem;
  font-size: 0.95rem;
  font-family: inherit;
  color: #0f172a !important;
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 12px !important;
  outline: none;
  transition: all 0.15s ease;
}

html.dark .field input {
  color: #f8fafc !important;
  background: #18181b !important;
  border: 1px solid #27272a !important;
}

.field input::placeholder { color: #94a3b8; }
html.dark .field input::placeholder { color: #71717a; }

/* password show/hide wrapper (phase 5) */
.input-wrap {
  position: relative;
}
.input-wrap input[type="password"],
.input-wrap input[type="text"] {
  padding-right: 2.75rem;
}
.pw-toggle {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  transition: color 0.15s ease, background 0.15s ease;
}
html.dark .pw-toggle { color: #a1a1aa; }
.pw-toggle:hover { color: #0f172a; background: #f1f5f9; }
html.dark .pw-toggle:hover { color: #ffffff; background: #27272a; }

.field input:focus-visible, .field input:focus {
  border-color: #f59e0b !important;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2) !important;
}

html.dark .field input:focus-visible, html.dark .field input:focus {
  border-color: #fbbf24 !important;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.25) !important;
}

/* error states */
.field.has-error input:not([type="checkbox"]),
.field input.is-error:not([type="checkbox"]) {
  border-color: #ef4444 !important;
}

.field input.is-invalid-ring {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2) !important;
}

/* valid states (phase 4) */
.field input.is-valid:not([type="checkbox"]) {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18) !important;
}

.field-hint {
  display: none;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: #ef4444;
}

.field-hint.show { display: block; }

.field-hint.hint-valid { color: #10b981; }

/* password strength meter (phase 4) */
.strength-meter {
  display: flex;
  gap: 0.3rem;
  margin-top: 0.4rem;
}
.strength-meter .bar {
  flex: 1;
  height: 4px;
  border-radius: 9999px;
  background: #e2e8f0;
  transition: background 0.2s ease;
}
html.dark .strength-meter .bar { background: #27272a; }
.strength-meter.weak .bar:nth-child(1) { background: #ef4444; }
.strength-meter.fair .bar:nth-child(-n+3) { background: #f59e0b; }
.strength-meter.strong .bar:nth-child(-n+5) { background: #10b981; }

.strength-note {
  margin-top: 0.3rem;
  font-size: 0.75rem;
  color: #64748b;
}

.hint-list, .pw-checklist, #pw-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.5rem 0 0.25rem;
  padding: 0;
  list-style: none;
}
.hint-list li, .pw-chip, #pw-checklist li {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 500;
  color: #64748b;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  transition: all 0.15s ease;
  white-space: nowrap;
  user-select: none;
}
html.dark .hint-list li, html.dark .pw-chip, html.dark #pw-checklist li {
  color: #a1a1aa;
  background: #18181b;
  border-color: #27272a;
}
.hint-list li.met, .pw-chip.met, #pw-checklist li.met {
  color: #059669 !important;
  background: rgba(16, 185, 129, 0.12) !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
  font-weight: 600;
}
.hint-list li.met::before, .pw-chip.met::before, #pw-checklist li.met::before {
  content: "✓";
  font-weight: 700;
  font-size: 0.72rem;
}

/* terms checkbox (phase 5) */
.terms-field {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin: 0.25rem 0 1.25rem;
}
.terms-field input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  margin-top: 0.1rem;
  accent-color: #f59e0b;
}
.terms-field label {
  font-size: 0.84rem;
  font-weight: 400;
  color: #64748b;
  margin: 0;
}
html.dark .terms-field label { color: #a1a1aa; }
.terms-field label a { color: #0f172a; font-weight: 600; text-decoration: underline; }
html.dark .terms-field label a { color: #fbbf24; }
.terms-field.has-error label { color: hsl(var(--destructive)); }
.terms-field.has-error input[type="checkbox"] {
  outline: 2px solid hsl(var(--destructive) / 0.5);
  outline-offset: 2px;
}

/* email availability hint (phase 5) */
.hint-availability {
  color: hsl(var(--muted-foreground));
}
.hint-availability.checking { color: hsl(var(--muted-foreground)); }
.hint-availability.available { color: hsl(150 55% 38%); }
.hint-availability.taken { color: hsl(var(--destructive)); }
.hint-availability::before { content: "… "; }
.hint-availability.available::before { content: "✓ "; }
.hint-availability.taken::before { content: "✗ "; }

/* ---------- actions ---------- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 3rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  color: #ffffff !important;
  background: #0f172a !important;
  border: 1px solid transparent !important;
  border-radius: 9999px !important;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.15) !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.btn-primary:hover:not(:disabled) {
  background: #1e293b !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.22) !important;
}
.btn-primary:active:not(:disabled) { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.65; cursor: not-allowed; }

html.dark .btn-primary {
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
  color: #000000 !important;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.35) !important;
}

html.dark .btn-primary:hover:not(:disabled) {
  filter: brightness(1.1) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 22px rgba(245, 158, 11, 0.45) !important;
}

/* loading spinner (spec #2) */
.btn-primary.is-loading .btn-label { opacity: 0.75; }
.spinner {
  display: none;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
html.dark .spinner {
  border-color: rgba(0, 0, 0, 0.35);
  border-top-color: #000000;
}
.btn-primary.is-loading .spinner { display: inline-block; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- success note ---------- */
.success-note {
  display: none;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: #047857;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 10px;
}
html.dark .success-note {
  color: #34d399;
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
}
.success-note.is-show { display: block; }

/* ---------- links ---------- */
.auth-links {
  margin-top: 1.5rem;
  font-size: 0.88rem;
  text-align: center;
  color: #64748b;
}
html.dark .auth-links { color: #a1a1aa; }
.auth-links a { color: #0f172a; font-weight: 700; text-decoration: none; border-bottom: 1.5px solid currentColor; padding-bottom: 1px; }
html.dark .auth-links a { color: #fbbf24; }
.auth-links a:hover { opacity: 0.8; }
.auth-links .sep { margin: 0 0.4rem; opacity: 0.5; }

/* ---------- site banner ---------- */
#site-banner {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translate(-50%, 140%);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  max-width: min(560px, calc(100% - 2rem));
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
  border-radius: var(--radius-lg);
  background: rgb(255 255 255 / 0.75);
  color: hsl(var(--foreground));
  border: 1px solid hsl(var(--glass-border));
  -webkit-backdrop-filter: blur(var(--glass-blur-md)) saturate(var(--glass-saturate));
  backdrop-filter: blur(var(--glass-blur-md)) saturate(var(--glass-saturate));
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s ease, opacity 0.3s ease;
  z-index: 50;
}
html.dark #site-banner { background: rgb(0 0 0 / 0.65); border-color: hsl(var(--glass-border-dark)); }
#site-banner.is-show { transform: translate(-50%, 0); opacity: 1; }
#site-banner.is-error { border-color: hsl(var(--destructive)); }
#site-banner.is-error::before {
  content: "⚠";
  color: hsl(var(--destructive));
  font-weight: 700;
}
#site-banner.is-info { border-color: hsl(var(--ring)); }
#site-banner.is-ok { border-color: hsl(150 50% 40%); }
#site-banner.is-ok::before {
  content: "✓";
  color: hsl(150 50% 40%);
  font-weight: 700;
}

/* banner progress drain (phase 6) */
#site-banner-drain {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 100%;
  background: hsl(150 50% 40% / 0.7);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  transform-origin: left center;
}
#site-banner.is-error #site-banner-drain { background: hsl(var(--destructive) / 0.7); }

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  body { padding: 0; }
  .auth-form-side { min-height: 100vh; padding: 1.25rem; }
  .auth-card { padding: 1.75rem 1.5rem; }
  .field input.is-valid:not([type="checkbox"]),
  .field input.is-invalid-ring {
    box-shadow: none;
  }
}

/* ============================================================
   Glassmorphism Redesign
   ============================================================ */

/* Ambient radial glowing blobs in background */
body::before, body::after {
  content: "";
  position: fixed;
  width: 50vw;
  height: 50vw;
  max-width: 600px;
  max-height: 600px;
  border-radius: 50%;
  filter: blur(120px);
  z-index: -2;
  opacity: 0.22;
  pointer-events: none;
  animation: float-blobs 25s ease-in-out infinite;
}

body::before {
  top: -10%;
  left: -10%;
  background: radial-gradient(circle, #f59e0b, transparent 70%);
}

body::after {
  bottom: -10%;
  right: -10%;
  background: radial-gradient(circle, #78716c, transparent 70%);
  animation-delay: -5s;
}

html.dark body::before {
  background: radial-gradient(circle, #f59e0b, transparent 70%);
  opacity: 0.04;
}

html.dark body::after {
  background: radial-gradient(circle, #27272a, transparent 70%);
  opacity: 0.06;
}

@keyframes float-blobs {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, 20px) scale(1.05); }
  100% { transform: translate(0, 0) scale(1); }
}

/* Glassmorphic Shell Panel */
.auth-shell {
  background: rgba(255, 255, 255, 0.75) !important;
  backdrop-filter: blur(20px) saturate(130%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(130%) !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 24px 70px -24px rgba(0, 0, 0, 0.12) !important;
}

html.dark .auth-shell {
  background: rgba(18, 18, 18, 0.8) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 24px 70px -24px rgba(0, 0, 0, 0.6) !important;
}

.auth-form-side {
  background: transparent !important;
}

/* Fields */
.field input {
  background: hsl(var(--card)) !important;
  border: 1px solid hsl(var(--border)) !important;
}

html.dark .field input {
  background: rgba(24, 24, 27, 0.75) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* ---------- Google & Social Login ---------- */
.auth-divider {
  display: flex;
  align-items: center;
  margin: 1.25rem 0;
  color: #64748b;
  font-size: 0.82rem;
  font-weight: 500;
}
html.dark .auth-divider {
  color: #94a3b8;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid #cbd5e1;
}
html.dark .auth-divider::before,
html.dark .auth-divider::after {
  border-bottom-color: #27272a;
}
.auth-divider span {
  padding: 0 0.75rem;
}

.google-auth-wrapper {
  margin-bottom: 1.25rem;
}

.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: 100%;
  min-height: 3rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  color: #1e293b !important;
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 9999px !important;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.btn-google:hover {
  background: #f8fafc !important;
  border-color: #94a3b8 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

html.dark .btn-google {
  color: #f8fafc !important;
  background: #18181b !important;
  border: 1px solid #27272a !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

html.dark .btn-google:hover {
  background: #27272a !important;
  border-color: #3f3f46 !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.btn-google svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ============================================================
   Auth brand — quiet in-card wordmark (no top bar on auth pages)
   ============================================================ */
.auth-brand {
  margin-bottom: 1.6rem;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #94a3b8;
}

html.dark .auth-brand {
  color: #71717a;
}

.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 1.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #64748b;
  text-decoration: none;
  transition: color 0.15s ease;
}

.auth-back:hover {
  color: #f59e0b;
}

html.dark .auth-back {
  color: #94a3b8;
}

html.dark .auth-back:hover {
  color: #fbbf24;
}
