/*
 * web-admin/styles.css — the commissioner's cockpit.
 *
 * Plain CSS, no framework, no build step (S3-servable). Shares the public site's
 * "Prime Time Productions" brand DNA (broadcast display type, film grain,
 * letterbox hairline, gold + film-black) so the admin tool and the fan site read
 * as one brand — but this stays a DENSE, READABLE WORKING TOOL, not a billboard.
 */

/* Athletic broadcast display (Anton) + condensed UI (Oswald) + clean body (Inter),
   matching web-public. Static S3 site — external font CDN is fine here. */
@import url("https://fonts.googleapis.com/css2?family=Anton&family=Oswald:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap");

:root {
  --gold: #ffcb05;          /* Prime Time gold */
  --gold-dim: #c9a200;
  --gold-deep: #8a6d00;
  --ink: #08080a;           /* film-black bg (matches web-public) */
  --panel: #131418;
  --panel-2: #1a1c22;
  --line: #2a2c34;
  --text: #f4f5f7;
  --muted: #9aa0ab;
  --green: #3ddc84;
  --red: #ff5d6c;
  --amber: #ffb020;
  --blue: #57b6ff;
  --purple: #b07cff;
  --radius: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  --f-display: "Anton", "Arial Narrow", "Impact", sans-serif;
  --f-cond: "Oswald", system-ui, "Segoe UI", sans-serif;
  --f-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-family: var(--f-body);
}

* { box-sizing: border-box; }

/*
 * Restore the native `[hidden]` semantics. Several elements below (`.login-gate`,
 * `.boot-loading`) set an author `display` (flex, to center their content) on the
 * SAME class the JS toggles `hidden` on — an author `display` rule wins the cascade
 * over the UA stylesheet's default `[hidden] { display: none }` (author beats
 * user-agent regardless of specificity), so those elements rendered visible even
 * while `hidden` was true. This one rule makes `hidden` win unconditionally again,
 * as every call site (app.js) assumes. (Modals are native <dialog>s and are NOT
 * toggled via `hidden` — showModal()/close() manage them in the top layer.)
 */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--ink);
  background-image:
    radial-gradient(1100px 560px at 82% -12%, rgba(255, 203, 5, 0.08) 0%, transparent 60%),
    radial-gradient(1000px 700px at 50% 20%, transparent 60%, rgba(0, 0, 0, 0.45) 100%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 64px;
}

/* film grain — full-viewport, non-interactive, blended over everything (subtle) */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.04;
  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.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
/* cinematic letterbox hairline (top) — one-brand cue with the public site */
body::before {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  height: 5px;
  z-index: 9998;
  pointer-events: none;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold) 50%, var(--gold-deep));
}

/* ---- login gate (P9 auth) ---- */
.login-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* ---- boot loading (post-login / stored-token data fetch) ---- */
.boot-loading {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}
.boot-badge {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 30px;
  background: radial-gradient(circle at 32% 28%, var(--gold), var(--gold-deep) 78%);
  border: 1px solid var(--gold);
  box-shadow: 0 0 24px rgba(255, 203, 5, 0.3);
}
.boot-ring {
  position: absolute;
  inset: -9px;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--gold);
  animation: boot-spin 0.9s linear infinite;
}
@keyframes boot-spin { to { transform: rotate(360deg); } }
.boot-line {
  margin: 0;
  font-family: var(--f-cond);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 13px;
  color: var(--muted);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 26px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-brand {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 26px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.login-tagline {
  margin: -6px 0 4px;
  color: var(--muted);
  font-size: 13px;
}
.login-error {
  color: var(--red);
  font-size: 13px;
  min-height: 18px;
  margin: 0;
}

/* ---- header ---- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 28px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-glasses { font-size: 34px; line-height: 1; }
.brand h1 { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: 30px; text-transform: uppercase; letter-spacing: 0.01em; line-height: 1; }
.brand-sub { color: var(--gold); }
.tagline { margin: 4px 0 0; color: var(--muted); font-size: 13px; font-style: italic; }
/* documentary kicker in the header ("COMMISSIONER'S DESK · REC") */
.desk-kicker {
  font-family: var(--f-cond);
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 10px;
  font-weight: 600;
  color: var(--gold);
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.desk-kicker::after {
  content: "● REC";
  color: var(--red);
  letter-spacing: 0.16em;
  font-weight: 700;
  animation: recblink 2s steps(1) infinite;
}
@keyframes recblink { 50% { opacity: 0.25; } }
.header-actions { display: flex; gap: 10px; }

/* ---- buttons ---- */
.btn {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 9px 16px;
  border-radius: 8px;
  font-family: var(--f-cond);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.05s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { border-color: var(--gold-dim); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--gold); color: #1a1500; border-color: var(--gold); }
.btn-primary:hover { background: #ffd633; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-danger { color: var(--red); border-color: #4a2b30; }
.btn-danger:hover { border-color: var(--red); }

/* ---- toolbar ---- */
.toolbar {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  padding: 16px 28px;
  flex-wrap: wrap;
}
.filter-group { display: flex; flex-direction: column; gap: 5px; }
.filter-group label { font-family: var(--f-cond); font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
select, input, textarea {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
}
select:focus, input:focus, textarea:focus { outline: 2px solid var(--gold-dim); outline-offset: 0; }

.stats { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 14px;
  text-align: center;
  min-width: 78px;
}
.stat .stat-num { display: block; font-family: var(--f-display); font-weight: 400; font-size: 26px; line-height: 1; }
.stat .stat-lbl { font-family: var(--f-cond); font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }
.stat.paid .stat-num { color: var(--green); }
.stat.owe .stat-num { color: var(--red); }
.stat.open .stat-num { color: var(--amber); }

/* ---- phase strip (POST /phase) ---- */
.phase-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 28px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  background: rgba(255, 203, 5, 0.03);
}
.phase-current { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.phase-kicker {
  font-family: var(--f-cond);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.phase-note { color: var(--muted); font-size: 12px; }
.phase-controls { display: flex; align-items: center; gap: 8px; }
.pill.phase-pill { text-transform: uppercase; }
.pill.phase-pill.is-auto { background: #20252e; color: var(--muted); border-color: #2c3645; }
.pill.phase-pill.is-override { background: #2a2410; color: var(--gold); border-color: #4a3f12; }

/* ---- tabs ---- */
.tabs {
  display: flex;
  gap: 4px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  padding: 12px 16px;
  font-family: var(--f-cond);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  flex: 0 0 auto;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--gold); border-bottom-color: var(--gold); }

/* ---- panels ---- */
main { padding: 22px 28px; }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; font-family: var(--f-cond); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; font-size: 19px; }
.muted { color: var(--muted); font-weight: 400; font-size: 13px; }

/* ---- table ---- */
/* overflow-x scrolls the table itself when it's wider than the viewport
   (Players/Waitlist/Payouts on a phone) instead of clipping columns off —
   overflow-y stays hidden so the border-radius corners still clip cleanly. */
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow);
}
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table thead th {
  text-align: left;
  padding: 12px 14px;
  background: var(--panel-2);
  color: var(--muted);
  font-family: var(--f-cond);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(255, 203, 5, 0.04); }
.data-table .num { text-align: right; }

.cell-name { font-weight: 700; }
.cell-phone { color: var(--muted); font-size: 12px; }
.cell-ammo { color: var(--gold-dim); font-size: 12px; font-style: italic; margin-top: 2px; }

/* ---- status pills ---- */
.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: capitalize;
  border: 1px solid transparent;
}
.pill.prospect   { background: #1c2533; color: var(--blue);   border-color: #243a52; }
.pill.invited    { background: #20252e; color: #8fa3bd;       border-color: #2c3645; }
.pill.interested { background: #1d2c24; color: var(--green);   border-color: #234534; }
.pill.confirmed  { background: #2a2410; color: var(--gold);    border-color: #4a3f12; }
.pill.paid       { background: #16301f; color: var(--green);   border-color: #1f5234; }
.pill.declined   { background: #2c2024; color: var(--muted);   border-color: #3a2a2f; }
.pill.dropped    { background: #301a1e; color: var(--red);     border-color: #4a2b30; }

/* heat + escalation chips */
.chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  margin-right: 4px;
}
.chip.heat-nuclear { background: #3a1411; color: #ff8a6b; }
.chip.heat-spicy   { background: #3a2a10; color: var(--amber); }
.chip.heat-clean   { background: #14302a; color: var(--green); }
.chip.esc-charm    { background: #14253a; color: var(--blue); }
.chip.esc-warning  { background: #3a2a10; color: var(--amber); }
.chip.esc-menace   { background: #3a1411; color: #ff8a6b; }
.chip.esc-unhinged { background: #2a1140; color: var(--purple); }
.chip.optout       { background: #2c2024; color: var(--red); border: 1px dashed #4a2b30; }

/* paid toggle */
.toggle {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
}
/* invisible hit-slop to ~44px effective tap height — `.toggle` is a <label>,
   so a click anywhere in its box (incl. this pseudo-element) toggles the
   input natively; each row's toggle sits alone in its own table cell, so the
   9px extension doesn't reach a neighboring control. */
.toggle::before { content: ""; position: absolute; inset: -9px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .track {
  position: absolute;
  inset: 0;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: background 0.15s ease;
  cursor: pointer;
}
.toggle .track::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background: var(--muted);
  border-radius: 50%;
  transition: transform 0.15s ease, background 0.15s ease;
}
.toggle input:checked + .track { background: #16301f; border-color: #1f5234; }
.toggle input:checked + .track::before { transform: translateX(20px); background: var(--green); }
.toggle input:disabled + .track { opacity: 0.45; cursor: not-allowed; }

.last-fresh { color: var(--muted); }
.last-overdue { color: var(--amber); font-weight: 600; }

.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---- empty state ---- */
.empty-state { padding: 28px; text-align: center; color: var(--muted); }

/* ---- wall of shame ---- */
.wall-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.wall-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.wall-card h3 { margin: 0 0 12px; font-size: 16px; color: var(--gold); }
.wall-col-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 10px 0 6px; }
.wall-list { list-style: none; margin: 0; padding: 0; }
.wall-list li { padding: 6px 0; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.wall-list li:last-child { border-bottom: none; }
.wall-paid li::before { content: "✅"; }
.wall-duck li::before { content: "🐔"; }
.wall-empty { color: var(--muted); font-size: 13px; font-style: italic; padding: 6px 0; }

/* ---- THE DEION BOWL tab ---- */
.pill.bracket-status-pill { text-transform: uppercase; background: #20252e; color: var(--muted); border-color: #2c3645; }
.pill.bracket-status-pill.status-deion_bowl,
.pill.bracket-status-pill.status-finals_week1 { background: #2a2410; color: var(--gold); border-color: #4a3f12; }
.pill.bracket-status-pill.status-complete { background: #16301f; color: var(--green); border-color: #1f5234; }
.pill.bracket-status-pill.status-league_playoffs,
.pill.bracket-status-pill.status-pending { background: #1c2533; color: var(--blue); border-color: #243a52; }

.bowl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-bottom: 18px; }
.bowl-league-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.bowl-league-card h3 { margin: 0 0 4px; font-family: var(--f-cond); text-transform: uppercase; font-size: 16px; }
.bowl-champion-line { margin: 6px 0 0; font-weight: 700; }

.bowl-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.bowl-card h3 { margin: 0 0 10px; font-family: var(--f-cond); font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em; font-size: 16px; }
.bowl-card .table-wrap { box-shadow: none; margin-bottom: 10px; }

.lock-card .lock-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.lock-card .lock-head h3 { margin: 0; }
.pill.lock-pill.locked { background: #16301f; color: var(--green); border-color: #1f5234; }
.pill.lock-pill.unlocked { background: #3a1411; color: #ff8a6b; border-color: #4a2b30; }
#lockWeek1Btn { margin: 10px 0; }

.override-form { display: grid; gap: 12px; }
.override-league-row { display: grid; grid-template-columns: 1fr 120px 1fr; align-items: center; gap: 10px; }
.override-league-label { font-family: var(--f-cond); font-size: 13px; color: var(--muted); }
.override-deion-row { grid-template-columns: 1fr 2fr; }
.override-deion-controls { display: flex; gap: 10px; }
.override-deion-controls select { flex: 0 0 150px; }
.override-deion-controls input[type="number"] { flex: 0 0 100px; }
.override-deion-controls input[type="text"] { flex: 1; }
.override-form button[type="submit"] { justify-self: start; margin-top: 4px; }

/* .lock-modal-body's <p> is a direct child of the 2-column .modal-body grid
   with no span — without grid-column it would auto-place into just the first
   column, squeezing the explanatory paragraph into half the modal width. */
.lock-modal-body p { grid-column: 1 / -1; color: var(--muted); font-size: 13px; line-height: 1.5; }

/* ---- modal (native <dialog>, broadcast lower-third framing) ---- */
dialog.modal {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  color: var(--text);
  border: 1px solid var(--gold-dim);
  border-top: 3px solid var(--gold);
  border-radius: 14px;
  width: min(480px, calc(100vw - 40px));
  max-height: 90vh;
  padding: 0;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.75), 0 0 44px rgba(255, 203, 5, 0.1);
}
dialog.modal[open] { display: flex; animation: modal-in 0.16s ease; }
dialog.modal::backdrop { background: rgba(4, 4, 6, 0.74); backdrop-filter: blur(5px); }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 16px 20px 14px; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-kicker {
  margin: 0 0 4px;
  font-family: var(--f-cond);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 10px;
  font-weight: 600;
  color: var(--gold);
}
.modal-close { background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; padding: 10px; margin: -10px; }
.modal-close:hover { color: var(--text); }
.modal-body { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 20px; overflow-y: auto; overflow-x: hidden; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; min-width: 0; }
.field input, .field select, .field textarea { width: 100%; }
.field > span { color: var(--muted); }
.field-full { grid-column: 1 / -1; }
.modal-foot { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

/* ---- toasts ---- */
.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 60;
  max-width: 360px;
}
.toast {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: toast-in 0.18s ease;
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast .toast-title { font-weight: 700; margin-bottom: 4px; }
.toast .toast-line { color: var(--muted); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 760px) {
  .modal-body { grid-template-columns: 1fr; }
  .data-table { font-size: 13px; }
  .stats { width: 100%; margin-left: 0; }
  .phase-strip { flex-direction: column; align-items: flex-start; }
  .override-league-row { grid-template-columns: 1fr; }
  .override-deion-controls { flex-direction: column; }
  .override-deion-controls select,
  .override-deion-controls input { flex: 1 1 auto; width: 100%; }
}
