/* === ESTRUCTURA GENERAL (LAYOUT) ESTRICTA === */
html, body {
    height: auto !important; 
    min-height: 100vh !important;
    margin: 0;
    padding: 0;
    overflow-y: auto !important; /* CLAVE: Permitir que toda la página escrolee junta */
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
}

/* Banner Pruebas */
.banner-pruebas {
    flex: 0 0 auto; 
    background-color: #ffc107 !important;
    color: #212529 !important;
    text-align: center;
    padding: 0.5rem 0;
    font-weight: bold;
    font-size: 0.9rem;
    border-bottom: 1px solid #d39e00;
    width: 100%;
    position: relative;
    z-index: 1100;
}

#wrapper {
    flex: 1 0 auto; /* CLAVE: Empuja el footer hacia abajo */
    display: flex;
    width: 100%;
}

/* === SIDEBAR (Barra Lateral) === */
#sidebar-wrapper {
    width: 300px;
    flex: 0 0 300px; 
    display: flex;
    flex-direction: column;
    background-color: #007a87 !important; /* Color Turquesa PBA */
    color: #fff;
    z-index: 1050;
    transition: margin 0.3s ease-out;
    border-top-right-radius: 0px;
    border-bottom-right-radius: 45px;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.08);
}

.sidebar-heading { flex-shrink: 0; }

/* Evitar doble barra de scroll en el menú lateral */
#sidebar-wrapper .flex-grow-1 {
    overflow: hidden; 
}

/* Items del menú */
.list-group-item {
    border: none;
    padding: 0.8rem 1.5rem;
    background-color: transparent; 
    color: #fff !important; 
    text-decoration: none;
}

.list-group-item:hover {
    background-color: rgba(0, 0, 0, 0.1) !important;
    padding-left: 1.8rem;
    transition: all 0.2s;
    margin: 4px 8px; 
    border-radius: 8px; 
}

.sub-menu-dark { background-color: #005e69; border-radius: 8px; overflow: hidden; }
.border-light-opacity { border-color: rgba(255, 255, 255, 0.3) !important; }
.info-box-visor {
    background-color: #f0f4f4;
    border-left: 5px solid #004d56;
    border-radius: 6px;
    position: relative;
}

/* === RESPONSIVE (CELULARES Y PC) === */
@media (max-width: 767px) {
    #sidebar-wrapper {
        position: fixed;
        margin-left: -300px; 
        height: 100%;
    }
    #wrapper.toggled #sidebar-wrapper { margin-left: 0; }
}
@media (min-width: 768px) {
    #sidebar-wrapper { margin-left: 0; }
    #wrapper.toggled #sidebar-wrapper { margin-left: -300px; }
}

/* === CONTENIDO PRINCIPAL === */
#page-content-wrapper {
    flex: 1 1 auto;
    display: flex; 
    flex-direction: column;
    position: relative;
    width: 100%;
}

#sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1040;
}
@media (max-width: 767px) {
    #wrapper.toggled #sidebar-overlay { display: block; }
}

/* === MAPA Y CONTENEDOR === */
.full-screen-map-container { 
    flex: 1; 
    min-height: calc(100vh - 86px) !important; /* Descuenta la altura del header para que no baje de más */
    width: 100%;
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
}

.full-h { height: 100%; width: 100%; flex: 1; }

/* =========================================
   ESTILOS MODERNOS DEL MAPA (LEAFLET)
   ========================================= */
.popup-custom .leaflet-popup-content-wrapper { border-radius: 12px; padding: 0; overflow: hidden; box-shadow: 0 8px 25px rgba(0,0,0,0.15); }
.popup-custom .leaflet-popup-content { margin: 0; width: 280px !important; }
.popup-custom .leaflet-popup-tip { box-shadow: 0 8px 25px rgba(0,0,0,0.15); }

.id-tooltip {
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #007a87;
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 13px;
    font-weight: 800;
    color: #2c3e50;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
    white-space: nowrap;
}

.zoom-hide-labels .leaflet-tooltip { display: none !important; }

.leaflet-control-layers { border: 2px solid rgba(0,0,0,0.1) !important; border-radius: 8px !important; box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important; overflow: hidden; }
.leaflet-control-layers-expanded { padding: 12px 16px !important; border-radius: 12px !important; }
.leaflet-control-layers-toggle { background-image: none !important; width: 38px !important; height: 38px !important; background-color: #ffffff !important; transition: background-color 0.2s; }
.leaflet-control-layers-toggle::before { font-family: "bootstrap-icons" !important; content: "\F585"; font-size: 22px; color: #495057; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.leaflet-control-layers-toggle:hover { background-color: #f8f9fa !important; }
.leaflet-control-layers-toggle:hover::before { color: #007a87; }
.leaflet-control-zoom { border: 2px solid rgba(0,0,0,0.1) !important; border-radius: 8px !important; box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important; overflow: hidden; }
.leaflet-control-zoom a { color: #495057 !important; background-color: #ffffff !important; transition: all 0.2s; }
.leaflet-control-zoom a:hover { background-color: #f8f9fa !important; color: #007a87 !important; }
.leaflet-control-attribution { display: none !important; }
.info.legend { border-radius: 12px; border: none !important; box-shadow: 0 6px 20px rgba(0,0,0,0.1) !important; padding: 12px 16px !important; }

/* =========================================
   BOTONES PERSONALIZADOS TURQUESA PBA
   ========================================= */
.btn-outline-pba {
    color: #007a87;
    border: 2px solid #007a87;
    background-color: transparent;
    transition: all 0.2s ease-in-out;
}
.btn-outline-pba:hover {
    color: #ffffff;
    background-color: #007a87;
    border-color: #007a87;
}
.btn-pba {
    color: #ffffff;
    background-color: #007a87;
    border: 2px solid #007a87;
    transition: all 0.2s ease-in-out;
}
.btn-pba:hover {
    color: #ffffff;
    background-color: #005e69; 
    border-color: #005e69;
}

/* ========================================= */
/* WIDGETS FLOTANTES (Pasan por debajo del footer) */
/* ========================================= */

/* El cartel de estado de red */
.cartel-estado-fijo {
    position: fixed !important; 
    bottom: 30px !important;    
    right: 20px !important;     
    /* El footer tiene 1040, al ponerle 1030 a este cartel, el footer lo aplasta/tapa al scrollear */
    z-index: 1030 !important;   
}

/* Los controles del mapa (zoom y capas) para que hagan lo mismo */
.leaflet-bottom.leaflet-right {
    position: fixed !important; 
    bottom: 20px !important;    
    right: 20px !important;     
    z-index: 1030 !important;   
}

/* Aseguramos que el footer tenga fondo sólido y esté en la capa superior */
.footer-pba {
    position: relative;
    background-color: #f8f9fa; /* Color sólido para que no se trasluzca el cartel */
    z-index: 1040 !important;
}