/* ==========================================================================
   css/auth.css — Qovox OCR sign-in / sign-up
   Dark futuristic theme · glassmorphism · glow focus states
   Colours live in :root so they can be matched to the logo in one place.
   ========================================================================== */

:root {
  --bg: #08080a;
  --surface: #121218;
  --surface-2: #191921;
  --text: #f2f1ee;
  --muted: #9a9aa6;
  --line: #24242c;
  --brand: #ff3b30;       /* primary logo colour */
  --brand-2: #e50914;     /* secondary colour for gradients */
  --brand-tint: rgba(255, 59, 48, 0.12);
  --grad: linear-gradient(90deg, var(--brand-2), var(--brand) 60%, #ff6b4a);
  --glow: 0 0 20px rgba(255, 59, 48, 0.35);

  /* supporting tokens */
  --ok: #2ecc8f;
  --warn: #e0a020;
  --glass: rgba(18, 18, 24, 0.62);
  --glass-line: rgba(255, 255, 255, 0.09);
  --brand-line: rgba(255, 59, 48, 0.28);
  --f-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --f-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", Consolas, "Courier New", monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --r-lg: 20px;
  --r-md: 12px;
  --r-sm: 8px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.55 var(--f-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
button, input, select { font-family: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
h1, h2 { font-family: var(--f-display); font-weight: 600; line-height: 1.15; letter-spacing: -0.015em; margin: 0 0 0.6rem; }
p { margin: 0 0 0.9rem; color: var(--muted); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
::selection { background: var(--brand); color: #fff; }

* { scrollbar-width: thin; scrollbar-color: #30303b transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a2a35; border-radius: 8px; border: 2px solid var(--bg); }

.skip-link {
  position: fixed; left: 12px; top: -64px; z-index: 500;
  padding: 0.5rem 0.9rem; border-radius: var(--r-sm);
  background: var(--brand); color: #fff; font-weight: 600;
  transition: top 0.2s;
}
.skip-link:focus { top: 12px; }

.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; }

/* ---------- Page layout ---------- */
.shell { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; min-height: 100dvh; }

/* ---------- Left: brand showcase ---------- */
.showcase {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: 2.5rem clamp(1.5rem, 4.5vw, 4.5rem);
  border-right: 1px solid var(--line);
  background: #0a0a0d;
}
.showcase::before {
  content: "";
  position: absolute; inset: 0; z-index: -2;
  background:
    radial-gradient(50% 45% at 12% 8%, rgba(229, 9, 20, 0.30), transparent 70%),
    radial-gradient(45% 40% at 92% 88%, rgba(255, 107, 74, 0.22), transparent 70%),
    radial-gradient(38% 34% at 70% 28%, rgba(255, 59, 48, 0.10), transparent 70%);
  animation: mesh 16s ease-in-out infinite alternate;
}
.showcase::after {
  content: "";
  position: absolute; inset: 0; z-index: -1; opacity: 0.4;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 40% 35%, #000 25%, transparent 100%);
  mask-image: radial-gradient(ellipse 80% 70% at 40% 35%, #000 25%, transparent 100%);
}
@keyframes mesh { to { transform: translate(-3%, 3%) scale(1.08); } }

.orb { position: absolute; z-index: -1; border-radius: 50%; filter: blur(60px); opacity: 0.5; pointer-events: none; }
.orb-1 { width: 320px; height: 320px; top: -80px; right: -60px; background: var(--brand-2); animation: float 14s ease-in-out infinite alternate; }
.orb-2 { width: 260px; height: 260px; bottom: -70px; left: -50px; background: #ff6b4a; opacity: 0.28; animation: float 18s ease-in-out infinite alternate-reverse; }
@keyframes float { to { transform: translate(-40px, 50px) scale(1.15); } }

.showcase-inner { display: flex; flex-direction: column; gap: 1.5rem; width: 100%; max-width: 540px; animation: rise 0.8s var(--ease) both; }
.showcase h2 { font-size: clamp(1.8rem, 3.1vw, 2.65rem); margin: 0; }
.showcase-lede { max-width: 46ch; margin: 0; font-size: 1.02rem; }

.code-card {
  max-width: 520px;
  overflow: hidden;
  border: 1px solid var(--glass-line);
  border-radius: var(--r-md);
  background: rgba(11, 11, 15, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 30px 80px -40px rgba(255, 59, 48, 0.55), 0 0 0 1px rgba(255, 59, 48, 0.06);
  animation: breathe 5s ease-in-out infinite;
}
@keyframes breathe { 50% { box-shadow: 0 30px 90px -36px rgba(255, 59, 48, 0.8), 0 0 0 1px rgba(255, 59, 48, 0.16); } }
.code-head { display: flex; align-items: center; gap: 0.4rem; padding: 0.6rem 0.9rem; border-bottom: 1px solid rgba(255, 255, 255, 0.08); font: 500 0.74rem var(--f-mono); color: var(--muted); }
.code-head i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, 0.18); }
.code-head i:first-child { background: var(--brand-2); }
.code-head span { margin-left: auto; }
.code-card pre { margin: 0; padding: 1rem; overflow-x: auto; font: 400 0.78rem/1.65 var(--f-mono); color: #d6d6dc; }
.tk-k { color: #ff7b72; } .tk-t { color: #79c0ff; } .tk-s { color: #a5d6ff; } .tk-n { color: #ffa657; } .tk-c { color: #7d8590; }
.stats { display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; padding: 0.7rem 1rem; border-top: 1px solid rgba(255, 255, 255, 0.08); font: 500 0.74rem var(--f-mono); color: var(--muted); }
.stats b { color: var(--ok); font-weight: 500; }

.perks { display: grid; gap: 0.85rem; }
.perks li { display: flex; gap: 0.8rem; align-items: flex-start; color: #d6d6dc; font-size: 0.95rem; }
.perks .ic { flex: none; width: 2rem; height: 2rem; display: grid; place-items: center; border-radius: var(--r-sm); background: var(--brand-tint); border: 1px solid var(--brand-line); font-size: 1rem; }

.trust { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.trust small { width: 100%; font: 500 0.72rem var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.chip { padding: 0.28rem 0.65rem; border: 1px solid var(--line); border-radius: 6px; font: 400 0.76rem var(--f-mono); color: #c9c9d1; background: rgba(255, 255, 255, 0.025); transition: border-color 0.2s, color 0.2s, box-shadow 0.2s; }
.chip:hover { border-color: var(--brand); color: #fff; box-shadow: var(--glow); }

/* ---------- Right: auth card ---------- */
.auth-side {
  position: relative;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(255, 59, 48, 0.07), transparent 70%),
    var(--bg);
}
.auth-card {
  position: relative;
  width: 100%;
  max-width: 480px;
  padding: 2rem;
  border: 1px solid var(--glass-line);
  border-radius: var(--r-lg);
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 30px 80px -40px #000, 0 0 0 1px rgba(255, 59, 48, 0.05);
  animation: rise 0.7s var(--ease) both;
}
.auth-card::before {
  content: "";
  position: absolute; left: 12%; right: 12%; top: -1px; height: 2px;
  background: var(--grad); border-radius: 2px; opacity: 0.85;
  box-shadow: var(--glow);
}
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

.card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.4rem; }
.brand img { height: 1.8rem; width: auto; }
.brand-lg img { height: 2.3rem; }
.showcase .brand-lg { align-self: flex-start; }
.back { font-size: 0.82rem; color: var(--muted); transition: color 0.2s, transform 0.2s var(--ease); }
.back:hover { color: var(--text); transform: translateX(-3px); }

.auth-card h1 { font-size: 1.75rem; margin-bottom: 0.3rem; }
.lede { font-size: 0.92rem; margin-bottom: 1.3rem; }

/* Tabs with a sliding indicator */
.tabs { position: relative; display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 1.2rem; padding: 4px; border: 1px solid var(--line); border-radius: var(--r-md); background: rgba(8, 8, 10, 0.55); }
.tab { position: relative; z-index: 1; padding: 0.6rem; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font: 600 0.9rem var(--f-display); transition: color 0.2s; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: #fff; }
.tab-indicator { position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 9px; background: var(--brand-tint); box-shadow: inset 0 0 0 1px var(--brand-line), var(--glow); transition: transform 0.35s var(--ease); }
.tabs[data-active="signin"] .tab-indicator { transform: translateX(100%); }

/* Buttons */
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.55rem;
  min-height: 46px; padding: 0.65rem 1.2rem;
  border: 1px solid transparent; border-radius: var(--r-md);
  font: 600 0.92rem var(--f-display);
  transition: transform 0.25s var(--ease), box-shadow 0.25s, border-color 0.2s, background-color 0.2s;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { cursor: default; opacity: 0.85; }
.btn svg { width: 1.15rem; height: 1.15rem; flex: none; }
.btn-primary { width: 100%; color: #fff; background-image: var(--grad); box-shadow: 0 8px 24px -12px rgba(255, 59, 48, 0.8); }
.btn-primary::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg); transition: left 0.6s var(--ease);
}
.btn-primary:hover:not(:disabled) { box-shadow: var(--glow), 0 14px 34px -12px rgba(255, 59, 48, 0.85); }
.btn-primary:hover:not(:disabled)::after { left: 130%; }
.btn-secondary { border-color: #3a3a46; background: rgba(255, 255, 255, 0.02); color: var(--text); }
.btn-secondary:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-tint); box-shadow: var(--glow); }
.btn.is-loading { pointer-events: none; }
.btn.is-loading::before { content: ""; width: 1rem; height: 1rem; border: 2px solid #fff; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }
.btn-secondary.is-loading::before { border-color: var(--text); border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

.social { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
.or { display: flex; align-items: center; gap: 0.8rem; margin: 1.2rem 0; color: var(--muted); font-size: 0.8rem; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

.link-btn { padding: 0; border: 0; background: none; color: var(--brand); font: 500 0.85rem var(--f-body); text-align: left; transition: color 0.2s; }
.link-btn:hover:not(:disabled) { color: #ff6b4a; text-decoration: underline; }
.link-btn:disabled { color: var(--muted); cursor: default; text-decoration: none; }
.swap { margin: 1.2rem 0 0; text-align: center; font-size: 0.86rem; }

/* Forms */
form { display: flex; flex-direction: column; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: 0.38rem; min-width: 0; }
.field label { font: 500 0.8rem var(--f-body); color: var(--text); transition: color 0.2s; }
.field:focus-within label { color: var(--brand); }

.field input,
.pw-wrap input,
.input-affix {
  width: 100%; min-height: 46px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: rgba(8, 8, 10, 0.7);
  color: var(--text);
  font: 400 0.93rem var(--f-body);
  transition: border-color 0.2s, box-shadow 0.25s, background-color 0.2s;
}
.field input, .pw-wrap input { padding: 0.65rem 0.85rem; }
.field input::placeholder { color: var(--muted); opacity: 0.65; }
.field input:hover, .input-affix:hover { border-color: #34343f; }
.field input:focus,
.input-affix:focus-within {
  outline: none;
  border-color: var(--brand);
  background: rgba(8, 8, 10, 0.9);
  box-shadow: 0 0 0 3px var(--brand-tint), var(--glow);
}
.field input[aria-invalid="true"], .input-affix.is-invalid { border-color: var(--brand); animation: shake 0.38s; }
.field input:-webkit-autofill { -webkit-text-fill-color: var(--text); box-shadow: 0 0 0 100px #14141a inset; }

.input-affix { display: flex; align-items: center; }
.input-affix .affix { padding-left: 0.85rem; color: var(--muted); font-family: var(--f-mono); }
.input-affix input { min-height: 44px; border: 0; background: transparent; box-shadow: none !important; padding-left: 0.3rem; flex: 1; animation: none; }
.input-affix input:focus { background: transparent; }
/* Browser autofill / saved-suggestion paints inputs white: keep the dark field instead */
.input-affix input:-webkit-autofill,
.input-affix input:-webkit-autofill:hover,
.input-affix input:-webkit-autofill:focus,
.pw-wrap input:-webkit-autofill,
.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  -webkit-box-shadow: 0 0 0 100px #101016 inset !important;
  box-shadow: 0 0 0 100px #101016 inset !important;
  transition: background-color 600000s 0s;
}
input, select, textarea { color-scheme: dark; }
.status-dot { width: 10px; height: 10px; margin-right: 0.85rem; border-radius: 50%; background: transparent; transition: background-color 0.2s, box-shadow 0.2s; flex: none; }
.input-affix.is-ok .status-dot { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.input-affix.is-bad .status-dot { background: var(--brand); box-shadow: var(--glow); }
.input-affix.is-checking .status-dot { background: var(--warn); animation: pulse 0.9s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }

.hint { min-height: 1.1em; margin: 0; font-size: 0.78rem; color: var(--muted); }
.hint[data-state="ok"] { color: var(--ok); }
.hint[data-state="error"] { color: var(--brand); }
.hint[data-state="checking"] { color: var(--warn); }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 4rem; }
.pw-toggle { position: absolute; right: 0.4rem; top: 50%; transform: translateY(-50%); padding: 0.4rem 0.55rem; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font: 500 0.78rem var(--f-body); transition: color 0.2s, background-color 0.2s; }
.pw-toggle:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }

.meter { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-top: 0.25rem; }
.meter span { height: 4px; border-radius: 2px; background: var(--line); transition: background-color 0.25s, box-shadow 0.25s; }
.meter[data-score="1"] span:nth-child(-n+1),
.meter[data-score="2"] span:nth-child(-n+2) { background: var(--brand); box-shadow: 0 0 8px rgba(255, 59, 48, 0.5); }
.meter[data-score="3"] span:nth-child(-n+3) { background: var(--warn); }
.meter[data-score="4"] span:nth-child(-n+4) { background: #b8c94a; }
.meter[data-score="5"] span:nth-child(-n+5) { background: var(--ok); box-shadow: 0 0 8px rgba(46, 204, 143, 0.5); }
.rules { display: grid; grid-template-columns: 1fr 1fr; gap: 0.2rem 1rem; margin: 0.5rem 0 0; font-size: 0.78rem; color: var(--muted); }
.rules li { transition: color 0.2s; }
.rules li::before { content: "○ "; }
.rules li.is-met { color: var(--ok); }
.rules li.is-met::before { content: "● "; }

.form-error { display: none; margin-bottom: 1rem; padding: 0.7rem 1rem; border-left: 3px solid var(--brand); border-radius: 6px; background: var(--brand-tint); font-size: 0.88rem; color: var(--text); }
.form-error.is-visible { display: block; animation: rise 0.3s var(--ease); }
.form-error a { margin-left: 0.35rem; color: var(--brand); font-weight: 600; }
.legal { margin: 0; text-align: center; font-size: 0.78rem; }
.legal a { color: var(--brand); }
.legal a:hover { text-decoration: underline; }

@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ---------- Toasts ---------- */
.toast-stack { position: fixed; top: 1rem; right: 1rem; z-index: 300; display: flex; flex-direction: column; gap: 0.6rem; width: min(380px, calc(100vw - 2rem)); pointer-events: none; }
.toast {
  position: relative; overflow: hidden; pointer-events: auto;
  display: flex; align-items: flex-start; gap: 0.7rem;
  padding: 0.8rem 2.2rem 0.95rem 0.9rem;
  border: 1px solid var(--glass-line); border-left: 3px solid var(--brand);
  border-radius: var(--r-md);
  background: rgba(18, 18, 24, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 14px 34px -12px rgba(0, 0, 0, 0.7);
  font-size: 0.9rem;
  animation: toast-in 0.4s var(--ease);
}
.toast[data-type="success"] { border-left-color: var(--ok); }
.toast[data-type="info"] { border-left-color: #6aa9ff; }
.toast-icon { flex: none; width: 1.4rem; height: 1.4rem; display: grid; place-items: center; border-radius: 50%; background: var(--brand-tint); color: var(--brand); font-size: 0.8rem; font-weight: 700; }
.toast[data-type="success"] .toast-icon { background: rgba(46, 204, 143, 0.15); color: var(--ok); }
.toast[data-type="info"] .toast-icon { background: rgba(106, 169, 255, 0.15); color: #6aa9ff; }
.toast-msg { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast-close { position: absolute; top: 0.35rem; right: 0.4rem; width: 1.6rem; height: 1.6rem; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 0.8rem; }
.toast-close:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.toast-bar { position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--brand); transform-origin: left; animation: bar linear forwards; }
.toast[data-type="success"] .toast-bar { background: var(--ok); }
.toast[data-type="info"] .toast-bar { background: #6aa9ff; }
.toast.is-leaving { opacity: 0; transform: translateX(16px); transition: opacity 0.26s, transform 0.26s; }
@keyframes toast-in { from { opacity: 0; transform: translateX(18px) scale(0.98); } }
@keyframes bar { to { transform: scaleX(0); } }

.noscript { position: fixed; inset: auto 0 0 0; padding: 0.9rem; text-align: center; background: var(--brand-2); color: #fff; z-index: 600; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .showcase { display: none; }
  .auth-side { align-items: start; padding: 1.5rem 1rem 2.5rem; }
}
@media (max-width: 520px) {
  .auth-card { padding: 1.4rem 1.15rem; border-radius: 16px; }
  .auth-card h1 { font-size: 1.5rem; }
  .social { grid-template-columns: 1fr; }
  .rules { grid-template-columns: 1fr; }
  .modal { align-items: flex-end; padding: 0; }
  .modal-card { max-width: none; border-radius: var(--r-lg) var(--r-lg) 0 0; padding-bottom: calc(1.6rem + env(safe-area-inset-bottom)); animation: sheet 0.4s var(--ease); }
  .code-boxes { gap: 0.45rem; }
  .code-boxes input { font-size: 1.45rem; }
  .toast-stack { top: auto; bottom: calc(1rem + env(safe-area-inset-bottom)); right: 1rem; left: 1rem; width: auto; }
}
@keyframes sheet { from { transform: translateY(100%); } }
@media (max-height: 700px) and (min-width: 961px) {
  .auth-side { align-items: start; }
}
/* very narrow phones (<= 360px) */
@media (max-width: 360px) {
  .tab { font-size: 0.8rem; padding: 0.55rem 0.2rem; }
  .auth-card { padding: 1.15rem 0.9rem; }
  .code-boxes { gap: 0.35rem; }
  .code-boxes input { font-size: 1.3rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

