/* ============================================================
   BASE NACIONAL DE SOCAVONES — Professional GIS Dashboard
   CartomeX · Cristian M Rougier
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

/* ---- Design Tokens ---- */
:root {
  /* Header palette */
  --header-from: #0f172a;
  --header-to:   #1e3a5f;
  --header-h:    72px;

  /* Sidebar */
  --sidebar-w:      185px;
  --sidebar-bg:     #eef1f5;
  --sidebar-header: #dde2ea;
  --sidebar-border: #ccd2dc;

  /* Surface */
  --card-bg:    #ffffff;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.06);
  --card-shadow-hover: 0 2px 6px rgba(0,0,0,0.10), 0 8px 24px rgba(0,0,0,0.10);

  /* Accent */
  --accent:       #1d6fce;
  --accent-light: #dbeafe;
  --accent-dark:  #1553a0;

  /* Text */
  --text:         #0f172a;
  --text-mid:     #374151;
  --text-muted:   #64748b;
  --text-faint:   #94a3b8;

  /* Borders */
  --border:       #e2e8f0;
  --border-focus: #1d6fce;

  /* Status colors */
  --c-blue:   #2563eb;
  --c-cyan:   #0891b2;
  --c-orange: #ea580c;
  --c-violet: #7c3aed;
  --c-sky:    #0284c7;
  --c-red:    #dc2626;
  --c-amber:  #b45309;
  --c-teal:   #0f766e;
  --c-stone:  #78716c;
  --c-gray:   #6b7280;
  --c-green:  #16a34a;

  /* Misc */
  --radius-sm: 5px;
  --radius:    8px;
  --radius-lg: 12px;
  --footer-h:  68px;
  --font: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'DM Mono', 'JetBrains Mono', monospace;
}

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

html, body {
  height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: #0f172a;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ================================================================
   HEADER / TOPBAR
   ================================================================ */
.topbar {
  display: flex;
  align-items: center;
  height: var(--header-h);
  padding: 0 16px 0 14px;
  background: linear-gradient(105deg, var(--header-from) 0%, #163a6b 55%, var(--header-to) 100%);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  box-shadow: 0 2px 12px rgba(0,0,0,0.35);
  flex-shrink: 0;
  z-index: 1000;
  gap: 16px;
  position: relative;
}

/* Subtle grid overlay on header */
.topbar::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
}

.brand-logo {
  height: 58px;
  width: auto;
  max-width: 320px;
  flex-shrink: 0;
  object-fit: contain;
  border-radius: 4px;
  position: relative;
}

.brand-title {
  flex: 1;
  text-align: center;
  font-size: 30px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.01em;
  line-height: 1.15;
  white-space: nowrap;
  margin: 0;
}

.brand-program {
  font-size: 12.5px;
  font-weight: 500;
  color: #94a3b8;
  line-height: 1.3;
  margin-top: 2px;
}

.brand-program a {
  color: #60a5fa;
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid rgba(96,165,250,0.35);
  transition: color 0.15s, border-color 0.15s;
}

.brand-program a:hover {
  color: #93c5fd;
  border-bottom-color: rgba(147,197,253,0.6);
}

.counter-bar {
  font-size: 12px;
  font-weight: 400;
  color: #94a3b8;
  white-space: nowrap;
  font-family: var(--font-mono);
  letter-spacing: 0.01em;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  position: relative;
}

.counter-bar strong {
  color: #7dd3fc;
  font-weight: 600;
}

.whatsapp-link {
  display: flex;
  align-items: center;
  margin-left: auto;
  padding: 4px;
  border-radius: 50%;
  transition: opacity 0.15s;
  opacity: 0.85;
}
.whatsapp-link:hover { opacity: 1; }

/* ---- Program bar (below header) ---- */
/* program-bar removed — text moved to footer */

/* ================================================================
   MAIN LAYOUT
   ================================================================ */
.main-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* ================================================================
   SLIDESHOW (right panel — 3 photos at a time)
   ================================================================ */
.slideshow-panel {
  width: 140px;
  flex-shrink: 0;
  background: #0f172a;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.slideshow-grid {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
}

.slideshow-card {
  flex: 1;
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  transition: opacity 0.8s ease;
}

.slideshow-card.fade-out { opacity: 0; }

.slideshow-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.slideshow-card-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 4px 8px;
  background: linear-gradient(transparent, rgba(0,0,0,0.75));
  font-size: 10.5px;
  font-weight: 500;
  color: #e2e8f0;
  line-height: 1.3;
}

/* ================================================================
   SIDEBAR
   ================================================================ */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  z-index: 800;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

/* ---- Featured / Latest sinkholes ---- */
.featured-panel {
  flex-shrink: 0;
  padding: 8px 8px 6px;
  background: linear-gradient(135deg, #0f172a, #1e3a5f);
  border-bottom: 1px solid var(--sidebar-border);
}

.featured-title {
  font-size: 9.5px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 6px;
  padding-left: 2px;
}

.featured-cards {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.featured-card {
  flex: 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: #1e293b;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  border: 1px solid rgba(255,255,255,0.08);
}

.featured-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.featured-card-img {
  width: 100%;
  height: 50px;
  object-fit: cover;
  display: block;
  background: #334155;
}

.featured-card-body {
  padding: 6px 8px 7px;
}

.featured-card-title {
  font-size: 11px;
  font-weight: 600;
  color: #e2e8f0;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 3px;
}

.featured-card-meta {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.featured-card-badge {
  font-size: 9px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 99px;
  background: rgba(255,255,255,0.1);
  color: #94a3b8;
}

.featured-card-badge.cause {
  color: #7dd3fc;
  background: rgba(125,211,252,0.12);
}

/* ---- Sidebar header / filters ---- */
.filters {
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--sidebar-border);
  background: var(--sidebar-header);
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex-shrink: 0;
}

.search-wrap {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  flex-shrink: 0;
}

.filters input[type="search"] {
  width: 100%;
  height: 34px;
  padding: 0 10px 0 32px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font);
  background: var(--card-bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
}

.filters input[type="search"]::placeholder { color: var(--text-faint); }

.filters input[type="search"]:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(29, 111, 206, 0.12);
}

.filter-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-row select {
  flex: 1;
  min-width: 0;
  height: 30px;
  padding: 0 6px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-family: var(--font);
  background: var(--card-bg);
  color: var(--text-mid);
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 7px center;
  padding-right: 22px;
}

.filter-row select:focus { border-color: var(--border-focus); }

/* Filter label row */
.filter-labels {
  display: none;
}

.filter-label {
  flex: 1;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
}

/* ---- List panel ---- */
.list-panel {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 7px 10px;
  scroll-behavior: smooth;
}

/* Custom scrollbar */
.list-panel::-webkit-scrollbar { width: 5px; }
.list-panel::-webkit-scrollbar-track { background: transparent; }
.list-panel::-webkit-scrollbar-thumb { background: #bec7d4; border-radius: 99px; }
.list-panel::-webkit-scrollbar-thumb:hover { background: #9aa4b2; }

/* ---- Result count chip ---- */
.list-count {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 4px 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.list-count-num {
  background: var(--accent);
  color: #fff;
  border-radius: 99px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
}

/* ---- Loading / empty state ---- */
.list-loading {
  padding: 40px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

.list-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-bottom: 10px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Sinkhole cards ---- */
.list-item {
  padding: 0;
  margin-bottom: 5px;
  border-radius: var(--radius);
  background: var(--card-bg);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  display: flex;
  flex-direction: column;
  gap: 0;
  box-shadow: var(--card-shadow);
  position: relative;
  overflow: hidden;
}

.list-item-thumb {
  width: 100%;
  height: 44px;
  object-fit: cover;
  display: block;
  border-bottom: 1px solid var(--border);
}

.list-item-content {
  padding: 7px 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* left accent stripe on hover / active */
.list-item::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.15s;
  border-radius: 0 0 0 0;
}

.list-item:hover {
  box-shadow: var(--card-shadow-hover);
  border-color: #b8c4d4;
  transform: translateY(-1px);
}

.list-item:hover::before { opacity: 0.5; }

.list-item.active {
  background: #f0f6ff;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--card-shadow-hover);
}

.list-item.active::before { opacity: 1; }

/* Card inner top row: icon + title */
.list-item-top {
  display: flex;
  gap: 7px;
  align-items: flex-start;
}

.list-cause-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
  border-radius: 3px;
  object-fit: contain;
}

.list-item-title {
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

/* Card meta badges row */
.list-item-meta {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding-left: 25px; /* align under title */
}

.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.badge-state {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.badge-year {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.badge-source {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

/* ================================================================
   MAP AREA
   ================================================================ */
#map {
  flex: 1;
  min-width: 0;
  position: relative;
}

/* Leaflet attribution compact */
.leaflet-control-attribution {
  font-size: 10px !important;
  background: rgba(255,255,255,0.8) !important;
  backdrop-filter: blur(4px);
}

/* ================================================================
   MAP LEGEND
   ================================================================ */
.map-legend {
  position: fixed;
  bottom: calc(var(--footer-h) + 8px);
  left: calc(var(--sidebar-w) + 2px);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.14), 0 1px 4px rgba(0,0,0,0.08);
  z-index: 800;
  min-width: 178px;
}

.legend-title {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend-title svg { flex-shrink: 0; }

.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 2px 0;
  color: var(--text-mid);
  font-size: 11.5px;
  font-weight: 400;
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  opacity: 0.85;
  border: 1.5px solid rgba(0,0,0,0.15);
}

/* ================================================================
   POPUP STYLES
   ================================================================ */
.leaflet-popup-content-wrapper {
  border-radius: var(--radius-lg) !important;
  background: #fff !important;
  color: var(--text) !important;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.10) !important;
  border: 1px solid var(--border) !important;
  padding: 0 !important;
  overflow: hidden;
}

.leaflet-popup-content {
  margin: 0 !important;
  font-family: var(--font) !important;
  font-size: 13px !important;
  line-height: 1.45 !important;
  width: auto !important;
}

.leaflet-popup-tip-container { margin-top: -1px; }
.leaflet-popup-tip { background: #fff !important; box-shadow: none !important; }

.leaflet-popup-close-button {
  top: 8px !important;
  right: 10px !important;
  color: #94a3b8 !important;
  font-size: 18px !important;
  z-index: 10;
}

.leaflet-popup-close-button:hover { color: var(--text) !important; }

/* Popup card */
.popup-card {
  width: min(480px, 88vw);
  max-height: 72vh;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.popup-card::-webkit-scrollbar { width: 5px; }
.popup-card::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 99px; }

/* Photo header */
.popup-media {
  width: 100%;
  height: 190px;
  overflow: hidden;
  background: #f1f5f9;
  position: relative;
}

.popup-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.popup-media img:hover { transform: scale(1.03); }

.popup-noimg {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-faint);
  font-size: 12px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.popup-noimg-icon {
  width: 40px;
  height: 40px;
  opacity: 0.25;
}

/* Body */
.popup-body { padding: 14px 16px 12px; }

.popup-body h3 {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 10px;
  color: var(--text);
  padding-right: 20px; /* space for close btn */
}

.popup-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 12px;
}

.popup-badges span {
  font-size: 10.5px;
  padding: 3px 9px;
  border-radius: 99px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.popup-badge-cause {
  /* background/color set inline via JS */
}

.popup-badge-type {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.popup-badge-source {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.popup-badge-year {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

/* Data grid */
.popup-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 12px;
  font-size: 12px;
  margin-bottom: 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.popup-grid dt {
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding-top: 1px;
}

.popup-grid dd {
  color: var(--text-mid);
  word-break: break-word;
}

/* Dimensions chips */
.popup-dims {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.popup-dim {
  background: #f0f6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 11.5px;
  color: var(--c-blue);
  font-family: var(--font-mono);
}

.popup-dim strong {
  font-weight: 600;
  margin-right: 3px;
}

/* Transcription */
.popup-fulltext {
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fafbfc;
}

.popup-fulltext h4 {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 7px 10px 4px;
  border-bottom: 1px solid var(--border);
}

.popup-fulltext p {
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 8px 10px 10px;
  color: var(--text-mid);
  max-height: 250px;
  overflow-y: auto;
}

/* Links row */
.popup-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.popup-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 13px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.12s, transform 0.1s;
}

.popup-link:hover { transform: translateY(-1px); }

.popup-link-primary {
  background: var(--accent);
  color: #fff;
}

.popup-link-primary:hover { background: var(--accent-dark); }

.popup-link-secondary {
  background: #f1f5f9;
  color: var(--text-mid);
  border: 1px solid var(--border);
}

.popup-link-secondary:hover { background: #e2e8f0; }

/* ================================================================
   FOOTER
   ================================================================ */
.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 16px;
  min-height: var(--footer-h);
  background: #1e293b;
  border-top: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
  z-index: 1000;
}

.footer-disclaimer {
  font-size: 10.5px;
  color: #e2e8f0;
  text-align: center;
  line-height: 1.4;
  max-width: 800px;
  padding: 3px 0;
}

.footer-program {
  font-size: 12px;
  font-weight: 500;
  color: #ffffff;
  text-align: center;
}

.footer-program a {
  color: #22d3ee;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.12s;
}

.footer-program a:hover { color: #67e8f9; }

.footer-credits {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 400;
  color: #ffffff;
  letter-spacing: 0.02em;
}

.footer-credits a {
  color: #ffffff;
  text-decoration: none;
  transition: color 0.12s;
}

.footer-credits a:hover { color: #bae6fd; }

.footer-sep {
  color: #475569;
  user-select: none;
}

/* ================================================================
   SIDEBAR TOGGLE (mobile)
   ================================================================ */
.sidebar-toggle {
  display: none;
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 900;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  color: #f1f5f9;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.sidebar-toggle:hover { background: rgba(30, 58, 107, 0.90); }

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 768px) {
  :root { --header-h: 48px; }

  .topbar { padding: 0 10px; gap: 8px; }
  .brand-logo { height: 36px; max-width: 120px; }
  .brand-title { font-size: 14px; white-space: normal; line-height: 1.2; }
  .brand-program { display: none; }
  .header-divider { display: none; }
  .counter-bar { font-size: 9.5px; padding: 2px 6px; }
  .whatsapp-link svg { width: 24px; height: 24px; }

  .sidebar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: min(85vw, 340px);
    transform: translateX(-100%);
    box-shadow: 6px 0 24px rgba(0,0,0,0.20);
  }

  .sidebar.open { transform: translateX(0); }

  .sidebar-toggle { display: flex; }

  .slideshow-panel { display: none; }

  .map-legend {
    bottom: calc(var(--footer-h) + 8px);
    left: 8px;
    padding: 6px 8px;
    min-width: 140px;
  }

  .legend-title { font-size: 10px; }
  .legend-item { font-size: 10px; gap: 5px; }
  .legend-dot { width: 8px; height: 8px; }

  .popup-card { width: min(320px, 92vw); max-height: 60vh; }
  .popup-media { height: 140px; }
  .popup-body { padding: 10px 12px 8px; }
  .popup-body h3 { font-size: 13px; }
  .popup-fulltext p { font-size: 11px; max-height: 180px; }

  .map-layer-control { right: 8px; }
}

@media (max-width: 420px) {
  :root { --header-h: 44px; }

  .topbar { padding: 0 8px; gap: 6px; }
  .brand-logo { height: 30px; max-width: 90px; }
  .brand-title { font-size: 12px; }
  .counter-bar { display: none; }

  .map-legend { padding: 5px 7px; min-width: 120px; }
  .legend-title { font-size: 9px; }
  .legend-item { font-size: 9px; gap: 4px; padding: 1px 0; }

  .popup-card { width: min(300px, 95vw); max-height: 55vh; }
}

/* ================================================================
   UTILITY
   ================================================================ */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

/* Pulse animation for markers on active */
@keyframes pulse-ring {
  0%   { transform: scale(0.9); opacity: 1; }
  70%  { transform: scale(1.8); opacity: 0; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* ================================================================
   MAP LAYER CONTROL (custom)
   ================================================================ */
.map-layer-control {
  position: absolute;
  top: 10px;
  right: calc(140px + 10px);
  z-index: 800;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.layer-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0,0,0,0.15);
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  transition: background 0.15s, transform 0.1s;
  color: #374151;
  font-size: 14px;
  padding: 0;
}

.layer-btn:hover {
  background: #f0f6ff;
  transform: scale(1.05);
}

.layer-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent-dark);
}

.layer-btn svg { pointer-events: none; }

/* ================================================================
   BATCH LOADING PROGRESS
   ================================================================ */
.batch-progress {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 800;
  background: rgba(15,23,42,0.9);
  backdrop-filter: blur(8px);
  color: #e2e8f0;
  padding: 6px 16px;
  border-radius: 99px;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  transition: opacity 0.4s;
  pointer-events: none;
}

.batch-progress.hidden { opacity: 0; }
