/* ══════════════════════════════════════════════════════════
   CRICKET ANALYTICS DASHBOARD — DESIGN SYSTEM
   Aesthetic: Sports editorial · Dark · Amber accent
   Fonts: Bebas Neue (display) + DM Sans (body)
   ══════════════════════════════════════════════════════════ */

/* ── TOKENS ──────────────────────────────────────────────── */
:root {
  --bg:         #090c10;
  --surface:    #10141b;
  --surface2:   #171d27;
  --border:     #1c2333;
  --border2:    #242d3d;
  --amber:      #f59e0b;
  --amber-dim:  rgba(245,158,11,.12);
  --green:      #22c55e;
  --red:        #ef4444;
  --blue:       #3b82f6;
  --purple:     #a855f7;
  --text:       #dce4f0;
  --text2:      #94a3b8;
  --muted:      #4b5873;
  --font-d:     'Bebas Neue', sans-serif;
  --font-b:     'DM Sans', sans-serif;
  --r:          6px;
  --r-lg:       12px;
  --r-xl:       18px;
}

/* ── BASE ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-b);
  font-size: 13.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button { font-family: var(--font-b); cursor: pointer; }

/* ── SCROLLBAR ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ══════════════════════════════════════════════════════════
   LAYOUT
   ══════════════════════════════════════════════════════════ */
.app-shell { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 196px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 28px 20px;
  display: flex; flex-direction: column; gap: 36px;
  flex-shrink: 0;
  position: sticky; top: 0; height: 100vh; overflow: hidden;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon { font-size: 30px; color: var(--amber); line-height: 1; }
.brand-text {
  font-family: var(--font-d);
  font-size: 14px; letter-spacing: .07em; line-height: 1.2;
  color: var(--text);
}
.nav-links { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: block; padding: 9px 12px;
  border-radius: var(--r);
  color: var(--muted);
  text-decoration: none;
  font-size: 11px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase;
  transition: color .15s, background .15s;
}
.nav-link:hover, .nav-link.active {
  color: var(--amber); background: var(--amber-dim);
}

/* Content area */
.content { flex: 1; overflow-y: auto; min-width: 0; }

/* ══════════════════════════════════════════════════════════
   UPLOAD SCREEN
   ══════════════════════════════════════════════════════════ */
.upload-zone {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
  background:
    radial-gradient(ellipse 70% 55% at 50% 45%, rgba(245,158,11,.05) 0%, transparent 65%),
    var(--bg);
}
.upload-inner {
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 22px;
  max-width: 520px;
}
.upload-icon {
  font-size: 72px; color: var(--amber); opacity: .55;
  animation: float 3s ease-in-out infinite;
}
@keyframes float {
  0%,100% { transform: translateY(0) rotate(0deg); opacity: .45; }
  50%      { transform: translateY(-8px) rotate(3deg); opacity: .75; }
}
.upload-title {
  font-family: var(--font-d);
  font-size: clamp(52px, 9vw, 100px);
  line-height: .95; letter-spacing: .04em;
  color: var(--text);
}
.upload-sub { color: var(--text2); font-size: 15px; font-weight: 300; }
.upload-btn {
  display: inline-block; padding: 14px 42px;
  background: var(--amber); color: #000;
  font-family: var(--font-d); font-size: 20px; letter-spacing: .1em;
  border-radius: var(--r); cursor: pointer;
  transition: opacity .15s, transform .1s;
  border: none;
}
.upload-btn:hover { opacity: .85; transform: translateY(-2px); }
.hidden-input { display: none; }
.format-hint {
  color: var(--muted); font-size: 11px; line-height: 1.6;
  border: 1px solid var(--border); border-radius: var(--r);
  padding: 10px 16px; max-width: 480px;
}
.error-banner {
  background: rgba(239,68,68,.08); border: 1px solid rgba(239,68,68,.3);
  color: var(--red); border-radius: var(--r); padding: 10px 18px;
  font-size: 13px;
}
.loading-row {
  display: flex; align-items: center; gap: 12px;
  color: var(--text2); font-size: 13px;
}
.spinner {
  width: 22px; height: 22px; flex-shrink: 0;
  border: 2px solid var(--border2); border-top-color: var(--amber);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════
   DASHBOARD CHROME
   ══════════════════════════════════════════════════════════ */
.dashboard { display: flex; flex-direction: column; }

/* Header */
.dash-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 32px 36px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.session-title {
  font-family: var(--font-d);
  font-size: clamp(28px, 4vw, 52px);
  line-height: 1; letter-spacing: .04em;
  color: var(--text);
}
.session-date {
  display: block; margin-top: 5px;
  color: var(--amber); font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
}
.reset-btn {
  background: transparent; border: 1px solid var(--border2);
  color: var(--muted); padding: 8px 18px;
  border-radius: var(--r); font-size: 11px; letter-spacing: .1em;
  transition: color .15s, border-color .15s;
}
.reset-btn:hover { color: var(--amber); border-color: var(--amber); }

/* KPI Strip */
.kpi-strip {
  display: grid; grid-template-columns: repeat(6, 1fr);
  border-bottom: 1px solid var(--border);
}
.kpi {
  display: flex; flex-direction: column; align-items: center;
  padding: 24px 12px; gap: 4px;
  border-right: 1px solid var(--border);
}
.kpi:last-child { border-right: none; }
.kpi-accent { background: var(--amber-dim); }
.kpi-val {
  font-family: var(--font-d); font-size: 38px; line-height: 1;
  color: var(--text);
}
.kpi-accent .kpi-val { color: var(--amber); }
.kpi-label {
  font-size: 10px; font-weight: 500; letter-spacing: .12em;
  color: var(--muted); text-transform: uppercase;
}
.kpi-sub { font-size: 10px; color: var(--muted); }

/* Outcome bar */
.outcome-bar-section {
  padding: 26px 36px;
  border-bottom: 1px solid var(--border);
}
.section-title {
  font-family: var(--font-d); font-size: 15px; letter-spacing: .1em;
  color: var(--text2); margin-bottom: 14px;
}
.outcome-bar {
  display: flex; height: 42px;
  border-radius: var(--r); overflow: hidden; gap: 2px;
}
.seg {
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; letter-spacing: .04em;
  color: rgba(0,0,0,.8); min-width: 2px;
  transition: flex .4s ease;
}
.seg-hit    { background: var(--green); }
.seg-miss   { background: var(--red); color: #fff; }
.seg-edge   { background: var(--amber); }
.seg-leave  { background: var(--blue); color: #fff; }
.seg-wide   { background: var(--purple); color: #fff; }
.seg-unknown{ background: var(--muted); color: #fff; }

.outcome-legend {
  display: flex; gap: 20px; margin-top: 10px; flex-wrap: wrap;
}
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text2); }

/* ── DOTS ─────────────────────────────────────────────────── */
.leg-dot, .leg-dot-sm {
  display: inline-block; border-radius: 2px; flex-shrink: 0;
}
.leg-dot    { width: 10px; height: 10px; }
.leg-dot-sm { width: 8px;  height: 8px; margin-right: 3px; vertical-align: middle; }
.dot-hit    { background: var(--green); }
.dot-miss   { background: var(--red); }
.dot-edge   { background: var(--amber); }
.dot-leave  { background: var(--blue); }
.dot-wide   { background: var(--purple); }
.dot-       { background: var(--muted); }

/* ── TABS ────────────────────────────────────────────────── */
.tables-section { }
.tab-bar {
  display: flex; border-bottom: 1px solid var(--border);
  padding: 0 36px; background: var(--surface);
}
.tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--muted); padding: 15px 22px;
  font-family: var(--font-d); font-size: 15px; letter-spacing: .08em;
  cursor: pointer; transition: color .15s, border-color .15s;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--amber); border-bottom-color: var(--amber); }

/* ── TABLE ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; padding: 24px 36px 0; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left; padding: 8px 14px;
  font-size: 10px; letter-spacing: .1em; color: var(--muted);
  font-weight: 500; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid rgba(255,255,255,.03);
  white-space: nowrap;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,.015); }
.name-cell      { font-weight: 500; color: var(--text); }
.highlight-cell { color: var(--amber); font-weight: 600; }
.warn-cell      { color: var(--red); font-weight: 600; }
.muted-cell     { color: var(--muted); font-size: 12px; }
.text-green     { color: var(--green); }
.text-red       { color: var(--red); }
.muted-inline   { font-size: 12px; color: var(--muted); }

/* Pills */
.pill {
  display: inline-block; padding: 3px 9px;
  border-radius: 20px; font-size: 11.5px; font-weight: 600;
}
.pill-green  { background: rgba(34,197,94,.1);  color: var(--green); }
.pill-red    { background: rgba(239,68,68,.1);  color: var(--red); }
.pill-amber  { background: rgba(245,158,11,.1); color: var(--amber); }

/* Badges */
.badge {
  display: inline-block; padding: 2px 7px;
  border-radius: 3px; font-size: 11px; font-weight: 700; letter-spacing: .05em;
}
.badge-r             { background: rgba(59,130,246,.12);  color: var(--blue); }
.badge-l             { background: rgba(168,85,247,.12);  color: var(--purple); }
.badge-type-spinner  { background: rgba(168,85,247,.12);  color: var(--purple); }
.badge-type-medium   { background: rgba(245,158,11,.12);  color: var(--amber); }
.badge-type-pace     { background: rgba(239,68,68,.12);   color: var(--red); }

/* ── CHARTS ROW ──────────────────────────────────────────── */
.charts-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px; padding: 24px 36px;
}

/* ── SHOT BREAKDOWN ──────────────────────────────────────── */
.breakdown-header { padding: 4px 0 0; }
.shot-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px; padding: 4px 36px 28px;
}
.breakdown-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.card-top { display: flex; align-items: center; justify-content: space-between; }
.card-name { font-size: 13px; font-weight: 600; color: var(--text); }
.shot-pills { display: flex; flex-wrap: wrap; gap: 5px; }
.shot-pill {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 20px; padding: 2px 9px;
  font-size: 11px; color: var(--text2);
}
.shot-pill strong { color: var(--amber); margin-left: 4px; }
.fw-row { display: flex; gap: 6px; flex-wrap: wrap; }
.fw-chip {
  font-size: 11px; color: var(--muted);
  padding: 2px 7px; background: rgba(100,116,139,.1); border-radius: 3px;
}
.fw-chip strong { color: var(--text2); }
.outcome-mini-bar {
  display: flex; height: 4px; border-radius: 2px; overflow: hidden; gap: 1px;
}
.outcome-mini-bar div { border-radius: 2px; min-width: 2px; transition: width .3s; }

/* ── ZONE GRID ───────────────────────────────────────────── */
.zone-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px; padding: 24px 36px;
}
.zone-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 18px;
  display: flex; flex-direction: column; gap: 12px;
}
.zone-card-header { display: flex; align-items: center; justify-content: space-between; }
.zone-bowler { font-size: 13px; font-weight: 600; color: var(--text); }
.zone-strip {
  display: flex; height: 52px;
  border-radius: var(--r); overflow: hidden; gap: 2px;
}
.zone {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
  min-width: 6px; transition: flex .3s;
}
.z-count { font-size: 14px; font-weight: 700; }
.z-lbl   { font-size: 7px; font-weight: 600; letter-spacing: .06em; opacity: .75; }
.z-wide-off { background: rgba(239,68,68,.65); color: #fff; }
.z-ideal    { background: rgba(34,197,94,.65);  color: #000; }
.z-stumps   { background: rgba(245,158,11,.8);  color: #000; }
.z-wide-leg { background: rgba(239,68,68,.65); color: #fff; }
.zone-stats-row {
  display: flex; gap: 16px; flex-wrap: wrap;
  font-size: 12px; color: var(--text2);
}
.zone-stats-row strong { font-weight: 600; }

/* ── PITCH MAP ───────────────────────────────────────────── */
.pitch-map-section { padding: 24px 36px; }
.pitch-map-intro {
  font-size: 12px; color: var(--muted);
  margin-bottom: 20px; line-height: 1.8;
}
.leg-inline { margin-left: 12px; font-size: 12px; color: var(--text2); }
.pitch-map-full { margin-bottom: 8px; }
.beehive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px; margin-top: 16px;
}

/* ── TIMELINE ────────────────────────────────────────────── */
.timeline-section {
  padding: 26px 36px 44px;
  border-top: 1px solid var(--border);
}
.timeline {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 14px 0;
}
.del-dot {
  width: 12px; height: 12px; border-radius: 2px; cursor: pointer;
  transition: transform .1s, opacity .1s;
}
.del-dot:hover { transform: scale(1.7); opacity: 1 !important; }
.timeline-legend {
  display: flex; align-items: center; gap: 18px;
  font-size: 12px; color: var(--text2); margin-top: 8px;
}
.leg-item { display: flex; align-items: center; gap: 6px; }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .kpi-strip { grid-template-columns: repeat(3, 1fr); }
  .kpi:nth-child(3) { border-right: none; }
  .kpi:nth-child(6) { border-right: none; }
}
@media (max-width: 768px) {
  .sidebar { display: none; }
  .dash-header, .outcome-bar-section, .table-wrap, .charts-row,
  .shot-breakdown-grid, .zone-grid, .timeline-section,
  .pitch-map-section, .breakdown-header { padding-left: 16px; padding-right: 16px; }
  .tab-bar { padding: 0 16px; }
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .kpi:nth-child(2n) { border-right: none; }
}
@media (max-width: 480px) {
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .session-title { font-size: 28px; }
}
