/* ===================================================================
   Match Analytics — Clean sports data UI
   =================================================================== */

:root {
  --bg: #0a0e10;
  --surface: #0f1418;
  --surface2: #111619;
  --border: rgba(255,255,255,0.06);
  --border-h: rgba(255,255,255,0.12);
  --cyan: #00d4ff;
  --gold: #f5c518;
  --red: #ff5050;
  --purple: #a078ff;
  --green: #50d890;
  --w: #fff;
  --w80: rgba(255,255,255,0.8);
  --w60: rgba(255,255,255,0.6);
  --w40: rgba(255,255,255,0.4);
  --w20: rgba(255,255,255,0.2);
  --w08: rgba(255,255,255,0.08);
  --fh: 'Space Grotesk', sans-serif;
  --fb: 'Inter', sans-serif;
  --fm: 'JetBrains Mono', monospace;
}

*,*::before,*::after { box-sizing: border-box; }
html { scroll-behavior: smooth; color-scheme: dark; }
body {
  margin: 0; min-height: 100vh;
  font-family: var(--fb); font-size: 14px; line-height: 1.5;
  color: var(--w); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }

/* ======== NAV ======== */
.nav {
  position: sticky; top: 0; z-index: 100;
  height: 52px; display: flex; align-items: center;
  padding: 0 24px; gap: 24px;
  background: rgba(10,14,16,0.94);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.nav-logo { display: flex; }
.nav-logo img { height: 26px; }
.nav-tabs { display: flex; gap: 2px; }
.nav-tab {
  font-family: var(--fb); font-size: 13px; font-weight: 500;
  padding: 6px 16px; border-radius: 6px;
  border: none; background: transparent;
  color: var(--w60); cursor: pointer;
  transition: all .15s ease;
}
.nav-tab:hover { color: var(--w); background: var(--w08); }
.nav-tab.active { color: var(--cyan); background: rgba(0,212,255,0.08); }

/* ======== GAME HEADER ======== */
.game-header { padding: 20px 24px 16px; }
.gh-inner { max-width: 1200px; margin: 0 auto; }

/* Scoreboard */
.scoreboard {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 20px 28px; margin-bottom: 16px;
}
.sb-top {
  display: flex; align-items: center; justify-content: center; gap: 40px;
}
.sb-team-col { text-align: center; min-width: 100px; }
.sb-name {
  display: block; font-family: var(--fh); font-size: 13px; font-weight: 700;
  letter-spacing: 0.06em; color: var(--w60); margin-bottom: 4px;
}
.sb-big {
  display: block; font-family: var(--fm); font-size: 44px; font-weight: 700;
  line-height: 1;
}
.sb-center { text-align: center; }

.sb-set-grid {
  display: grid; grid-template-columns: 40px repeat(3, 36px);
  gap: 0; font-family: var(--fm); font-size: 13px;
  border: 1px solid var(--border); border-radius: 6px;
  overflow: hidden; margin-bottom: 8px;
}
.sb-set-header {
  padding: 4px 0; text-align: center; font-weight: 600;
  color: var(--w40); background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border);
}
.sb-set-label {
  padding: 5px 6px; font-size: 11px; font-weight: 600;
  color: var(--w40); text-align: left;
  border-right: 1px solid var(--border);
}
.sb-set-val {
  padding: 5px 0; text-align: center; color: var(--w80);
  border-right: 1px solid var(--border);
}
.sb-set-val:last-child { border-right: none; }
.sb-set-grid > :nth-child(n+5):nth-child(-n+8) {
  border-bottom: 1px solid var(--border);
}

.sb-info {
  font-size: 12px; color: var(--w40); margin-top: 4px;
}

/* Game video */
.game-video {
  border-radius: 10px; overflow: hidden;
  border: 1px solid var(--border);
  background: #000; aspect-ratio: 16/9;
  position: relative;
}
.game-video iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%; border: 0;
}

/* ======== MAIN ======== */
.main-content { max-width: 1200px; margin: 0 auto; padding: 0 24px 40px; }

/* Views */
.view { display: none; }
.view.active-view { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.hidden { display: none !important; }

/* Section */
.section { margin-top: 24px; }
.section-title {
  font-family: var(--fh); font-size: 18px; font-weight: 700;
  margin: 0 0 12px; letter-spacing: -0.01em;
}

/* ======== DATA TABLE ======== */
.table-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; overflow-x: auto;
}
.data-table {
  width: 100%; border-collapse: collapse; min-width: 500px;
}
.data-table th {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--w40);
  padding: 10px 14px; text-align: center;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table th:first-child { text-align: left; padding-left: 20px; }
.col-header { min-width: 50px; }

.data-table td {
  padding: 10px 14px; text-align: center;
  font-family: var(--fm); font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.data-table td:first-child {
  text-align: left; padding-left: 20px;
  font-family: var(--fb); font-weight: 600; color: var(--w80);
}
.data-table tbody tr:hover td { background: rgba(255,255,255,0.015); }
.data-table tbody tr:last-child td { border-bottom: none; }

.row-black td:first-child { border-left: 3px solid var(--cyan); }
.row-lb td:first-child { border-left: 3px solid var(--gold); }
.row-set-gap td { border-top: 2px solid var(--border); }

.time-link {
  color: var(--cyan); text-decoration: none;
  font-family: var(--fm); cursor: pointer;
  transition: color .15s ease;
}
.time-link:hover { color: var(--gold); text-decoration: underline; }

/* ======== CHARTS ======== */
.chart-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.chart-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 20px;
}
.chart-heading {
  font-family: var(--fh); font-size: 14px; font-weight: 600;
  margin: 0 0 12px; color: var(--w80);
}
.chart-container { position: relative; height: 220px; }
.chart-container-sm { position: relative; height: 150px; }

.pie-row { display: flex; gap: 20px; }
.pie-cell { flex: 1; text-align: center; }
.pie-label { font-size: 12px; color: var(--w40); margin-top: 6px; display: block; }

/* ======== CATEGORY GRID (highlights overview) ======== */
.cat-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
  margin-top: 16px;
}
.cat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden; cursor: pointer;
  transition: border-color .2s ease, transform .15s ease;
}
.cat-card:hover { border-color: var(--border-h); transform: translateY(-2px); }
.cat-top {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
}
.cat-name { font-family: var(--fh); font-size: 15px; font-weight: 600; }
.cat-count {
  font-family: var(--fm); font-size: 12px; font-weight: 600;
  background: var(--w08); color: var(--w60);
  padding: 2px 8px; border-radius: 4px;
}
.cat-link {
  font-size: 12px; color: var(--cyan); white-space: nowrap;
}
.cat-thumb {
  width: 100%; aspect-ratio: 16/9;
  object-fit: cover; display: block;
  background: #0d1114;
}
.cat-bottom {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 16px; font-size: 12px; color: var(--w40);
}

/* ======== CLIP THUMBNAIL GRID (drill-down) ======== */
.back-btn {
  font-family: var(--fb); font-size: 13px; font-weight: 500;
  padding: 8px 16px; border-radius: 6px;
  border: 1px solid var(--border); background: transparent;
  color: var(--w60); cursor: pointer;
  transition: all .15s ease; margin: 16px 0 12px;
}
.back-btn:hover { color: var(--w); border-color: var(--border-h); }

.clip-thumb-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
}
.clip-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden; cursor: pointer;
  transition: border-color .2s ease, transform .15s ease;
}
.clip-card:hover { border-color: var(--cyan); transform: translateY(-2px); }
.clip-thumb {
  width: 100%; aspect-ratio: 16/9;
  object-fit: cover; display: block;
  background: #0d1114;
  position: relative;
}
.clip-card-top {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 14px; font-size: 12px;
}
.clip-card-label { color: var(--w80); font-weight: 500; }
.clip-card-time { font-family: var(--fm); color: var(--cyan); font-size: 11px; }

/* ======== PLAYER OVERLAY ======== */
.player-overlay {
  display: none; position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.88); backdrop-filter: blur(6px);
  align-items: center; justify-content: center;
}
.player-overlay.open { display: flex; animation: fadeIn .2s ease; }
.player-box {
  position: relative; width: 90vw; max-width: 840px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden;
}
.player-box iframe { width: 100%; aspect-ratio: 16/9; border: 0; display: block; }
.player-close {
  position: absolute; top: 10px; right: 10px; z-index: 10;
  background: rgba(0,0,0,0.5); border: none; color: var(--w);
  width: 32px; height: 32px; border-radius: 50%;
  font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.player-close:hover { background: var(--w20); }
.player-info { padding: 10px 16px; font-size: 13px; color: var(--w60); }

/* ======== FOOTER ======== */
.footer {
  padding: 24px; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.footer img { height: 18px; opacity: 0.3; }
.footer span { font-size: 11px; color: var(--w20); }

/* ======== RESPONSIVE ======== */
@media (max-width: 900px) {
  .chart-row { grid-template-columns: 1fr; }
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .clip-thumb-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .nav { padding: 0 14px; gap: 12px; }
  .nav-logo img { height: 22px; }
  .nav-tab { font-size: 12px; padding: 5px 10px; }
  .sb-top { gap: 16px; flex-wrap: wrap; }
  .sb-big { font-size: 32px; }
  .cat-grid { grid-template-columns: 1fr; }
  .clip-thumb-grid { grid-template-columns: 1fr; }
  .pie-row { flex-direction: column; }
  .game-header { padding: 12px 14px 10px; }
  .main-content { padding: 0 14px 24px; }
}
