/* =============================================================
   CultoRD — mapa.css
   Toolbar de búsqueda + contenedor Leaflet + popup styling.
   ============================================================= */

/* Toolbar superior: búsqueda + contador de resultados */
.mapa-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.mapa-search {
  position: relative;
  flex: 1 1 320px;
  min-width: 260px;
  max-width: 520px;
  display: flex;
  align-items: center;
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 999px;
  padding: 0 14px 0 44px;
  height: 46px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.mapa-search:focus-within {
  border-color: #2563EB;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
.mapa-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  pointer-events: none;
}
.mapa-search input {
  flex: 1;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  color: #111827;
}
.mapa-search input::placeholder {
  color: #9CA3AF;
  font-weight: 500;
}
.mapa-search-clear {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #D1D5DB;
  color: #FFFFFF;
  border: none;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  margin-left: 6px;
}

.mapa-meta {
  font-size: 13px;
  font-weight: 700;
  color: #4B5563;
  padding: 6px 14px;
  border-radius: 999px;
  background: #F3F4F6;
}

/* Contenedor del mapa: "aire" en los 4 lados vía padding del container
   + ancho máximo + bordes redondeados + shadow suave. */
.mapa-wrap {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
}
#mapa {
  width: 100%;
  height: clamp(420px, 70vh, 680px);
  border-radius: 18px;
  overflow: hidden;
  box-shadow:
    0 1px 2px rgba(0,0,0,0.04),
    0 12px 40px -18px rgba(0,0,0,0.18);
  border: 1px solid #E5E7EB;

  /* Aísla el stacking-context. Leaflet usa internamente z-index 200-700
     en sus panes (tiles, markers, popups). Sin `isolation: isolate`
     esos z-index compiten contra el header fijo (z-40 de Tailwind) y
     lo tapan al hacer scroll. Creando un contexto aquí, todo lo de
     Leaflet queda contenido. */
  position: relative;
  isolation: isolate;
  z-index: 0;
}

/* Popup custom: card minimalista con nombre + CTA "Visitar" */
.leaflet-popup-content-wrapper {
  border-radius: 14px !important;
  padding: 0 !important;
  box-shadow: 0 12px 30px -12px rgba(0,0,0,0.22) !important;
}
.leaflet-popup-content {
  margin: 14px 16px !important;
  font-family: inherit !important;
  line-height: 1.35 !important;
  min-width: 220px;
}
.leaflet-popup-tip { background: #FFFFFF; }

.popup-title {
  font-size: 15px;
  font-weight: 900;
  color: #111827;
  margin: 0 0 4px;
  line-height: 1.3;
}
.popup-cat {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #6B7280;
  margin: 0;
}
.popup-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #FEF3C7;
  color: #92400E;
}
.popup-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}
.popup-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease;
  font-family: inherit;
  border: none;
  white-space: nowrap;
}
.popup-btn-primary {
  background: #2563EB;
  color: #FFFFFF !important;
}
.popup-btn-primary:hover { background: #1E4ED8; }
.popup-btn-primary:active { transform: scale(0.98); }

/* Marker custom (usa un pin SVG azul en vez del default) */
.cultord-marker {
  background: transparent;
  border: none;
}
.cultord-marker-inner {
  width: 28px;
  height: 36px;
  position: relative;
  filter: drop-shadow(0 4px 6px rgba(30,64,175,0.3));
}

/* Empty state cuando la búsqueda no devuelve nada */
.mapa-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.85);
  color: #6B7280;
  font-weight: 700;
  font-size: 14px;
  pointer-events: none;
  z-index: 500;
  opacity: 0;
  transition: opacity 140ms ease;
}
.mapa-empty.show { opacity: 1; }
