/* ============================================================
   TagFirst Solo — Shared Auth Theme  (split layout)
   Branding panel on the LEFT, form on the RIGHT.
   Fully responsive: desktop = side-by-side, mobile = stacked.
   Theme: dark + cyan glow (Syne / Outfit / JetBrains Mono).
   ============================================================ */

:root {
  --bg:       #060a0f;
  --bg2:      #0b1118;
  --bg3:      #111c27;
  --bg4:      #172334;
  --accent:   #00e5ff;
  --accent2:  #0097b2;
  --green:    #00ff88;
  --amber:    #ffb800;
  --red:      #ff3d5a;
  --text:     #d8eaf5;
  --text2:    #5a7d96;
  --text3:    #2a4a5e;
  --border:   #162332;
  --border2:  #1e3348;
  --font:     'Outfit', sans-serif;
  --mono:     'JetBrains Mono', monospace;
  --display:  'Syne', sans-serif;
  --r:        8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 14px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }

/* ── UI polish: text selection, keyboard focus rings, scrollbar tint, reduced motion ── */
::selection { background: rgba(0,229,255,0.25); }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}
::-webkit-scrollbar-thumb { background: rgba(0,229,255,0.22); }
::-webkit-scrollbar-thumb:hover { background: rgba(0,229,255,0.40); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
}

/* ── Animations ── */
@keyframes fadeUp { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:none; } }

/* ============================================================
   SPLIT LAYOUT
   ============================================================ */
/* Auth-flow pages lock to the viewport — NEVER a page scrollbar. The injected
   56px top bar + the split fill the screen exactly; a card taller than the screen
   scrolls INSIDE the form panel with the bar hidden. Scoped via :has() so the long
   legal / 404 pages (no .auth-split) keep scrolling normally. */
body:has(.auth-split) { position: fixed; inset: 0; display: flex; flex-direction: column; overflow: hidden; }
body:has(.auth-split) .auth-topbar { flex-shrink: 0; }
body:has(.auth-split) .auth-split  { flex: 1 1 auto; min-height: 0; }
body:has(.auth-split) .auth-main   { align-items: safe center; }
.auth-split { display: flex; overflow: hidden; }
.auth-split, .auth-main { scrollbar-width: none; -ms-overflow-style: none; }
.auth-split::-webkit-scrollbar, .auth-main::-webkit-scrollbar { width: 0; height: 0; display: none; }

/* ── LEFT: branding panel ── */
.auth-side {
  flex: 0 0 44%; max-width: 560px;
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center;
  padding: 56px 56px;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(0,229,255,0.10) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 80%, rgba(0,151,178,0.08) 0%, transparent 55%),
    linear-gradient(150deg, #0b1118 0%, #060a0f 60%, #0b1118 100%);
  border-right: 1px solid var(--border);
}
/* grid overlay */
.auth-side::before {
  content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image: linear-gradient(rgba(0,229,255,0.04) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(0,229,255,0.04) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse at 35% 45%, #000 0%, transparent 78%);
}
.side-content { position: relative; z-index: 1; max-width: 380px; }

.auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 40px; }
.auth-logo { font-size: 34px; color: var(--accent); line-height: 1; filter: drop-shadow(0 0 12px rgba(0,229,255,0.5)); }
.auth-logo-name { font-family: var(--display); font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.auth-logo-name span { color: var(--accent); }
.auth-logo-sub { font-size: 11px; color: var(--text2); font-family: var(--mono); letter-spacing: 1px; text-transform: uppercase; margin-top: 2px; }

.side-headline {
  font-family: var(--display); font-weight: 800; font-size: 34px;
  line-height: 1.12; letter-spacing: -1px; margin-bottom: 18px;
}
.side-headline span { color: var(--accent); }
.side-sub { font-size: 15px; color: var(--text2); margin-bottom: 30px; max-width: 340px; }

.side-points { list-style: none; display: flex; flex-direction: column; gap: 14px; }
.side-points li { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--text); }
.side-points .tick {
  width: 24px; height: 24px; flex-shrink: 0; border-radius: 7px;
  display: flex; align-items: center; justify-content: center; font-size: 12px;
  color: var(--accent); background: rgba(0,229,255,0.10); border: 1px solid rgba(0,229,255,0.22);
}

/* ── RIGHT: form panel ── */
.auth-main {
  flex: 1; display: flex; align-items: safe center; justify-content: center;
  padding: 28px 24px; background: var(--bg);
  height: 100%; overflow-y: auto;                 /* scroll inside, never the page */
  scrollbar-width: none; -ms-overflow-style: none; /* hide the bar (Firefox/IE) */
}
.auth-main::-webkit-scrollbar { width: 0; height: 0; display: none; } /* hide the bar (WebKit) */
.auth-card {
  width: 100%; max-width: 400px;
  animation: fadeUp 0.35s ease;
}
/* compact brand shown only on mobile (inside the form panel) */
.auth-card-brand { display: none; align-items: center; gap: 12px; margin-bottom: 26px; }

.auth-title { font-family: var(--display); font-size: 24px; font-weight: 700; margin-bottom: 6px; }
.auth-sub   { font-size: 13px; color: var(--text2); margin-bottom: 20px; }

/* ── Fields ── */
.auth-field { margin-bottom: 14px; }
.auth-label {
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--mono); font-size: 10px; color: var(--text2);
  letter-spacing: 1px; text-transform: uppercase; margin-bottom: 7px;
}
.auth-input-wrap { position: relative; }
.auth-input {
  width: 100%; background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--r); color: var(--text); padding: 12px 14px;
  font-size: 14px; font-family: var(--font); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.auth-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,229,255,0.12); }
.auth-input::placeholder { color: var(--text3); }
.auth-input.error { border-color: var(--red); }
.auth-input.valid { border-color: var(--green); }
.auth-eye {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 15px;
  color: var(--text2); padding: 4px; line-height: 1;
}
.auth-eye:hover { color: var(--accent); }

/* Error TEXT hidden by design — invalid/required fields show a red border only. */
.field-err { font-size: 11px; color: var(--red); margin-top: 5px; display: none !important; line-height: 1.4; }
.field-err.show { display: none !important; }

/* ── Password strength meter ── */
.pwd-strength { margin-top: 7px; height: 4px; border-radius: 2px; background: var(--bg2); overflow: hidden; }
.pwd-strength-bar { height: 100%; width: 0; border-radius: 2px; transition: width .3s, background .3s; }
.pwd-hint { font-size: 11px; margin-top: 4px; min-height: 14px; color: var(--text2); }

/* ── Terms / agreement row ── */
.auth-terms { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 18px; cursor: pointer; }
.auth-terms input { accent-color: var(--accent); width: 15px; height: 15px; margin-top: 3px; cursor: pointer; flex-shrink: 0; }
.auth-terms span { font-size: 12px; color: var(--text2); line-height: 1.5; }
.auth-terms.error input { outline: 2px solid var(--red); outline-offset: 2px; border-radius: 3px; }
.auth-terms.error span { color: var(--red); }

/* ── OTP code boxes ── */
.otp-row { display: flex; gap: 10px; justify-content: space-between; margin-bottom: 8px; }
.otp-input {
  flex: 1 1 0; min-width: 0; aspect-ratio: 1 / 1;
  text-align: center; background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--r); color: var(--text); font-family: var(--mono);
  font-size: 22px; font-weight: 700; outline: none; padding: 0;
  transition: border-color .2s, box-shadow .2s;
  -moz-appearance: textfield;
}
.otp-input::-webkit-outer-spin-button, .otp-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.otp-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,229,255,0.12); }
.otp-input.filled { border-color: var(--accent2); background: var(--bg3); }
.otp-input.error  { border-color: var(--red); }
.otp-resend { text-align: center; font-size: 13px; color: var(--text2); margin: 18px 0 2px; }
.otp-timer  { color: var(--accent); font-family: var(--mono); }
@media (max-width: 380px) { .otp-row { gap: 7px; } .otp-input { font-size: 18px; } }

/* ── Remember / row helpers ── */
.auth-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.auth-check { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--text2); }
.auth-check input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }

/* ── Buttons ── */
.auth-btn {
  width: 100%; padding: 13px; background: var(--accent); border: none;
  border-radius: var(--r); color: #060a0f; font-size: 14px; font-weight: 700;
  font-family: var(--display); cursor: pointer; transition: all .2s;
  box-shadow: 0 4px 16px rgba(0,229,255,0.3);
}
.auth-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(0,229,255,0.45); }
.auth-btn:active { transform: none; }
.auth-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }

/* ── Links & switch ── */
.auth-link { color: var(--accent); cursor: pointer; font-weight: 500; }
.auth-link:hover { text-decoration: underline; }
.auth-switch { text-align: center; font-size: 13px; color: var(--text2); margin-top: 20px; }

/* ── Social login (Google / Microsoft) ── */
.auth-or {
  display: flex; align-items: center; gap: 12px; margin: 14px 0;
  color: var(--text3); font-size: 11px; font-family: var(--mono);
  letter-spacing: 1px; text-transform: uppercase;
}
.auth-or::before, .auth-or::after { content: ''; flex: 1; height: 1px; background: var(--border2); }
/* Icon-only social buttons — two equal halves filling the form width (gap kept) */
.auth-social { display: flex; flex-direction: row; gap: 14px; }
.auth-social-btn {
  display: flex; align-items: center; justify-content: center;
  flex: 1 1 0; height: 46px; border-radius: var(--r);
  background: var(--bg3); border: 1px solid var(--border2);
  cursor: pointer; transition: border-color .15s, background .15s, transform .15s;
}
.auth-social-btn:hover { border-color: var(--accent); background: var(--bg4); transform: translateY(-1px); }
.auth-social-btn:active { transform: none; }
.soc-ic { width: 22px; height: 22px; flex-shrink: 0; }

/* ── Modal (Terms / Privacy popup) ── */
.tf-modal { position: fixed; inset: 0; z-index: 200; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(2,5,9,0.72); }
.tf-modal.open { display: flex; animation: fadeUp .2s ease; }
.tf-modal-card { background: var(--bg2); border: 1px solid var(--border2); border-radius: 12px; width: 100%; max-width: 560px; max-height: 85vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 24px 70px rgba(0,0,0,0.6); }
.tf-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 20px; border-bottom: 1px solid var(--border); font-family: var(--display); font-weight: 700; font-size: 16px; flex-shrink: 0; }
.tf-modal-x { background: none; border: none; color: var(--text2); font-size: 18px; line-height: 1; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.tf-modal-x:hover { color: var(--red); background: var(--bg3); }
.tf-modal-body { padding: 16px 20px; overflow-y: auto; }
.tf-modal-body h2 { font-family: var(--display); font-size: 15px; font-weight: 700; margin: 14px 0 7px; color: var(--text); }
.tf-modal-body p, .tf-modal-body li { font-size: 12.5px; color: var(--text2); line-height: 1.65; margin-bottom: 8px; }
.tf-modal-body ul { padding-left: 18px; }
.tf-modal-body a { color: var(--accent); }
.tf-modal-foot { padding: 13px 20px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-shrink: 0; background: var(--bg); }
.tf-modal-agree { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text); cursor: pointer; user-select: none; }
.tf-modal-agree input { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; flex-shrink: 0; }
.tf-modal-done { padding: 8px 18px; background: var(--accent); border: none; color: #060a0f; border-radius: 7px; font-family: var(--display); font-weight: 700; font-size: 13px; cursor: pointer; }
.tf-modal-done:hover { opacity: .9; }
/* auto-driven "I agree" row on the form */
.auth-terms input:disabled { opacity: 1; }

/* ── Alert boxes (form-level) ── */
.auth-alert { display: none; font-size: 12.5px; padding: 10px 12px; border-radius: var(--r); margin-bottom: 16px; line-height: 1.5; }
.auth-alert.show { display: block; }
.auth-alert.err  { color: var(--red);   background: rgba(255,61,90,0.08);  border: 1px solid rgba(255,61,90,0.25); }
.auth-alert.ok   { color: var(--green); background: rgba(0,255,136,0.08);  border: 1px solid rgba(0,255,136,0.25); }
.auth-alert.info { color: var(--accent);background: rgba(0,229,255,0.07);  border: 1px solid rgba(0,229,255,0.22); }

/* ── Password requirements checklist ── */
.pwd-reqs { list-style: none; margin: 8px 0 2px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
.pwd-reqs li { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--text2); transition: color .2s; }
.pwd-reqs li .rq { width: 14px; height: 14px; flex-shrink: 0; border-radius: 50%; border: 1px solid var(--border2);
  display: flex; align-items: center; justify-content: center; font-size: 9px; color: transparent; transition: all .2s; }
.pwd-reqs li.met { color: var(--green); }
.pwd-reqs li.met .rq { border-color: var(--green); background: rgba(0,255,136,0.15); color: var(--green); }

/* ── Caps-lock warning ── */
.caps-warn { display: none; font-size: 11px; color: var(--amber); margin-top: 5px; align-items: center; gap: 5px; }
.caps-warn.show { display: flex; }

/* ── Confirm-match indicator ── */
.match-hint { font-size: 11px; margin-top: 5px; display: none; align-items: center; gap: 5px; }
.match-hint.show { display: flex; }
.match-hint.ok  { color: var(--green); }
.match-hint.no  { color: var(--red); }

/* ── Button loading spinner ── */
.auth-btn.loading { color: transparent !important; position: relative; pointer-events: none; }
.auth-btn.loading::after {
  content: ''; position: absolute; top: 50%; left: 50%; width: 18px; height: 18px;
  margin: -9px 0 0 -9px; border-radius: 50%;
  border: 2px solid rgba(6,10,15,0.35); border-top-color: #060a0f;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast notifications ── */
.toast-wrap { position: fixed; top: 18px; right: 18px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; max-width: calc(100vw - 36px); }
.toast {
  display: flex; align-items: flex-start; gap: 10px; min-width: 240px; max-width: 360px;
  padding: 12px 14px; border-radius: var(--r); font-size: 13px; line-height: 1.45;
  background: var(--bg3); border: 1px solid var(--border2); color: var(--text);
  box-shadow: 0 8px 28px rgba(0,0,0,0.5); animation: toastIn .25s ease;
}
.toast.out { animation: toastOut .25s ease forwards; }
.toast .tic { font-size: 15px; line-height: 1.3; }
.toast.ok   { border-color: rgba(0,255,136,0.4); }   .toast.ok .tic   { color: var(--green); }
.toast.err  { border-color: rgba(255,61,90,0.4); }   .toast.err .tic  { color: var(--red); }
.toast.info { border-color: rgba(0,229,255,0.4); }   .toast.info .tic { color: var(--accent); }
@keyframes toastIn  { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }

/* ── Success screen (replaces card body on terminal actions) ── */
.auth-success { text-align: center; animation: fadeUp .35s ease; }
.auth-success .succ-icon {
  width: 64px; height: 64px; margin: 4px auto 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 30px;
  color: var(--green); background: rgba(0,255,136,0.10); border: 1px solid rgba(0,255,136,0.30);
}
.auth-success .succ-icon.info { color: var(--accent); background: rgba(0,229,255,0.10); border-color: rgba(0,229,255,0.30); }
.auth-success h2 { font-family: var(--display); font-size: 22px; font-weight: 700; margin-bottom: 10px; }
.auth-success p  { font-size: 13.5px; color: var(--text2); margin-bottom: 22px; }

/* ── Brand logo as inline SVG (injected by auth.js) ── */
.auth-logo svg { width: 1em; height: 1em; display: block; }

/* ── Legal / content pages (terms, privacy) ── */
.legal { max-width: 760px; margin: 0 auto; padding: 40px 24px 90px; position: relative; z-index: 1; }
.legal-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 30px; padding-bottom: 22px; border-bottom: 1px solid var(--border); }
.legal h1 { font-family: var(--display); font-size: 32px; font-weight: 800; letter-spacing: -0.8px; }
.legal .updated { font-family: var(--mono); font-size: 11px; color: var(--text2); letter-spacing: 1px; text-transform: uppercase; margin-top: 6px; }
.legal h2 { font-family: var(--display); font-size: 19px; font-weight: 700; margin: 30px 0 10px; }
.legal p, .legal li { font-size: 14.5px; color: var(--text2); line-height: 1.7; margin-bottom: 10px; }
.legal ul { padding-left: 20px; margin-bottom: 10px; }
.legal a { color: var(--accent); }

/* ── Centered stage (404 / standalone messages) ── */
.center-stage { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px 24px; text-align: center; position: relative; z-index: 1; }
.center-stage .big-code { font-family: var(--display); font-size: 92px; font-weight: 800; line-height: 1; letter-spacing: -2px; color: var(--accent); filter: drop-shadow(0 0 24px rgba(0,229,255,0.35)); margin-bottom: 8px; }
@media (max-width: 480px) { .center-stage .big-code { font-size: 64px; } .legal h1 { font-size: 26px; } }

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablet: narrow the branding panel a bit */
@media (max-width: 1024px) {
  .auth-side { flex-basis: 40%; padding: 44px 40px; }
  .side-headline { font-size: 28px; }
}

/* Mobile / small: stack — branding becomes a compact top header */
@media (max-width: 800px) {
  .auth-split { flex-direction: column; }
  .auth-side {
    flex: none; max-width: none; width: 100%;
    justify-content: flex-start; padding: 28px 22px 22px;
    border-right: none; border-bottom: 1px solid var(--border);
  }
  .auth-side .auth-brand { margin-bottom: 0; }
  /* hide the heavy marketing content on small screens */
  .side-headline, .side-sub, .side-points { display: none; }
  .auth-main { padding: 28px 20px 36px; }
  .auth-card { max-width: 460px; margin: 0 auto; }
  .auth-title { font-size: 22px; }
}

/* very small phones */
@media (max-width: 380px) {
  .auth-side { padding: 22px 16px 18px; }
  .auth-main { padding: 24px 16px 32px; }
  .auth-logo { font-size: 28px; }
  .auth-logo-name { font-size: 19px; }
}
