/*
  Night Desk theme for the public auth pages (login/register and the
  email/phone verification steps chained after registration) - matches
  app/static/landing.html's palette and type system. Deliberately its
  own stylesheet rather than an addition to style.css: the rest of the
  app (dashboard, sidebar) keeps its existing light theme, and this file
  is only linked from auth_base.html, so it can't leak into any other
  page.
*/
:root {
  --bg: #070B14;
  --bg-alt: #101B31;
  --surface: #0F1626;
  --surface-2: #141D33;
  --ink: #E7ECF5;
  --muted: #8B96AC;
  --faint: #4E5872;
  --blue: #3D8BE0;
  --blue-ink: #7EB6F2;
  --blue-dim: #1B3B63;
  --blue-solid: #1465C7;
  --teal: #1FD1A6;
  --teal-ink: #6EE9C9;
  --rule: #1C2438;
  --rule-strong: #29334C;
  --bear: #E2564F;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Consolas, monospace;
  --sans: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --shadow: 0 1px 2px rgba(0,0,0,0.5), 0 24px 70px -24px rgba(4,10,25,0.75);
}

* { box-sizing: border-box; }
html.auth-html, .auth-html body { -webkit-text-size-adjust: 100%; }
body.auth-body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.auth-body a { color: inherit; text-decoration: none; }
.auth-body a:focus-visible, .auth-body button:focus-visible, .auth-body input:focus-visible {
  outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 2px;
}
@media (prefers-reduced-motion: reduce) {
  .auth-body * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

.auth-wrap { max-width: 460px; margin: 0 auto; padding: 0 1.5rem; width: 100%; }

/* ---------- nav ---------- */
.auth-nav { border-bottom: 1px solid var(--rule); background: rgba(7,11,20,0.9); }
.auth-nav-row { max-width: 1200px; margin: 0 auto; padding: 1.1rem 1.5rem; display: flex; align-items: center; justify-content: space-between; }
.auth-brand { display: flex; align-items: center; gap: 0.65rem; }
.auth-brand img { width: 2rem; height: 2rem; display: block; flex-shrink: 0; }
.auth-brand-text { display: flex; flex-direction: column; gap: 0.15rem; line-height: 1; }
.auth-brand-word { font-family: var(--mono); font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; }
.auth-brand-word .goal { color: var(--blue-ink); }
.auth-brand-word .trade { color: var(--teal); }
.auth-brand-tag { font-size: 0.65rem; color: var(--faint); font-family: var(--mono); letter-spacing: 0.03em; }
.auth-nav-back { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); padding: 0.5rem 0.9rem; border: 1px solid var(--rule-strong); border-radius: 0.55rem; background: var(--surface-2); transition: border-color 0.15s ease, color 0.15s ease; }
.auth-nav-back:hover { color: var(--blue-ink); border-color: var(--blue); }

/* ---------- main / card ---------- */
.auth-main { flex: 1; display: flex; align-items: center; padding: clamp(2.5rem, 8vh, 4.5rem) 0; }
.auth-eyebrow {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--blue-ink); background: rgba(61,139,224,0.1); border: 1px solid rgba(61,139,224,0.3);
  padding: 0.35rem 0.75rem; border-radius: 999px; margin-bottom: 1.1rem;
}
.auth-eyebrow::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 8px var(--teal); }

.auth-card h1 { font-family: var(--mono); font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 1.4rem; color: #F5F8FC; }

form.card {
  background: var(--surface); border: 1px solid var(--rule); border-radius: 0.9rem;
  box-shadow: var(--shadow); padding: 1.5rem; display: flex; flex-direction: column; gap: 1.1rem;
}
form.card label {
  display: flex; flex-direction: column; gap: 0.45rem; font-size: 0.85rem; font-weight: 600; color: var(--ink);
}
form.card input[type="text"],
form.card input[type="password"],
form.card input[type="email"],
form.card input[type="tel"] {
  font-family: var(--sans); font-size: 0.92rem; color: var(--ink); background: var(--bg-alt);
  border: 1px solid var(--rule-strong); border-radius: 0.55rem; padding: 0.65rem 0.8rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}
form.card input:focus { border-color: var(--blue); background: #0C1424; outline: none; }
form.card input::placeholder { color: var(--faint); }

.auth-body .hint { font-size: 0.78rem; color: var(--muted); margin: -0.4rem 0 0; }
.auth-body .error {
  font-size: 0.85rem; color: #F5A9A4; background: rgba(226,86,79,0.1);
  border: 1px solid rgba(226,86,79,0.35); border-radius: 0.55rem; padding: 0.65rem 0.85rem; margin: 0 0 1rem;
}

.password-strength-bar { height: 5px; border-radius: 999px; background: var(--rule); overflow: hidden; margin-top: -0.3rem; }
.password-strength-fill { height: 100%; width: 0%; border-radius: 999px; transition: width 0.2s ease, background 0.2s ease; }
.password-strength-fill.weak { width: 33%; background: var(--bear); }
.password-strength-fill.fair { width: 66%; background: #D9A441; }
.password-strength-fill.strong { width: 100%; background: var(--teal); }
.password-strength-label { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); }
.password-strength-label.weak { color: var(--bear); }
.password-strength-label.fair { color: #D9A441; }
.password-strength-label.strong { color: var(--teal-ink); }

form.card button[type="submit"] {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.8rem 1.15rem; border-radius: 0.6rem; font-weight: 700; font-size: 0.92rem;
  border: none; cursor: pointer; font-family: var(--sans); color: #F4FAFF;
  background: linear-gradient(135deg, var(--blue-solid), #2472D6);
  box-shadow: 0 8px 24px -10px rgba(20,101,199,0.7);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
form.card button[type="submit"]:hover { transform: translateY(-1px); box-shadow: 0 12px 30px -10px rgba(20,101,199,0.85); }
form.card button[type="submit"]:disabled { opacity: 0.6; cursor: default; transform: none; }

.auth-card > p { font-size: 0.88rem; color: var(--muted); margin: 1.2rem 0 0; }
.auth-card > p a { color: var(--blue-ink); font-weight: 600; }
.auth-card > p a:hover { color: var(--teal-ink); }
.auth-card > p.hint { margin-top: 0.6rem; }

/* ---------- flash toast (same classes/behavior app.js already drives) ---------- */
.flash-container { position: fixed; top: 1.2rem; right: 1.2rem; z-index: 60; display: flex; flex-direction: column; gap: 0.6rem; max-width: 22rem; }
.flash {
  display: flex; align-items: flex-start; gap: 0.6rem; background: var(--surface-2); border: 1px solid var(--rule-strong);
  border-radius: 0.6rem; padding: 0.75rem 0.9rem; font-size: 0.85rem; color: var(--ink); box-shadow: var(--shadow);
  animation: flash-in 0.2s ease;
}
@keyframes flash-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.flash.flash-hide { animation: flash-out 0.2s ease forwards; }
@keyframes flash-out { to { opacity: 0; transform: translateY(-6px); } }
.flash-success { border-left: 3px solid var(--teal); }
.flash-error { border-left: 3px solid var(--bear); }
.flash-info { border-left: 3px solid var(--blue); }
.flash-message { flex: 1; }
.flash-close { background: none; border: none; color: var(--faint); cursor: pointer; font-size: 1rem; line-height: 1; opacity: 0.7; padding: 0; }
.flash-close:hover { opacity: 1; color: var(--ink); }

/* ---------- footer ---------- */
.auth-foot { border-top: 1px solid var(--rule); padding: 1.5rem 0; }
.auth-foot-row { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.8rem; font-size: 0.76rem; color: var(--faint); }

/* form-submitting spinner state driven by app.js's site-wide submit handler */
.btn-spinner {
  display: inline-block; width: 0.85em; height: 0.85em; border: 2px solid currentColor;
  border-right-color: transparent; border-radius: 50%; margin-right: 0.45em;
  vertical-align: -0.15em; animation: btn-spin 0.6s linear infinite; flex-shrink: 0;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }
.progress-indeterminate { height: 3px; width: 100%; max-width: 240px; background: var(--rule); border-radius: 2px; overflow: hidden; margin-top: 0.5rem; }
.progress-indeterminate-bar { height: 100%; width: 40%; background: var(--blue); border-radius: 2px; animation: progress-indeterminate-slide 1.1s ease-in-out infinite; }
@keyframes progress-indeterminate-slide { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }
