/* Leaflet + SAPSC map blocks (reemplazo de embeds Atlist) */

/*
 * Tipografía del mapa vs sitio (checklist doc 16):
 * En sapsc.main.css los selectores globales `p` y `li` usan 18px (paridad respaldo producción).
 * Aquí se fuerza 15px solo dentro del bloque `.sapsc-leaflet-map` (panel, canvas Leaflet y popups),
 * con mayor especificidad que `p`/`li` global — no hace falta cambiar <p> por otro tag si el HTML
 * del popup vive bajo este contenedor (Leaflet suele renderizar el popup dentro del mapa).
 */
.sapsc-leaflet-map .leaflet-popup-content p,
.sapsc-leaflet-map .leaflet-popup-content li,
.sapsc-leaflet-map .leaflet-popup-content .sapsc-popup-richtext p,
.sapsc-leaflet-map .leaflet-popup-content .sapsc-popup-richtext li {
  font-size: 15px;
  line-height: 1.5;
}

.sapsc-leaflet-map .leaflet-popup-content li {
  font-weight: 500;
}

.sapsc-leaflet-map .sapsc-map-ui p,
.sapsc-leaflet-map .sapsc-map-ui li {
  font-size: 15px;
}

.sapsc-leaflet-map {
  width: 100%;
  min-height: 320px;
  border-radius: 4px;
  overflow: hidden;
  background: #e8eef2;
}

.sapsc-map-host {
  position: relative;
}

.sapsc-map-canvas {
  position: absolute;
  inset: 0;
}

.sapsc-leaflet-map .leaflet-container {
  width: 100%;
  height: 100%;
  min-height: inherit;
  font-family: inherit;
  z-index: 5;
}

.sapsc-map-ui {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 650;
  width: min(340px, calc(100% - 28px));
  background: rgba(255, 255, 255, 0.96);
  border-radius: 10px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(17, 24, 39, 0.12);
}

.sapsc-map-ui-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
}

.sapsc-map-ui-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #24324a;
  padding: 0.65rem 0.25rem 0.3rem 0.8rem;
}

.sapsc-map-ui-toggle {
  border: 0;
  background: rgba(37, 99, 235, 0.12);
  color: #1e3a8a;
  border-radius: 6px;
  width: 24px;
  height: 24px;
  margin-right: 0.65rem;
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
}

.sapsc-map-ui-toggle:hover {
  background: rgba(37, 99, 235, 0.18);
}

.sapsc-map-ui-toggle:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.55);
  outline-offset: 1px;
}

.sapsc-map-ui.is-collapsed .sapsc-map-search-wrap,
.sapsc-map-ui.is-collapsed .sapsc-map-list-wrap {
  display: none;
}

.sapsc-map-search-wrap {
  position: relative;
  padding: 0.1rem 0.55rem 0.35rem;
}

.sapsc-map-search-wrap::before {
  content: "";
  position: absolute;
  left: 0.95rem;
  top: 50%;
  width: 0.9rem;
  height: 0.9rem;
  transform: translateY(-50%);
  pointer-events: none;
  opacity: 0.9;
  background: no-repeat center / contain url("../images/favicon.png");
}

.sapsc-map-search {
  width: 100%;
  border: 1px solid rgba(37, 99, 235, 0.25);
  border-radius: 8px;
  padding: 0.46rem 0.6rem 0.46rem 2.05rem;
  font-size: 0.79rem;
  color: #0f172a;
  background: #fff;
}

.sapsc-map-search:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.14);
}

.sapsc-map-list-wrap {
  max-height: 210px;
  overflow-y: auto;
  padding: 0.2rem 0.45rem 0.45rem;
}

.sapsc-map-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sapsc-map-list-item + .sapsc-map-list-item {
  margin-top: 0.2rem;
}

.sapsc-map-list-btn {
  width: 100%;
  display: flex;
  flex-direction: column;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 7px;
  cursor: pointer;
  padding: 0.4rem 0.5rem;
}

.sapsc-map-list-btn:hover {
  background: rgba(37, 99, 235, 0.08);
}

.sapsc-map-list-btn:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.55);
  outline-offset: 1px;
  background: rgba(37, 99, 235, 0.1);
}

.sapsc-map-list-btn.is-active {
  background: rgba(30, 58, 138, 0.12);
}

.sapsc-map-list-name {
  font-size: 0.83rem;
  font-weight: 700;
  line-height: 1.2;
  color: #0f172a;
}

.sapsc-map-list-address {
  font-size: 0.74rem;
  line-height: 1.2;
  color: #475569;
  margin-top: 0.15rem;
}

.sapsc-map-empty {
  display: block;
  font-size: 0.76rem;
  color: #64748b;
  text-align: center;
  padding: 0.45rem 0.35rem 0.2rem;
}

/* Popup: densidad tipo referencia Atlist (tipografia compacta) */
.sapsc-popup-card.sapsc-popup-card--compact {
  letter-spacing: 0;
  font-size: 0.75rem;
  line-height: 1.22;
  color: #1f2937;
}

.sapsc-popup-card.sapsc-popup-card--compact .sapsc-popup-image-wrap {
  margin: -3px -3px 0.28rem -3px;
  border-radius: 7px;
  overflow: hidden;
}

.sapsc-popup-card.sapsc-popup-card--compact .sapsc-popup-image {
  display: block;
  width: 100%;
  height: 88px;
  object-fit: cover;
}

.sapsc-popup-card.sapsc-popup-card--compact .sapsc-popup-name {
  font-size: 0.9375rem;
  line-height: 1.12;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 0.18rem;
}

.sapsc-popup-card.sapsc-popup-card--compact .sapsc-popup-name strong {
  font-weight: 700;
}

.sapsc-popup-card.sapsc-popup-card--compact .sapsc-popup-address {
  font-size: 0.6875rem;
  line-height: 1.18;
  color: #4b5563;
  margin: 0 0 0.28rem;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.sapsc-company-marker-icon {
  background: #ffffff;
  border: 1px solid rgba(30, 64, 175, 0.26);
  border-radius: 999px;
  box-sizing: border-box;
  padding: 4px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
}

.sapsc-generic-marker-icon {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.28));
}

.sapsc-popup-card.sapsc-popup-card--compact .sapsc-popup-notes {
  font-size: 0.75rem;
  line-height: 1.22;
  color: #1f2937;
  max-height: 36vh;
  overflow: auto;
}

.sapsc-popup-card.sapsc-popup-card--compact .sapsc-popup-richtext {
  font-size: inherit;
  line-height: inherit;
  color: inherit;
}

.sapsc-popup-card.sapsc-popup-card--compact .sapsc-popup-richtext h1,
.sapsc-popup-card.sapsc-popup-card--compact .sapsc-popup-richtext h2,
.sapsc-popup-card.sapsc-popup-card--compact .sapsc-popup-richtext h3,
.sapsc-popup-card.sapsc-popup-card--compact .sapsc-popup-richtext h4,
.sapsc-popup-card.sapsc-popup-card--compact .sapsc-popup-richtext h5,
.sapsc-popup-card.sapsc-popup-card--compact .sapsc-popup-richtext h6 {
  margin: 0.06rem 0 0.14rem;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.2;
  color: #111827;
}

.sapsc-popup-card.sapsc-popup-card--compact .sapsc-popup-richtext p {
  margin: 0.05rem 0 0.12rem;
}

.sapsc-popup-card.sapsc-popup-card--compact .sapsc-popup-richtext ul,
.sapsc-popup-card.sapsc-popup-card--compact .sapsc-popup-richtext ol {
  padding-left: 0.85rem;
  margin: 0.08rem 0 0.12rem;
}

.sapsc-popup-card.sapsc-popup-card--compact .sapsc-popup-richtext li {
  margin: 0;
  padding: 0.04rem 0;
}

.sapsc-popup-card.sapsc-popup-card--compact .sapsc-popup-richtext strong {
  color: #111827;
  font-weight: 700;
}

.sapsc-leaflet-map .leaflet-popup-content-wrapper {
  border-radius: 10px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.22);
  padding: 3px 4px;
}

.sapsc-leaflet-map .leaflet-popup-content {
  margin: 5px 7px;
  min-width: 220px;
  max-width: 278px;
  font-family: "Mulish", "Inter", system-ui, sans-serif;
  font-size: 0.75rem;
  line-height: 1.22;
  color: #1f2937;
}

.sapsc-map-error {
  padding: 1rem;
  color: #721c24;
  background: #f8d7da;
  border-radius: 4px;
}

@media (max-width: 767px) {
  .sapsc-map-ui {
    width: auto;
    left: 10px;
    right: 10px;
    top: auto;
    bottom: 10px;
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  }

  .sapsc-map-ui.is-mobile .sapsc-map-ui-title {
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
  }

  .sapsc-map-ui.is-mobile .sapsc-map-search-wrap {
    padding-top: 0.15rem;
  }

  .sapsc-map-ui.is-mobile .sapsc-map-list-wrap {
    max-height: 35vh;
  }

  .sapsc-map-list-wrap {
    max-height: 150px;
  }
}
