/* ================================================================
   Mapa de la agenda: al lado de los planes; en pantallas estrechas,
   una tira que se abre a pantalla completa
================================================================ */

.ag-side {
  position: sticky; top: calc(var(--navbar-h) + 16px); height: calc(100vh - var(--navbar-h) - 32px); margin-top: 28px;
}
.ag-map-wrap { position: relative; isolation: isolate; height: 100%; }   /* los z-index de Leaflet no pasan por encima del menú */
.ag-map-btn { display: none; }

.mp-map { height: 100%; border-radius: 24px; overflow: hidden; background: var(--bg-2); z-index: 0; }
.mp-map img { max-width: none; max-height: none; }   /* el reset de style.css deforma los mosaicos de Leaflet */
.mp-follow {
  position: absolute; top: 14px; left: 14px; z-index: 500; display: flex; align-items: center; gap: 8px;
  background: var(--bg-card); color: var(--text); border-radius: 12px; padding: 10px 14px;
  font-size: 14px; font-weight: 600; box-shadow: 0 4px 12px rgba(15,23,42,.15); cursor: pointer;
}
.mp-follow input { width: 18px; height: 18px; accent-color: var(--primary); margin: 0; }
.mp-map .leaflet-top.leaflet-left { top: 56px; }
.mp-map .leaflet-control-attribution { font-size: 10px; background: color-mix(in srgb, var(--bg-card) 80%, transparent); color: var(--mid); }
.mp-map .leaflet-control-attribution a { color: inherit; }

/* Puntos y grupos */
.mp-pin span {
  display: block; width: 20px; height: 20px; margin: 3px; border-radius: 50%;
  border: 3px solid #fff; box-shadow: 0 2px 8px rgba(15,23,42,.35); box-sizing: border-box;
}
.mp-pin.is-approx span { border-style: dashed; opacity: .85; }
.mp-pin.is-hot span { transform: scale(1.45); box-shadow: 0 0 0 4px rgba(15,118,110,.35); }
.mp-map .mp-cluster.is-hot { box-shadow: 0 0 0 5px rgba(15,118,110,.45); }
/* .mp-map delante: leaflet.css (cargado después) pone display: block a los iconos */
.mp-map .mp-cluster {
  display: grid; place-items: center; box-sizing: border-box; border-radius: 50%; background: #0F172A; color: #fff;
  border: 3px solid #fff; box-shadow: 0 6px 16px rgba(15,23,42,.25); font: 700 14px/1 'Poppins', sans-serif;
}
:root[data-theme="dark"] .mp-map .mp-cluster { background: #2DD4BF; color: #04201C; border-color: #0B1220; }
.mp-pop { display: flex; flex-direction: column; gap: 4px; font-family: 'Poppins', sans-serif; min-width: 180px; }
.mp-pop small { font-size: 12px; font-weight: 600; color: #0F766E; }
.mp-pop a { font-size: 15px; font-weight: 600; color: #0F172A; line-height: 1.3; }
.mp-pop em { font-size: 12px; font-style: normal; color: #64748B; }
.mp-map .leaflet-popup-content-wrapper { border-radius: 14px; }

/* Botones +/− con los colores del tema */
.mp-map .leaflet-bar { border: 0; box-shadow: 0 4px 12px rgba(15,23,42,.15); border-radius: 12px; overflow: hidden; }
.mp-map .leaflet-bar a { background: var(--bg-card); color: var(--text); border-bottom-color: var(--border); width: 36px; height: 36px; line-height: 36px; }
.mp-map .leaflet-bar a:hover { background: var(--bg-2); }

@media (max-width: 1000px) {
  .ag-side { position: relative; top: auto; height: 180px; margin-top: 16px; order: -1; }
  .ag-map-wrap:not(.is-open) .mp-follow, .ag-map-wrap:not(.is-open) .leaflet-control-zoom { display: none; }
  .ag-map-btn {
    position: absolute; z-index: 600; display: flex; align-items: flex-end; justify-content: center;
    border: 0; background: none; font: inherit; cursor: pointer; padding: 0;
  }
  .ag-map-btn span {
    padding: 10px 16px; border-radius: 999px; background: var(--bg-card); color: var(--text);
    font-size: 14px; font-weight: 600; box-shadow: 0 4px 12px rgba(15,23,42,.25);
  }
  .ag-map-btn:focus-visible span { outline: 2px solid var(--accent-text); outline-offset: 2px; }
  /* Toda la tira es el botón: así arrastrar por encima mueve la página, no el mapa */
  .ag-map-btn.is-open-btn { inset: 0; padding-bottom: 12px; border-radius: 24px; }
  .ag-map-btn.is-close-btn { display: none; left: 0; right: 0; bottom: calc(24px + env(safe-area-inset-bottom)); margin: 0 auto; width: max-content; }
  .ag-map-wrap.is-open { position: fixed; inset: 0; z-index: 1100; height: auto; background: var(--bg); }
  .ag-map-wrap.is-open .mp-map { border-radius: 0; }
  .ag-map-wrap.is-open .is-open-btn { display: none; }
  .ag-map-wrap.is-open .is-close-btn { display: flex; }
  .ag-map-lock, .ag-map-lock body { overflow: hidden; }
}
