@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&family=Roboto+Mono:wght@400;500;700&display=swap');

:root {
  --bg-amoled: #08080a;
  --bg-card: #111116;
  --bg-hover: #1b1b22;
  --border-color: #22222a;
  --f1-red: #e10600;
  --text-primary: #ffffff;
  --text-secondary: #a0a0ab;
  --text-muted: #52525b;
  --flag-yellow: #ffd000;
  --flag-green: #00d2c4;
  --flag-red: #f43f5e;
  
  --font-display: 'Outfit', sans-serif;
  --font-mono: 'Roboto Mono', monospace;
}

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

body {
  background-color: var(--bg-amoled);
  color: var(--text-primary);
  font-family: var(--font-display);
  overflow-x: hidden;
  height: 100vh;
  display: flex;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-amoled);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Sidebar Navigation */
.sidebar {
  width: 250px;
  background-color: #0b0b0f;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
}

.sidebar-logo-container {
  padding: 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 20px;
  color: white;
  letter-spacing: -0.5px;
  text-transform: uppercase;
  background-color: var(--f1-red);
  padding: 4px 10px;
  border-radius: 4px;
  transform: skewX(-10deg);
}

.sidebar-logo span {
  font-weight: 400;
  opacity: 0.8;
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px 12px;
}

.nav-link-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.2s ease;
  cursor: pointer;
  border: 1px solid transparent;
}

.nav-link-item:hover {
  color: white;
  background-color: var(--bg-hover);
}

.nav-link-item.active {
  color: white;
  background-color: var(--f1-red);
  box-shadow: 0 4px 12px rgba(225, 6, 0, 0.2);
}

.sidebar-footer {
  margin-top: auto;
  padding: 20px;
  border-top: 1px solid var(--border-color);
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Main Workspace */
.main-workspace {
  margin-left: 250px;
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
}

/* Session Header Banner */
.session-banner {
  background-color: #0b0b0f;
  border-bottom: 1px solid var(--border-color);
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 90;
  backdrop-filter: blur(10px);
}

.session-title-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.session-title-group h2 {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.session-badge {
  background-color: var(--f1-red);
  color: white;
  font-size: 9px;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.session-meta {
  display: flex;
  align-items: center;
  gap: 20px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}

.session-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.live-badge {
  background-color: rgba(225, 6, 0, 0.1);
  border: 1px solid var(--f1-red);
  color: var(--f1-red);
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  animation: pulse 1.5s infinite alternate;
}

/* Content Container */
.content-container {
  padding: 32px;
  flex: 1;
}

.dashboard-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.card-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-secondary);
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 8px;
}

/* Timing Table CSS */
.table-wrapper {
  overflow-x: auto;
  width: 100%;
}

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

.timing-table th {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 12px 16px;
  border-bottom: 2px solid var(--border-color);
  letter-spacing: 0.5px;
}

.timing-table td {
  font-size: 12.5px;
  font-weight: 500;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.timing-table tbody tr {
  transition: background-color 0.15s ease;
}

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

.team-stripe-cell {
  position: relative;
}

.team-stripe {
  width: 4px;
  height: 20px;
  border-radius: 2px;
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
}

.tyre-badge {
  display: inline-block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 900;
  line-height: 20px;
  text-align: center;
}

.tyre-badge.soft, .tyre-badge.s { background-color: var(--f1-red); color: white; }
.tyre-badge.medium, .tyre-badge.m { background-color: #ffd000; color: black; }
.tyre-badge.hard, .tyre-badge.h { background-color: white; color: black; }
.tyre-badge.inter, .tyre-badge.i { background-color: #4ade80; color: black; }
.tyre-badge.wet, .tyre-badge.w { background-color: #3b82f6; color: white; }

/* Microsector styles */
.microsectors {
  display: flex;
  gap: 3px;
  align-items: center;
}

.microsector-block {
  width: 6px;
  height: 14px;
  border-radius: 1px;
  background-color: #222228;
}

.microsector-block.yellow { background-color: var(--flag-yellow); }
.microsector-block.green { background-color: #4ade80; }
.microsector-block.purple { background-color: #c084fc; }
.microsector-block.grey { background-color: #222228; }

/* Charts Grid */
.charts-grid-2x2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-bottom: 24px;
}

.chart-wrapper {
  background-color: #0c0c10;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  height: 250px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.chart-wrapper canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
  padding: 8px;
  background-color: rgba(255,255,255,0.02);
  border-radius: 6px;
}

/* Split Layout for map/car comparison */
.split-layout {
  display: flex;
  gap: 24px;
}

.left-panel {
  flex: 1;
}

.right-panel {
  flex: 2.2;
}

/* Segmented Buttons */
.segmented-control {
  display: flex;
  background-color: #0c0c10;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 16px;
}

.segmented-btn {
  flex: 1;
  text-align: center;
  padding: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
  text-transform: uppercase;
}

.segmented-btn.active {
  background-color: var(--f1-red);
  color: white;
}

/* Lap Grid */
.laps-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding: 10px;
  background-color: #0c0c10;
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.lap-cell {
  aspect-ratio: 1.2;
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.lap-cell:hover {
  border-color: var(--text-secondary);
  color: white;
}

.lap-cell.active {
  background-color: var(--f1-red);
  border-color: var(--f1-red);
  color: white;
  font-weight: 800;
  box-shadow: 0 0 10px rgba(225, 6, 0, 0.4);
}

/* Comparison Metric Grid */
.comparison-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.comparison-card {
  background-color: #0c0c10;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  font-family: var(--font-mono);
  border-top: 3px solid var(--f1-red);
}

.comparison-header {
  font-size: 11px;
  font-weight: 800;
  color: white;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  display: flex;
  justify-content: space-between;
}

.comparison-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.comparison-row span.val {
  color: white;
  font-weight: bold;
}

/* Form Styles */
.form-select {
  width: 100%;
  background-color: #0c0c10;
  border: 1px solid var(--border-color);
  color: white;
  padding: 10px;
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 12px;
  outline: none;
  cursor: pointer;
}

.form-select option {
  background-color: var(--bg-amoled);
}

/* Subtab Header controls */
.subtabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.subtab-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 6px 12px;
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
}

.subtab-btn:hover {
  color: white;
  border-color: var(--text-muted);
}

.subtab-btn.active {
  background-color: var(--border-color);
  color: white;
  border-color: var(--text-secondary);
}

/* Animations */
@keyframes pulse {
  0% { opacity: 0.4; }
  100% { opacity: 1; }
}

/* team colors utility mapping for db stripes */
.team-stripe.mercedes { background-color: #00d2c4; }
.team-stripe.red_bull { background-color: #0600ef; }
.team-stripe.ferrari { background-color: #ef1b0d; }
.team-stripe.mclaren { background-color: #ff8700; }
.team-stripe.aston_martin { background-color: #006f62; }
.team-stripe.alpine { background-color: #0090ff; }
.team-stripe.williams { background-color: #005aff; }
.team-stripe.sauber { background-color: #52e252; }
.team-stripe.haas { background-color: #ffffff; }
.team-stripe.rb { background-color: #1a30ff; }

/* Custom Select styles matching H2H Dropdown */
.custom-select-container {
  position: relative;
  width: auto;
  min-width: 260px;
}

.custom-select-trigger {
  background: rgba(30, 30, 38, 0.8) !important;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  color: white !important;
  border-radius: 8px !important;
  padding: 10px 14px !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  font-family: var(--font-display) !important;
  letter-spacing: 0.5px !important;
  text-transform: uppercase;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  min-width: 0 !important;
}

.custom-select-trigger:hover {
  border-color: rgba(225, 6, 0, 0.5) !important;
  background: rgba(40, 40, 50, 0.9) !important;
  box-shadow: 0 0 10px rgba(225, 6, 0, 0.15);
}

.custom-select-trigger.active {
  border-color: var(--f1-red) !important;
  background: rgba(24, 24, 28, 0.95) !important;
  box-shadow: 0 0 12px rgba(225, 6, 0, 0.25);
}

.custom-select-trigger .custom-select-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 8px;
  min-width: 0 !important;
}

.custom-select-menu {
  position: absolute !important;
  top: calc(100% + 6px) !important;
  width: 100% !important;
  max-height: 250px !important;
  overflow-y: auto !important;
  background-color: #141419 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 10px !important;
  padding: 6px 0 !important;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.9) !important;
  z-index: 99999 !important;
  transform-origin: top;
  will-change: transform, opacity;
  
  opacity: 0;
  pointer-events: none;
  transform: translate3d(0, -6px, 0);
  transition: opacity 0.1s ease, transform 0.1s ease !important;
}

.custom-select-menu.open {
  opacity: 1 !important;
  pointer-events: auto !important;
  transform: translate3d(0, 0, 0) !important;
}

.custom-dropdown-item {
  padding: 11px 16px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  color: rgba(255, 255, 255, 0.7) !important;
  font-family: var(--font-display) !important;
  letter-spacing: 0.5px !important;
  text-transform: uppercase;
  transition: background-color 0.15s ease, color 0.15s ease, border-left-color 0.15s ease !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  border-left: 3px solid transparent;
  white-space: nowrap !important;
  cursor: pointer;
}

.custom-dropdown-item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-dropdown-item:hover {
  background-color: rgba(255, 255, 255, 0.04) !important;
  color: white !important;
}

.custom-dropdown-item.selected {
  color: white !important;
  background-color: rgba(225, 6, 0, 0.08) !important;
  border-left-color: var(--f1-red);
  font-weight: 700 !important;
}

.custom-select-trigger.active i {
  transform: rotate(180deg);
  color: var(--f1-red) !important;
}

