/* Motorsport Dark Dashboard Theme */
:root {
  --bg-main: #090d16;
  --bg-card: #0f172a;
  --bg-card-hover: #1e293b;
  --bg-card-alt: #131d33;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(225, 29, 72, 0.5);
  
  --color-primary: #e11d48;
  --color-primary-hover: #f43f5e;
  --color-primary-glow: rgba(225, 29, 72, 0.25);
  
  --color-accent-blue: #0ea5e9;
  --color-accent-cyan: #06b6d4;
  --color-accent-green: #10b981;
  --color-accent-gold: #f59e0b;
  --color-accent-silver: #94a3b8;
  --color-accent-bronze: #d97706;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px -5px var(--color-primary-glow);
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image: 
    radial-gradient(circle at 15% 10%, rgba(225, 29, 72, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(14, 165, 233, 0.06) 0%, transparent 40%);
  background-attachment: fixed;
}

/* Tabular numbers for lap times */
.tabular-nums {
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

/* Header & Navigation */
header {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav-container {
  max-width: 1350px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.brand-icon {
  min-width: 40px;
  width: auto;
  height: 40px;
  padding: 0 0.65rem;
  background: linear-gradient(135deg, var(--color-primary), #9f1239);
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow);
  font-size: 0.95rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: 0.5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.brand-text h1 {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #fff;
  line-height: 1.2;
}

.brand-text p {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

nav.main-nav {
  display: flex;
  gap: 0.4rem;
  background: rgba(0, 0, 0, 0.35);
  padding: 0.3rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 2px 10px rgba(225, 29, 72, 0.4);
}

/* Layout Container */
main.content-area {
  max-width: 1350px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
  flex: 1;
}

.section-panel {
  display: none;
  animation: fadeIn 0.25s ease forwards;
}

.section-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Hero & Superlatives Banner */
.superlatives-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.2rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent-blue));
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}

.stat-icon {
  font-size: 1.2rem;
  opacity: 0.8;
}

.stat-value {
  font-size: 2.1rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
  margin-bottom: 0.35rem;
  letter-spacing: -0.5px;
}

.stat-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Superlatives Cards with highlight accents */
.superlative-card {
  background: linear-gradient(145deg, #10192d, #0c1322);
  border: 1px solid rgba(14, 165, 233, 0.2);
}

.superlative-card .stat-value {
  font-size: 1.45rem;
  color: #38bdf8;
}

.superlative-highlight {
  display: inline-block;
  background: rgba(14, 165, 233, 0.15);
  color: #38bdf8;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  margin-top: 0.4rem;
}

/* Charts Section */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (max-width: 950px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.2rem;
}

.chart-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
}

.chart-wrapper {
  position: relative;
  height: 280px;
  width: 100%;
}

/* Lap Records Ticker & Badges */
.records-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.2rem;
  margin-bottom: 2rem;
}

.record-card {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s ease;
}

.record-card:hover {
  border-color: rgba(225, 29, 72, 0.4);
  box-shadow: 0 4px 15px rgba(225, 29, 72, 0.15);
}

.record-info h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.record-driver {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}

.record-meta {
  font-size: 0.76rem;
  color: var(--text-dim);
}

.record-time {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--color-primary);
  text-shadow: 0 0 12px rgba(225, 29, 72, 0.35);
}

/* Drivers Table & Search */
.controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  background: var(--bg-card);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 250px;
}

.search-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 1rem 0.65rem 2.4rem;
  color: #fff;
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.search-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-glow);
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 0.95rem;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.filter-select {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.filter-select:focus {
  border-color: var(--color-primary);
}

/* Custom Data Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

table.data-table th {
  background: rgba(0, 0, 0, 0.4);
  padding: 0.9rem 1rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

table.data-table td {
  padding: 0.95rem 1rem;
  font-size: 0.88rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}

table.data-table tbody tr {
  transition: background-color 0.15s ease;
  cursor: pointer;
}

table.data-table tbody tr:hover {
  background-color: var(--bg-card-hover);
}

/* Badges & Tags */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.badge-winner {
  background: rgba(225, 29, 72, 0.18);
  color: #fb7185;
  border: 1px solid rgba(225, 29, 72, 0.3);
}

.badge-gold {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-blue {
  background: rgba(14, 165, 233, 0.18);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, 0.3);
}

.badge-gray {
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.badge-green {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Modal Styling */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: #0d1527;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 960px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.85);
  position: relative;
  animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 1.5rem 1.8rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.7);
  position: sticky;
  top: 0;
  z-index: 10;
}

.modal-close {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--color-primary);
  color: #fff;
}

.modal-body {
  padding: 1.8rem;
}

/* Head to Head Widget */
.h2h-selector-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-card);
  text-align: center;
}

.h2h-pickers {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin: 1.5rem 0;
}

.vs-badge {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.h2h-scoreboard {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1.5rem;
  align-items: center;
  margin: 2rem 0;
  background: rgba(0, 0, 0, 0.35);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
}

.h2h-score-col {
  text-align: center;
}

.h2h-driver-name {
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.4rem;
}

.h2h-score-num {
  font-size: 3rem;
  font-weight: 900;
  line-height: 1;
}

.h2h-score-num.win {
  color: var(--color-accent-green);
}

.h2h-score-num.loss {
  color: var(--text-dim);
}

/* Footer */
footer {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  background: rgba(10, 15, 28, 0.7);
  padding: 1.8rem 1.5rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.82rem;
}

footer a {
  color: var(--text-muted);
  text-decoration: none;
}

footer a:hover {
  color: var(--color-primary);
}

/* ==========================================================================
   Championship Standings & Podium Styling
   ========================================================================== */
.champ-controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

/* Class Selector Pills (Championship & Hall of Fame) */
.class-pills {
  display: inline-flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  align-items: center;
  background: rgba(0, 0, 0, 0.35);
  padding: 0.35rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  max-width: 100%;
}

.pill-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.5rem 0.95rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  line-height: 1.2;
}

.pill-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.pill-btn.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
  box-shadow: 0 2px 10px rgba(225, 29, 72, 0.4);
}

.pill-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.12rem 0.45rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  transition: all 0.2s ease;
  line-height: 1;
}

.pill-btn:hover .pill-badge {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.pill-btn.active .pill-badge {
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
}

.champ-podium-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.champ-podium-card {
  background: var(--bg-card, #0f172a);
  border: 1px solid var(--border-color, #1e293b);
  border-radius: var(--radius-lg, 12px);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.champ-podium-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.champ-podium-card.podium-gold {
  border-color: rgba(234, 179, 8, 0.45);
  background: linear-gradient(145deg, rgba(234, 179, 8, 0.08) 0%, rgba(15, 23, 42, 0.95) 100%);
}
.champ-podium-card.podium-gold:hover {
  border-color: rgba(234, 179, 8, 0.85);
}

.champ-podium-card.podium-silver {
  border-color: rgba(203, 213, 225, 0.35);
  background: linear-gradient(145deg, rgba(203, 213, 225, 0.06) 0%, rgba(15, 23, 42, 0.95) 100%);
}
.champ-podium-card.podium-silver:hover {
  border-color: rgba(203, 213, 225, 0.75);
}

.champ-podium-card.podium-bronze {
  border-color: rgba(249, 115, 22, 0.35);
  background: linear-gradient(145deg, rgba(249, 115, 22, 0.06) 0%, rgba(15, 23, 42, 0.95) 100%);
}
.champ-podium-card.podium-bronze:hover {
  border-color: rgba(249, 115, 22, 0.75);
}

.champ-podium-rank {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.champ-podium-medal {
  font-size: 1.5rem;
  line-height: 1;
}

.champ-podium-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.champ-podium-card.podium-gold .champ-podium-title {
  color: #facc15;
}
.champ-podium-card.podium-silver .champ-podium-title {
  color: #cbd5e1;
}
.champ-podium-card.podium-bronze .champ-podium-title {
  color: #fb923c;
}

.champ-podium-driver {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.champ-podium-points {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 0.6rem;
}

.champ-points-val {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-primary, #00f0ff);
}

.champ-points-lbl {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.champ-score-dropped {
  color: var(--text-dim, #64748b);
  text-decoration: line-through;
  opacity: 0.7;
  font-size: 0.85rem;
  cursor: help;
}

.champ-score-counting {
  font-weight: 700;
  color: #f8fafc;
}
