/* ===================================================
   Race Countdown — Custom CSS
   Base styles on top of Tailwind CSS v3
   =================================================== */

/* --- Fonts --- */
* { box-sizing: border-box; }

body { font-family: 'Inter', sans-serif; }
.font-rajdhani, h1, h2, h3 { font-family: 'Rajdhani', sans-serif; }

/* --- Carbon fiber hero background --- */
.carbon-hero {
  position: relative;
  background-color: #09090B;
  background-image:
    radial-gradient(#1a1a1e 1px, transparent 1px),
    radial-gradient(#1a1a1e 1px, transparent 1px);
  background-size: 20px 20px;
  background-position: 0 0, 10px 10px;
}
.carbon-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(225,6,0,0.06) 0%, transparent 60%);
  pointer-events: none;
}
html:not(.dark) .carbon-hero {
  background-color: #0f0f12;
}

/* --- Glassmorphism card --- */
.glass-card {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(228, 228, 231, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.dark .glass-card {
  background: rgba(28, 28, 31, 0.75);
  border: 1px solid rgba(39, 39, 42, 0.8);
}

/* --- Racing stripe decorative line --- */
.racing-stripe {
  background: linear-gradient(90deg, #E10600 0%, #ff4444 50%, #E10600 100%);
  height: 3px;
}

/* --- Checkered pattern --- */
.checkered-pattern {
  background-image:
    linear-gradient(45deg, #000 25%, transparent 25%),
    linear-gradient(-45deg, #000 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #000 75%),
    linear-gradient(-45deg, transparent 75%, #000 75%);
  background-size: 8px 8px;
  background-position: 0 0, 0 4px, 4px -4px, -4px 0px;
}
.dark .checkered-pattern {
  background-image:
    linear-gradient(45deg, #fff 25%, transparent 25%),
    linear-gradient(-45deg, #fff 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #fff 75%),
    linear-gradient(-45deg, transparent 75%, #fff 75%);
}

/* --- Countdown digits --- */
.countdown-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}
.countdown-digit-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 90px;
}
.countdown-digit {
  font-family: 'Rajdhani', sans-serif;
  font-size: 4.5rem;
  font-weight: 700;
  line-height: 1;
  color: #E10600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  text-shadow: 0 0 30px rgba(225, 6, 0, 0.3);
  transition: transform 0.08s ease;
}
.countdown-digit.tick {
  transform: scale(1.05);
}
.countdown-label {
  font-family: 'Inter', sans-serif;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #71717A;
  margin-top: 4px;
}
.countdown-sep {
  font-family: 'Rajdhani', sans-serif;
  font-size: 4rem;
  font-weight: 700;
  color: rgba(225, 6, 0, 0.4);
  line-height: 1;
  padding: 0 4px;
  margin-bottom: 18px;
  animation: blink 1s step-end infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

/* Smaller countdown variant (for cards) */
.countdown-sm .countdown-digit {
  font-size: 2.25rem;
}
.countdown-sm .countdown-digit-block {
  min-width: 52px;
}
.countdown-sm .countdown-sep {
  font-size: 2rem;
  margin-bottom: 12px;
}
.countdown-sm .countdown-label {
  font-size: 0.55rem;
}

/* --- Session badges --- */
.badge-session {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge-race            { background: rgba(225, 6, 0, 0.15);   color: #E10600;  border: 1px solid rgba(225,6,0,0.3); }
.badge-qualifying      { background: rgba(245,158,11, 0.15);  color: #F59E0B;  border: 1px solid rgba(245,158,11,0.3); }
.badge-sprint-qualifying { background: rgba(99,102,241,0.15); color: #818CF8;  border: 1px solid rgba(99,102,241,0.3); }
.badge-sprint          { background: rgba(6, 182, 212, 0.15); color: #06B6D4;  border: 1px solid rgba(6,182,212,0.3); }
.badge-practice        { background: rgba(34, 197, 94, 0.15); color: #22C55E;  border: 1px solid rgba(34,197,94,0.3); }
.badge-other           { background: rgba(113,113,122, 0.15); color: #A1A1AA;  border: 1px solid rgba(113,113,122,0.3); }

/* Light mode badge adjustments */
html:not(.dark) .badge-race            { background: rgba(225, 6, 0, 0.08); }
html:not(.dark) .badge-qualifying      { background: rgba(245,158,11, 0.08); }
html:not(.dark) .badge-sprint          { background: rgba(6, 182, 212, 0.08); }
html:not(.dark) .badge-practice        { background: rgba(34, 197, 94, 0.08); }

/* --- Racing red left-border nav active indicator --- */
.nav-active-border {
  border-left: 3px solid #E10600;
}

/* --- Custom Leaflet map marker --- */
.rc-map-marker {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rc-map-pin {
  width: 32px;
  height: 32px;
  background: #E10600;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}
.rc-map-pin i {
  transform: rotate(45deg);
  color: #fff;
  font-size: 12px;
}

/* Leaflet overrides */
.leaflet-container {
  font-family: 'Inter', sans-serif;
  background: #09090B;
}
.leaflet-popup-content-wrapper {
  background: #1C1C1F;
  border: 1px solid #27272A;
  color: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.leaflet-popup-tip { background: #1C1C1F; }
.leaflet-popup-content { margin: 10px 14px; font-size: 13px; }

/* --- Hover card effects --- */
.event-card {
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}
.event-card:hover {
  border-color: #E10600 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(225, 6, 0, 0.15);
}

/* --- Racing button --- */
.btn-racing {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.4rem;
  background: #E10600;
  color: #fff;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  text-decoration: none;
}
.btn-racing:hover {
  background: #c50500;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(225, 6, 0, 0.35);
}
.btn-racing:active { transform: translateY(0); }

/* Ghost button */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.2rem;
  background: transparent;
  color: #E10600;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 8px;
  border: 1px solid #E10600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  text-decoration: none;
}
.btn-ghost:hover {
  background: #E10600;
  color: #fff;
}

/* --- Breadcrumbs --- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: #71717A;
  flex-wrap: wrap;
}
.breadcrumb a {
  color: #71717A;
  text-decoration: none;
  transition: color 0.15s;
}
.breadcrumb a:hover { color: #E10600; }
.breadcrumb-sep { color: #3F3F46; font-size: 0.65rem; }
.breadcrumb-current { color: #A1A1AA; font-weight: 500; }

/* --- Section headings with racing accent --- */
.section-heading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.section-heading h2 {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.section-heading::before {
  content: '';
  display: block;
  width: 4px;
  height: 1.5em;
  background: #E10600;
  border-radius: 2px;
}

/* --- Country flag sizing helpers --- */
.fi { border-radius: 2px; }
.fi-lg { font-size: 1.5rem; }
.fi-xl { font-size: 2rem; }
.fi-2xl { font-size: 2.5rem; }

/* --- Session row hover --- */
.session-row {
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.session-row:hover {
  background: rgba(225, 6, 0, 0.04);
}
.session-row.active {
  border-left: 3px solid #E10600;
  background: rgba(225, 6, 0, 0.06);
}

/* --- Live indicator pulse --- */
.live-dot {
  width: 8px;
  height: 8px;
  background: #22C55E;
  border-radius: 50%;
  display: inline-block;
  animation: pulse-live 1.5s ease-in-out infinite;
}
@keyframes pulse-live {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.4); }
}

/* --- Progress bar for schedule --- */
.schedule-progress {
  height: 2px;
  background: rgba(225, 6, 0, 0.2);
  border-radius: 1px;
  overflow: hidden;
}
.schedule-progress-fill {
  height: 100%;
  background: #E10600;
  border-radius: 1px;
  transition: width 0.5s ease;
}

/* --- Scrollbar styling --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #27272A; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #E10600; }

/* --- Series grid card --- */
.series-card {
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  cursor: pointer;
}
.series-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
.dark .series-card:hover {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

/* --- Finished / past event styling --- */
.event-past {
  opacity: 0.5;
}
.event-past:hover {
  opacity: 0.75;
}

/* --- Responsive countdown for hero --- */
@media (max-width: 480px) {
  .countdown-digit { font-size: 3rem; }
  .countdown-digit-block { min-width: 68px; }
  .countdown-sep { font-size: 2.5rem; }
}

/* --- Weather card icon (basmilius SVG, served locally) --- */
.weather-icon {
  width: 72px;
  height: 72px;
  display: block;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.18));
}

/* --- Smooth page transitions --- */
main {
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
