@import url('https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700;900&display=swap');

@font-face{
  font-family: 'Good Times';
  src: url('assets/fonts/GoodTimes-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

*, *::before, *::after{ box-sizing:border-box; }

body{
  font-family:'Lato',sans-serif;
  background:#0f172a;
  color:#ffffff;
  padding:0;
  min-height:100vh;
  display:flex;
}

/* Prevent horizontal overflow */
html, body { overflow-x: hidden; }

/* =========================================================
   HOME / INDEX PAGE ONLY (scoped so it won't affect dashboard)
   ========================================================= */
body.page-home{
  /* override dashboard globals ONLY on index */
  background-color:#020617;
  color:#e5e7eb;

  /* your index font stack */
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;

  /* IMPORTANT: your main CSS sets body to display:flex;
     index wants normal document flow */
  display:block;
}

/* Hero / Video */
body.page-home .hero-section{
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  isolation: isolate;
}


body.page-home .hero-video{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}


body.page-home .hero-overlay{
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(circle at top left, rgba(15, 23, 42, 0.4), transparent 55%),
    linear-gradient(to bottom, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.95));
}


body.page-home .hero-content{
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 16px;
}


body.page-home .hero-title{
  font-family: 'Good Times', 'Lato', sans-serif;
  font-weight: 700;
  font-size: clamp(2.5rem, 4vw, 3.5rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #e5e7eb;
}


body.page-home .hero-subtitle{
  max-width: 540px;
  margin: 1rem auto 0;
  color: #9ca3af;
}

body.page-home .hero-badge{
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #93c5fd;
}

body.page-home .hero-cta-btn{
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.85rem;
  border-radius: 999px;
  padding: 0.85rem 2.5rem;
  font-weight: 700;
}

/* Home CTA color override (Bootstrap btn-warning) */
body.page-home .btn-warning{
  color:#020617;
  background-color:#29abe2;
  border-color:#29abe2;
  font-weight:700;
}


/* Scroll cue */
body.page-home .scroll-indicator{
  position: absolute;
  z-index: 3; /* above overlay */
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: #ffffff;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-shadow: 0 0 14px rgba(255,255,255,0.35);
}


body.page-home .scroll-indicator .mouse{
  width: 24px;
  height: 40px;
  border-radius: 999px;
  border: 2px solid #ffffff;
  position: relative;
  overflow: hidden;
}


body.page-home .scroll-indicator .wheel{
  width: 4px;
  height: 8px;
  border-radius: 999px;
  background: #ffffff;
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  animation: wheel-move 1.2s infinite ease-in-out;
}


@keyframes wheel-move{
  0% { opacity: 0; transform: translate(-50%, 0); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, 12px); }
}

/* =========================
   SIDEBAR
========================= */
.sidebar{
  width:260px;
  background:linear-gradient(180deg,#020617 0%,#020617 40%,#020617 100%);
  border-right:1px solid #1f2937;
  display:flex;
  flex-direction:column;
  padding:24px 16px;
  position:fixed;
  left:0;
  top:0;
  height:100vh;
  z-index:100;
}

.sidebar-header{
  display:flex;
  align-items:center;
  gap:12px;
  padding-bottom:20px;
  border-bottom:1px solid #1f2937;
}

.sidebar-logo{
  width:40px;
  height:40px;
  border-radius:12px;
  background:linear-gradient(135deg,#29abe2,#0c75a1);
  display:flex;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
}
.logo-icon{ font-weight:900; font-size:16px; letter-spacing:1px; }

/* replaces the old HR text logo */
.logo-icon-img{
  width: 36px;          /* tweak if needed */
  height: 36px;
  object-fit: contain;
  display: block;
}

.sidebar-title{
  font-family: 'Good Times', sans-serif;
  font-weight: 700;
  letter-spacing: 3px;
  font-size: 18px;
  text-transform: uppercase;
}

.sidebar-menu{
  flex:1;
  list-style:none;
  padding:24px 12px;
  overflow-y:auto;
}

/* Toggle button */
.sidebar-toggle{
  margin-left: auto;
  width: 36px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  color: rgba(229,231,235,0.9);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sidebar-toggle svg{ width: 18px; height: 18px; }

/* Animate widths */
.sidebar,
.main-content{
  transition: all 220ms ease;
}

/* Keep sidebar header layout consistent across pages */
.sidebar-header{
  padding-top: 0;
}

.sidebar-header .sidebar-logo{ order: 1; }
.sidebar-header .sidebar-title{
  order: 2;
  margin: 0;
  line-height: 1;
  display: flex;
  align-items: center;
}
.sidebar-header .sidebar-toggle{
  order: 3;
  margin-left: auto;
  padding: 0;
  line-height: 0;
}

/* COLLAPSED MODE */
body.sidebar-collapsed .sidebar{
  width: 84px;
  padding: 24px 10px;
}

body.sidebar-collapsed .main-content{
  margin-left: 84px;
  width: calc(100vw - 84px);
}

/* Hide title + text labels, keep icons */
body.sidebar-collapsed .sidebar-title,
body.sidebar-collapsed .menu-item span,
body.sidebar-collapsed .sidebar-footer{
  display: none;
}

/* Optional: shrink the logo area */
body.sidebar-collapsed .menu-logo{
  width: 48px;
}

/* Center icons in collapsed mode */
body.sidebar-collapsed .menu-item a{
  justify-content: center;
  padding: 12px 10px;
}

/* Remove top logo square when collapsed */
body.sidebar-collapsed .sidebar-logo{
  display: none;
}

/* Tighten header spacing after logo removal */
body.sidebar-collapsed .sidebar-header{
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px 0;
}

body.sidebar-collapsed .sidebar-toggle{
  margin-left: 0;
}

.menu-item{ margin-bottom:4px; }

.menu-item a{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 10px;
  border-radius:8px;
  color:#e5e7eb;
  text-decoration:none;
  font-size:14px;
  transition:all .2s ease;
}

.menu-item a:hover{
  background:rgba(15,23,42,0.9);
  color:#29abe2;
}

.menu-item.active a{
  background:rgba(249,115,22,0.09);
  color:#29abe2;
}

.menu-icon{ width:18px; height:18px; }

.sidebar-footer{
  padding-top:16px;
  border-top:1px solid #1f2937;
  font-size:12px;
  color:#6b7280;
}
.footer-text{ text-transform:uppercase; letter-spacing:1px; }

/* --- Logo replaces Dashboard tab --- */
.menu-logo{
  width: 140px;      /* tweak: 120–180 */
  max-width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
}
.menu-logo-item a{
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  height: auto;
}
.menu-logo-item{
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding-bottom: 10px;
  margin-bottom: 10px;
}

/* =========================
   MAIN
========================= */
.main-content{
  margin-left:260px;
  width: calc(100vw - 260px);
  min-height:100vh;
  background:#0f172a;
}
.dashboard-container{
  padding:24px;
  max-width:1600px;
  margin:0 auto;
}

/* =========================
   HEADER (LOGO OUTSIDE + CARD RIGHT)
   KEY CONTROL: --header-card-drop
========================= */
:root{
  --section-gap: 26px;            /* canonical spacing */
  --header-card-drop: calc(var(--section-gap) + 18px);
}

/* wrapper = layout only */
.dashboard-header-wrapper{
  display:grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items:start;
  width:100%;
  margin-bottom: 8px; /* tight gap to RACING section */
  background:none;
  padding:0;
  border-radius:0;
  box-shadow:none;
}

/* left logo */
.hero-logo{
  display:flex;
  align-items:flex-start;
  justify-content:flex-start;
}
.hero-logo-img{
  width: 360px;
  max-width:100%;
  height:auto;
  object-fit:contain;
  display:block;
}

/* right card */
.dashboard-header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:24px;

  padding:24px;
  background:#1e293b;
  border-radius:16px;
  border:1px solid #334155;
  box-shadow:0 20px 40px rgba(15,23,42,0.6);

  margin: 0;                 /* wipe old spacing */
  margin-top: var(--header-card-drop); /* 👈 THIS is the red-arrow move */
}

.header-left{ max-width:70%; }

.description{
  font-size:14px;
  color:#9ca3af;
  line-height:1.55;
}

.header-right{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap:10px;
}

.season-badge{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:4px;
  padding:12px 14px;
  border-radius:14px;
  border:1px solid rgba(148,163,184,0.25);
  background:rgba(2,6,23,0.25);
}

.badge-label{
  font-size:10px;
  text-transform:uppercase;
  letter-spacing:1px;
  color:#9ca3af;
}
.badge-value{
  font-size:18px;
  font-weight:800;
  color:#29abe2;
}

.data-source{ font-size:12px; color:#9ca3af; }
.source-label{ opacity:.8; margin-right:6px; }
.source-value{ color:#e5e7eb; }

/* =========================
   STATS GRID (KEEPING YOUR ORIGINAL FORMATTING)
========================= */
.stats-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:20px;
}

.stat-card{
  background:radial-gradient(circle at top left, rgba(248,250,252,0.04), #020617);
  border-radius:16px;
  padding:18px 18px 16px;
  border:1px solid #1f2937;
  box-shadow:0 10px 30px rgba(15,23,42,0.6);
  position:relative;
  overflow:hidden;

  display:flex;
  flex-direction:column;
  gap:10px;
  min-height:140px;
}

.stat-card::before{
  content:'';
  position:absolute;
  inset:0;
  background:radial-gradient(circle at top left, rgba(249,115,22,0.07), transparent 60%);
  opacity:.8;
  pointer-events:none;
}

.stat-header{
  display:flex;
  justify-content:flex-start;
  margin-bottom:0;
  align-items:center;
  position:relative;
  z-index:1;
}

.stat-header h3{
  font-size:13px;
  text-transform:uppercase;
  letter-spacing:1px;
  color:#9ca3af;
}

.stat-value-container{
  display:flex;
  align-items:baseline;
  gap:10px;
  margin-bottom:0;
  position:relative;
  z-index:1;
}

.stat-value{
  font-size:34px;
  line-height:1.05;
  font-weight:800;
  margin-bottom:0;
}

.stat-unit{
  font-size:12px;
  color:#9ca3af;
  text-transform:uppercase;
  letter-spacing:.8px;
}

.stat-footer{
  display:flex;
  align-items:baseline;
  gap:6px;
  font-size:12px;
  color:#9ca3af;
  position:relative;
  z-index:1;
  margin-top:auto;
  padding-top:6px;
}

.stat-card-art{
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 200px;
  height: 200px;
  object-fit: contain;

  opacity: 1;
  pointer-events: none;
}

.stat-subvalue{ font-weight:700; color:#e5e7eb; }
.stat-subtext{ opacity:.9; }

/* =========================
   CHART CARDS + CONTROLS
========================= */
/* Collapse button (replaces the old section accent pill) */
.section-toggle{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  color: rgba(229,231,235,0.85);
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.section-toggle:hover{
  background: rgba(41,171,226,0.10);
  border-color: rgba(41,171,226,0.35);
}

.section-toggle .chevron{
  width: 18px;
  height: 18px;
  transition: transform 220ms ease;
}

/* collapsed state */
.section-shell.is-collapsed .section-content{
  display: none;
}

/* rotate chevron when collapsed */
.section-shell.is-collapsed .section-toggle .chevron{
  transform: rotate(-90deg);
}

.chart-card{
  background:#020617;
  border-radius:16px;
  padding:18px;
  border:1px solid #1f2937;
  box-shadow:0 16px 40px rgba(15,23,42,0.7);
}

.chart-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:10px;
  gap:12px;
}

.chart-header h3{
  font-size:13px;
  text-transform:uppercase;
  letter-spacing:1px;
  color:#9ca3af;
}

.chart-controls{
  display:flex;
  align-items:center;
  gap:8px;
  font-size:11px;
  color:#9ca3af;
}

.chart-caption{
  font-size:11px;
  color:#9ca3af;
  margin-top:10px;
}

.styled-select{
  background-color:#020617;
  border:1px solid #1f2937;
  border-radius:999px;
  padding:6px 10px;
  font-size:11px;
  color:#e5e7eb;
  outline:none;
  cursor:pointer;
}

/* Charts grid (side-by-side + equal height) */
.charts-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0,1fr));
  gap:20px;
  align-items:stretch;
}

.charts-grid .chart-card{
  display:flex;
  flex-direction:column;
  height:100%;
  overflow:visible;
}

.charts-grid .chart-header{
  flex:0 0 auto;
  min-height:64px;
}

.charts-grid svg{
  flex:1 1 auto;
  width:100%;
  min-height:360px;
  height:360px;
  display:block;
}

/* In case you have a specific ID chart */
#irating-chart{
  width:100% !important;
  height:300px !important;
}

/* Tooltip */
.tooltip{
  position:absolute;
  pointer-events:none;
  background:#020617;
  color:white;
  padding:8px 10px;
  border-radius:8px;
  font-size:11px;
  border:1px solid #4b5563;
  box-shadow:0 8px 25px rgba(15,23,42,0.8);
  z-index:50;
}

/* Axes */
.axis path,
.axis line{ stroke:#4b5563; }
.axis text{ fill:#9ca3af; font-size:11px; }

/* =========================
   TOP 10 TABLES
========================= */
.top10-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:20px;
}
.top10-card{ padding:14px; }

.top10-table{
  max-height:420px;
  overflow-y:auto;
}

.top10-table table{
  width:100%;
  border-collapse:collapse;
  font-size:12px;
}

.top10-table thead th{
  text-align:left;
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.8px;
  color:#9ca3af;
  border-bottom:1px solid #1f2937;
  padding:10px 8px;
}

.top10-table tbody td{
  padding:10px 8px;
  border-bottom:1px solid rgba(31,41,55,0.6);
  color:#e5e7eb;
  vertical-align:middle;
}

.top10-table tbody tr:hover{
  background:rgba(41,171,226,0.06);
}

.top10-rank{ color:#9ca3af; width:44px; }
.top10-name{ font-weight:700; }

/* =========================
   SPLIT ROW + 2x2
========================= */
.split-row{
  display:grid;
  grid-template-columns:1.2fr 1fr;
  gap:24px;
  align-items:stretch;
}
.split-row.reverse{ grid-template-columns:1fr 1.2fr; }
.split-row > *{ background-clip:padding-box; }

.card-grid-2x2{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:20px;
}

/* =========================
   SECTION SHELLS
========================= */
.section-shell{
  width:100%;
  margin-top:26px;
  padding:18px 18px 20px;
  border-radius:18px;
  border:1px solid rgba(255,255,255,0.08);
  background:rgba(255,255,255,0.02);
  box-shadow:0 12px 40px rgba(0,0,0,0.35);
  position:relative;
  overflow:hidden;
}

.section-shell::before{
  content:"";
  position:absolute;
  inset:-2px;
  background:radial-gradient(900px 220px at 20% 0%, rgba(41,171,226,0.18), transparent 60%);
  opacity:.9;
  pointer-events:none;
}

.section-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:14px;
  position:relative;
  z-index:1;
}

.section-title{
  font-size:22px;
  letter-spacing:.5px;
  margin:0;
  color:#ffffff;
}

.section-accent{
  height:8px;
  width:140px;
  border-radius:99px;
  background:rgba(255,255,255,0.08);
  border:1px solid rgba(255,255,255,0.10);
}

.section-shell > *{ position:relative; z-index:1; }
.section-shell .stats-grid,
.section-shell .split-row,
.section-shell .charts-grid{ margin-top:6px; }

/* Theme variants */
.section-racing::before{
  background:radial-gradient(900px 220px at 20% 0%, rgba(41,171,226,0.22), transparent 60%);
}
.section-results::before{
  background:radial-gradient(900px 220px at 20% 0%, rgba(248,113,113,0.18), transparent 60%);
}
.section-team::before{
  background:radial-gradient(900px 220px at 20% 0%, rgba(34,197,94,0.14), transparent 60%);
}

/* Rankings theme (optional, but nice) */
.section-rankings::before{
  background: radial-gradient(900px 220px at 20% 0%, rgba(41,171,226,.14), transparent 60%);
}
.section-rankings .section-accent{
  background: rgba(41,171,226,.12);
  border-color: rgba(41,171,226,.22);
}

/* =========================
   MAP
========================= */
#wins-map{
  border-radius:16px;
  overflow:hidden;
}
.leaflet-container{
  background:#020617;
}

/* =========================
   LOADING
========================= */
.loading{
  position:fixed;
  inset:0;
  background:rgba(15,23,42,0.9);
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-items:center;
  z-index:200;
}
.loading.hidden{ display:none; }

.loading-spinner{
  width:32px;
  height:32px;
  border:3px solid rgba(148,163,184,0.4);
  border-top-color:#29abe2;
  border-radius:50%;
  animation:spin 1s linear infinite;
  margin-bottom:12px;
}

.loading-text{
  font-size:13px;
  color:#e5e7eb;
  letter-spacing:.8px;
  text-transform:uppercase;
}
@keyframes spin{ to{ transform:rotate(360deg); } }

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 1100px){
  .split-row{ grid-template-columns:1fr; }
  .split-row.reverse{ grid-template-columns:1fr; }
}

@media (max-width: 1024px){
  .stats-grid{ grid-template-columns:repeat(2, minmax(0,1fr)); }
  .top10-grid{ grid-template-columns:1fr; }
  .charts-grid{ grid-template-columns:1fr; }
}

@media (max-width: 900px){
  .dashboard-header-wrapper{
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .hero-logo-img{
    width: 260px;
  }
  .dashboard-header{
    margin-top: 0; /* remove drop on mobile */
  }
}

@media (max-width: 768px){
  .main-content{ margin-left:0; width:100vw; }
  .dashboard-container{ padding:16px; }
  .sidebar{ position:relative; width:100%; height:auto; border-right:none; border-bottom:1px solid #334155; }
}


/* =========================================================
   HOME ONLY: Sections + feature cards (scoped to page-home)
   Restores the layout/styling below the hero without touching dashboard pages.
   ========================================================= */
body.page-home .section{
  padding: 4rem 0;
}
body.page-home .section-dark,
body.page-home .section-alt{
  background: #020617;
}

/* Bring back comfortable typography spacing (Bootstrap-like) */
body.page-home h1, 
body.page-home h2, 
body.page-home h3, 
body.page-home h4, 
body.page-home h5{
  margin: 0 0 0.75rem;
}
body.page-home p{
  margin: 0 0 1rem;
}
body.page-home .text-muted{
  color: #9ca3af !important;
}

/* Feature cards (Stats section) */
body.page-home .feature-card{
  background: #020617;
  border-radius: 1rem;
  border: 1px solid #1f2937;
  padding: 1.5rem;
  height: 100%;
}
body.page-home .feature-icon{
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: rgba(41,171,226,0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  color: #29abe2;
}

/* Scroll cue above overlay */
body.page-home .scroll-indicator{ z-index: 3; }

/* Mobile fallback (no autoplay video on some devices) */
@media (max-width: 767.98px){
  body.page-home .hero-video{ display:none; }
  body.page-home .hero-section{
    background-image: url("https://images.pexels.com/photos/1149137/pexels-photo-1149137.jpeg");
    background-size: cover;
    background-position: center;
  }
  body.page-home .hero-overlay{
    background: linear-gradient(
      to bottom,
      rgba(15, 23, 42, 0.85),
      rgba(15, 23, 42, 0.98)
    );
  }
}
/* =========================================================
   HOME PAGE: Dynamic layout with/without sidebar (auto-detect)
   Requires modern Chrome/Safari/Edge (:has support)
   ========================================================= */

body.page-home {
  --home-sidebar-w: 0px;            /* default: no sidebar */
}

/* If a sidebar exists on the page, reserve its width */
body.page-home:has(.sidebar) {
  --home-sidebar-w: 260px;
}

/* If sidebar is collapsed, reserve collapsed width */
body.page-home.sidebar-collapsed:has(.sidebar) {
  --home-sidebar-w: 84px;
}

/* Home main content fills the remaining space (no extra margins/padding) */
body.page-home .main-content {
  margin-left: var(--home-sidebar-w) !important;
  width: calc(100vw - var(--home-sidebar-w)) !important;
  padding: 0 !important;
}

/* Full-bleed container */
body.page-home .dashboard-container {
  margin: 0 !important;
  padding: 0 !important;
  max-width: none !important;
}

/* Safety: prevent horizontal scrollbars due to 100vw math */
body.page-home {
  overflow-x: hidden;
}

