        .bd-placeholder-img {
            font-size: 1.125rem;
            text-anchor: middle;
            -webkit-user-select: none;
            -moz-user-select: none;
            user-select: none;
        }

        @media (min-width: 768px) {
            .bd-placeholder-img-lg {
                font-size: 3.5rem;
            }
        }

        .b-example-divider {
            width: 100%;
            height: 3rem;
            background-color: rgba(0, 0, 0, .1);
            border: solid rgba(0, 0, 0, .15);
            border-width: 1px 0;
            box-shadow: inset 0 .5em 1.5em rgba(0, 0, 0, .1), inset 0 .125em .5em rgba(0, 0, 0, .15);
        }

        .b-example-vr {
            flex-shrink: 0;
            width: 1.5rem;
            height: 100vh;
        }

        .bi {
            vertical-align: -.125em;
            fill: currentColor;
        }

        .nav-scroller {
            position: relative;
            z-index: 2;
            height: 2.75rem;
            overflow-y: hidden;
        }

        .nav-scroller .nav {
            display: flex;
            flex-wrap: nowrap;
            padding-bottom: 1rem;
            margin-top: -1px;
            overflow-x: auto;
            text-align: center;
            white-space: nowrap;
            -webkit-overflow-scrolling: touch;
        }

        .btn-bd-primary {
            --bd-violet-bg: #712cf9;
            --bd-violet-rgb: 112.520718, 44.062154, 249.437846;

            --bs-btn-font-weight: 600;
            --bs-btn-color: var(--bs-white);
            --bs-btn-bg: var(--bd-violet-bg);
            --bs-btn-border-color: var(--bd-violet-bg);
            --bs-btn-hover-color: var(--bs-white);
            --bs-btn-hover-bg: #6528e0;
            --bs-btn-hover-border-color: #6528e0;
            --bs-btn-focus-shadow-rgb: var(--bd-violet-rgb);
            --bs-btn-active-color: var(--bs-btn-hover-color);
            --bs-btn-active-bg: #5a23c8;
            --bs-btn-active-border-color: #5a23c8;
        }

        .bd-mode-toggle {
            z-index: 1500;
        }

        .bd-mode-toggle .dropdown-menu .active .bi {
            display: block !important;
        }
    .list-group-item {
        font-size: 0.8rem;
        padding: 0.3rem 0.5rem;
    }
    .color-indicator {
        display: inline-block;
        width: 20px;
        min-width: 20px;
        height: 20px;
        margin-right: 10px;
        background-clip: content-box; /* Para que el color no tenga bordes */
        border: none; /* Eliminar bordes */
    }
    html, body {
            height: 100%;
            margin: 0;
            padding: 0;
        }

        #map {
            position: absolute;
            top: 0;
            bottom: 0;
            width: 100%;
            height: 100%;
            z-index: 1;
        }

        .container-fluid, .row {
            height: calc(100% - 48px);
            margin: 0;
            padding: 0;
        }

        .sidebar {
            height: calc(100vh - 48px);
            overflow-y: auto;
            position: relative;
            z-index: 2;
        }
    .accordion-button{
        font-size: 0.9rem;
    }

    /* Secciones (categorías) del menú de capas. Se pintan como encabezado de
       sección, con un registro tipográfico distinto al de los grupos del
       acordeón, para no añadir un tercer nivel de chevrones e indentación. */
    .layer-section + .layer-section {
        margin-top: 0.35rem;
    }
    .layer-section-header {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        width: 100%;
        padding: 0.65rem 1.25rem 0.4rem;
        border: 0;
        background: transparent;
        color: var(--bs-secondary-color);
        font-size: 0.7rem;
        font-weight: 600;
        letter-spacing: 0.05em;
        text-transform: uppercase;
        text-align: left;
        cursor: pointer;
    }
    .layer-section-header:hover,
    .layer-section-header:focus-visible {
        color: var(--bs-body-color);
        outline: none;
    }
    .layer-section-header:focus-visible .layer-section-title {
        text-decoration: underline;
    }
    .layer-section-icon {
        width: 16px;
        height: 16px;
        object-fit: contain;
        flex: 0 0 auto;
    }
    .layer-section-title {
        /* Puede envolver a dos líneas en el sidebar angosto; nunca fuerza el
           ancho del acordeón (nowrap haría que el menú desbordara). */
        flex: 1 1 auto;
        min-width: 0;
        line-height: 1.3;
        overflow-wrap: anywhere;
    }
    .layer-section-count {
        flex: 0 0 auto;
        font-size: 0.65rem;
        font-weight: 500;
        letter-spacing: 0;
        line-height: 1.2;
        padding: 0.05rem 0.45rem;
        border-radius: 999px;
        background: var(--bs-secondary-bg);
    }
    .layer-section-chevron {
        flex: 0 0 auto;
        font-size: 0.6rem;
        transition: transform 0.2s ease;
    }
    .layer-section.is-collapsed .layer-section-chevron {
        transform: rotate(-90deg);
    }
    .layer-section.is-collapsed .layer-section-body {
        display: none;
    }
    .layer-section-body .accordion-item:first-child {
        border-top: 1px solid var(--bs-border-color);
    }
    .form-check-label{
        font-size: 0.8rem;
    }
    .mapboxgl-ctrl-top-right {
        right: 1px;
        top: 50px;
    }
    .card-header{
        font-size: 0.9rem;
    }
    .close-card{
        font-size: 0.4rem;
    }
    .card-text{
        margin-bottom: 0rem !important;
        font-size: 0.9rem;
    }
    .desc_text{
        font-size: 0.8rem;
        line-height: 1.4 !important;
        font-weight: 400;
        text-align: justify !important;

    }
    .text-body-secondary,.fw-normal {
        line-height: 1.4 !important;
        text-align: justify;
    }
    /* Estilos para el slider de opacidad */
    .opacity-slider-container {
        width: 100%;
        padding: 6px 0 4px 0;
    }
    .opacity-slider {
        -webkit-appearance: none;
        appearance: none;
        width: 100%;
        height: 4px;
        border-radius: 2px;
        background: linear-gradient(to right, rgba(200,200,200,0.3), rgba(100,100,100,0.8));
        outline: none;
        cursor: pointer;
    }
    .opacity-slider::-webkit-slider-thumb {
        -webkit-appearance: none;
        appearance: none;
        width: 12px;
        height: 12px;
        border-radius: 50%;
        background: #4678d7;
        cursor: pointer;
        border: 2px solid #fff;
        box-shadow: 0 1px 3px rgba(0,0,0,0.3);
        transition: transform 0.1s ease;
    }
    .opacity-slider::-webkit-slider-thumb:hover {
        transform: scale(1.2);
    }
    .opacity-slider::-moz-range-thumb {
        width: 12px;
        height: 12px;
        border-radius: 50%;
        background: #4678d7;
        cursor: pointer;
        border: 2px solid #fff;
        box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    }
    .list-group-item.layer-item {
        flex-direction: column;
        align-items: stretch;
    }
    .layer-item-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }
    /* Estilos para los botones de reordenar */
    .layer-order-controls {
        display: flex;
        flex-direction: column;
        margin-right: 6px;
        gap: 1px;
    }
    .layer-order-btn {
        background: none;
        border: none;
        padding: 0;
        cursor: pointer;
        color: #6c757d;
        font-size: 0.65rem;
        line-height: 1;
        transition: color 0.15s ease;
    }
    .layer-order-btn:hover:not(:disabled) {
        color: #4678d7;
    }
    .layer-order-btn:disabled {
        color: #dee2e6;
        cursor: not-allowed;
    }
    .layer-name-text {
        font-size: 0.8rem;
        word-break: break-word;
        line-height: 1.3;
    }
    /* Botón pequeño y discreto de descarga de la capa (debajo del slider de opacidad) */
    .layer-download-container {
        display: flex;
        justify-content: flex-end;
        padding: 2px 0 4px 0;
    }
    .layer-download-btn {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        font-size: 0.7rem;
        font-weight: 500;
        line-height: 1;
        color: #4678d7;
        background-color: #fff;
        border: 1px solid #cdd9f3;
        text-decoration: none;
        padding: 4px 10px;
        border-radius: 999px;
        cursor: pointer;
        transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    }
    .layer-download-btn:hover {
        color: #fff;
        background-color: #4678d7;
        border-color: #4678d7;
        box-shadow: 0 1px 4px rgba(70, 120, 215, 0.35);
        text-decoration: none;
    }
    .layer-download-btn:active {
        transform: translateY(1px);
    }
    .layer-download-btn i {
        font-size: 0.7rem;
    }
    /* Estilos para los cards en legend-content */
    .feature-card {
        margin-bottom: 10px;
        border: 1px solid #dee2e6;
        border-radius: 4px;
    }
    .feature-card .card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem;
        background-color: #f8f9fa;
    }
    .feature-card .card-body {
        padding: 0.5rem;
    }
    .feature-card-controls {
        display: flex;
        gap: 4px;
    }
    .feature-card-btn {
        background: none;
        border: none;
        padding: 2px 4px;
        cursor: pointer;
        color: #6c757d;
        font-size: 0.7rem;
    }
    .feature-card-btn:hover:not(:disabled) {
        color: #4678d7;
    }
    .feature-card-btn:disabled {
        color: #dee2e6;
        cursor: not-allowed;
    }
    
    /* Estilos para sidebar colapsable */
    .sidebar-collapsible {
        transition: margin-left 0.3s ease, width 0.3s ease;
    }
    .sidebar-collapsible.collapsed {
        margin-left: -100%;
        width: 0;
    }
    #toggle-sidebar-btn {
        position: fixed;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        z-index: 1050;
        background-color: #4678d7;
        border: none;
        border-radius: 0 4px 4px 0;
        padding: 10px 8px;
        cursor: pointer;
        transition: left 0.3s ease;
        box-shadow: 2px 0 5px rgba(0,0,0,0.2);
        opacity: 0.8;
    }
    #toggle-sidebar-btn i {
        color: white;
        font-size: 1.2rem;
    }
    #toggle-sidebar-btn:hover {
        background-color: #3b6eb5;
    }
    .sidebar-collapsible.collapsed ~ #toggle-sidebar-btn {
        left: 0;
    }
    .sidebar-collapsible:not(.collapsed) ~ #toggle-sidebar-btn {
        left: calc(16.666667% - 8px); /* Ajusta según el ancho del sidebar en md */
    }
    
    @media (min-width: 768px) and (max-width: 991.98px) {
        .sidebar-collapsible:not(.collapsed) ~ #toggle-sidebar-btn {
            left: calc(25% - 8px); /* col-md-3 */
        }
    }
    
    @media (min-width: 992px) {
        .sidebar-collapsible:not(.collapsed) ~ #toggle-sidebar-btn {
            left: calc(16.666667% - 8px); /* col-lg-2 */
        }
    }
    
    @media (max-width: 767.98px) {
        #toggle-sidebar-btn {
            display: none; /* Ocultar en móviles, ya que usan offcanvas */
        }
    }

    /* Segundo sidebar (CAPAS ACTIVAS) colapsable a una pestaña (#1) */
    .sidebar-active {
        transition: flex-basis 0.3s ease, width 0.3s ease, min-width 0.3s ease, max-width 0.3s ease;
    }
    .sidebar-active.peek {
        flex: 0 0 16px;
        width: 16px;
        min-width: 16px;
        max-width: 16px;
        overflow: hidden;
    }
    .sidebar-active.peek .offcanvas-md {
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }
    #toggle-active-sidebar-btn {
        position: fixed;
        left: 0;
        /* Desplazado verticalmente para no solaparse con #toggle-sidebar-btn
           cuando el panel está en modo pestaña (ambos quedan cerca). */
        top: calc(50% + 58px);
        transform: translateY(-50%);
        z-index: 1050;
        background-color: #4678d7;
        border: none;
        border-radius: 0 4px 4px 0;
        padding: 10px 8px;
        cursor: pointer;
        box-shadow: 2px 0 5px rgba(0,0,0,0.2);
        opacity: 0.9;
        transition: opacity 0.2s ease, background-color 0.2s ease;
    }
    #toggle-active-sidebar-btn i {
        color: #fff;
        font-size: 1.2rem;
    }
    #toggle-active-sidebar-btn:hover {
        background-color: #3b6eb5;
        opacity: 1;
    }
    @media (max-width: 767.98px) {
        #toggle-active-sidebar-btn { display: none; }
        /* En móvil el panel usa offcanvas; anula el modo pestaña. */
        .sidebar-active.peek {
            flex: initial;
            width: auto;
            min-width: 0;
            max-width: none;
            overflow: visible;
        }
    }

            /* navbar-brand width 100% in small screens */
            @media (max-width: 768px) {
                .navbar-brand {
                    width: 100%;
                }
                .mapboxgl-ctrl-top-right{
                    top: 86px !important;
                }
                .sidebar {
                    height: 0vh;
                    border: none !important;
                    top: 100px;
                }
                #sidebarMenu, #sidebarMenu2 {
                    top: 88px;
                }
            }

            @media (max-width: 576px) {
                #sidebarMenu,
                #sidebarMenu2 {
                    top: 116px; /* Altura ajustada para cuando los botones se apilan */
            }
            .mapboxgl-ctrl-top-right{
                    top: 126px !important;
                }
        }

    /* Loader Styles */
#page-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* Velo translúcido + desenfoque: deja entrever el mapa base mientras carga
     (progressive disclosure) en lugar de taparlo con un muro opaco. Si el
     navegador no soporta backdrop-filter, el rgba mantiene un velo de marca. */
  background: rgba(36, 112, 220, 0.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease-out;
}

#page-loader.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loader-logo {
  max-width: 350px;
  width: 100%;
  margin-bottom: 0px;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.9;
  }
}

/* Respeta la preferencia de movimiento reducido: sin pulso del logo para
   usuarios sensibles al movimiento (accesibilidad). */
@media (prefers-reduced-motion: reduce) {
  .loader-logo {
    animation: none;
  }
}

@keyframes fade {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}