/* ════════════════════════════════════════════════════════════
   SANGHELIOS · mapa.css
   Vista Mapa 3D: contenedor MapLibre, overlay con leyenda,
   lista de recogida en vivo, marcadores y popups.
   ════════════════════════════════════════════════════════════ */

#view-mapa { position: relative; }
#map3d { position: fixed; top: var(--nav-h); left: 0; right: 0; bottom: 0; }

/* ── Panel overlay ── */
.map-overlay {
  position: absolute; top: calc(var(--nav-h) + 20px); left: 20px; z-index: 600;
  width: 420px;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 18px; padding: 26px 28px;
  box-shadow: 0 10px 38px rgba(0,0,0,0.18);
}
.map-overlay-title { display: flex; align-items: center; gap: 11px; margin-bottom: 5px; }
.map-overlay-dot { width: 13px; height: 13px; border-radius: 50%; background: var(--red); animation: pulse-r 2s infinite; }
.map-overlay-name { font-size: 20px; font-weight: 800; letter-spacing: -0.3px; }
.map-overlay-addr { font-size: 14.5px; color: var(--text-muted); margin-bottom: 16px; }
.map-legend { display: flex; flex-direction: column; gap: 13px; border-top: 1px solid var(--border); padding-top: 16px; }
.mli { display: flex; align-items: center; gap: 12px; font-size: 15px; color: var(--text-secondary); }
.mli b { color: var(--text-primary); }
.mli-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; border: 2px solid white; box-shadow: 0 1px 4px rgba(0,0,0,0.3); }
.mli-emoji {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 17px; line-height: 1; border: 2.5px solid white;
  box-shadow: 0 2px 7px rgba(0,0,0,0.3); user-select: none;
}
.mli-pulse { animation: pulse-r 1.8s infinite; }
.map-overlay-foot { font-size: 11px; color: var(--text-muted); margin-top: 14px; line-height: 1.55; }

/* ── Lista "Recogida en vivo" ── */
.camp-list-label {
  font-size: 11.5px; font-weight: 700; letter-spacing: 1.3px; text-transform: uppercase;
  color: var(--text-muted); margin-top: 16px; padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 7px;
}
.camp-item { margin-top: 13px; }
.ci-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
.ci-name { font-size: 13.5px; font-weight: 700; }
.ci-tipo {
  font-size: 11.5px; font-weight: 800; color: var(--red);
  background: var(--red-soft); border-radius: 5px; padding: 2px 9px;
}
.ci-bar { height: 8px; border-radius: 4px; background: var(--bg-section); overflow: hidden; }
.ci-fill { height: 100%; border-radius: 4px; background: var(--red); transition: width .8s ease; }
.ci-meta { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }

/* ── Botones flotantes ── */
.map-actions { position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 600; display: flex; gap: 10px; }
.map-btn {
  font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 700;
  background: rgba(255,255,255,0.96); color: var(--text-primary);
  border: 1px solid var(--border-strong); border-radius: 50px;
  padding: 13px 24px; cursor: pointer; backdrop-filter: blur(10px);
  box-shadow: 0 6px 24px rgba(0,0,0,0.18);
  transition: all .2s; display: inline-flex; align-items: center; gap: 9px;
}
.map-btn:hover { border-color: var(--text-secondary); transform: translateY(-1px); }
.map-btn.primary { background: var(--red); color: white; border-color: var(--red); }
.map-btn.primary:hover { background: var(--red-hover); }

/* ── Marcadores (elementos HTML sobre MapLibre) ── */
.mk-hgm {
  width: 82px; height: 82px;
  background: var(--red); border-radius: 50% 50% 50% 12px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 26px rgba(191,18,18,0.55);
  border: 3.5px solid white; cursor: pointer;
  animation: pulse-r 2.2s infinite;
}
.mk-hgm .mk-hgm-ico {
  width: 58px; height: 58px; border-radius: 50%;
  background: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 36px; line-height: 1;
  box-shadow: inset 0 0 0 2px rgba(191,18,18,0.15);
}
/* Emojis centrados dentro de los marcadores */
.mk-hosp, .mk-camp, .mk-shelter, .mk-donation, .mk-affected, .mk-emergency {
  display: flex; align-items: center; justify-content: center;
  line-height: 1; user-select: none;
}
.mk-hosp {
  border-radius: 50%; background: var(--graphite);
  border: 2.5px solid white; box-shadow: 0 2px 10px rgba(31,41,55,0.45);
  cursor: pointer;
}
.mk-camp {
  width: 40px; height: 40px; border-radius: 50%; font-size: 21px;
  background: var(--red); border: 3px solid white;
  box-shadow: 0 4px 14px rgba(191,18,18,0.55);
  animation: pulse-r 1.6s infinite; cursor: pointer;
}
/* Campañas finalizadas: marcador gris, sin pulso */
.mk-camp.mk-camp-old {
  background: #9aa0a6; animation: none;
  box-shadow: 0 2px 8px rgba(31,41,55,0.4);
}

/* Flyer dentro del popup de campaña */
.popup-flyer {
  width: 210px; max-width: 100%; display: block; cursor: zoom-in;
  margin-top: 10px; border-radius: 10px;
  border: 1px solid #e6e0d6; box-shadow: 0 10px 22px -14px rgba(0,0,0,.5);
}

/* ── Popups MapLibre ── */
.maplibregl-popup-content {
  font-family: 'Inter', sans-serif; border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.2); padding: 12px 16px;
}
.popup-t { font-weight: 700; font-size: 12.5px; margin-bottom: 2px; }
.popup-s { color: var(--text-muted); font-size: 11px; }
.popup-n { font-size: 11px; font-weight: 700; color: var(--red); margin-top: 4px; }

/* ── Marcadores de escenario de desastre ── */
.mk-shelter {
  width: 40px; height: 40px; border-radius: 50%; font-size: 21px;
  background: #D97706; border: 3px solid white;
  box-shadow: 0 4px 14px rgba(217,119,6,0.55);
  animation: pulse-r 1.6s infinite; cursor: pointer;
}
.mk-donation {
  width: 34px; height: 34px; border-radius: 50%; font-size: 17px;
  background: var(--blue); border: 3px solid white;
  box-shadow: 0 4px 14px rgba(29,78,216,0.55);
  cursor: pointer;
}
.mk-affected {
  width: 38px; height: 38px; border-radius: 8px; font-size: 20px;
  background: #DC2626; border: 3px solid white;
  box-shadow: 0 4px 14px rgba(220,38,38,0.55);
  opacity: .9; cursor: pointer;
}
.mk-emergency {
  border-radius: 50%; background: #D97706;
  border: 2.5px solid white; box-shadow: 0 2px 10px rgba(217,119,6,0.45);
  cursor: pointer;
}

@keyframes pulse-a {
  0%   { box-shadow: 0 0 0 0 rgba(217,119,6,0.4); }
  70%  { box-shadow: 0 0 0 12px rgba(217,119,6,0); }
  100% { box-shadow: 0 0 0 0 rgba(217,119,6,0); }
}

@media (max-width: 880px) {
  .map-overlay { width: calc(100% - 36px); }
}

/* Leyenda como toggle de capas */
.mli-toggle { cursor: pointer; border-radius: 8px; padding: 2px 4px; margin: -2px -4px;
  transition: opacity .15s ease, background .15s ease; user-select: none; }
.mli-toggle:hover { background: var(--bg-section); }
.mli-toggle.mli-off { opacity: 0.32; filter: grayscale(70%); }
.mli-toggle.mli-off b { text-decoration: line-through; }
