/* ═══════════════════════════════════════════════════════════════════════════
   CU3B Broadcast Dashboard — style.css
   Single-screen, full-focus broadcast layout
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Design Tokens ─────────────────────────────────────────────────────── */
:root {
  --bg:          #f8f9fa;
  --bg-card:     #ffffff;
  --bg-elevated: #ffffff;
  --border:      #dadce0;
  --border-hi:   #bdc1c6;

  --fg:          #202124;
  --fg-muted:    #5f6368;
  --fg-dim:      #9aa0a6;

  --accent:      #1a73e8;
  --accent-glow: rgba(26,115,232,.15);
  --brand:       #1a73e8;

  --green:  #1e8e3e;
  --yellow: #f9ab00;
  --orange: #e37400;
  --red:    #d93025;
  --purple: #9333ea;

  /* Grade colours */
  --grade-a:  #1e8e3e;
  --grade-b:  #34a853;
  --grade-c:  #f9ab00;
  --grade-d:  #e37400;
  --grade-f:  #d93025;
  --grade-na: #dadce0;

  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;

  --surface-3:   #f1f3f4;

  --font: 'Inter', -apple-system, sans-serif;
  --shadow: 0 1px 3px rgba(60,64,67,0.1), 0 2px 6px rgba(60,64,67,0.05);
}

/* ─── Dark Theme (Grey/Black) ───────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:          #121212;
  --bg-card:     #1e1e1e;
  --bg-elevated: #282828;
  --border:      #333333;
  --border-hi:   #444444;

  --fg:          #f3f4f6;
  --fg-muted:    #9ca3af;
  --fg-dim:      #6b7280;

  --surface-3:   #2a2a2a;
  
  --shadow: 0 4px 12px rgba(0,0,0,0.5);
  
  /* Retain brand blue safely, or we could desaturate it */
  --accent-glow: rgba(26,115,232,.25);
}

/* ─── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin:0; padding:0; }
html, body { height: 100%; overflow: hidden; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ─── Layout ─────────────────────────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  height: 56px;
  flex-shrink: 0;
}

.app-main {
  height: calc(100vh - 56px);
  overflow: hidden;
  position: relative;
}

/* ─── Brand ─────────────────────────────────────────────────────────────── */
.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.brand-icon { font-size: 20px; }
.brand-name {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--fg);
}

/* ─── Player Tabs ─────────────────────────────────────────────────────────── */
.player-tabs {
  display: flex;
  gap: 6px;
  flex: 1;
}
.player-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg-muted);
  font: 500 13px var(--font);
  cursor: pointer;
  transition: all .15s;
}
.player-tab:hover { border-color: var(--border-hi); color: var(--fg); }
.player-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.tab-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--fg-dim);
  flex-shrink: 0;
}
.tab-dot.online { background: var(--green); box-shadow: 0 0 8px var(--green); }
.tab-badge {
  font-size: 11px;
  opacity: .7;
}

/* ─── View Mode Tabs ─────────────────────────────────────────────────────── */
.view-tabs {
  display: flex;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  flex-shrink: 0;
}
.view-tab {
  padding: 4px 14px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--fg-muted);
  font: 500 12px var(--font);
  cursor: pointer;
  transition: all .15s;
}
.view-tab:hover { color: var(--fg); }
.view-tab.active { background: var(--bg-elevated); color: var(--brand); box-shadow: var(--shadow); }

/* ─── Views ──────────────────────────────────────────────────────────────── */
.view {
  height: 100%;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.view.hidden { display: none; }

/* ─── Connect Prompt ─────────────────────────────────────────────────────── */
.connect-prompt {
  margin: auto;
  max-width: 480px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.connect-icon { font-size: 56px; }
.connect-prompt h2 { font-size: 26px; font-weight: 700; }
.connect-prompt p { color: var(--fg-muted); }
.connect-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.connect-hint { font-size: 12px; color: var(--fg-dim); }
.player-setup {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.setup-label { font-size: 12px; color: var(--fg-muted); }
.player-name-input {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--fg);
  font: 500 15px var(--font);
  text-align: center;
  width: 240px;
  outline: none;
  transition: border-color .15s;
}
.player-name-input:focus { border-color: var(--accent); }

/* ─── Live Panel ─────────────────────────────────────────────────────────── */
.live-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
}
.live-panel.hidden { display: none; }

/* Shot Spotlight */
.shot-spotlight {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}
.shot-spotlight.visible {
  opacity: 1;
  pointer-events: auto;
}
.spotlight-grade {
  font-size: 140px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -6px;
  color: var(--grade-a);
}
.spotlight-label {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 4px;
  color: var(--fg-muted);
  margin-top: 8px;
}

/* Status Bar */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.status-left, .status-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.status-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--fg-dim);
}
.status-dot.connected { background: var(--green); box-shadow: 0 0 10px var(--green); }
.status-name { font-weight: 600; font-size: 15px; }
.shot-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--fg-muted);
  font-weight: 500;
}
.shot-pulse {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--red);
  animation: pulse 0.8s infinite;
}
.shot-pulse.hidden { display: none; }
@keyframes pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .5; transform: scale(.75); }
}
.session-count { font-size: 12px; color: var(--fg-dim); }

/* ─── Grade Hero ─────────────────────────────────────────────────────────── */
.grade-hero {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 20px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.grade-badge {
  width: 88px; height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 2px solid var(--grade-na);
  font-size: 52px;
  font-weight: 900;
  letter-spacing: -3px;
  color: var(--grade-na);
  transition: all .4s;
  flex-shrink: 0;
}
.grade-label { font-size: 11px; font-weight: 600; letter-spacing: 2px; color: var(--fg-dim); text-transform: uppercase; margin-bottom: 4px; }
.grade-score { font-size: 28px; font-weight: 700; color: var(--fg-muted); }

/* Grade colour variants */
.grade-A { --gc: var(--grade-a); }
.grade-B { --gc: var(--grade-b); }
.grade-C { --gc: var(--grade-c); }
.grade-D { --gc: var(--grade-d); }
.grade-F { --gc: var(--grade-f); }
.grade-badge[data-grade] { border-color: var(--gc, var(--grade-na)); color: var(--gc, var(--grade-na)); }

/* ─── Metrics Grid ───────────────────────────────────────────────────────── */
.info-icon {
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--fg-muted);
  cursor: help; margin-left: 6px; position: relative;
  font-family: 'Material Symbols Outlined';
  font-size: 15px; font-weight: 400;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
}
.metric-label.has-tooltip {
  position: relative;
  cursor: help;
}
.metric-label.has-tooltip::after {
  content: attr(data-tooltip); position: absolute; bottom: 120%; left: 50%; transform: translateX(-50%);
  width: max-content; max-width: 220px; white-space: normal; text-align: center;
  padding: 8px 12px; border-radius: 6px; font-size: 13px; font-weight: 500; font-family: 'Inter', sans-serif;
  background: var(--bg-elevated); color: var(--fg-norm);
  border: 1px solid var(--surface-3); box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  opacity: 0; pointer-events: none; transition: opacity 0.2s; z-index: 100;
}
.metric-label.has-tooltip:hover::after { opacity: 1; }

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 900px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
}
.metric-card {
  background: var(--bg-card);
  border: 1px solid transparent;
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease, border-color 0.3s ease;
  position: relative;
}
.metric-card.focused-metric {
  transform: scale(1.08);
  border-color: var(--accent);
  box-shadow: 0 4px 24px rgba(79, 142, 247, 0.3);
  z-index: 10;
}
.metric-card.active { border-color: var(--accent); }
.metric-val {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1;
  color: var(--fg);
}
.metric-unit { font-size: 12px; font-weight: 600; color: var(--fg-dim); }
.metric-label { font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--fg-muted); margin-top: 2px; }
.metric-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}
.metric-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  background: var(--accent);
  transition: width .4s ease;
}

/* ─── History Strip ──────────────────────────────────────────────────────── */
.history-strip {
  margin-top: auto;
  background: var(--bg-card);
  border: 1px solid transparent;
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.history-strip-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--fg-dim);
  writing-mode: horizontal-tb;
  flex-shrink: 0;
}
.history-canvas {
  flex: 1;
  height: 56px;
  display: block;
}

/* ─── History View ───────────────────────────────────────────────────────── */
.view-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.view-title { font-size: 22px; font-weight: 700; }
.view-subtitle { color: var(--fg-muted); font-size: 14px; }

.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.shot-card {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 16px;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(60,64,67,0.05);
  border-radius: var(--radius);
  padding: 14px 18px;
  transition: border-color .15s;
}
.shot-card:hover { border-color: var(--border-hi); }
.shot-num { font-size: 22px; font-weight: 800; color: var(--fg-dim); }
.shot-metrics-mini {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.metric-mini { display: flex; flex-direction: column; }
.metric-mini-val { font-size: 18px; font-weight: 700; }
.metric-mini-label { font-size: 10px; letter-spacing: 1px; color: var(--fg-dim); text-transform: uppercase; }
.shot-grade-pill {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 900;
}

/* ─── Compare View ───────────────────────────────────────────────────────── */
.compare-selectors {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.compare-select-group { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.compare-label { font-size: 11px; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; color: var(--fg-muted); }
.compare-select {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--fg);
  font: 500 14px var(--font);
  outline: none;
  cursor: pointer;
}
.compare-vs {
  font-size: 13px;
  font-weight: 700;
  color: var(--fg-dim);
  letter-spacing: 2px;
  flex-shrink: 0;
}
.compare-table {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.compare-row {
  display: grid;
  grid-template-columns: 1fr 180px 1fr;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.compare-row:last-child { border-bottom: none; }
.compare-row-header { background: var(--bg-elevated); }
.compare-metric-name { font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--fg-muted); text-align: center; font-weight: 600; }
.compare-val { font-size: 28px; font-weight: 800; text-align: center; }
.compare-delta {
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-block;
}
.compare-delta.pos { color: var(--green); background: rgba(34,197,94,.12); }
.compare-delta.neg { color: var(--red);   background: rgba(239,68,68,.12); }
.compare-delta.neu { color: var(--fg-dim); }

/* ─── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-sm);
  font: 600 13px var(--font);
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; padding: 10px 20px; }
.btn-primary:hover { filter: brightness(1.15); }
.btn-ghost { background: transparent; color: var(--fg-muted); padding: 6px 10px; }
.btn-ghost:hover { color: var(--fg); background: var(--bg-elevated); }
.btn-outline {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--border-hi); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 14px 32px; font-size: 16px; }

/* ─── Shared ─────────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  color: var(--fg-dim);
  padding: 48px;
  font-size: 14px;
}
.hidden { display: none !important; }

/* ─── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 3px; }

/* ─── Progress View ──────────────────────────────────────────────────────── */
.progress-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.progress-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.progress-summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.progress-val {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -2px;
  line-height: 1;
  color: var(--fg);
}
.progress-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-top: 8px;
}
.progress-section-title {
  font-size: 16px;
  font-weight: 700;
  margin-top: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.progress-chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  height: 212px; /* 180 + paddings */
}
.progress-chart {
  width: 100%;
  height: 180px;
  display: block;
}
.progress-actions {
  display: flex;
  align-items: center;
  margin-top: 10px;
}

.focus-select {
  background: var(--bg-card);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  cursor: pointer;
  height: 32px;
  margin-right: 12px;
}
.focus-select:focus { border-color: var(--accent); }

