.mapa-page { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.mapa-page .map-hero {
  padding: 18px 24px 16px;
  flex-shrink: 0;
}
.mapa-page .map-hero h1 { font-size: 18px; margin-bottom: 12px; }
.mapa-page .map-hero .hero-inner { max-width: 560px; margin: 0; }

/* ── MAP CONTROLS ──────────────────────────────────────────────── */
.map-controls {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  height: 46px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.map-controls-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.mc-group {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.mc-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}

.map-tipo-btn {
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.map-tipo-btn:hover { border-color: var(--accent); color: var(--accent); }
.map-tipo-btn.active { background: var(--accent); border-color: var(--accent); color: white; }

.mc-reset {
  font-size: 12px;
  font-family: inherit;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all .15s;
}
.mc-reset:hover { border-color: var(--red); color: var(--red); }

/* ── MAP CONTAINER (standalone mapa.html) ──────────────────────── */
#map {
  flex: 1;
  width: 100%;
  min-height: 0;
}

/* ── MAP CONTAINER (inline en index.html) ──────────────────────── */
.results-map-container {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  height: calc(100vh - 260px);
  min-height: 480px;
  width: 100%;
}

/* ── NAVBAR VIEW TOGGLE ────────────────────────────────────────── */
.nav-views {
  display: flex;
  gap: 0;
}

.nav-view-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  transition: all .12s;
  user-select: none;
  border: 1px solid #c8cdd6;
  /* raised — not selected */
  background: linear-gradient(180deg, #ffffff 0%, #f1f4f8 100%);
  box-shadow: 0 1px 2px rgba(0,0,0,.14);
  color: #374151;
}

.nav-view-link:first-child {
  border-radius: 5px 0 0 5px;
  border-right: none;
}

.nav-view-link:last-child {
  border-radius: 0 5px 5px 0;
}

.nav-view-link.active {
  /* sunken — selected */
  background: #d4d8df;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.22), inset 0 1px 1px rgba(0,0,0,.12);
  border-color: #b8bdc6;
  color: #374151;
  font-weight: 600;
}

/* ── MARKERS ───────────────────────────────────────────────────── */
.map-marker {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: conic-gradient(var(--mc) var(--pct, 80%), #e7e5e4 0);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.18));
  transition: transform .15s;
}
.map-marker:hover { transform: scale(1.12); }

.map-marker-in {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 11px;
  color: var(--mc);
}

/* ── POPUP ─────────────────────────────────────────────────────── */
.tc-popup .leaflet-popup-content-wrapper {
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  border: 1px solid var(--border);
  padding: 0;
  overflow: hidden;
}

.tc-popup .leaflet-popup-content {
  margin: 0;
  width: auto !important;
}

.tc-popup .leaflet-popup-tip-container { display: none; }

.mp-wrap { padding: 16px; min-width: 260px; max-width: 300px; }

.mp-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.mp-ring {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mp-ring-in {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
}

.mp-title { flex: 1; min-width: 0; }

.mp-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 2px;
}

.mp-loc { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 3px; flex-wrap: wrap; }

.mp-areas {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 10px;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  padding: 7px 0;
}

.mp-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin-bottom: 12px;
}

.mp-kpi {
  text-align: center;
  border-right: 1px solid var(--border-light);
  padding: 4px 2px;
}
.mp-kpi:last-child { border-right: none; }

.mp-kv { display: block; font-size: 15px; font-weight: 700; color: var(--text); }
.mp-kl { display: block; font-size: 9px; color: var(--text-light); text-transform: uppercase; letter-spacing: .03em; }

.mp-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  padding: 8px;
  background: var(--accent);
  color: white;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  text-decoration: none;
  transition: background .15s;
}
.tc-popup .mp-btn:hover { background: #1d4ed8; color: white; }

/* ── LEGEND ────────────────────────────────────────────────────── */
.map-legend {
  position: absolute;
  bottom: 30px;
  left: 16px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 12px;
  z-index: 1000;
  box-shadow: var(--shadow);
  min-width: 170px;
  white-space: nowrap;
}
.map-legend-title { font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; font-size: 10px; }
.map-legend-item { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; color: var(--text-muted); }
.map-legend-item:last-child { margin-bottom: 0; }
.map-legend-dot { width: 13px; height: 13px; border-radius: 50%; flex-shrink: 0; }

@media (max-width: 600px) {
  .map-controls-inner { gap: 10px; }
  .mc-label { display: none; }
}
