/* -----------------------------------------
ROTATE DEVICE OVERLAY
----------------------------------------- */

#rotate-device-overlay{
    position: fixed;
    inset: 0;

    display: none;
    align-items: center;
    justify-content: center;

    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(6px);

    z-index: 10000;
}

/* contenedor */
.rotate-device-content{
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 14px;

    text-align: center;
    color: white;

    font-size: 0.95rem;
    line-height: 1.4;
}

/* icono */
.phone-icon{
    font-size: 6rem;
    opacity: 0.9;

    animation: phoneRotate 1.6s ease-in-out infinite;
}

.rotate-text{
    font-size: 1.4rem;
    line-height: 1.4;
}

/* animación teléfono */
@keyframes phoneRotate{

    0%{
        transform: rotate(0deg);
    }

    40%{
        transform: rotate(90deg);
    }

    60%{
        transform: rotate(90deg);
    }

    100%{
        transform: rotate(0deg);
    }

}

/* -----------------------------------------
MOSTRAR SOLO EN HORIZONTAL (MÓVIL / TABLET)
----------------------------------------- */

@media (max-width: 991px) and (orientation: landscape){

    #rotate-device-overlay{
        display: flex;
    }

}

/* ==========================================================
   MAPA 
   ========================================================== */


.map-wrapper {
  position: relative;     
  height: calc(100dvh - 90px);
}

#map {
  height: 100%;
  width: 100%;
}




/* ==========================================================
   MAPA – RESPONSIVE
   ========================================================== */

@media (min-width: 992px) {
  .bottom-sheet {
    display: none !important;
  }

  /* Posiciones base */
  .leaflet-top {
    top: 10px !important;
  }

  .leaflet-bottom {
    bottom: 20px !important;
  }


.leaflet-left {
  left: calc(1rem + clamp(320px, 25vw, 480px)) !important;
}

.leaflet-right {
  transition: right 0.35s ease-in-out;
}

/* Sidebar abierto */
.sidebar-open .leaflet-right {
  right: calc(1rem + clamp(320px, 25vw, 480px)) !important;
}

.sidebar-open .leaflet-left {
  left: calc(1rem + clamp(320px, 25vw, 480px)) !important;
}

/* Sidebar cerrado */
.sidebar-closed .leaflet-right {
  right: 1rem !important;
}


/* contenedor principal */
.sidebar-flex {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* TEXTO */
.intro-text {
  flex: 1 1 auto;     /* ocupa todo el espacio disponible */
  overflow-y: auto;   /* scroll SOLO aquí */
  padding: 0.5rem;
  text-align: justify;

}

.intro-text p {
    text-align: justify !important;
}



/* CAROUSEL */
.intro-carousel {
  flex: 0 0 auto;     /* NO crece */
  margin-top: 10px;
  padding-bottom: 10px;
}

}

@media (max-width: 991px ) {

   .scroll-pane-left {
    display: none !important;
  }

  .scroll-pane-right {
    display: none !important;
  }

  .leaflet-bottom {
    bottom: 120px  !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: fixed;
  top: calc(90px + 1rem);
  left: 1rem;
  width: clamp(320px, 25vw, 480px);
  height: calc(100vh - 90px - 2rem);
  border-radius: 0.5rem;
  z-index: 1040;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.scroll-pane-right {
  position: fixed;
  top: calc(90px + 1rem);
  right: 1rem;
  width: clamp(320px, 25vw, 480px);
  height: calc(100vh - 90px - 2rem);
  border-radius: 0.5rem;
  padding: 1rem;
  z-index: 1040;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  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.6s ease, transform 0.3s ease;
  touch-action: none;
}

.bottom-sheet.expanded {
  height: 65vh;
  height: 65dvh;
}


.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 */
.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 ---------- */



/* ---------- 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;
}


.symbology-icon {
    display: flex;
    align-items: center;
    justify-content: center; 
    /* background: rgb(17, 49, 233); */
    transform: translateY(-2px);
}



/* ---------- CONTENEDOR DEL ICONO ---------- */
.map-icon {
  position: relative;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: visible; /*  clave para que se vea la sombra */
}

/* ---------- SOMBRA (elipse inferior) ---------- */
.map-icon::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 50%;
  width: 20px;
  height: 6px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 50%;
  transform: translateX(-50%);
  filter: blur(2px);
  z-index: 0;
  pointer-events: none;
}

/* ---------- WRAPPER INTERNO ---------- */
.resource-icon-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1; /*  por encima de la sombra */
}

/* ---------- IMG DEL ICONO ---------- */
.resource-icon {
  width: 85%;
  height: 85%;
  object-fit: contain;
  display: block;
}



.infra-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 18px;
    height: 18px;

    line-height: 1;
    background: rgb(255, 255, 255);
    border-radius: 10%;

    box-shadow: 0 1px 3px rgba(0,0,0,0.35);

    font-size: 12px;
    color: #343a40;
}


/* ===== VISIBILIDAD ===== */
.help-mobile {
  display: none;
}

@media (max-width: 992px) {
  .help-desktop {
    display: none;
  }

  .help-mobile {
    display: block;
  }
}

/* ===== AJUSTE MOBILE SIN SCROLL ===== */
@media (max-width: 992px) {

  #helpModal .modal-body {
    height: calc(100vh - 80px); /* ajustable */
    overflow: hidden;
  }

  #helpModal .help-mobile .carousel,
  #helpModal .help-mobile .carousel-inner,
  #helpModal .help-mobile .carousel-item {
    height: 100%;
  }

  #helpModal .help-mobile img {
    height: 100%;
    width: 100%;
    object-fit: contain;
  }

}

/* ===== FLECHAS VISIBLES (AMBOS) ===== */
#helpModal .carousel-control-prev-icon,
#helpModal .carousel-control-next-icon {
  filter: invert(1) drop-shadow(0 0 5px rgba(0,0,0,0.9));
}




/* =============== UBICACION ============== */

.user-location-marker {
  position: relative;
  width: 20px;
  height: 20px;
}

.location-white {
  position: absolute;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
}

.location-blue {
  position: absolute;
  width: 14px;
  height: 14px;
  background: #2a93ee;
  border-radius: 50%;
  top: 3px;
  left: 3px;

  animation: locationPulse 3s ease-in-out infinite;
}


@keyframes locationPulse {

  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.25);
  }

  100% {
    transform: scale(1);
  }

}



/* ============= CAROUSEL =============== */
.carousel-continuous {
  width: 100%;
  overflow: hidden;
}

.carousel-track {
  display: flex;
  width: max-content;

  animation: scrollCarousel 90s linear infinite;
}

/* cada slide */
.carousel-slide {
  flex: 0 0 auto;
}

.carousel-slide img {
  height: 150px;    
  width: auto;
  object-fit: cover;
  display: block;
}

@keyframes scrollCarousel {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}
