/*
  NFL Matchup Analyzer - styles.

  Summary:
    Dark, mobile-first styling that matches the Parlay Hedge Calculator.
    Two matchup tables sit side by side on wide screens and stack on phones.

  Input files: None.
  Output files: None.
  Location: D:\OneDrive\Code\DFS_direct\NFL\nfl-matchups\styles.css
*/

:root {
  --bg: #0f172a;
  --panel: #1e293b;
  --panel2: #273449;
  --border: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --good: #4ade80;
  --bad: #f87171;
  --warn: #fbbf24;
  --purple: #c084fc;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); }

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding:
    calc(20px + env(safe-area-inset-top))
    calc(14px + env(safe-area-inset-right))
    calc(40px + env(safe-area-inset-bottom))
    calc(14px + env(safe-area-inset-left));
}

h1 { margin: 0 0 4px; font-size: 1.6rem; }
.subtitle { color: var(--muted); margin: 0 0 16px; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}
.card h2 {
  font-size: .85rem;
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

/* ---------- Controls ---------- */
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .controls .row2 { grid-template-columns: 1fr; } }

select {
  width: 100%;
  padding: 9px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem; /* 16px minimum stops iOS Safari from zooming in on focus */
}
select:focus, button:focus-visible { outline: 2px solid var(--accent); border-color: transparent; }

.select-with-btn { display: flex; gap: 6px; }
#swap-btn {
  flex: none;
  width: 42px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
}

.segmented { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.segmented button {
  flex: 1;
  background: transparent;
  color: var(--muted);
  border: 0;
  padding: 9px 10px;
  cursor: pointer;
  font-size: .9rem;
}
.segmented button.active { background: var(--accent); color: var(--bg); font-weight: 600; }
.segmented button:disabled { opacity: .4; cursor: not-allowed; }
#stats-hint { margin: 6px 0 0; font-size: .8rem; }

.view-toggle { margin-bottom: 16px; }
.view-toggle button { padding: 11px 10px; font-size: .95rem; }

.hidden { display: none !important; }

/* ---------- Alerts ---------- */
.alert {
  border-left: 4px solid var(--accent);
  background: var(--panel);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: .9rem;
}
.alert.warn { border-color: var(--warn); background: #2a2210; }
.alert.error { border-color: var(--bad); background: #2a1215; }

/* ---------- Team badges and game header ---------- */
.team-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.team-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, .35);
  flex: none;
}

.game-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  font-size: 1.2rem;
  margin-bottom: 8px;
}
.game-title .at { color: var(--muted); font-weight: 400; }
.meta { color: var(--muted); font-size: .9rem; }
.final-line { margin-top: 10px; font-size: .95rem; }

/* ---------- Stat tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.tile { background: var(--panel2); border-radius: 10px; padding: 10px 12px; }
.tile .label { color: var(--muted); font-size: .78rem; }
.tile .value { font-size: 1.2rem; font-weight: 600; margin: 2px 0; font-variant-numeric: tabular-nums; }
.tile .detail { color: var(--muted); font-size: .78rem; }
.tile .unit { font-size: .8rem; font-weight: 400; color: var(--muted); }
.tile .adj-row { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--border); font-size: .95rem; }
.tile .adj-label { color: var(--muted); font-size: .78rem; }

.explain { color: var(--muted); font-size: .88rem; margin: 10px 0 0; }

/* ---------- Tables ---------- */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { padding: 7px 6px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank { color: var(--muted); font-size: .78rem; margin-left: 4px; }
.rank.top { color: var(--good); }
.rank.bottom { color: var(--bad); }

.matchups-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.matchups-grid .card { margin-bottom: 0; }
@media (max-width: 900px) { .matchups-grid { grid-template-columns: minmax(0, 1fr); } }
.matchups-grid { margin-bottom: 16px; }

tr.big-edge td { background: rgba(56, 189, 248, .08); }

/* ---------- League rankings ---------- */
.sort-btn {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}
.sort-btn.active { color: var(--accent); font-weight: 600; }
.rankings-table td.pos-col { color: var(--muted); width: 2.5em; }
.rankings-table tr.selected td { background: rgba(56, 189, 248, .14); }
.rankings-table tr.selected td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.name-short { display: none; }
@media (max-width: 600px) {
  .name-full { display: none; }
  .name-short { display: inline; }
  .rankings-table { font-size: .78rem; }
  .rankings-table th, .rankings-table td { padding: 6px 3px; }
  .rankings-table th { white-space: normal; }
  .rankings-table th:first-child, .rankings-table td.pos-col { display: none; }
  .rankings-table td.sched-col .rank { display: block; }
}

/* ---------- Starred games ---------- */
.star-btn {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 4px 0 0;
  cursor: pointer;
  vertical-align: baseline;
}
.star-btn.on { color: var(--warn); }
.star-btn.labeled {
  font-size: .85rem;
  margin-left: 10px;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  vertical-align: middle;
}
.star-btn.labeled.on { border-color: var(--warn); }
.star-filter { display: inline-flex; align-items: center; gap: 6px; margin: 4px 0 10px; font-size: .88rem; color: var(--muted); cursor: pointer; }

/* ---------- Weekly overview ---------- */
.overview-table td { vertical-align: top; }
.overview-table .sub { display: block; color: var(--muted); font-size: .74rem; margin-top: 1px; }
.overview-table .result-chips { margin-top: 4px; }
.overview-table .sub.pick { color: var(--accent); }
.overview-table .result-chips .chip { margin: 2px 0 0 2px; }
.overview-table tr.clickable { cursor: pointer; }
.overview-table tr.clickable:hover td { background: rgba(56, 189, 248, .06); }
.overview-table tr.selected td { background: rgba(56, 189, 248, .14); }
.overview-table tr.selected td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
@media (max-width: 600px) {
  .overview-table { font-size: .70rem; }
  .overview-table th, .overview-table td { padding: 5px 1px; }
  .overview-table th { white-space: normal; }
  .overview-table .sub { font-size: .66rem; }
  .overview-table .chip { font-size: .64rem; padding: 1px 4px; white-space: normal; }
  .overview-table .result-chips { white-space: normal; }
  .overview-table td.num { white-space: normal; }
  .overview-table td.num strong { white-space: nowrap; }
  .overview-table td:first-child { max-width: 64px; }
}

.chip {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 6px;
  font-size: .74rem;
  font-weight: 600;
  white-space: nowrap;
}
.chip.off { background: rgba(74, 222, 128, .15); color: var(--good); }
.chip.def { background: rgba(248, 113, 113, .15); color: var(--bad); }
.chip.even { background: rgba(148, 163, 184, .15); color: var(--muted); }
.chip.svs { background: rgba(192, 132, 252, .18); color: var(--purple); margin-top: 3px; }
.chip.big { outline: 1px solid currentColor; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: .8rem; color: var(--muted); }

/* ---------- Game script ---------- */
.script-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
@media (max-width: 760px) { .script-grid { grid-template-columns: minmax(0, 1fr); } }
.script-side { background: var(--panel2); border-radius: 10px; padding: 12px; }
.script-side h3 { margin: 0 0 8px; font-size: 1rem; }
.script-side h4 { margin: 10px 0 4px; font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.script-side ul { margin: 0; padding-left: 18px; font-size: .9rem; }
.script-side li { margin-bottom: 6px; }
.script-side .none { color: var(--muted); font-size: .88rem; margin: 0; }
.chip.strong { background: rgba(74, 222, 128, .18); color: var(--good); }
.chip.lean { background: rgba(251, 191, 36, .16); color: var(--warn); }
.script-notes { margin: 12px 0 0; padding-left: 18px; font-size: .9rem; }
.script-notes li { margin-bottom: 6px; }

/* ---------- Key injuries ---------- */
.inj-list { list-style: none; padding-left: 0 !important; }
.inj-list li { margin-bottom: 10px; }
.inj-about { color: var(--muted); font-size: .82rem; }
.inj-detail { display: block; color: var(--muted); font-size: .82rem; margin-top: 2px; }
.inj-notes-title { margin: 14px 0 4px; font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

/* ---------- Weather ---------- */
.tile.alert { box-shadow: inset 0 0 0 1px var(--bad); }
.tile.alert .value { color: var(--bad); }
.weather-alert { margin: 10px 0 0; padding: 8px 12px; border-radius: 8px; border-left: 3px solid var(--bad);
  background: rgba(248, 113, 113, .1); font-size: .9rem; }
.weather-alert strong { color: var(--bad); }
.overview-table .sub.wx { color: var(--text); opacity: .85; }
.under-note { margin: 10px 0 0; padding: 8px 12px; border-radius: 8px; border-left: 3px solid var(--accent);
  background: rgba(56, 189, 248, .1); font-size: .9rem; }
.under-note strong { color: var(--accent); }
.chip.under { background: rgba(56, 189, 248, .15); color: var(--accent); }

/* ---------- Fantasy ---------- */
.fantasy-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin-top: 12px; }
@media (max-width: 760px) { .fantasy-grid { grid-template-columns: minmax(0, 1fr); } }
.fantasy-box { background: var(--panel2); border-radius: 10px; padding: 12px; }
.fantasy-box.avoid { margin-top: 14px; border-left: 3px solid var(--bad); }
.fantasy-box h3 { margin: 0; font-size: 1rem; }
.fantasy-box .explain { margin: 4px 0 8px; font-size: .8rem; }
.fantasy-table td { vertical-align: top; padding: 6px 4px; }
.fantasy-table .sub, .fantasy-all .sub { display: block; color: var(--muted); font-size: .72rem; margin-top: 1px; }
.fantasy-table .at { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.fantasy-table td.tags { text-align: right; }
.fantasy-table .chip, .fantasy-all .chip { margin: 0 0 2px 2px; }
.fantasy-games { margin: 0; padding-left: 18px; font-size: .88rem; }
.fantasy-games li { margin-bottom: 6px; }
.fantasy-details { margin: 14px 0; }
.fantasy-all { font-size: .82rem; }
#fantasy-view .clickable { cursor: pointer; }
#fantasy-view tr.clickable:hover td, #fantasy-view li.clickable:hover { background: rgba(56, 189, 248, .06); }
@media (max-width: 600px) {
  .fantasy-table { font-size: .8rem; }
  .fantasy-table .chip { font-size: .64rem; padding: 1px 4px; }
  .fantasy-table td.tags { max-width: 90px; }
}

.dfs-link { margin: 10px 0 0; padding: 8px 12px; border-radius: 8px; border-left: 3px solid var(--good);
  background: rgba(74, 222, 128, .08); font-size: .9rem; }
.dfs-link a { font-weight: 600; }
.dfs-link .sub { display: block; color: var(--muted); font-size: .72rem; margin-top: 3px; }

/* ---------- Line movement ---------- */
.moves { margin: 0; padding-left: 18px; }
.moves li { margin-bottom: 6px; }

/* ---------- Footer / glossary ---------- */
details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}
details[open] summary { margin-bottom: 10px; }
.footnote { color: var(--muted); font-size: .82rem; line-height: 1.5; }
.footnote dt { color: var(--text); font-weight: 600; margin-top: 8px; }
.footnote dd { margin: 2px 0 0; }
footer { margin-top: 8px; }

.pos { color: var(--good); }
.neg { color: var(--bad); }
