/* ── Reset & tokens ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
 
:root {
  --bg:         #0a0d12;
  --surface:    #111520;
  --border:     #1e2535;
  --text:       #c8d0e0;
  --text-muted: #4a5568;
  --accent:     #3b7dd8;
 
  /* Advisory tier colours */
  --avoid-all:      #e53e3e;
  --avoid-ess:      #dd6b20;
  --some-parts:     #d69e2e;
  --no-warning:     #2d8a5e;
  --neutral:        #0f1720;
  --neutral-hover:  #253348;
}
 
html, body { height: 100%; background: var(--bg); color: var(--text); font-family: 'Syne', sans-serif; overflow: hidden; }
 
/* ── Layout ───────────────────────────────────────────────────────── */
#app { display: flex; flex-direction: column; height: 100vh; }
 
/* ── Map area ─────────────────────────────────────────────────────── */
.leaflet-container { background: #1a2333 !important; }
 
/* ── Header ───────────────────────────────────────────────────────── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 1000;
}
 
.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
 
.header-flag {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.header-flag span {
  display: block;
  width: 22px;
  height: 4px;
  border-radius: 1px;
}
.header-flag span:nth-child(1) { background: #00247d; }
.header-flag span:nth-child(2) { background: #cf142b; }
.header-flag span:nth-child(3) { background: #00247d; }
 
.header-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #e2e8f0;
}
.header-title span {
  color: var(--text-muted);
  font-weight: 400;
}
 
.header-meta {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}
 
/* ── Header delta indicator ───────────────────────────────────────── */
.header-delta {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 200px;
  justify-content: center;
}
 
.header-delta .delta-up {
  color: #fc8181;
}
 
.header-delta .delta-down {
  color: #68d391;
}
 
.header-delta .delta-sep {
  color: var(--border);
}
 
.header-delta .delta-none {
  color: var(--text-muted);
  opacity: 0.5;
}
 
.header-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
}
.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--no-warning);
  box-shadow: 0 0 6px var(--no-warning);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}
 
/* ── Time slider strip ────────────────────────────────────────────── */
#slider-strip {
  display: flex;
  align-items: center;
  gap: 0;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 999;
  overflow: hidden;
}
 
#slider-strip.hidden {
  display: none;
}
 
/* Date label block — left side */
#slider-date-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  padding: 0 16px 0 20px;
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  min-width: 130px;
  height: 100%;
  gap: 2px;
}
 
#slider-date-label {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color 0.2s;
  line-height: 1;
}
 
#slider-date-label.is-latest {
  color: var(--accent);
}
 
#slider-date-sub {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  opacity: 0.5;
  line-height: 1;
}
 
/* Canvas track */
#slider-track-wrap {
  flex: 1;
  height: 100%;
  position: relative;
  cursor: crosshair;
}
 
#timeline-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}
 
/* ── Map area ─────────────────────────────────────────────────────── */
#map-container { flex: 1; position: relative; overflow: hidden; min-height: 0; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; }
 
/* ── Info panel ───────────────────────────────────────────────────── */
#info-panel {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 950;
  width: 340px;
  max-height: calc(100% - 32px);
  background: rgba(17, 21, 32, 0.96);
  border: 1px solid var(--border);
  border-radius: 8px;
  backdrop-filter: blur(12px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
  opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
 
#info-panel.panel-hidden {
  transform: translateX(380px);
  opacity: 0;
  pointer-events: none;
}
 
.info-header {
  display: flex;
  justify-content: flex-end;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
 
.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
}
.close-btn:hover {
  background: var(--neutral-hover);
  color: var(--text);
}
 
.info-content {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
 
#info-country-name {
  font-size: 22px;
  font-weight: 700;
  color: #e2e8f0;
  margin-bottom: 12px;
  line-height: 1.2;
}
 
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
}
 
.status-badge.avoid-all {
  background: rgba(229, 62, 62, 0.15);
  color: #fc8181;
  border: 1px solid rgba(229, 62, 62, 0.3);
}
 
.status-badge.avoid-essential {
  background: rgba(221, 107, 32, 0.15);
  color: #f6ad55;
  border: 1px solid rgba(221, 107, 32, 0.3);
}
 
.status-badge.some-parts {
  background: rgba(214, 158, 46, 0.15);
  color: #f6e05e;
  border: 1px solid rgba(214, 158, 46, 0.3);
}
 
.status-badge.no-warning {
  background: rgba(45, 138, 94, 0.15);
  color: #68d391;
  border: 1px solid rgba(45, 138, 94, 0.3);
}
 
.status-badge.no-data {
  background: rgba(30, 42, 61, 0.5);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
 
/* ── Delta / escalation badge ─────────────────────────────────────── */
.delta-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 3px;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 14px;
  margin-left: 6px;
}
 
.delta-badge.escalated {
  background: rgba(229, 62, 62, 0.12);
  color: #fc8181;
  border: 1px solid rgba(229, 62, 62, 0.25);
}
 
.delta-badge.improved {
  background: rgba(45, 138, 94, 0.12);
  color: #68d391;
  border: 1px solid rgba(45, 138, 94, 0.25);
}
 
.delta-badge.hidden {
  display: none;
}
 
#info-description {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 20px;
  margin-top: 8px;
}
 
.gov-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--accent);
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.2s;
}
.gov-link:hover {
  background: #4a90e2;
}
 
/* ── Legend ───────────────────────────────────────────────────────── */
#legend {
  position: absolute;
  bottom: 28px;
  left: 16px;
  z-index: 900;
  background: rgba(17, 21, 32, 0.92);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  backdrop-filter: blur(8px);
  min-width: 210px;
}
 
.legend-heading {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}
 
.legend-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 0;
}
.legend-swatch {
  width: 10px; height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}
.legend-label {
  font-size: 11px;
  color: var(--text);
  line-height: 1.2;
}
.legend-sub {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  color: var(--text-muted);
  display: block;
}
 
/* ── Country count badge ──────────────────────────────────────────── */
#country-count {
  position: absolute;
  bottom: 28px;
  right: 16px;
  z-index: 900;
  background: rgba(17, 21, 32, 0.92);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  backdrop-filter: blur(8px);
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
}
#country-count strong {
  display: block;
  font-size: 20px;
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  color: #e2e8f0;
  line-height: 1;
  margin-bottom: 2px;
}
 
/* ── Loading overlay ──────────────────────────────────────────────── */
#loading {
  position: absolute;
  inset: 0;
  z-index: 950;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  transition: opacity 0.5s ease;
}
#loading.hidden { opacity: 0; pointer-events: none; }
 
.loader-ring {
  width: 40px; height: 40px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
 
.loader-label {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}
 
/* ── Utility ──────────────────────────────────────────────────────── */
.hidden { display: none !important; }
 
/* ── Leaflet overrides ────────────────────────────────────────────── */
.leaflet-control-zoom {
  border: 1px solid var(--border) !important;
  border-radius: 6px !important;
  overflow: hidden;
}
.leaflet-control-zoom a {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
  font-weight: 600;
}
.leaflet-control-zoom a:hover {
  background: var(--neutral-hover) !important;
}
.leaflet-control-attribution {
  background: rgba(10, 13, 18, 0.7) !important;
  color: var(--text-muted) !important;
  font-size: 10px !important;
}
.leaflet-control-attribution a { color: #4a6fa5 !important; }
 
/* Tooltip */
.country-tooltip {
  background: rgba(17, 21, 32, 0.95);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-family: 'Syne', sans-serif;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 9px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  white-space: nowrap;
}
.country-tooltip::before { display: none; }
