/* ═══════════════════════════════════════════════
   NBA Fantasy Brief – Light Basketball Dashboard
   Palette: Soft Slate + Amber + Data-Green/Red
   ═══════════════════════════════════════════════ */

:root {
  --bg:          #eef1f6;
  --surface:     #ffffff;
  --surface-2:   #f4f6fa;
  --border:      #e2e8f0;
  --text:        #0f172a;
  --text-muted:  #64748b;
  --text-dim:    #475569;

  --amber:       #ea9006;
  --amber-dim:   #fde9c8;
  --win:         #16a34a;
  --win-bg:      rgba(22,163,74,.10);
  --loss:        #dc2626;
  --loss-bg:     rgba(220,38,38,.09);
  --open:        #94a3b8;
  --open-bg:     rgba(148,163,184,.14);

  --mono: 'JetBrains Mono', monospace;
  --sans: 'Inter', system-ui, sans-serif;

  --radius: 12px;
  --radius-sm: 6px;

  --shadow: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
}

/* ─── HEADER ─────────────────────────────────── */

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
  box-shadow: 0 1px 3px rgba(15,23,42,.05);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-left { display: flex; align-items: center; gap: 12px; }

.ball-icon { font-size: 28px; line-height: 1; }

.site-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--amber);
  letter-spacing: -.3px;
}

.site-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--mono);
}

.header-right { display: flex; align-items: center; gap: 12px; }

.league-badge {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 99px;
}

.btn-trigger {
  background: var(--amber);
  color: #000;
  border: none;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: opacity .15s;
}
.btn-trigger:hover { opacity: .85; }
.btn-trigger:disabled { opacity: .4; cursor: default; }

/* ─── LAYOUT ──────────────────────────────────── */

.layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
}

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; padding: 16px; }
}

.col-main, .col-side { display: flex; flex-direction: column; gap: 16px; }

/* ─── CARD ────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-label {
  font-size: 10px;
  font-family: var(--mono);
  font-weight: 600;
  letter-spacing: .12em;
  color: var(--amber);
  text-transform: uppercase;
}

/* ─── MATCHUP CARD ────────────────────────────── */

.matchup-record {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.matchup-opp {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.cat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.cat-item {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid var(--border);
  transition: border-color .2s;
}

.cat-item.win  { border-color: var(--win);  background: var(--win-bg); }
.cat-item.loss { border-color: var(--loss); background: var(--loss-bg); }
.cat-item.open { border-color: var(--border); }

.cat-name {
  font-size: 10px;
  font-family: var(--mono);
  letter-spacing: .1em;
  color: var(--text-muted);
}
.cat-item.win  .cat-name { color: var(--win); }
.cat-item.loss .cat-name { color: var(--loss); }

.cat-scores {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
}

.cat-mine {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}
.cat-item.win  .cat-mine { color: var(--win); }
.cat-item.loss .cat-mine { color: var(--loss); }

.cat-sep {
  font-size: 10px;
  color: var(--text-muted);
}

.cat-theirs {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text-muted);
}

.cat-result {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .12em;
  text-align: right;
}
.cat-item.win  .cat-result { color: var(--win); }
.cat-item.loss .cat-result { color: var(--loss); }
.cat-item.open .cat-result { color: var(--text-muted); }

.cat-skeleton {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  height: 70px;
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: .5; }
  50% { opacity: 1; }
}

/* ─── BRIEF TEXT ──────────────────────────────── */

.brief-time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
}

.brief-text {
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-word;
}

.brief-text b, .brief-text strong { color: var(--text); }

.loading-state {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  padding: 16px 0;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── ARCHIVE ─────────────────────────────────── */

.btn-ghost {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color .15s;
}
.btn-ghost:hover { color: var(--amber); }

.archive-list { margin-top: 4px; }
.archive-list.hidden { display: none; }

.archive-item {
  border-top: 1px solid var(--border);
  padding: 14px 0;
}

.archive-item:first-child { border-top: none; padding-top: 0; }

.archive-date {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--amber);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.archive-text {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: pre-wrap;
  line-height: 1.65;
  display: none;
}
.archive-text.open { display: block; }

/* ─── ROSTER LISTS ────────────────────────────── */

.count-badge {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
}
.count-badge.plays { background: var(--win-bg);  color: var(--win);  }
.count-badge.off   { background: var(--open-bg); color: var(--text-muted); }

.player-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }

.player-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.player-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-slot {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 3px;
  flex-shrink: 0;
}

.player-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.player-time {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--amber);
  flex-shrink: 0;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.active  { background: var(--win); }
.status-dot.off     { background: var(--open); }
.status-dot.injured { background: var(--loss); }

/* ─── MODAL ───────────────────────────────────── */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  backdrop-filter: blur(4px);
}
.modal.hidden { display: none; }

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 400px;
  width: 90%;
}

.modal-box h3 { font-size: 16px; margin-bottom: 8px; }
.modal-box p  { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.modal-box label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }

.modal-box input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  margin-bottom: 20px;
}
.modal-box input:focus { outline: none; border-color: var(--amber); }

.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

.btn-cancel {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
}

.btn-confirm {
  background: var(--amber);
  border: none;
  color: #000;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

/* ─── TOAST ───────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface);
  border: 1px solid var(--amber);
  color: var(--text);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  z-index: 9999;
  box-shadow: 0 4px 16px rgba(15,23,42,.12);
  animation: slideIn .25s ease;
}
.toast.error { border-color: var(--loss); }

@keyframes slideIn {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* ─── EMPTY STATE ─────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 24px 0;
  color: var(--text-muted);
  font-size: 13px;
}
