:root {
  /* Colors: Professional Dashboard Light */
  --bg-app: #f8fafc;
  --bg-ocean: #e2e8f0;
  --land-fill: #ffffff;
  --land-stroke: #cbd5e1;
  --land-hover: #f1f5f9;
  --land-active: #2563eb;
  --land-dim: #f8fafc;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --accent: #2563eb;
  --surface: #ffffff;
  --border: #e2e8f0;
  --shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
  
  /* Metrics */
  --header-h: 60px;
  --panel-w: 400px;
  --font-sans: 'Inter', system-ui, sans-serif;
  --transition: 200ms ease;
}

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

body {
  font-family: var(--font-sans);
  background: var(--bg-app);
  color: var(--text-main);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

button { background: none; border: none; cursor: pointer; color: inherit; font: inherit; }

/* Header */
.header {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-h);
  background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 16px; gap: 20px; z-index: 100;
}
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; }
.logo-icon { color: var(--accent); }

/* Navigation */
.continent-nav { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.pill {
  padding: 6px 14px; border-radius: 99px; font-size: 13px; font-weight: 500;
  color: var(--text-muted); border: 1px solid var(--border); white-space: nowrap;
  transition: var(--transition);
}
.pill:hover { background: var(--bg-app); color: var(--text-main); }
.pill.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Map Stage */
.stage { position: absolute; top: var(--header-h); bottom: 0; left: 0; right: 0; }
#worldMap { width: 100%; height: 100%; cursor: grab; background: var(--bg-ocean); }
#worldMap:active { cursor: grabbing; }

/* Update your country paths in style.css */
.country {
  /* Use the dynamic color from JS, fallback to white */
  fill: var(--base-color, var(--land-fill)); 
  stroke: #94a3b8; /* Slightly darker slate for crisp borders */
  stroke-width: 0.6px;
  transition: fill var(--transition); 
  vector-effect: non-scaling-stroke; /* This keeps borders visible at any zoom! */
}
.country:hover { 
  fill: var(--land-hover); 
}
.country.active { 
  fill: var(--land-active); 
  stroke: var(--land-active); 
  stroke-width: 1px; /* Slightly thicker when clicked */
}
.country.dimmed { 
  fill: var(--land-dim); 
  pointer-events: none; 
  stroke: var(--bg-ocean); 
}
.ocean {
  fill: var(--bg-ocean);
  cursor: grab;
}
.ocean:active {
  cursor: grabbing;
}

.map-tooltip {
  position: absolute; background: var(--surface); color: var(--text-main);
  padding: 8px 12px; border-radius: 6px; font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow); pointer-events: none; opacity: 0; z-index: 50;
  border: 1px solid var(--border); transition: opacity 100ms;
}

/* Controls */
.zoom-controls {
  position: absolute; bottom: 24px; right: 24px; background: var(--surface);
  border-radius: 8px; box-shadow: var(--shadow); border: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 50;
}
.zoom-controls button { width: 40px; height: 40px; font-size: 20px; font-weight: 500; }
.zoom-controls button:hover { background: var(--bg-app); }
.zoom-controls .divider { height: 1px; background: var(--border); margin: 0 8px; }

/* Info Panel */
.panel {
  position: fixed; z-index: 200; background: var(--surface);
  box-shadow: -10px 0 30px rgba(0,0,0,0.05); transition: transform 300ms ease;
  display: flex; flex-direction: column;
}
.panel-handle { display: none; }
.close-btn { position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; background: var(--bg-app); border-radius: 50%; font-size: 14px; }
.panel-content { padding: 30px 24px; overflow-y: auto; height: 100%; }

/* Panel Data Styles */
.p-hero { display: flex; gap: 16px; align-items: center; margin-bottom: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.p-flag { font-size: 48px; line-height: 1; }
.p-name { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.p-alpha { font-family: monospace; color: var(--accent); background: #eff6ff; padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.p-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 24px; }
.p-card { background: var(--bg-app); padding: 12px; border-radius: 8px; border: 1px solid var(--border); }
.p-label { font-size: 11px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 4px; font-weight: 600; }
.p-value { font-size: 15px; font-weight: 600; }
.p-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.p-tag { background: var(--bg-ocean); padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 500; }

/* Overlays */
.overlay { position: fixed; inset: 0; background: var(--bg-app); z-index: 500; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; transition: opacity 300ms; }
.overlay.hidden { opacity: 0; pointer-events: none; }
.spinner { width: 40px; height: 40px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-icon { font-size: 40px; }
.retry-btn { background: var(--accent); color: white; padding: 10px 24px; border-radius: 6px; font-weight: 600; }

/* Responsive Desktop/Mobile */
@media (min-width: 768px) {
  .panel { top: var(--header-h); bottom: 0; right: 0; width: var(--panel-w); transform: translateX(100%); border-left: 1px solid var(--border); }
  .panel.open { transform: translateX(0); }
  .scrim { display: none; }
  .stage.panel-open { padding-right: var(--panel-w); }
}
@media (max-width: 767px) {
  .panel { bottom: 0; left: 0; right: 0; max-height: 80vh; transform: translateY(100%); border-radius: 20px 20px 0 0; }
  .panel.open { transform: translateY(0); }
  .panel-handle { display: block; width: 40px; height: 4px; background: var(--border); border-radius: 2px; margin: 12px auto; }
  .scrim { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.4); z-index: 150; opacity: 0; pointer-events: none; transition: opacity 300ms; }
  .scrim.visible { opacity: 1; pointer-events: auto; }
}
