/* ═══════════════════════════════════════════════════
   Stadium Pulse AI — Command Center Stylesheet
   ═══════════════════════════════════════════════════ */

/* ── Design Tokens ─────────────────────────────── */
:root {
  /* Palette — dark mode default */
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: #1a2233;
  --bg-card-hover: #1e2a3f;
  --bg-elevated: #1f2d42;

  --text-primary: #e8ecf4;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --border: #2a3a52;
  --border-light: #334155;

  --accent: #3b82f6;
  --accent-glow: rgba(59, 130, 246, 0.15);
  --accent-hover: #60a5fa;

  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;

  --density-low: #10b981;
  --density-moderate: #f59e0b;
  --density-high: #f97316;
  --density-critical: #ef4444;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px var(--accent-glow);

  --transition: 200ms ease;
}

/* ── Light theme override ──────────────────────── */
[data-theme='light'] {
  --bg-primary: #f1f5f9;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-elevated: #f8fafc;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-light: #cbd5e1;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
}

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

html {
  font-size: 14px;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Skip link ─────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  z-index: 9999;
  border-radius: var(--radius-sm);
  transition: top var(--transition);
}
.skip-link:focus {
  top: 8px;
}

/* ── Top Bar ───────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar__title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.topbar__badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  letter-spacing: 0.05em;
  border: 1px solid var(--border);
}
.topbar__badge.active {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.3);
}

.topbar__status {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar__venue {
  font-weight: 500;
  color: var(--text-secondary);
}

.topbar__phase {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--accent-glow);
  color: var(--accent);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.topbar__weather {
  font-size: 0.85rem;
}

.topbar__btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  cursor: pointer;
  font-size: 1rem;
  transition: all var(--transition);
}
.topbar__btn:hover {
  background: var(--bg-elevated);
  border-color: var(--accent);
}

/* ── Command Center Grid ───────────────────────── */
.command-center {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr) 340px;
  gap: 12px;
  padding: 12px;
  height: calc(100vh - 52px);
  overflow: hidden;
}

.center-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}

.center-col .panel {
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.center-col .panel--center {
  flex: 0 0 auto;
  max-height: 48%;
}

.center-col .panel--right {
  flex: 1 1 auto;
}

.decisions-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
}

@media (max-width: 1200px) {
  .command-center {
    grid-template-columns: 1fr;
    height: auto;
    overflow: auto;
  }
  .decisions-split {
    grid-template-columns: 1fr;
  }
}

/* ── Panels ────────────────────────────────────── */
.panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.panel--chatbot {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}

.chatbot-panel-body {
  padding: 14px 16px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel__tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--accent-glow);
  color: var(--accent);
}

.btn--full {
  width: 100%;
}

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel__title {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.panel__counter {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.panel--center,
.panel--right {
  overflow-y: auto;
}

/* ── Stadium Map ───────────────────────────────── */
.stadium-map {
  padding: 12px;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stadium-map svg {
  width: 100%;
  max-height: 480px;
}

.zone-node {
  cursor: pointer;
  transition: all var(--transition);
}
.zone-node:hover {
  filter: brightness(1.3);
}
.zone-node:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.zone-label {
  font-size: 2.5px;
  fill: var(--text-primary);
  text-anchor: middle;
  pointer-events: none;
  font-weight: 500;
}

.zone-legend {
  display: flex;
  gap: 8px;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  justify-content: center;
}

.legend-item {
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}
.legend-item--low {
  background: rgba(16, 185, 129, 0.15);
  color: var(--density-low);
}
.legend-item--moderate {
  background: rgba(245, 158, 11, 0.15);
  color: var(--density-moderate);
}
.legend-item--high {
  background: rgba(249, 115, 22, 0.15);
  color: var(--density-high);
}
.legend-item--critical {
  background: rgba(239, 68, 68, 0.15);
  color: var(--density-critical);
}

/* ── Buttons ───────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition);
}
.btn--sm {
  padding: 4px 10px;
  font-size: 0.7rem;
}
.btn--accent {
  background: var(--accent);
  color: #fff;
}
.btn--accent:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-glow);
}
.btn--success {
  background: var(--success);
  color: #fff;
}
.btn--success:hover {
  opacity: 0.9;
}
.btn--danger {
  background: var(--danger);
  color: #fff;
}
.btn--danger:hover {
  opacity: 0.9;
}
.btn--outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn--outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 12px 16px 6px;
}
