/* ============================================================
   EUROPE HEATWAVE TRACKER — style.css
   Design system: dark heat palette, merged from McDonalds
   sidebar system + earthquakes_venusavela map shell.
   ============================================================ */

/* ─────────────────────────────────────────────────────────────
   CSS Custom Properties — Heat Design Tokens
   ───────────────────────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-primary:   #f3f4f6; /* crisp porcelain / off-white */
  --bg-secondary: #ffffff; /* pure white sidebar */
  --bg-tertiary:  #e5e7eb; /* clean neutral gray */
  --bg-card:      #ffffff; /* pure white cards */

  /* Longevity age-bracket palette */
  --heat-cool:   #ef4444; /* < 60 years - Red */
  --heat-amber:  #f97316; /* 60–70 years - Orange */
  --heat-orange: #ea580c; 
  --heat-red:    #eab308; /* 70–80 years - Yellow */
  --heat-violet: #10b981; /* >= 80 years - Emerald Green */
  --heat-pink:   #34d399; /* soft green */

  /* Text */
  --text-main:  #111827; /* deep charcoal gray */
  --text-muted: #4b5563; /* muted gray */
  --text-dim:   #9ca3af; /* very muted gray */

  /* Borders / Glass */
  --border-color:  rgba(0, 0, 0, 0.08); /* subtle dark border */
  --border-focus:  rgba(230, 92, 0, 0.5); /* premium brand orange focus */
  --glass-bg:      rgba(255, 255, 255, 0.85); /* white glassmorphism */
  --glass-border:  rgba(0, 0, 0, 0.06);

  /* Typography */
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.05);
  --shadow-glow-violet: 0 0 25px rgba(16, 185, 129, 0.3);
  --shadow-glow-red:    0 0 25px rgba(239, 68, 68, 0.3);
  --shadow-glow-amber:  0 0 25px rgba(249, 73, 22, 0.3);

  /* Transitions */
  --t-fast:   0.15s ease;
  --t-normal: 0.3s cubic-bezier(0.4,0,0.2,1);
  --t-slow:   0.8s cubic-bezier(0.4,0,0.2,1);
}

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

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

.font-mono { font-family: var(--font-mono); }

/* ─────────────────────────────────────────────────────────────
   App Layout — Grid: Sidebar (360px) + Map (1fr)
   Mirrors McDonalds app-container pattern
   ───────────────────────────────────────────────────────────── */
.app-container {
  position: relative;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ─────────────────────────────────────────────────────────────
   Loading Overlay
   ───────────────────────────────────────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.loading-inner {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.loading-fire {
  font-size: 3rem;
  animation: loadPulse 1.2s ease-in-out infinite;
}

@keyframes loadPulse {
  0%, 100% { transform: scale(1);   opacity: 1;   }
  50%       { transform: scale(1.2); opacity: 0.7; }
}

.loading-title {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 3px;
  background: linear-gradient(90deg, var(--heat-amber), var(--heat-red), var(--heat-violet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.loading-bar {
  width: 220px;
  height: 3px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
}

.loading-bar-fill {
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, var(--heat-amber), var(--heat-violet));
  border-radius: 2px;
  animation: loadBar 1.4s ease-in-out infinite;
}

@keyframes loadBar {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(350%);  }
}

/* ─────────────────────────────────────────────────────────────
   Sidebar — absolute floating layout
   ───────────────────────────────────────────────────────────── */
.sidebar {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 360px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  overflow: visible;
  z-index: 10;
  box-shadow: 2px 0 16px rgba(0,0,0,0.04);
  transition: transform var(--t-normal);
}

.sidebar.collapsed {
  transform: translateX(-100%);
}

.sidebar-scroll {
  width: 100%;
  height: 100%;
  padding: 22px 20px 80px 20px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-tertiary) transparent;
}

.sidebar-scroll::-webkit-scrollbar { width: 5px; }
.sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
.sidebar-scroll::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 3px;
}
.sidebar-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--heat-violet);
}

/* Sidebar toggle button - nested absolutely inside sidebar */
.sidebar-toggle-btn {
  position: absolute;
  top: 50%;
  right: -28px;
  transform: translateY(-50%);
  width: 28px;
  height: 56px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-left: none;
  border-radius: 0 8px 8px 0;
  color: var(--text-muted);
  cursor: pointer;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast);
  padding: 0;
}

.sidebar-toggle-btn:hover {
  color: var(--heat-violet);
  border-color: var(--heat-violet);
  background: var(--bg-tertiary);
}

/* ─────────────────────────────────────────────────────────────
   App Header
   ───────────────────────────────────────────────────────────── */
.app-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.heat-logo {
  font-size: 2rem;
  line-height: 1;
  animation: flamePulse 2s ease-in-out infinite;
}

@keyframes flamePulse {
  0%, 100% { transform: scale(1) rotate(-3deg); }
  50%       { transform: scale(1.15) rotate(3deg); }
}

.logo-area h1 {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-main);
}

.logo-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 1px;
}

.subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.event-badges {
  display: flex;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  padding: 3px 10px;
  border-radius: 20px;
}


.badge-proj {
  background: rgba(147,51,234,0.15);
  color: #C084FC;
  border: 1px solid rgba(192,132,252,0.3);
}

/* ─────────────────────────────────────────────────────────────
   Section labels
   ───────────────────────────────────────────────────────────── */
.section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

.control-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ─────────────────────────────────────────────────────────────
   Playback Buttons — from McDonalds btn pattern
   ───────────────────────────────────────────────────────────── */
button {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 9px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: all var(--t-fast);
}

.playback-actions {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 10px;
}

.playback-actions button {
  height: 38px;
  box-sizing: border-box;
}

.playback-actions button svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn-primary {
  background: linear-gradient(135deg, #e65c00, #ff6600);
  color: #fff;
  box-shadow: 0 2px 12px rgba(230, 92, 0, 0.2);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 18px rgba(230, 92, 0, 0.35);
  filter: brightness(1.1);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary.playing {
  background: linear-gradient(135deg, #ff6600, #ffaa00);
}

.btn-secondary {
  background: var(--bg-tertiary);
  border-color: var(--border-color);
  color: var(--text-main);
}
.btn-secondary:hover {
  background: var(--bg-primary);
  border-color: var(--text-muted);
}

/* ─────────────────────────────────────────────────────────────
   Sliders — from McDonalds custom-slider pattern
   ───────────────────────────────────────────────────────────── */
.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.custom-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 3px;
  background: var(--bg-tertiary);
  outline: none;
}
.custom-slider:focus,
.custom-slider:focus-visible,
.custom-slider:active {
  outline: none !important;
  box-shadow: none !important;
}

.custom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ff6600;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(255,102,0,0.4);
  transition: transform var(--t-fast);
}
.custom-slider::-webkit-slider-thumb:hover { transform: scale(1.3); }
.custom-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: none;
  border-radius: 50%;
  background: #ff6600;
  cursor: pointer;
}

/* ─────────────────────────────────────────────────────────────
   Checkbox
   ───────────────────────────────────────────────────────────── */
.checkbox-group { padding-top: 2px; }

.checkbox-container {
  display: flex;
  align-items: center;
  position: relative;
  padding-left: 26px;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text-muted);
  user-select: none;
  transition: color var(--t-fast);
}
.checkbox-container:hover { color: var(--text-main); }
.checkbox-container input { position: absolute; opacity: 0; width: 0; height: 0; }

.checkmark {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  transition: all var(--t-fast);
}
.checkbox-container input:checked ~ .checkmark {
  background: #ff6600;
  border-color: #ff6600;
}
.checkmark::after {
  content: '';
  display: none;
  position: absolute;
  left: 5px; top: 2px;
  width: 4px; height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.checkbox-container input:checked ~ .checkmark::after { display: block; }

/* ─────────────────────────────────────────────────────────────
   Stats Grid — from McDonalds stat-card pattern
   ───────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stat-card {
  background: #f9fafb;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.stat-card:hover {
  border-color: var(--border-focus);
  background: #f3f4f6;
}

.stat-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
}

.stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
}

.stat-peak .stat-value { color: var(--heat-amber); }
.stat-hot  .stat-value { color: var(--heat-cool); }
.stat-record .stat-value { color: var(--heat-violet); }

/* ─────────────────────────────────────────────────────────────
   Station Detail Panel
   ───────────────────────────────────────────────────────────── */
.station-section {
  gap: 10px;
}

.station-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color var(--t-normal);
}
.station-card:hover { border-color: var(--border-focus); }

.station-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.station-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.station-flag {
  font-size: 1.1rem;
  margin-left: 6px;
}

.record-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}
.record-badge.broken {
  background: rgba(220,38,38,0.08);
  color: #B91C1C;
  border: 1px solid rgba(220,38,38,0.25);
  animation: badgePulse 1.5s ease-in-out infinite;
}
.record-badge.near {
  background: rgba(245,158,11,0.08);
  color: #B45309;
  border: 1px solid rgba(245,158,11,0.25);
}

@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,0.3); }
  50%       { box-shadow: 0 0 0 5px rgba(220,38,38,0); }
}

.station-temps {
  display: flex;
  align-items: center;
  gap: 0;
}

.temp-block {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.temp-label {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
}

.temp-value {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
}

.temp-max .temp-value { color: var(--heat-red); }
.temp-min .temp-value { color: var(--heat-cool); }
.temp-rec .temp-value { color: var(--text-muted); }

.temp-divider {
  width: 1px;
  height: 32px;
  background: var(--border-color);
  flex-shrink: 0;
}

.projected-note {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  color: #C084FC;
  background: rgba(147,51,234,0.1);
  border: 1px solid rgba(147,51,234,0.2);
  border-radius: 6px;
  padding: 5px 8px;
}

/* Sparkline chart */
.sparkline-wrapper {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#sparklineCanvas {
  width: 100%;
  height: 52px;
  border-radius: 6px;
  background: #f3f4f6;
}

.sparkline-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.6rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.station-hint {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-align: center;
  font-style: italic;
}

/* ─────────────────────────────────────────────────────────────
   Layer Toggles — from earthquakes toggle-control pattern
   ───────────────────────────────────────────────────────────── */
.toggle-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toggle-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 7px 6px;
  border-radius: 8px;
  transition: background var(--t-fast);
}
.toggle-control:hover { background: rgba(255,255,255,0.03); }

.toggle-label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
}

.toggle-icon { width: 14px; height: 14px; color: var(--text-dim); }

.toggle-control input { display: none; }

.toggle-switch {
  position: relative;
  width: 36px;
  height: 20px;
  background: var(--bg-tertiary);
  border-radius: 20px;
  flex-shrink: 0;
  transition: background var(--t-fast);
}
.toggle-switch::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  transition: transform var(--t-fast);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.toggle-control input:checked + .toggle-switch { background: #ff6600; }
.toggle-control input:checked + .toggle-switch::after { transform: translateX(16px); }

.toggle-control:hover .toggle-switch {
  box-shadow: 0 0 8px rgba(255, 102, 0, 0.3);
}

.toggle-control input:focus-visible + .toggle-switch {
  outline: 2px solid #ff6600;
  outline-offset: 2px;
}

/* ─────────────────────────────────────────────────────────────
   Footer
   ───────────────────────────────────────────────────────────── */
.app-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.68rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
}

.footer-version {
  display: flex;
  gap: 6px;
  color: var(--text-dim);
}

/* ─────────────────────────────────────────────────────────────
   Map Viewport
   ───────────────────────────────────────────────────────────── */
.map-viewport {
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
  background: var(--bg-primary);
}

.canvas-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  outline: none;
}

#mapCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#heatCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

/* ─────────────────────────────────────────────────────────────
   Date Clock Overlay — from McDonalds clock-overlay pattern
   ───────────────────────────────────────────────────────────── */
.clock-overlay {
  position: absolute;
  top: 22px;
  right: 22px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 10px 22px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-md);
  text-align: center;
  z-index: 5;
  pointer-events: none;
}

.clock-label {
  font-size: 0.62rem;
  letter-spacing: 2.5px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.clock-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--heat-amber);
  text-shadow: 0 0 14px rgba(245,158,11,0.5);
  white-space: nowrap;
}

/* ─────────────────────────────────────────────────────────────
   Map Nav Controls
   ───────────────────────────────────────────────────────────── */
.map-nav-controls {
  position: absolute;
  top: 22px;
  left: 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 5;
}

.map-nav-controls button {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  font-size: 1.05rem;
  font-weight: 600;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: var(--shadow-sm);
}
.map-nav-controls button:hover {
  border-color: var(--heat-violet);
  color: var(--heat-violet);
  transform: scale(1.08);
}

/* ─────────────────────────────────────────────────────────────
   Map Legend
   ───────────────────────────────────────────────────────────── */
.map-legend {
  position: absolute;
  top: auto;
  bottom: 20px;
  left: 380px;
  right: auto;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 12px 14px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-md);
  z-index: 20;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
  cursor: grab;
  user-select: none;
}
.map-legend:active {
  cursor: grabbing;
}

.drag-handle-icon {
  position: absolute;
  top: 12px;
  right: 12px;
  color: rgba(255, 255, 255, 0.4);
  cursor: grab;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.map-legend:active .drag-handle-icon {
  cursor: grabbing;
}

.legend-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border-color);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.73rem;
  color: var(--text-muted);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-pulse {
  animation: legendPulse 1.8s ease-in-out infinite;
}

@keyframes legendPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(147,51,234,0.6); }
  50%       { box-shadow: 0 0 0 5px rgba(147,51,234,0); }
}

.legend-divider {
  height: 1px;
  background: var(--border-color);
}

.legend-pin-demo {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--heat-red);
  flex-shrink: 0;
}
.legend-pin-demo.record {
  border-color: var(--heat-violet);
  background: rgba(147,51,234,0.3);
  animation: legendPulse 1.2s ease-in-out infinite;
}

/* ─────────────────────────────────────────────────────────────
   Map Instructions
   ───────────────────────────────────────────────────────────── */
.map-instructions {
  position: absolute;
  bottom: 88px;
  right: 22px;
  font-size: 0.68rem;
  color: var(--text-dim);
  pointer-events: none;
  z-index: 5;
  background: rgba(9,13,24,0.5);
  padding: 4px 10px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
}

/* ─────────────────────────────────────────────────────────────
   Record Alert Toast — Matched to sleek matte card layout
   ───────────────────────────────────────────────────────────── */
.record-alert {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card); /* #0F121C matte card background */
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main); /* Wait, the user previously wanted orange, let's keep it var(--heat-amber) if they requested it earlier, wait! My previous replacement set it to var(--heat-amber). Oh, line 964 in TargetContent has color: var(--heat-amber)! Yes, I will keep color: var(--heat-amber). */
  color: var(--heat-amber);
  z-index: 25;
  box-shadow: var(--shadow-md);
  animation: alertBounce 0.4s cubic-bezier(0.34,1.56,0.64,1);
  letter-spacing: 0.5px;
  cursor: grab;
  user-select: none;
}
.record-alert:active {
  cursor: grabbing;
}

@keyframes alertBounce {
  from { transform: translateX(-50%) translateY(-20px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0);     opacity: 1; }
}

.record-alert-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--heat-red);
}

/* ─────────────────────────────────────────────────────────────
   Timeline Slider Bar — from McDonalds timeline-bar pattern
   ───────────────────────────────────────────────────────────── */
.timeline-bar {
  height: 70px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 0 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 10;
  flex-shrink: 0;
}

.timeline-label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.timeline-slider-wrapper {
  flex: 1;
  position: relative;
  height: 24px;
  display: flex;
  align-items: center;
}

.custom-slider.main-timeline {
  height: 7px;
  background: var(--bg-tertiary);
  z-index: 2;
  position: relative;
}

/* Gradient progress fill */
.timeline-progress {
  position: absolute;
  left: 0;
  height: 7px;
  background: linear-gradient(to right,
    var(--heat-cool) 0%,
    var(--heat-amber) 35%,
    var(--heat-red) 65%,
    var(--heat-violet) 100%);
  border-radius: 4px;
  pointer-events: none;
  z-index: 1;
  transition: width 0.1s linear;
}

.custom-slider.main-timeline::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
  background: #fff;
  border: 3px solid #ff9900;
  box-shadow: 0 0 12px rgba(255,110,0,0.6);
}
.custom-slider.main-timeline::-webkit-slider-thumb:hover {
  transform: scale(1.3);
}
.custom-slider.main-timeline::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: #fff;
  border: 3px solid #ff9900;
}

/* ─────────────────────────────────────────────────────────────
   Heat Pin Markers — Seismic-style from earthquakes project
   ───────────────────────────────────────────────────────────── */
.heat-pin {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 10;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  mix-blend-mode: screen;
}

.pin-core {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--heat-cool);
  border: 2px solid transparent;
  z-index: 3;
  opacity: 0.85;
  transition: width var(--t-normal), height var(--t-normal), background var(--t-normal);
}

.pin-ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  pointer-events: none;
  opacity: 0;
}

.pin-label {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.9);
  white-space: nowrap;
  pointer-events: none;
}

/* Temperature state classes */
.heat-pin.temp-cool  .pin-core { background: var(--heat-cool);   box-shadow: 0 0 15px rgba(239,68,68,0.8); }
.heat-pin.temp-warm  .pin-core { background: var(--heat-amber);  box-shadow: 0 0 30px rgba(255,110,0,0.8); }
.heat-pin.temp-hot   .pin-core { background: var(--heat-red);    box-shadow: 0 0 35px rgba(229,231,35,0.8); width:14px; height:14px; }
.heat-pin.temp-extreme .pin-core {
  background: var(--heat-violet);
  box-shadow: 0 0 45px rgba(16,185,129,0.8);
  width: 16px;
  height: 16px;
}

/* Pulsating rings for hot/extreme */
.heat-pin.temp-hot .ring-1,
.heat-pin.temp-extreme .ring-1 {
  width: 26px; height: 26px;
  color: var(--heat-red);
  opacity: 0.7;
  animation: pingRing1 1.8s ease-out infinite;
}

.heat-pin.temp-extreme .ring-1 {
  color: var(--heat-violet);
  animation: pingRing1 1.4s ease-out infinite;
}

.heat-pin.temp-extreme .ring-2 {
  width: 36px; height: 36px;
  color: var(--heat-pink);
  opacity: 0.5;
  animation: pingRing2 1.4s ease-out infinite 0.5s;
}

@keyframes pingRing1 {
  0%   { width: 16px; height: 16px; opacity: 0.55; }
  100% { width: 50px; height: 50px; opacity: 0;   }
}

@keyframes pingRing2 {
  0%   { width: 22px; height: 22px; opacity: 0.45; }
  100% { width: 68px; height: 68px; opacity: 0;   }
}

/* Record-broken extra styling */
.heat-pin.record-broken .pin-core {
  border-color: #fff;
  border-width: 2.5px;
  animation: recordCore 0.8s ease-in-out infinite alternate;
}

@keyframes recordCore {
  from { box-shadow: 0 0 12px rgba(147,51,234,0.8); }
  to   { box-shadow: 0 0 24px rgba(220,38,38,1.0); }
}

/* Selected pin */
.heat-pin.selected .pin-core {
  border-color: var(--heat-amber);
  border-width: 3px;
  box-shadow: 0 0 14px rgba(245,158,11,0.8);
}

/* MapLibre popup override */
.maplibregl-popup-content {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 10px !important;
  color: var(--text-main) !important;
  font-family: var(--font-sans) !important;
  padding: 12px 14px !important;
  box-shadow: var(--shadow-md) !important;
}
.maplibregl-popup-tip { display: none !important; }

/* ─────────────────────────────────────────────────────────────
   Utility
   ───────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

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

/* Accessibility — focus rings */
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--heat-violet);
  outline-offset: 2px;
}

/* ─────────────────────────────────────────────────────────────
   Welcome Onboarding Overlay Modal
   ───────────────────────────────────────────────────────────── */
.welcome-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--t-normal), visibility var(--t-normal);
  opacity: 1;
  visibility: visible;
}

.welcome-overlay.fade-out {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.modal-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 30px;
  max-width: 500px;
  width: 90%;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: fadeIn 0.4s ease;
}

#overlay-close-x {
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 24px;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: color 0.2s;
  line-height: 1;
}

#overlay-close-x:hover {
  color: #ff9900;
}

.modal-card h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
  margin-bottom: 4px;
}

.modal-card ul {
  list-style-type: disc;
  color: var(--text-main);
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-card li {
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-muted);
}
.modal-card li::marker {
  color: var(--text-muted);
}

.modal-card strong {
  color: var(--text-main);
  display: block;
  font-size: 0.92rem;
  margin-bottom: 2px;
}

#close-overlay-btn {
  background: linear-gradient(135deg, #e65c00, #ff6600);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--t-fast);
  text-align: center;
  box-shadow: 0 4px 12px rgba(230, 92, 0, 0.2);
  margin-top: 8px;
}

#close-overlay-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(230, 92, 0, 0.35);
  filter: brightness(1.1);
}

.sidebar-footer {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.3);
  padding: 10px 0;
  text-align: center;
}

#info-toggle-btn {
  position: absolute;
  top: 0;
  right: 0;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  font-size: 1.2rem;
  cursor: pointer;
  transition: color 0.2s;
}

#info-toggle-btn:hover {
  color: #ff9900;
}

/* ─────────────────────────────────────────────────────────────
   Demographic Toggles & Toplist Card Styling
   ───────────────────────────────────────────────────────────── */
.demographic-toggles {
  position: absolute;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 30px;
  padding: 4px;
  box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.08);
}

.demographic-btn {
  background: transparent;
  border: none;
  color: rgba(0, 0, 0, 0.55);
  padding: 8px 16px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.demographic-btn:hover {
  color: #000;
}

.demographic-btn.active {
  background: rgba(0, 0, 0, 0.06);
  color: #000;
  box-shadow: inset 0 1px 0 0 rgba(0, 0, 0, 0.04);
}

.toplist-card {
  position: absolute;
  top: 20px;
  bottom: auto;
  left: 380px;
  right: auto;
  width: 220px;
  z-index: 9;
  max-height: 450px;
  overflow-y: auto;
}

.toplist-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 8px;
}

.toplist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  font-size: 12px;
}

.toplist-item:last-child {
  border-bottom: none;
}

.toplist-rank {
  font-weight: 700;
  color: #ff6600;
  margin-right: 8px;
  font-family: var(--font-mono);
}

.toplist-country {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-main);
  flex-grow: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toplist-val {
  font-family: var(--font-mono);
  font-weight: 600;
  color: #10B981; /* emerald green */
}

