/* ============================================================================
   auth.css — shared look for the unauthenticated / pre-app pages:
   login.html, first-login.html, reset-password.html.

   A centered white card (TIS color logo + "AgentDesk" rule) floating over a
   full-bleed photo: Adobe Stock #1489998918, Standard License (see
   login-bg.webp / login-bg.jpg, 2560px web copies).

   Both status-bar vocabularies are supported because the page scripts toggle
   different class names: login.js uses .status + .show, first-login.js /
   reset-password.js use .msg-bar + .visible. Same for the secondary action:
   .text-link (button) and .back-link (button or <a>).
   ============================================================================ */

:root {
  --navy:           oklch(0.21 0.045 248);
  --bg:             oklch(0.972 0.007 245);
  --surface:        oklch(1.0 0.004 245);
  --text:           oklch(0.19 0.018 248);
  --text-secondary: oklch(0.48 0.018 248);
  --text-tertiary:  oklch(0.64 0.012 248);
  --border:         oklch(0.87 0.01 245);

  --accent:         oklch(0.45 0.13 255);   /* TIS logo blue */
  --accent-hover:   oklch(0.39 0.13 255);

  --red:            oklch(0.52 0.18 22);
  --red-bg:         oklch(0.96 0.03 22);
  --green:          oklch(0.56 0.15 158);
  --green-bg:       oklch(0.94 0.04 158);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; -webkit-font-smoothing: antialiased; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--text);
  background: var(--navy);
  min-height: 100vh;
}

/* ── Full-bleed photo ──────────────────────────────────────────────────────
   Layers: inline 48px blur (first paint is never a blank box) → the photo
   (webp, jpg fallback) → a navy vignette so the white card stays the
   brightest thing on screen. */
.scene {
  position: fixed; inset: 0; z-index: 0;
  background: var(--navy) url("data:image/jpeg;base64,/9j/4AAQSkZJRgABAgAtmCzTAAD//gAQTGF2YzYyLjI4LjEwMQD/2wBDAAgQEBMQExYWFhYWFhoYGhsbGxoaGhobGxsdHR0iIiIdHR0bGx0dICAiIiUmJSMjIiMmJigoKDAwLi44ODpFRVP/xABkAAEBAQEAAAAAAAAAAAAAAAAGBQcDAQADAQEBAAAAAAAAAAAAAAAEAwIFAQAQAAICAQUBAQAAAAAAAAAAAAIBAAMSBDFRQREhUhEBAQEBAQEBAQAAAAAAAAAAAAERAhIhEzH/wAARCAAgADADARIAAhIAAxIA/9oADAMBAAIRAxEAPwC9UwfcC1GX6mPptrZw+ctXHDmAwOzmRr2hsHeY0lCPMDjeY9ynf6zhl5h00K7gZ3WPue10EK8wtPGB1e389k67YFwRkWbTFQ9Z93cnUfQ+NGcc1koawk95AU1PENYn69B2k0a0iXkF1WYxXiQ0V+nVCtWDKxbwxRrMZHyPWCL1SDQ2wCGy1isfkHv2m4MnVwLqedpgbc63YNS5Ild7pSTbrj5kC7eX5jpn6dEv/9k=") center 62% / cover no-repeat;
}
.scene::before {
  content: ''; position: absolute; inset: 0;
  background-image: url("/assets/login/login-bg.jpg");
  background-image: image-set(url("/assets/login/login-bg.webp") type("image/webp"),
                              url("/assets/login/login-bg.jpg") type("image/jpeg"));
  background-size: cover;
  background-position: center 62%;
  animation: photoIn 1.1s ease both;
}
.scene::after {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 70% 60% at 50% 45%, oklch(0.16 0.04 250 / 0.05), oklch(0.16 0.04 250 / 0.50) 100%),
    linear-gradient(to bottom, oklch(0.16 0.04 250 / 0.30), oklch(0.16 0.04 250 / 0.10) 40%, oklch(0.14 0.04 250 / 0.65));
}
@keyframes photoIn { from { opacity: 0; transform: scale(1.03); } to { opacity: 1; transform: none; } }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.stage {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 16px 72px;
}

.card {
  width: 100%; max-width: 420px;
  background: var(--surface);
  border-radius: 14px;
  padding: 40px 40px 28px;
  box-shadow:
    0 24px 60px oklch(0.12 0.03 250 / 0.45),
    0 4px 14px oklch(0.12 0.03 250 / 0.25);
  animation: cardIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.15s both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.logo { display: block; width: 236px; max-width: 100%; height: auto; margin: 0 auto; }

.product {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin: 20px 0 28px;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-tertiary);
}
.product::before, .product::after { content: ''; height: 1px; flex: 1; background: var(--border); }

.form-heading, .heading {
  font-size: 20px; font-weight: 600; letter-spacing: -0.02em;
  color: var(--text); margin-bottom: 4px;
}
.form-heading.solo { margin-bottom: 20px; }
.form-sub, .subtitle { font-size: 14px; line-height: 1.5; color: var(--text-secondary); margin-bottom: 24px; }

/* ── Status bars ─────────────────────────────────────────────────────────── */
.status, .msg-bar {
  display: none; align-items: flex-start; gap: 8px;
  padding: 10px 12px; border-radius: 8px;
  font-size: 13.5px; line-height: 1.45; margin-bottom: 20px;
  border: 1px solid transparent;
  animation: statusIn 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
.status svg, .msg-bar svg { flex-shrink: 0; margin-top: 2px; }
.status.show, .msg-bar.visible { display: flex; }
.status.error,   .msg-bar.error   { background: var(--red-bg);   color: var(--red);   border-color: oklch(0.52 0.18 22 / 0.18); }
.status.success, .msg-bar.success { background: var(--green-bg); color: var(--green); border-color: oklch(0.56 0.15 158 / 0.18); }
@keyframes statusIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ── Fields ──────────────────────────────────────────────────────────────── */
.field { margin-bottom: 16px; }
label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--text); margin-bottom: 6px;
}
input[type="email"],
input[type="password"] {
  width: 100%; height: 44px; padding: 0 13px;
  font-size: 15px; font-family: inherit;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text);
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
/* first-login / reset-password stack label+input without .field wrappers */
.card > input[type="password"],
.card > div > input[type="password"] { margin-bottom: 16px; }
input:hover { border-color: oklch(0.80 0.012 245); }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px oklch(0.45 0.13 255 / 0.14); }
input::placeholder { color: var(--text-tertiary); }

/* Live password-requirements checklist (first-login.js / reset-password.js
   toggle .met). Mirrors the users/validate.js ruleset. */
.pw-reqs {
  list-style: none;
  margin: -6px 0 18px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 12px;
}
.pw-reqs li {
  font-size: 12.5px; color: var(--text-tertiary);
  display: flex; align-items: center; gap: 7px;
  transition: color 0.15s;
}
.pw-reqs li::before { content: '○'; font-size: 12px; line-height: 1; }
.pw-reqs li.met { color: var(--green); }
.pw-reqs li.met::before { content: '✓'; font-weight: 700; }

/* ── Button ──────────────────────────────────────────────────────────────── */
.btn {
  width: 100%; height: 44px; margin-top: 8px;
  font-size: 15px; font-weight: 600; font-family: inherit;
  border: none; border-radius: 8px; cursor: pointer;
  position: relative; overflow: hidden;
  background: var(--accent); color: white;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
}
.btn:hover { background: var(--accent-hover); box-shadow: 0 6px 18px oklch(0.45 0.13 255 / 0.28); }
.btn:active { transform: scale(0.99); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }

/* Ripple (login.js) */
.ripple {
  position: absolute; border-radius: 50%; background: white; opacity: 0.2;
  transform: scale(0); animation: ripple 0.55s ease-out; pointer-events: none;
}
@keyframes ripple { to { transform: scale(5); opacity: 0; } }

/* ── Secondary actions ───────────────────────────────────────────────────── */
.text-link, .back-link {
  display: block; width: 100%; text-align: center; margin-top: 16px;
  font-size: 13px; font-family: inherit; font-weight: 500;
  color: var(--text-secondary); background: none; border: none; cursor: pointer;
  text-decoration: none;
  transition: color 0.15s;
}
.text-link:hover, .back-link:hover { color: var(--accent); }
.text-link:focus-visible, .back-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.loading {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px 0 4px; font-size: 14px; color: var(--text-secondary);
}
.loading::before {
  content: ''; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.card-foot {
  margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-tertiary); text-align: center; line-height: 1.5;
}

.legal {
  position: absolute; left: 0; right: 0; bottom: 22px;
  display: flex; justify-content: center; gap: 18px; padding: 0 16px;
  font-size: 12px; color: oklch(0.92 0.01 248 / 0.78);
}
.legal a { color: inherit; text-decoration: none; }
.legal a:hover { color: white; text-decoration: underline; text-underline-offset: 3px; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .stage { justify-content: flex-start; padding-top: 32px; }
  .card { padding: 32px 24px 22px; }
  .logo { width: 208px; }
  .pw-reqs { grid-template-columns: 1fr; }
}

/* ── Reduced motion ──────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .scene::before, .card, .status, .msg-bar { animation: none !important; }
  .loading::before { animation-duration: 2.4s; }
}
