/* ═══════════════════════════════════════════════
   MAP CONTAINER
   ═══════════════════════════════════════════════ */
#map {
  height: 600px;
  border-radius: 16px;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.08),
    0 2px 4px -1px rgba(0, 0, 0, 0.04);
  position: relative;
  z-index: 10;
  overflow: hidden;
  border: 1px solid rgba(0, 71, 52, 0.08);
}

@media (max-width: 640px) {
  #map { height: 280px; border-radius: 12px; }
}
@media (min-width: 641px) and (max-width: 768px) {
  #map { height: 340px; }
}
@media (min-width: 769px) and (max-width: 1024px) {
  #map { height: 420px; }
}


/* ═══════════════════════════════════════════════
   ZOOM CONTROLS  –  frosted glass
   ═══════════════════════════════════════════════ */
.leaflet-control-container { z-index: 10 !important; }
.leaflet-control-zoom      { z-index: 10 !important; }

.leaflet-control-zoom {
  border: none !important;
  border-radius: 12px !important;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0,0,0,0.10), 0 1px 3px rgba(0,0,0,0.06) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(255,255,255,0.85) !important;
  border: 1px solid rgba(0,0,0,0.06) !important;
}

.leaflet-control-zoom a {
  width: 38px !important;
  height: 38px !important;
  line-height: 38px !important;
  font-size: 17px !important;
  font-weight: 500 !important;
  color: #0F172A !important;
  background: transparent !important;
  transition: background 0.2s, color 0.2s;
}
.leaflet-control-zoom a:hover {
  background: rgba(0, 71, 52, 0.08) !important;
  color: #004734 !important;
}
.leaflet-control-zoom a + a {
  border-top: 1px solid rgba(0,0,0,0.06) !important;
}


/* ═══════════════════════════════════════════════
   LAYER CONTROL  –  map / satellite toggle
   ═══════════════════════════════════════════════ */
.leaflet-control-layers {
  border: none !important;
  border-radius: 12px !important;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0,0,0,0.10), 0 1px 3px rgba(0,0,0,0.06) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(255,255,255,0.85) !important;
  border: 1px solid rgba(0,0,0,0.06) !important;
  font-family: 'Poppins', sans-serif;
}

.leaflet-control-layers-toggle {
  width: 38px !important;
  height: 38px !important;
  background-size: 22px 22px !important;
}

.leaflet-control-layers-expanded {
  padding: 8px 12px 8px 8px !important;
}

.leaflet-control-layers label {
  display: flex !important;
  align-items: center;
  gap: 6px;
  padding: 3px 4px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #0F172A;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
}
.leaflet-control-layers label:hover {
  background: rgba(0, 71, 52, 0.06);
}

.leaflet-control-layers-selector {
  margin: 0 !important;
  accent-color: #004734;
}

.leaflet-control-layers-separator {
  display: none !important;
}

/* ═══════════════════════════════════════════════
   ATTRIBUTION  –  subtle pill
   ═══════════════════════════════════════════════ */
.leaflet-control-attribution {
  z-index: 10 !important;
  font-size: 10px !important;
  padding: 3px 8px !important;
  background: rgba(255, 255, 255, 0.88) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 6px !important;
  margin: 0 4px 4px 0 !important;
  border: 1px solid rgba(0,0,0,0.04) !important;
}
.leaflet-control-attribution a { color: #64748b !important; }


/* ═══════════════════════════════════════════════
   MARKERS  –  ring + animated pulse
   ═══════════════════════════════════════════════ */
.map-marker {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.18));
  transition: filter 0.2s ease;
}

@keyframes marker-pulse {
  0%   { r: 8; opacity: 0.9; }
  50%  { r: 12; opacity: 0.35; }
  100% { r: 8; opacity: 0.9; }
}


/* ═══════════════════════════════════════════════
   CLUSTER MARKERS  –  single circle, type-tinted
   ═══════════════════════════════════════════════ */
.marker-cluster.marker-cluster-custom {
  background: transparent !important;
  border: none !important;
  border-radius: 50% !important;
}

.marker-cluster-custom > span {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 36px !important;
  height: 36px !important;
  margin-left: 2px !important;
  margin-top: 2px !important;
  background: #004734 !important;
  color: #fff !important;
  font-weight: 600 !important;
  font-size: 12px !important;
  font-family: 'Poppins', sans-serif !important;
  border-radius: 50% !important;
  line-height: 1 !important;
  box-shadow: 0 2px 10px rgba(0, 71, 52, 0.4), 0 0 0 3px rgba(0, 71, 52, 0.12);
  border: 2.5px solid #fff;
  box-sizing: border-box;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.marker-cluster-custom:hover > span {
  transform: scale(1.08);
  box-shadow: 0 4px 16px rgba(0, 71, 52, 0.5), 0 0 0 4px rgba(0, 71, 52, 0.15);
}

.marker-cluster-medium.marker-cluster-custom > span {
  width: 44px !important;
  height: 44px !important;
  margin-left: -2px !important;
  margin-top: -2px !important;
  font-size: 13px !important;
}
.marker-cluster-large.marker-cluster-custom > span {
  width: 50px !important;
  height: 50px !important;
  margin-left: -5px !important;
  margin-top: -5px !important;
  font-size: 14px !important;
}

.marker-cluster-custom .cluster-count { line-height: 1 !important; }

.marker-cluster-mixed.marker-cluster-custom > span {
  background: #006B50 !important;
  box-shadow: 0 2px 10px rgba(0, 107, 80, 0.4), 0 0 0 3px rgba(0, 107, 80, 0.12);
}
.marker-cluster-supported.marker-cluster-custom > span {
  background: #ca8a04 !important;
  box-shadow: 0 2px 10px rgba(202, 138, 4, 0.4), 0 0 0 3px rgba(202, 138, 4, 0.12);
}
.marker-cluster-sunset.marker-cluster-custom > span {
  background: #6B7280 !important;
  box-shadow: 0 2px 10px rgba(107, 114, 128, 0.4), 0 0 0 3px rgba(107, 114, 128, 0.12);
}


/* ═══════════════════════════════════════════════
   POPUPS  –  modern card matching dropdown / nav
   ═══════════════════════════════════════════════ */

/* Outer wrapper – kill Leaflet defaults, match select-panel */
.leaflet-popup-content-wrapper {
  border-radius: 1rem !important;
  box-shadow: 0 12px 40px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.06) !important;
  padding: 0 !important;
  border: 1px solid rgba(0,0,0,0.06) !important;
  overflow: hidden;
  font-family: 'Poppins', sans-serif !important;
  background: #fff !important;
}

.leaflet-popup-content {
  margin: 0 !important;
  font-size: 0.8125rem !important;
  line-height: 1.5 !important;
}

/* Tip / arrow */
.leaflet-popup-tip-container { margin-top: -1px; }
.leaflet-popup-tip {
  background: #fff !important;
  box-shadow: 0 3px 8px rgba(0,0,0,0.08) !important;
  border: 1px solid rgba(0,0,0,0.05) !important;
}

/* Close button – matches mobile-menu close style */
.leaflet-popup-close-button {
  top: 14px !important;
  right: 10px !important;
  width: 26px !important;
  height: 26px !important;
  font: 14px/26px 'Poppins', sans-serif !important;
  text-align: center !important;
  text-decoration: none !important;
  background: #f1f5f9 !important;
  border-radius: 8px !important;
  color: #94a3b8 !important;
  transition: background 0.2s, color 0.2s !important;
  padding: 0 !important;
  z-index: 5;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.leaflet-popup-close-button:hover {
  background: var(--color-brand-green, #004734) !important;
  color: #fff !important;
}

/* Popup entrance animation — on the wrapper, NOT .leaflet-popup
   (.leaflet-popup uses inline transform for positioning; animating
   transform on it breaks placement.) */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  animation: popupFadeIn 0.2s cubic-bezier(0.32, 0.72, 0, 1) both;
}
@keyframes popupFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}


/* ── Popup inner card ── */
.map-popup {
  min-width: 240px;
  max-width: 310px;
  padding: 0;
}

/* Header section */
.popup-header {
  padding: 14px 16px 0;
}

.popup-title {
  font-weight: 700;
  font-size: 0.9375rem;
  color: #0f172a;
  line-height: 1.3;
  margin: 0 0 2px;
  padding-right: 24px;
}

.popup-subtitle {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 400;
  margin-bottom: 2px;
}

/* Divider */
.popup-divider {
  height: 1px;
  background: #f1f5f9;
  margin: 10px 16px;
}

/* Body section */
.popup-body {
  padding: 0 16px;
}

/* Meta row: badge + source */
.popup-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.popup-badge {
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  border-radius: 8px;
  line-height: 1.4;
}
.popup-badge-confirmed {
  background: var(--color-brand-green, #004734);
  color: #fff;
}
.popup-badge-mixed {
  background: var(--color-brand-green-light, #006B50);
  color: #fff;
}
.popup-badge-supported {
  background: #ca8a04;
  color: #fff;
}
.popup-badge-sunset {
  background: #6B7280;
  color: #fff;
}

.popup-source {
  font-size: 0.6875rem;
  color: #94a3b8;
  font-weight: 500;
}

.popup-country {
  font-size: 0.75rem;
  color: #475569;
  margin-bottom: 6px;
}

/* Structured fields */
.popup-fields {
  background: #f8fafc;
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 4px;
}

.popup-line {
  font-size: 0.6875rem;
  color: #334155;
  line-height: 1.55;
  margin-bottom: 2px;
  display: flex;
  gap: 4px;
}
.popup-line:last-child { margin-bottom: 0; }

.popup-line .popup-label {
  color: #94a3b8;
  font-weight: 600;
  flex-shrink: 0;
  text-transform: uppercase;
  font-size: 0.625rem;
  letter-spacing: 0.03em;
  margin-top: 1px;
}

/* Description fallback */
.popup-desc {
  font-size: 0.75rem;
  color: #64748b;
  line-height: 1.5;
  margin-bottom: 4px;
}

/* Sunset / info note */
.popup-note {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  background: #f8fafc;
  border-left: 3px solid #6B7280;
  border-radius: 0 8px 8px 0;
  padding: 8px 10px;
  margin-top: 6px;
  margin-bottom: 4px;
  font-size: 0.6875rem;
  color: #475569;
  line-height: 1.5;
}
.popup-note svg {
  flex-shrink: 0;
  color: #6B7280;
  margin-top: 1px;
}
.popup-note-link {
  display: inline-block;
  margin-top: 2px;
  color: #004734;
  font-weight: 600;
  text-decoration: none;
  font-size: 0.625rem;
}
.popup-note-link:hover {
  text-decoration: underline;
}

/* Sites list */
.popup-sites {
  font-size: 0.6875rem;
  color: #475569;
  line-height: 1.5;
  margin-bottom: 4px;
}
.popup-sites strong {
  color: #334155;
  font-weight: 600;
}

/* Footer disclaimer */
.popup-footer {
  padding: 8px 16px 12px;
  font-size: 0.625rem;
  color: #94a3b8;
  line-height: 1.4;
  border-top: 1px solid #f1f5f9;
  margin-top: 8px;
}

/* Tablet popup adjustments */
@media (max-width: 768px) {
  .map-popup {
    min-width: 180px;
    max-width: 270px;
  }
}

/* Mobile popup adjustments */
@media (max-width: 640px) {
  .leaflet-popup-content-wrapper {
    border-radius: 0.75rem !important;
  }
  .map-popup {
    min-width: 160px;
    max-width: 240px;
  }
  .popup-title {
    font-size: 0.8125rem;
    padding-right: 20px;
  }
  .popup-header { padding: 10px 12px 0; }
  .popup-body { padding: 0 12px; }
  .popup-footer { padding: 6px 12px 8px; font-size: 0.5625rem; }
  .popup-divider { margin: 6px 12px; }
  .popup-fields { padding: 6px 8px; }
  .popup-badge { font-size: 0.5625rem; padding: 2px 8px; }
  .popup-source { font-size: 0.625rem; }
  .popup-subtitle { font-size: 0.6875rem; }
  .popup-meta { gap: 6px; margin-bottom: 6px; }

  .leaflet-popup-close-button {
    top: 8px !important;
    right: 8px !important;
    width: 22px !important;
    height: 22px !important;
    font: 12px/22px 'Poppins', sans-serif !important;
  }
}


/* ═══════════════════════════════════════════════
   SITE ACCORDION  (below map)
   ═══════════════════════════════════════════════ */
.site-accordion {
  transition: all 0.2s ease-in-out;
}
.site-accordion summary {
  display: grid;
  list-style: none;
}
.site-accordion summary::-webkit-details-marker { display: none; }

.site-accordion:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

details[open] summary svg {
  transform: rotate(180deg);
}

#site-lists::-webkit-scrollbar { width: 6px; }
#site-lists::-webkit-scrollbar-track {
  background: var(--color-surface-muted, #f1f5f9);
  border-radius: 3px;
}
#site-lists::-webkit-scrollbar-thumb {
  background: var(--color-border-muted, #cbd5e1);
  border-radius: 3px;
}
#site-lists::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted, #94a3b8);
}
