
/* ==========================================================
   MAPA – RESPONSIVE
   ========================================================== */

@media (min-width: 900px) {
  .bottom-sheet {
    display: none !important;
  }

  /* Posiciones base */
  .leaflet-top {
    top: 10px !important;
  }

  .leaflet-bottom {
    bottom: 20px !important;
  }

  .leaflet-left {
    left: 26vw !important;
  }

  .leaflet-right {
    transition: right 0.35s ease-in-out;
  }

  /* Sidebar abierto */
  .sidebar-open .leaflet-right {
    right: 26vw !important;
  }

  .sidebar-open .leaflet-left {
    left: 26vw !important;
  }

  /* Sidebar cerrado */
  .sidebar-closed .leaflet-right {
    right: 1vw !important;
  }

  .sidebar-closed .leaflet-left {
    left: 26vw !important;
  }
}

@media (max-width: 900px ) {

   .scroll-pane-left {
    display: none !important;
  }

  .scroll-pane-right {
    display: none !important;
  }

  .leaflet-bottom {
    bottom: 170px  !important;
    /* bottom-sheet+10px */
  }
}


/* ==========================================================
   MAPA – OVERLAY / ESTADOS DE CARGA
   ========================================================== */


.loading-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.4);
  pointer-events: none;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.5s ease;
  color: rgba(var(--primary-rgb), 0.6);
}

.loading-overlay.initial {
  z-index: 1000;
  opacity: 1;
}

.loading-overlay.background-mode {
  z-index: 0;
  opacity: 1;
}


/* ==========================================================
   MAPA – ACCORDION / PANELES INTERNOS
   ========================================================== */

.accordion-button {
  background-color: rgba(var(--primary-rgb), 0.4);
  color: var(--color-texto);
  /* backdrop-filter: blur(6px); */
  /* -webkit-backdrop-filter: blur(6px); */
  border: none;
  box-shadow: none;
  transition: background-color 0.3s ease;
}

/* Hover cuando está cerrado */
.accordion-button.collapsed:hover {
  background-color: rgba(var(--primary-rgb), 0.6);
  color: #fff;
}

/* Hover cuando está abierto */
.accordion-button:not(.collapsed):hover {
  background-color: rgba(var(--primary-rgb), 0.4);
  color: #fff;
}
.accordion-button:not(.collapsed) {
  background-color: rgba(var(--primary-rgb), 0.8);
  color: #fff;
  font-weight: bold;
}

.accordion-button:focus {
  box-shadow: none;
  outline: none;
}

.accordion-button.collapsed::after {
  filter: brightness(0) saturate(0%) opacity(0.6);
}

.accordion-button:not(.collapsed)::after {
  filter: brightness(0) saturate(100%) invert(1);
}

/* Asegura que el contenido no quede recortado */
.accordion-body {
  overflow: visible;
}


/* ==========================================================
   MAPA – BOTONES Y ESTADOS VISUALES
   ========================================================== */

.btn-ghost {
  background: none;
  border: none;
  margin: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.result-active {
  background-color: rgba(var(--primary-rgb), 0.2);
  border-left: 4px solid rgb(var(--primary-rgb));
}


/* ==========================================================
   MAPA – MODALES Y STACKING CONTEXT
   ========================================================== */
/* ⚠️ Z-INDEX CRÍTICO: revisar al final */


/* Modal del carrusel */
#carouselModal {
  z-index: 2000 !important;
}

/* Backdrop del carrusel */
#carouselModal + .modal-backdrop {
  z-index: 1990 !important;
}


/* ==========================================================
   MAPA – SCROLLBARS PERSONALIZADOS
   ========================================================== */

.custom-scrollbar {
  overflow: auto;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}


/* Leyendas */
.legend-scroll-wrapper {
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}


/* ==========================================================
   MAPA – EFECTOS VISUALES (FROSTED / GLASS)
   ========================================================== */

.frosted {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.frosted div {
  background: none;
  color: inherit;
  backdrop-filter: none;
}


/* ==========================================================
   MAPA – PANELES LATERALES (DESKTOP)
   ========================================================== */

.scroll-pane-left {
  position: absolute;
  top: 12vh;
  left: 1rem;
  width: 25vw;
  height: 86vh;
  border-radius: 0.5rem;
  z-index: 1040; /* ⚠️ stacking con modales */
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.scroll-pane-right {
  position: fixed;
  top: 12vh;
  right: 1rem;
  width: 25vw;
  height: 86vh;
  border-radius: 0.5rem;
  padding: 1rem;
  z-index: 1040;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateX(99%);
  transition: transform 0.35s ease-in-out;
}

.scroll-pane-right.visible {
  transform: translateX(0);
}


/* Botón lateral de apertura */
.edge-btn {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  width: 20px;
  height: 60px;
  background: none;
  border: none;
  color: #6b6b6b;
  cursor: pointer;
  z-index: 1045; /* ⚠️ sobre panel */
  display: flex;
  align-items: center;
  justify-content: center;
}

.edge-btn:hover {
  background: rgba(183, 183, 185, 0.95);
}


/* ==========================================================
   MAPA – TRANSICIONES DE VISTAS (INTRO / DETALLE)
   ========================================================== */

.fade-section {
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.fade-section.visible {
  opacity: 1;
  pointer-events: auto;
  z-index: 1;
}

.close-detail-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  background: rgba(255,255,255,0.8);
  border: none;
  border-radius: 4px;
  font-size: 1.1rem;
  width: 28px;
  height: 28px;
  cursor: pointer;
  z-index: 10;
}


/* ==========================================================
   MAPA – TABS INTERNOS
   ========================================================== */

.tab-content-wrapper {
  position: relative;
  flex: 1;
}

.tab-pane-scroll {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 1rem;
  display: none;
}

.tab-pane-scroll.active {
  display: block;
}


.tab-left {
  padding: 0;
  margin: 0;
}


.nav-tabs .nav-link {
  background-color: transparent;
  color: var(--color-texto); /* opcional */
}

.nav-tabs .nav-link.active {
  background-color: transparent;
  color: var(--color-texto);
  font-weight: bold; /* opcional */
}



/* ==========================================================
   MAPA – BOTTOM SHEET (MÓVIL)
   ========================================================== */

.bottom-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 110px;
  background: #fff;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15);
  z-index: 1045; /* ⚠️ alto */
  overflow: hidden;
  transform: translateY(0);
  transition: height 0.3s ease, transform 0.3s ease;
  touch-action: none;
}

.bottom-sheet.expanded {
  height: 65vh;
}

.drag-handle {
  width: 40px;
  height: 5px;
  background-color: #ccc;
  border-radius: 3px;
  margin: 8px auto;
  cursor: grab;
}

.drag-handle.active {
  background-color: #2ecc71;
}


/* Contenido del sheet */
.bottom-sheet-content,
.sheet-content {
  padding: 0 1rem;
  height: calc(100% - 30px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}


/* Fondo oscuro del sheet */
/* ⚠️ nombre genérico, revisar al final */
.backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.25);
  display: none;
  z-index: 1040;
  pointer-events: auto;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.backdrop.active {
  display: block;
  opacity: 1;
}





/* ==========================================================
   MAPA – LEAFLET: CONTROLES, POPUPS Y UI
   ========================================================== */

/* ---------- Attribution ---------- */

.leaflet-control-attribution {
  max-width: 200px;          /* limita ancho */
  white-space: normal;       /* permite varias líneas */
  overflow: hidden;
  text-overflow: ellipsis;   /* opcional */
}


/* ---------- Popups ---------- */

.leaflet-popup-content {
  max-height: 300px;         /* evita popups gigantes */
  overflow-y: auto;
  margin: 8px 12px;
}

.leaflet-popup-content-wrapper {
  background-color: rgba(255, 255, 255, 0.85) !important;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: none;
}

.leaflet-popup-tip {
  background-color: rgba(255, 255, 255, 0.85) !important;
}


/* ---------- Control de capas ---------- */

.leaflet-control-layers {
  background-color: rgba(255, 255, 255, 0.6) !important;
  border-radius: 6px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.leaflet-control-layers-expanded {
  background-color: rgba(255, 255, 255, 0.8) !important;
}

.leaflet-control-layers-list {
  color: black;
  padding: 5px;
}

.leaflet-control-layers-separator {
  border-top: 1px solid rgba(0, 0, 0, 0.2);
  margin: 4px 0;
}


/* ---------- Controles Leaflet (zoom, etc.) ---------- */

.leaflet-bar a {
  background-color: rgba(255, 255, 255, 0.6) !important;
  color: black !important;
  border: 1px solid rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
  transition: background-color 0.3s ease;
}

.leaflet-bar a:hover {
  background-color: rgba(255, 255, 255, 0.85) !important;
}





/* ==========================================================
   MAPA – CLUSTERS DE MARKERS
   ========================================================== */

.marker-cluster {
  background-color: #496049 !important;
  border: 2px solid #ffffff !important;
  border-radius: 50% !important;
  color: #ffffff !important;
  font-weight: 600;
  font-size: 13px;
  width: 30px !important;
  height: 30px !important;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.marker-cluster div {
  background: none !important;
  border: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background-color: #768776 !important;
  border: 2px solid #ffffff !important;
  color: #ffffff !important;
}


