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

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #22263a;
  --border: #2e3350;
  --text: #e2e8f0;
  --muted: #7b82a0;
  --green: #22c55e;
  --red: #ef4444;
  --blue: #3b82f6;
  --yellow: #f59e0b;
  --accent: #6366f1;
  --radius: 12px;
  --sidebar-w: 220px;
}

html, body { height: 100%; font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }

/* ── Layout ─────────────────────────────────────────────────────────────────── */

.sidebar {
  position: fixed; top: 0; left: 0; width: var(--sidebar-w); height: 100vh;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 24px 0;
}

.sidebar-footer {
  margin-top: auto; padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px;
}
.last-updated { font-size: 11px; color: var(--muted); }

.sidebar-logo {
  font-size: 18px; font-weight: 700; color: var(--accent);
  padding: 0 20px 24px; border-bottom: 1px solid var(--border);
}

.sidebar-nav { list-style: none; padding: 16px 0; }
.sidebar-nav li { margin: 2px 0; }
.nav-link {
  display: block; padding: 10px 20px; color: var(--muted);
  text-decoration: none; border-radius: 0 8px 8px 0;
  transition: color .15s, background .15s;
}
.nav-link:hover { color: var(--text); background: var(--surface2); }
.nav-link.active { color: var(--text); background: var(--surface2); font-weight: 600; }

.content {
  margin-left: var(--sidebar-w); padding: 32px; min-height: 100vh;
}

/* ── Tabs ───────────────────────────────────────────────────────────────────── */

.tab { display: none; }
.tab.active { display: block; }
.page-title { font-size: 24px; font-weight: 700; margin-bottom: 24px; }

/* ── Cards ──────────────────────────────────────────────────────────────────── */

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; display: flex; align-items: center; gap: 16px;
}
.card-icon { font-size: 28px; }
.card-value { font-size: 28px; font-weight: 700; line-height: 1; }
.card-label { color: var(--muted); font-size: 12px; margin-top: 4px; }
.card-green .card-value { color: var(--green); }
.card-red   .card-value { color: var(--red); }
.card-blue  .card-value { color: var(--blue); }

/* ── Charts ─────────────────────────────────────────────────────────────────── */

.charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.chart-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.chart-box h2 { font-size: 15px; font-weight: 600; margin-bottom: 16px; color: var(--muted); }
.chart-box-sm { max-height: 320px; }

/* ── Tables ─────────────────────────────────────────────────────────────────── */

.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }

table { width: 100%; border-collapse: collapse; background: var(--surface); }
thead { background: var(--surface2); }
th { padding: 12px 14px; text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); white-space: nowrap; }
td { padding: 11px 14px; border-top: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: var(--surface2); }

.loading { color: var(--muted); text-align: center; padding: 32px !important; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; text-transform: uppercase;
}
.badge-green  { background: rgba(34,197,94,.15); color: var(--green); }
.badge-red    { background: rgba(239,68,68,.15); color: var(--red); }
.badge-yellow { background: rgba(245,158,11,.15); color: var(--yellow); }
.badge-blue   { background: rgba(59,130,246,.15); color: var(--blue); }
.badge-gray   { background: rgba(123,130,160,.15); color: var(--muted); }

.text-preview {
  max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--muted); font-size: 12px;
}
.btn-text { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 12px; }
.btn-text:hover { text-decoration: underline; }

/* ── Filters ────────────────────────────────────────────────────────────────── */

.filter-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 24px; }
.filter-section h2 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.muted { color: var(--muted); margin-bottom: 16px; font-size: 13px; }

.inline-form { display: flex; gap: 10px; align-items: center; }
.input {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); padding: 8px 12px; font-size: 14px; width: 140px;
  outline: none;
}
.input:focus { border-color: var(--accent); }

.sports-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-top: 16px; }

.sport-toggle {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 14px; cursor: pointer; user-select: none; transition: border-color .15s;
}
.sport-toggle:hover { border-color: var(--accent); }
.sport-name { font-size: 13px; text-transform: capitalize; }

/* Toggle switch */
.toggle { position: relative; display: inline-block; width: 36px; height: 20px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; background: var(--border);
  border-radius: 999px; transition: .2s;
}
.slider::before {
  content: ''; position: absolute; width: 14px; height: 14px;
  left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: .2s;
}
input:checked + .slider { background: var(--red); }
input:checked + .slider::before { transform: translateX(16px); }

/* ── Buttons ────────────────────────────────────────────────────────────────── */

.btn {
  background: var(--surface2); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 8px 14px; cursor: pointer; font-size: 13px;
  transition: border-color .15s;
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn-primary:hover { opacity: .9; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-danger { border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: rgba(239,68,68,.1); }

select {
  background: var(--surface2); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 6px 10px; font-size: 13px; outline: none;
}

/* ── Modal ──────────────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center; z-index: 999;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px; max-width: 600px; width: 90%; position: relative; max-height: 80vh; overflow-y: auto;
}
.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: none; border: none; color: var(--muted); cursor: pointer; font-size: 18px;
}
.modal h2 { margin-bottom: 16px; }
.modal pre { background: var(--surface2); border-radius: 8px; padding: 16px; white-space: pre-wrap; word-break: break-word; font-size: 13px; line-height: 1.6; }

/* ── Fixture filter tag list ─────────────────────────────────────────────────── */

.filter-tag-list { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.filter-tag {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 6px;
  padding: 5px 10px; font-size: 13px;
}
.filter-tag button {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 14px; line-height: 1; padding: 0;
}
.filter-tag button:hover { color: var(--red); }
.filter-tag-empty { color: var(--muted); font-size: 13px; }

@media (max-width: 900px) {
  .charts-row { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .sidebar { display: none; }
  .content { margin-left: 0; padding: 16px; }
}
