/* Valentine Bonne Map — styles
   Design goals:
   - Strong visual hierarchy
   - Mobile-first touch targets
   - Decorations that never block interaction
*/

:root{
  --bg: #fff7fb;
  --ink: #25101b;
  --muted: #6a4b5a;
  --panel: rgba(255,255,255,0.88);
  --stroke: rgba(37,16,27,0.18);
  --accent: #d81b60;
  --accent2: #7c4dff;
  --shadow: 0 12px 30px rgba(0,0,0,0.14);
  --radius: 16px;
}

*{ box-sizing: border-box; }
html, body{ height: 100%; margin: 0; font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial; color: var(--ink); background: radial-gradient(circle at 20% 0%, #ffe2ef 0%, var(--bg) 45%, #fff 100%); }

.topbar{
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  backdrop-filter: blur(10px);
  background: rgba(255,255,255,0.65);
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.title{
  font-weight: 700; letter-spacing: 0.2px;
  font-size: 16px;
  display:flex; align-items:center; gap:8px;
}
.topbar-actions{ display:flex; gap:8px; }
button{ font: inherit; }
.ghost{
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(255,255,255,0.8);
  color: var(--ink);
  box-shadow: 0 3px 10px rgba(0,0,0,0.06);
}
.ghost:active{ transform: translateY(1px); }

.app{ height: 100%; padding-top: 52px; }
.map-wrap{ height: calc(100vh - 52px); width: 100vw; position: relative; }

.loading{
  position: fixed; inset: 52px 0 0 0; z-index: 40;
  display:flex; align-items:center; justify-content:center; flex-direction: column; gap: 10px;
  background: rgba(255,247,251,0.82);
  backdrop-filter: blur(4px);
}
.spinner{
  width: 40px; height: 40px; border-radius: 999px;
  border: 4px solid rgba(0,0,0,0.08);
  border-top-color: rgba(0,0,0,0.35);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text{ color: var(--muted); font-weight: 600; }

.legend{
  position: fixed; z-index: 60;
  left: 12px; bottom: 12px;
  width: min(340px, calc(100vw - 24px));
  background: var(--panel);
  border: 1px solid rgba(0,0,0,0.07);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.legend-header{
  display:flex; justify-content: space-between; align-items:center;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.legend-title{ font-weight: 800; }
.legend-body{ padding: 10px 12px; }
.legend-item{ display:flex; gap: 10px; align-items:center; }
.swatch{
  width: 18px; height: 18px; border-radius: 6px;
  background: rgba(216,27,96,0.20);
  border: 1px solid rgba(216,27,96,0.35);
}
.legend-note{ margin: 10px 0 0 0; color: var(--muted); font-size: 13px; line-height: 1.3; }

.icon{
  width: 36px; height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(255,255,255,0.85);
  font-size: 20px;
}
.icon:active{ transform: translateY(1px); }

.backdrop{
  position: fixed; inset: 0; z-index: 80;
  background: rgba(20,10,15,0.38);
  backdrop-filter: blur(2px);
}
.hidden{ display:none; }

.popup, .modal{
  position: fixed; z-index: 90;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: min(420px, calc(100vw - 24px));
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.popup-head, .modal-head{
  padding: 12px 12px;
  display:flex; align-items:center; justify-content: space-between;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.popup-title, .modal-title{ font-weight: 900; }
.popup-body, .modal-body{ padding: 14px 12px; color: var(--ink); }
.popup-text{ margin:0; line-height: 1.35; color: var(--muted); font-weight: 600; }

.popup-actions{
  padding: 10px 12px 12px 12px;
  display:flex; gap: 10px; justify-content:flex-end;
}
.btn{
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.10);
  font-weight: 800;
}
.primary{
  background: linear-gradient(135deg, rgba(216,27,96,0.98), rgba(124,77,255,0.92));
  color: white;
  border-color: rgba(0,0,0,0.06);
}
.secondary{
  background: rgba(255,255,255,0.9);
  color: var(--ink);
}
.btn:active{ transform: translateY(1px); }

.sources{ margin: 0; padding-left: 18px; color: var(--muted); line-height: 1.4; }
.credits{ margin-top: 12px; color: var(--muted); font-size: 13px; }
.credits a{ color: var(--accent2); text-decoration: none; font-weight: 800; }

a{ color: inherit; }

/* SVG map styling */
svg#mapSvg{ width: 100%; height: 100%; display:block; }
.country{
  cursor: pointer;
  vector-effect: non-scaling-stroke;
  transition: filter 120ms ease, opacity 120ms ease;
}
.country:hover{ filter: drop-shadow(0 6px 10px rgba(216,27,96,0.18)); }
.country:active{ opacity: 0.92; }

.country.selected{
  fill: rgba(216,27,96,0.92);
  stroke: rgba(37,16,27,1);
  stroke-width: 1.1;
}

.graticule{
  vector-effect: non-scaling-stroke;
}

.decor{
  pointer-events: none; /* never block clicks */
  opacity: 0.92;
}

@media (max-width: 420px){
  .title{ font-size: 14px; }
}

/* remove the browser focus rectangle around SVG paths */
.country:focus { outline: none; }

/* stronger selected state (contrasting pink), persists until cleared */
.country.selected{
  filter: none;              /* optional: remove shadow-only selection */
  opacity: 1;
}
