/* ================================================================
   map-panama.css (v5.0 — Leaflet)
   ================================================================ */

bm-map-panama {
  display: block;
  height: 100%;
}

.map-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--surface-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
}

.map-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.map-header > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.map-title {
  margin: 0;
  font-family: "Instrument Serif", serif;
  font-size: 22px;
  font-weight: 400;
  color: var(--text-strong);
}

.map-sub {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Breadcrumb del filtro activo */
.map-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 12px;
}

.bc-label {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10px;
}

.bc-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  background: var(--green-mint);
  color: var(--green-deep);
  border-radius: 999px;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.02em;
}

.bc-chip[data-level="barrio"] {
  background: var(--teal-light);
}

.bc-clear {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.15s ease, color 0.15s ease;
}

.bc-clear:hover {
  background: #fee2e2;
  color: #991b1b;
}

/* Contenedor del mapa Leaflet */
.map-body {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 360px;
  margin: 0.5rem 0;
}

.map-leaflet {
  width: 100%;
  height: 100%;
  min-height: 360px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #f5f5f0;
}

.map-overlay-msg {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(247, 247, 244, 0.95);
  color: #b91c1c;
  font-size: 13px;
  padding: 1rem;
  border-radius: var(--radius-md);
}

/* Atribución de Leaflet — más discreta */
.map-leaflet .leaflet-control-attribution {
  font-size: 10px;
  background: rgba(255, 255, 255, 0.75);
}

/* Tooltip personalizado */
.bm-leaflet-tooltip {
  background: rgba(3, 57, 50, 0.95) !important;
  color: #fff !important;
  border: none !important;
  border-radius: 6px !important;
  padding: 6px 10px !important;
  font-size: 12px !important;
  line-height: 1.4 !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2) !important;
}

.bm-leaflet-tooltip::before {
  border-top-color: rgba(3, 57, 50, 0.95) !important;
}

/* Burbujas (circleMarkers) del bubble map */
.bm-bubble {
  filter: drop-shadow(0 2px 4px rgba(0, 158, 131, 0.35));
  cursor: pointer;
  transition: filter 0.15s ease;
}
.bm-bubble:hover {
  filter: drop-shadow(0 3px 8px rgba(3, 57, 50, 0.55)) brightness(1.05);
}
.bm-bubble-selected {
  filter: drop-shadow(0 3px 6px rgba(3, 57, 50, 0.6));
}

/* Leyenda */
.map-legend {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.legend-label {
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.legend-bar {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, #E8F4F0, #033932);
  max-width: 240px;
}

/* ─── Drill-down: lista de distritos ──────────────────────────── */
.map-drilldown {
  border-top: 1px solid var(--border-soft);
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  max-height: 260px;
  overflow-y: auto;
}

.dd-title {
  margin: 0 0 0.5rem 0;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.dd-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.dd-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition: background 0.15s ease;
}

.dd-row:hover { background: rgba(0, 158, 131, 0.06); }
.dd-row.is-selected { background: var(--green-mint); }
.dd-row.is-selected .dd-name { font-weight: 700; color: var(--green-deep); }

.dd-row.is-no-geom { opacity: 0.7; }

.no-geom-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 9px;
  background: #fde68a;
  color: #92400e;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.alias-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 9px;
  background: #dbeafe;
  color: #1e40af;
  border-radius: 3px;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.dd-row.is-via-alias {
  opacity: 0.92;
}

.dd-row-bg {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(to right, rgba(0, 158, 131, 0.10), rgba(0, 158, 131, 0.02));
  z-index: -1;
}

.dd-name {
  color: var(--text-strong);
  font-weight: 500;
  z-index: 1;
}

.dd-count {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-base);
  font-feature-settings: "tnum" 1;
  z-index: 1;
}

.dd-loading, .dd-error, .dd-empty {
  padding: 0.5rem 0.75rem;
  font-size: 12px;
  color: var(--text-muted);
}

.dd-error { color: #b91c1c; }
