/* ══════════════════════════════════════════════════════════════════════
   auth.css — premium redesign of the Login + Register pages, matching the
   marketing home page (home.css). Used ONLY by login.html + register.html,
   so this whole file is free to define the auth look wholesale. Structure and
   class names are preserved so auth.js (password toggle, flash dismiss, form
   validation reading .form-group > .input-wrap > input / .error-text) keeps
   working untouched. The living background + fx helpers are self-contained
   here; behavior (constellation, spotlight) is reused from home.js, which is
   fully null-guarded on pages without the hero markup.
   ══════════════════════════════════════════════════════════════════════ */

body.auth-page {
  --th-ink: #eef4ff;
  --th-line: rgba(147, 197, 253, .10);
  --th-line-2: rgba(147, 197, 253, .18);
  --th-fill: rgba(96, 165, 250, .05);
  --th-fill-2: rgba(96, 165, 250, .09);
  --th-card: rgba(16, 18, 30, .55);
  --th-card-2: rgba(20, 23, 38, .72);
  --th-shadow: 0 40px 100px -40px rgba(0, 0, 0, .85);
  --th-glow: rgba(96, 165, 250, .35);
  --th-ease: cubic-bezier(.22, 1, .36, 1);

  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

/* This page carries its own living background — retire base.html's mesh. */
body.auth-page .mesh-bg { display: none !important; }

/* ─────────────────────────────────────────────
   LIVING BACKGROUND (mirrors home.css .th-bg)
   ───────────────────────────────────────────── */
.auth-page .th-bg {
  position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
  background:
    radial-gradient(1100px 640px at 78% -10%, rgba(59, 130, 246, .14), transparent 60%),
    radial-gradient(820px 560px at 4% 6%, rgba(147, 197, 253, .08), transparent 55%),
    linear-gradient(180deg, #08080e 0%, #070710 45%, #06060c 100%);
}
.auth-page .th-bg-aurora {
  position: absolute; inset: -30% -10% auto -10%; height: 88vh;
  background:
    conic-gradient(from 120deg at 50% 40%,
      rgba(96, 165, 250, 0) 0deg, rgba(96, 165, 250, .15) 70deg,
      rgba(59, 130, 246, .05) 150deg, rgba(147, 197, 253, .13) 240deg,
      rgba(96, 165, 250, 0) 360deg);
  filter: blur(72px); opacity: .55; animation: authAurora 28s linear infinite;
}
@keyframes authAurora { from { transform: rotate(0) scale(1.1); } to { transform: rotate(360deg) scale(1.1); } }
.auth-page .th-bg-orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .8; }
.auth-page .th-bg-orb-1 { width: 520px; height: 520px; top: -12%; left: -8%;  background: rgba(96, 165, 250, .10); animation: authOrb1 24s ease-in-out infinite; }
.auth-page .th-bg-orb-2 { width: 460px; height: 460px; top: 28%; right: -10%; background: rgba(59, 130, 246, .08); animation: authOrb2 30s ease-in-out infinite; }
.auth-page .th-bg-orb-3 { width: 420px; height: 420px; bottom: -14%; left: 40%; background: rgba(147, 197, 253, .06); animation: authOrb3 22s ease-in-out infinite; }
@keyframes authOrb1 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(58px,48px)} }
@keyframes authOrb2 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(-48px,40px)} }
@keyframes authOrb3 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(40px,-38px)} }
.auth-page .th-bg-constellation { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .5; }
.auth-page .th-bg-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(147, 197, 253, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(147, 197, 253, .05) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(120% 80% at 50% 0%, #000 30%, transparent 78%);
          mask-image: radial-gradient(120% 80% at 50% 0%, #000 30%, transparent 78%);
  opacity: .55;
}
.auth-page .th-bg-noise {
  position: absolute; inset: 0; opacity: .035; mix-blend-mode: overlay;
  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'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.auth-page .th-bg-vignette {
  position: absolute; inset: 0;
  background: radial-gradient(130% 100% at 50% 0%, transparent 55%, rgba(4, 4, 9, .55) 100%);
}

/* Spotlight helper (aside panel) — driven by home.js */
.auth-page .th-spot { position: relative; }
.auth-page .th-spot::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 30%), rgba(96, 165, 250, .18), transparent 62%);
  opacity: 0; transition: opacity .4s var(--th-ease); pointer-events: none; z-index: 0;
}
.auth-page .th-spot:hover::before { opacity: 1; }

/* ─────────────────────────────────────────────
   SHELL + SPLIT LAYOUT
   ───────────────────────────────────────────── */
.auth-shell {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 96px 20px 48px;
}

.auth-split {
  display: flex;
  align-items: stretch;
  width: 100%;
  max-width: 860px;
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid var(--th-line-2);
  background: linear-gradient(180deg, var(--th-card-2), var(--th-card));
  backdrop-filter: blur(24px) saturate(1.15);
  box-shadow: var(--th-shadow);
  animation: authIn .7s var(--th-ease) both;
}
.auth-split.auth-split-wide { max-width: 1000px; }
@keyframes authIn { from { opacity: 0; transform: translateY(22px) scale(.99); } to { opacity: 1; transform: none; } }

/* Fine top-edge highlight on the whole panel. */
.auth-split { position: relative; }
.auth-split::before {
  content: ''; position: absolute; inset: 0; border-radius: 28px; padding: 1px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .16), transparent 38%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none; z-index: 3;
}

/* ── Branded aside ── */
.auth-aside {
  position: relative;
  flex: 0 0 360px;
  min-height: 520px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 44px;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(96, 165, 250, .22), transparent 55%),
    radial-gradient(90% 70% at 0% 100%, rgba(59, 130, 246, .16), transparent 60%),
    linear-gradient(160deg, rgba(20, 26, 46, .9), rgba(10, 12, 22, .92));
  border-right: 1px solid var(--th-line);
}
.auth-split-wide .auth-aside { flex-basis: 400px; }
/* Faint grid texture in the aside. */
.auth-aside::after {
  content: ''; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(147, 197, 253, .06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(147, 197, 253, .06) 1px, transparent 1px);
  background-size: 40px 40px;
  -webkit-mask-image: radial-gradient(80% 80% at 30% 20%, #000, transparent 75%);
          mask-image: radial-gradient(80% 80% at 30% 20%, #000, transparent 75%);
  opacity: .5; pointer-events: none;
}
.auth-aside-content { position: relative; z-index: 1; }
.auth-aside-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; margin-bottom: auto;
  border-radius: 999px;
  background: var(--th-fill); border: 1px solid var(--th-line-2);
  font-size: 11.5px; font-weight: 600; color: var(--accent2);
  position: relative; z-index: 1;
}
.auth-aside-badge span { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(110, 231, 183, .16); }
.auth-aside-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 26px; font-weight: 700; line-height: 1.2; letter-spacing: -.02em;
  margin-bottom: 22px;
  background: linear-gradient(180deg, #eef4ff, #a9c8f5);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.auth-aside-points { list-style: none; display: flex; flex-direction: column; gap: 13px; }
.auth-aside-points li {
  position: relative; padding-left: 30px;
  font-size: 13.5px; color: var(--text); line-height: 1.45;
}
.auth-aside-points li::before {
  content: ''; position: absolute; left: 0; top: 0;
  width: 19px; height: 19px; border-radius: 50%;
  background: rgba(110, 231, 183, .12); border: 1px solid rgba(110, 231, 183, .35);
}
.auth-aside-points li::after {
  content: ''; position: absolute; left: 6px; top: 6px;
  width: 7px; height: 4px;
  border-left: 1.8px solid var(--success); border-bottom: 1.8px solid var(--success);
  transform: rotate(-45deg);
}

/* ─────────────────────────────────────────────
   FORM CARD
   ───────────────────────────────────────────── */
.auth-card {
  flex: 1 1 auto;
  min-width: 0;
  padding: 46px 42px;
  background: transparent;
  position: relative;
  z-index: 1;
}
/* Standalone card (mobile, aside hidden) keeps its own chrome. */
.auth-card-wide { }

.auth-card .auth-header { text-align: left; margin-bottom: 28px; }
.auth-card .auth-header .auth-icon {
  width: 46px; height: 46px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 120% at 30% 20%, rgba(96, 165, 250, .22), rgba(96, 165, 250, .05));
  border: 1px solid var(--th-line-2);
  color: var(--accent2);
  margin: 0 0 16px;
}
.auth-card .auth-header .auth-logo { display: none; }
.auth-card .auth-header h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 27px; font-weight: 700; letter-spacing: -.02em;
  color: var(--th-ink); margin-bottom: 7px;
}
.auth-card .auth-header p { font-size: 14.5px; color: var(--text-muted); line-height: 1.5; }

/* ── Flash messages ── */
.flash-messages { margin-bottom: 20px; }
.flash-message {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 12px;
  font-size: 13px; font-weight: 500; margin-bottom: 10px;
  animation: flashIn .3s ease;
}
.flash-message.success { background: var(--success-tint); border: 1px solid rgba(110, 231, 183, .4); color: var(--success); }
.flash-message.error { background: var(--danger-tint); border: 1px solid rgba(252, 165, 165, .4); color: var(--danger); }
.flash-message.info { background: rgba(96, 165, 250, .1); border: 1px solid rgba(96, 165, 250, .35); color: var(--accent2); }
.flash-message .flash-close { margin-left: auto; cursor: pointer; background: none; border: none; color: inherit; font-size: 16px; opacity: .6; transition: opacity .2s ease; }
.flash-message .flash-close:hover { opacity: 1; }
@keyframes flashIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ── Form ── */
.auth-form { display: flex; flex-direction: column; gap: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 7px; }
.form-group label { font-size: 12.5px; font-weight: 600; color: var(--text); letter-spacing: -.01em; }
.form-group .input-wrap { position: relative; }
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="date"] {
  width: 100%;
  padding: 13px 16px;
  border-radius: 12px;
  border: 1px solid var(--th-line-2);
  background: rgba(6, 7, 12, .5);
  color: var(--th-ink);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color .22s var(--th-ease), box-shadow .22s var(--th-ease), background .22s var(--th-ease);
}
.form-group input[type="date"] { color-scheme: dark; }
.form-group input[type="date"]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .55; transition: opacity .2s ease; }
.form-group input[type="date"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }
.form-group input::placeholder { color: var(--text-muted); }
.form-group input:hover { border-color: rgba(147, 197, 253, .3); }
.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, .18);
  background: rgba(6, 7, 12, .8);
}
.form-group input.error { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(252, 165, 165, .15); }
.form-group .error-text { font-size: 12px; color: var(--danger); display: none; }
.form-group .error-text.visible { display: block; }

.password-toggle {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: 4px; font-size: 18px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: color .2s ease;
}
.password-toggle:hover { color: var(--accent2); }

.form-options { display: flex; align-items: center; font-size: 13px; flex-wrap: wrap; gap: 8px; }
.form-options .remember-me {
  display: flex; align-items: flex-start; gap: 9px; cursor: pointer;
  color: var(--text-muted); line-height: 1.5; transition: color .2s ease;
}
.form-options .remember-me:hover { color: var(--text); }
.form-options .remember-me a { color: var(--accent2); text-decoration: none; font-weight: 600; }
.form-options .remember-me a:hover { text-decoration: underline; }
.form-options .remember-me input[type="checkbox"] {
  appearance: none; width: 18px; height: 18px; border-radius: 6px;
  border: 1px solid var(--th-line-2); background: rgba(6, 7, 12, .5);
  cursor: pointer; transition: all .2s ease; position: relative; flex-shrink: 0; margin-top: 1px;
}
.form-options .remember-me input[type="checkbox"]:checked { background: var(--gradient-1); border-color: transparent; }
.form-options .remember-me input[type="checkbox"]:checked::after {
  content: ''; position: absolute; left: 6px; top: 3px;
  width: 5px; height: 9px; border-right: 2px solid #061021; border-bottom: 2px solid #061021;
  transform: rotate(45deg);
}

/* ── Submit ── */
.auth-form .btn-submit {
  width: 100%;
  margin-top: 4px;
  padding: 14px;
  border-radius: 12px;
  border: none;
  color: #061021;
  background: radial-gradient(120% 180% at 30% 0%, #cfe4ff 0%, #93c5fd 34%, #60a5fa 72%, #3b82f6 100%);
  font-family: 'Inter', sans-serif; font-size: 15px; font-weight: 700; letter-spacing: -.01em;
  cursor: pointer;
  box-shadow: 0 12px 32px -12px var(--th-glow), inset 0 1px 0 rgba(255, 255, 255, .5);
  transition: transform .3s var(--th-ease), box-shadow .3s var(--th-ease), filter .25s;
}
.auth-form .btn-submit:hover { transform: translateY(-2px); box-shadow: 0 18px 46px -14px var(--th-glow), inset 0 1px 0 rgba(255, 255, 255, .6); filter: saturate(1.05); }
.auth-form .btn-submit:active { transform: translateY(0); }

.auth-footer { text-align: center; margin-top: 22px; font-size: 13.5px; color: var(--text-muted); }
.auth-footer a { color: var(--accent2); text-decoration: none; font-weight: 600; transition: color .2s ease; }
.auth-footer a:hover { color: #fff; }

/* ─────────────────────────────────────────────
   NAV (top app-header) refine + contextual CTA
   ───────────────────────────────────────────── */
.auth-page .app-header {
  background: rgba(8, 9, 16, .5);
  backdrop-filter: blur(20px) saturate(1.2);
  border-bottom: 1px solid var(--th-line);
}
body.auth-page .navbar-login { display: none; }
.navbar-cta {
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--th-line-2);
  background: var(--th-fill-2);
  color: var(--th-ink) !important;
  font-size: 13px; font-weight: 600;
  text-decoration: none; white-space: nowrap;
  backdrop-filter: blur(10px);
  transition: background .2s var(--th-ease), border-color .2s var(--th-ease), color .2s;
}
.navbar-cta:hover { background: rgba(96, 165, 250, .16); border-color: rgba(96, 165, 250, .45); color: #fff !important; }

/* ─────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────── */
@media (max-width: 560px) {
  .form-row { grid-template-columns: 1fr; gap: 18px; }
}
@media (max-width: 820px) {
  .auth-aside { display: none; }
  .auth-split, .auth-split.auth-split-wide { max-width: min(460px, calc(100vw - 32px)); }
  .auth-card { padding: 40px 30px; }
  .auth-card .auth-header { text-align: center; }
  .auth-card .auth-header .auth-icon { margin: 0 auto 16px; }
}
@media (max-width: 480px) {
  .auth-shell { padding: 84px 16px 40px; }
  .auth-card { padding: 32px 22px; }
  .auth-page .app-header { padding: 10px 16px; }
  .navbar-cta { padding: 8px 14px; font-size: 12px; }
}

/* ─────────────────────────────────────────────
   REDUCED MOTION
   ───────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .auth-page .th-bg-aurora, .auth-page .th-bg-orb { animation: none !important; }
  .auth-split { animation: none !important; }
  .auth-form .btn-submit, .form-group input { transition: none !important; }
}
