/* Variables CSS para fácil personalización */
:root {
    --color-primary: #0066cc;
    --color-secondary: #004d99;
    --color-background: #f5f5f5;
    --color-background-header: #01374c;
    --color-font-oficial: #01374c;
    --color-header: #01374c;
    --color-panel: #ffffff;
    --color-border: #ddd;
    --color-text: #333;
    --color-text-light: #666;
    --sidebar-width: 28%;
    --map-width: 72%;
}
/*USO GENERICO*/
.d-none {
    display: none !important;
}

/* Reset y estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--color-text);
    background-color: var(--color-background);
    overflow: hidden;
} */
 body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--color-text);
    background-color: var(--color-background);

    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}


/* Header */
#header {
    background-color: var(--color-background-header);
    color: white;
    padding: 10px 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

#banner {
    max-height: 60px;
    width: auto;
}

#header h1 {
    font-size: 24px;
    font-weight: 600;
}
.organismo{
    color: #87B867;
}
/* Contenedor principal */
/* #main-container {
    display: flex;
    height: calc(100vh - 90px);
    overflow: hidden;
} */
 #main-container {
    display: flex;
    flex: 1;              /*ocupa TODO lo que queda bajo el header */
    overflow: hidden;
}


/* Panel lateral (sidebar) */
#sidebar {
    width: var(--sidebar-width);
    background-color: var(--color-panel);
    border-right: 1px solid var(--color-border);
    overflow-y: auto;
    padding: 20px;
}

.panel {
    margin-bottom: 15px;
    padding: 15px;
    background-color: #fafafa;
    border: 1px solid var(--color-border);
    border-radius: 5px;
}
/* .capas-panel {
    background-color: #efefee;
} */

.panel h2 {
    font-size: 17px;
    margin-bottom: 5px;
    color: var(--color-font-oficial);
    border-bottom: 2px solid var(--color-font-oficial);
    padding-bottom: 8px;
}
.separador{
    margin-bottom: 20px;
    margin-top: 20px;
    border-color: #155724;
    border: dashed 1px;
}

/* Mapas base */
.base-maps {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.base-maps label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.base-maps label:hover {
    background-color: #e8f4ff;
}

.base-maps input[type="radio"] {
    margin-right: 10px;
    cursor: pointer;
}

/* Capas disponibles */
#available-layers {
    display: flex;
    flex-direction: column;
    gap: 8px;

}

.layer-theme {
    padding-bottom: 5px;
    margin-bottom: 0px;
    border: solid 1px #ccc;
    border-radius: 5px;
    padding-right: 10px;
    background-color: #f1f1f1;
}

.layer-item {
    display: flex;
    align-items: center;
    padding: 10px;
    /* border: 1px solid var(--color-border); */
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.layer-item:hover {
    background-color: #e8f4ff;
    /* border-color: var(--color-primary); */
}

.layer-item input[type="checkbox"] {
    margin-right: 10px;
    cursor: pointer;
}

.layer-item span {
    font-size: 13px;
}

/* Formulario para agregar capas */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 14px;
    color: var(--color-text);
}

.form-group input[type="text"] {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.1);
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background-color: var(--color-primary);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: var(--color-secondary);
}

.btn-primary:active {
    transform: translateY(1px);
}

/* Leyenda */
#legend {
    font-size: 13px;
    padding: 10px;
}

.legend-info {
    color: var(--color-text-light);
    font-style: italic;

    font-size: 13px;
}


 .legend-item {
    border-bottom: 1px solid #d3d3d3;
    padding: 8px 0;
    display: block;
}
.legend-title {
    font-weight: 600;
    margin-bottom: 0.8rem;
    /* color: #0b5ed7; */
    color: var(--color-font-oficial);
    font-size: 16px;
}
.legend-visual {
    
    display: flex;
    align-items: center;
    gap: 10px;
}
.legend-img {
    max-width: 100%;
    height: auto;
    display: block;
}

 .legend-color {
    width: 36px;
    height: 18px;
    border-radius: 4px;
    border: 1px solid #ccc;
}
.legend-fallback {
    color: #666;
    font-size: 13px;
}

/* Contenedor del mapa */
#map-container {
    width: var(--map-width);
    position: relative;
    margin: 1rem;
    border: dashed 1px #333;
    /* border-radius: 10px; */
}

#map {
    width: 100%;
    height: 100%;

    position: relative;
}

/* Estilos para popups de Leaflet */
.leaflet-popup-content-wrapper {
    border-radius: 5px;
}

.leaflet-popup-content {
    margin: 15px;
    font-size: 14px;

    /*ajustamos e scroll*/
    max-height: 400px; 
    overflow-y: auto; 
    padding-right: 10px;
    
}
/* Contenido interno */
.popup-content {
    max-width: 350px;       /* evita popups gigantes */
}


.leaflet-popup-content::-webkit-scrollbar {
    width: 6px;
}

.leaflet-popup-content::-webkit-scrollbar-thumb {
    background: #01374c;
    border-radius: 4px;
}

.leaflet-popup-content::-webkit-scrollbar-track {
    background: transparent;
}

.popup-title {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 10px;
    color: var(--color-primary);
}

.popup-info {
    margin: 5px 0;
}

.popup-info strong {
    color: var(--color-text);
}

/* Scrollbar personalizada */
#sidebar::-webkit-scrollbar {
    width: 8px;
}

#sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#sidebar::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#sidebar::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Mensajes de estado */
.message {
    padding: 12px;
    margin: 5px 0;
    border-radius: 4px;
    font-size: 14px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #86a18d;
}

.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #9b7c7f;
}

.message.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #87a1a5;
}

/* Responsive para pantallas muy pequeñas */
@media (max-width: 768px) {
    #main-container {
        flex-direction: column;
    }

    #sidebar {
        width: 100%;
        height: 40vh;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
    }

    #map-container {
        width: 100%;
        height: 60vh;
    }
}

/* Etiquetas en el mapa */
.map-label {
    background: none;
    border: none;
}

.label-text {
    background-color: rgba(255, 255, 255, 0.9);
    color: #000;
    padding: 4px 8px;
    border: 1px solid #333;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    text-align: center;
    pointer-events: none;
}

/* Panel de control de etiquetas */
#labels-control {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.labels-info {
    font-size: 12px;
    color: var(--color-text-light);
    font-style: italic;
    margin: 5px 0 0 0;
    padding-left: 30px;
}

/* Etiquetas responsive */
@media (max-width: 768px) {
    .label-text {
        font-size: 10px;
        padding: 3px 6px;
    }
}


.layers-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
}

.btn-add-layer {
    font-size: 2rem;
    font-weight: bold;
    width: 1.5rem;
    height: 2rem;
    cursor: pointer;
    background-color: transparent;
    border: none;
    color: #7a7a7a;
    margin-top: 0px;
    
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
}

.hidden {
    display: none !important;
}

.map-floating-btn {
    position: absolute;
    top: 9px;
    right: 60px;
    z-index: 1010;

    border: 1px solid #2980b9;

    background: white;
    border-radius: 5px;
    padding: 2px 6px 2px 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);

    display: flex;
    align-items: center;
    justify-content: center;
}

.map-floating-btn img {
    width: 30px;
    margin-left: 7px;
}
.map-floating-btn:hover {
    background: #f0f0f0;
    cursor: pointer;
}
.map-floating-btn:hover img{
    filter: brightness(0.9);
}



/* ===== Modal ===== */
.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    width: auto;
    min-width: 420px;
    max-width: 70%;
    border-radius: 12px;
    z-index: 1001;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    overflow: hidden;
    animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translate(-50%, -60%); }
    to   { opacity: 1; transform: translate(-50%, -50%); }
}

.modal-content {
    padding: 16px 18px 20px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    border-bottom: 1px solid #e5e5e5;
    padding-bottom: 8px;

    gap: 8px;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #444;
}

.modal-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 60vh;
    overflow-y: auto;
}

/* ===== Items de capas ===== */
.predefined-layer-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8f9fb;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    padding: 10px 12px;
    gap: 10px !important;
    /* margin-bottom: .6rem; */
}

.predefined-layer-item span {
    font-size: 10px;
    flex: 1;
}

/* ===== Botón + ===== */
.predefined-layer-item button {
    width: 38px;
    height: 34px;
    background: #0d6efd;
    color: #fff;
    font-size: 20px;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;

    display: flex;
    justify-content: center;
    align-items: center;
}

.predefined-layer-item button:hover {
    background: #0b5ed7;
}

.modal-search {
    width: 100%;
    padding: 8px 10px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin: 10px 0 12px;
    outline: none;
}

.modal-search:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 2px rgba(13,110,253,0.10);
}

/*FIN DEL MODAL*/

.header-with-button {
    display: flex ;
    justify-content: space-between;
    align-items: start;
    border-bottom: #01374c 2px solid;
    margin-bottom: 1rem;
}
.header-with-button h2{
    border-bottom: none;
    /* margin-top: .3rem; */
    
}
/**estilos para el slider de opacidad*/
.layer-item-wrapper {

    display: flex;
    flex-direction: column;
    /*nuevo agregado*/
    position: relative;

    margin-left: 5px;
    border: 1px solid #ddd;
    /* padding: 6px; */
    padding: 4px;
    border-radius: 5px;
    margin-bottom: 0.15rem;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.layer-item-wrapper div{
    align-items: center !important;
}

.opacity-control {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    margin-top: 5px;
}

.opacity-slider {
    flex: 1;
}

/*boton de eliminar*/

.btn-delete-layer {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    color: #555;
    transition: all 0.2s ease;

    display: flex;
    align-items: center;
    justify-content: center;

    margin-left: auto;   /*lo empuja a la derecha */
    flex-shrink: 0;      /*evita que se achique */
}


.btn-delete-layer:hover {
    background: transparent;
    color: #c62828;
    transform: scale(1.02);
    outline: solid 1px #c62828;
}



.layer-legend-visual{
    margin-top: 0.7rem;
    /* overflow: hidden; */
}

.layer-item {
    display: flex;
    gap: 6px;
}



.opacity-slider:focus {
    outline: none;
} 

.btn-layer-tools {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #555;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-layer-tools:hover {
    background: transparent;
    color: #04742f;
    transform: scale(1.02);
    outline: solid 1px #04742f;
}
.subtheme-filter-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #8d8d8d;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content:flex-end;
}
.subtheme-filter-btn:hover {
    background: transparent;
    color: #0066cc;
    transform: scale(1.02);
    outline: solid 1px #0066cc;
}

.layer-tools-menu {
    position: absolute;
    top: 28px;              /* debajo del botón */
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 140px;
    z-index: 1000;

    padding: 4px 0;
}


.layer-tools-item {
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}

.layer-tools-item:hover {
    background-color: #f2f2f2;
}


#attributes-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

#attributes-table th,
#attributes-table td {
    border: 1px solid #ddd;
    padding: 6px 8px;
    text-align: left;
    white-space: nowrap;
}

#attributes-table th {
    background: #f3f3f3;
    position: sticky;
    top: 0;
    z-index: 1;
}
.modal-body {
    max-height: 60vh;
    overflow: auto;
}
.close-attributes-modal,.minimized-attributes-modal {
    background: transparent !important;
    border: none !important;
    font-size: 20px;
    cursor: pointer;
    color: #444;
    margin-right: 5px;
}
.close-attributes-modal:hover {
    color: #000;
}

/*mapas bases*/
#basemap-control {
    position: absolute;
    /* top: 10px; */
    bottom: 30px;
    right: 10px;
    z-index: 1000;

    background: #fff;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    padding: 4px;

    display: flex;
    flex-direction: column;
    gap: 4px;
}

.basemap-btn {
    width: 36px;
    height: 36px;

    border: none;
    border-radius: 4px;
    background: #f4f4f4;

    cursor: pointer;
    font-size: 18px;

    display: flex;
    align-items: center;
    justify-content: center;

    transition: background 0.2s, transform 0.1s;
}

.basemap-btn:hover {
    background: #e0e0e0;
}
.basemap-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}
.basemap-btn:active {
    transform: scale(0.95);
}

.basemap-btn.active {
    /* background: #a3cc97; */
    border: solid 2px #01374c;
    color: #fff;
}



/* Botón ayuda */
.help-control button {
    width: 34px;
    height: 34px;
    background: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.help-control button:hover {
    background: #1976d2;
    color: #fff;
}

/* Modal */
.help-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.help-modal-content {
    background: #fff;
    width: 100%;
    max-width: 1200px;
    padding: 16px;
    border-radius: 8px;
    position: relative;
}

.help-close {
    /* position: absolute; */
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
}

.measure-tooltip {
    background: rgba(255, 230, 150, 0.9);
    color: #000;
    font-size: 12px;
    font-weight: 600;
    border-radius: 4px;
    padding: 2px 6px;
    border: 1px solid #d6b656;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}


.theme-header,
.subtheme-header {
    display: flex;
    align-items: center;
    padding: 10px 4px;
    gap: 6px;
    cursor: pointer;
    user-select: none;
    font-weight: 600;
    
}

.theme-content,
.subtheme-header {
    padding-left: 6px;
    
}
.subtheme-header-left {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.subtheme-title {
    display: inline-block;
    font-weight: 400 !important;
    /* max-width: 300px; */
    width: calc(auto - 50px);
}

.layer-subtheme {
    background-color: #fdf8f8;
    outline: solid 1px #ccc;
    margin-bottom: 10px;
    /* padding:3px 7px 3px 3px; */
    padding:1px 4px 1px 1px;
    border-radius: 5px;
}
.layer-subtheme > * {
    justify-content: space-between;
}
.toggle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
    color: #555;
    margin-right: 5px;
}

.is-open > .toggle-icon {
    transform: rotate(90deg);
}


/* Flechas por defecto */
.theme-header .toggle-icon,
.subtheme-header .toggle-icon {
    display: inline-flex;
    transition: transform 0.2s ease;
}

/* Giro cuando está abierto */
.theme-header.is-open .toggle-icon {
    transform: rotate(90deg);
}

.subtheme-header.is-open .toggle-icon {
    transform: rotate(90deg);
}




.layer-filters-row {
    display: flex;
    gap: 6px;
    margin-left: 22px; /* alinear con el texto */
    margin-top: 2px;
}

.layer-filter {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    background: #eef2f6;
    color: #2c3e50;
    white-space: nowrap;
}

.layer-filter.year {
    font-weight: 600;
}


.layer-badges {
    display: flex;
    gap: 6px;
    margin-top: 4px;
    margin-left: 22px;
}

.badge {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    background: #e6eaf0;
    color: #333;
}

.badge-year {
    background: #dbe7ff;
}

.badge-unit {
    background: #e9f5e9;
}

.subtheme-empty {
    font-size: 12px;
    color: #666;
    padding: 8px 6px;
    font-style: italic;
}


.subtheme-filters {
    display: none;
    justify-content: space-between;
    gap: 8px;
    padding: 2px 8px 8px 10px;
    border-bottom: solid 1px #b6b6b6;
    margin-bottom: 8px;
}

.subtheme-filters.is-open {
    display: flex; 
}

.subtheme-filter-btn.active {
    color: #1976d2;
}

.subtheme-filters select {
    flex: 1;
    font-size: 14px;
    color: #666;
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid #ccc;
    background: #fff;
    gap: 4px;
}

#message-container {
    position: absolute;
    top: 5px;
    left: 50px;
    z-index: 1500;
    width: auto;
    max-width: 90%;

}


.layer-subtheme.has-active-filters {
    border-left: 3px solid #0d6efd; 
    background-color: rgba(13, 110, 253, 0.04);
}

.layer-subtheme.has-active-filters .subtheme-title::after {
    /* content: '• filtros activos'; */
    content: 'filtros activos';
    margin-left: 6px;
    font-size: 12px;
    color: #0d6efd;
    background-color: #f7f6f6;
    font-weight: 500;
    border: solid 1px #0d6efd;
    padding: 3px 5px;
    border-radius: 5px;

}

.layer-subtheme.has-active-filters .subtheme-filter-btn {
    color: #0d6efd;
    border: solid 1px #0d6efd 
}

.layer-subtheme.has-active-filters .subtheme-filter-btn svg {
    /* stroke-width: 3.5; */
    fill: #0d6efd;
    ;
}

/*Descarga de archivos */
 .attributes-actions {
    position: relative;
    margin-left: auto; /* empuja a la derecha */
}
.download-dropdown {
    position: relative;
}

.btn-download-main {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    cursor: pointer;
    background-color: transparent;
    border: solid 1px #adadad;
    border-radius: 5px;
    margin: 0px 10px;
}
.btn-download-main:hover {
    background-color: #f0f0f0;
}

.download-menu {
    position: absolute;
    right: 0;
    top: 100%;
    background: #fff;
    color: #777 !important;
    border: 1px solid #b6b5b5;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,.15);
    z-index: 20;
    width: 160px;
    padding-bottom: 5px;
   /*  max-width: 200px; */
}
.download-menu svg {
    stroke: #777777 !important;
    margin-right: 6px;
}

.download-menu button {
    display: block;
    width: 100%;
    padding: 6px 12px;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
}

.download-menu button:hover {
    background: #f0f0f0;
}

.hidden {
    display: none;
}

 /* ===============================
   BUSCADOR DE CAPAS
   =============================== */

.layer-search-wrapper {
    position: relative;
    margin-bottom: 15px;
}

/* Input */
#layerSearchInput {
    width: 100%;
    padding: 8px 10px 8px 34px; /* espacio para icono */
    font-size: 14px;
    border: 1px solid #d0d7de;
    border-radius: 5px;
    outline: none;
    background-color: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

/* Focus */
#layerSearchInput:focus {
    border-color: #2563eb; /* azul suave */
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

/* Icono lupa */
.layer-search-wrapper::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 10px;
    width: 14px;
    height: 14px;
    transform: translateY(-50%);
    opacity: 0.6;
    background-size: contain;
    background-repeat: no-repeat;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='11' cy='11' r='7' stroke='%23666' stroke-width='2'/%3E%3Cline x1='16.5' y1='16.5' x2='21' y2='21' stroke='%23666' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* ===============================
   RESULTADOS
   =============================== */

.layer-search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 1000;

    background: #fff;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.1);

    max-height: 500px;
    overflow-y: auto;

    display: none;
}

/* Item */
.layer-search-item {
    padding: 8px 10px;
    font-size: 13px;
    cursor: pointer;
    line-height: 1.3;
    border-bottom: 1px solid #f0f0f0;
}

.layer-search-item:last-child {
    border-bottom: none;
}

/* Hover */
.layer-search-item:hover {
    background-color: #f3f6fb;
}

/* Texto secundario (tema / subtema) */
.layer-search-item small {
    display: block;
    font-size: 11px;
    color: #666;
}
.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 26px;
    cursor: pointer;
}
/*MODAL DE CARGA DE CAPAS EXTERNAS*/
/* .externos .modal-body{
    overflow-y: hidden;
    padding-bottom: 15px;
} */
 .externos .modal-body {
    display: flex;
    flex-direction: column;
    max-height: 70vh; /* limita altura del modal */
    padding-bottom: 15px;
}

#externalLayersList {
    overflow-y: auto;   /* scroll real */
    max-height: 40vh;   /* controla crecimiento */
}
.externos .modal-body > .form-group,
#btnConnectExternal {
    flex-shrink: 0;
}

.layer-theme.external-theme {
    background-color: rgba(52, 152, 219, 0.06);
    border: 1px solid rgb(52, 152, 219);
    border-radius: 6px;
}

.external-layer {
    /* background-color: rgba(52, 152, 219, 0.08); */
    border-left: 1px solid #3498db;
    border-radius: 4px;
}

@media (max-width: 768px) {

    html, body {
        height: 100%;
        overflow: hidden;
    }

    #main-container {
        height: calc(100vh - 90px); /* alto real sin header */
        flex-direction: column;
        overflow: hidden;
    }

    #map-container {
        width: 100%;
        height: 100%;
        margin: 0;
        border: none;
    }

    #map {
        width: 100%;
        height: 100%;
    }
    .header-content img{
        display: none;
    }

    .text-header{
       font-size: 12px;
    }

    
    .menu-toggle {
        display: block;
    }

    #main-container {
        position: relative;
    }

     #sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 90%;
        max-width: 360px;
        height: 100dvh;
        z-index: 2000;

        background: var(--color-panel);
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0,0,0,0.35);
        touch-action: pan-y;
    }
    .modal {
        z-index: 3000;
        padding:0px 10px !important;
        
    }
    .modal-body {
        max-height: 70dvh;
        overflow: auto;
        
    }
    .modal-body > table {
        max-height: 50dvh;
        max-width: 90dvw !important;
        
    }
    .subtheme-filters{
        flex-direction: column;
        align-items: stretch;
    }

    #sidebar.is-open {
        left: 0;
    }

    /* El mapa ocupa todo */
    #map-container {
        width: 100%;
        margin: 0;
    }

    #sidebarSwipeZone {
    position: fixed;
    top: 0;
    left: 0;
    width: 30px;
    height: 100dvh;
    z-index: 1500;
}

     .attributes-window {

    width: 98vw !important;

    max-width: 98vw !important;

    left: 50% !important;

    top: 80px !important;

    transform: translateX(-50%) !important;

    max-height: 75vh;
}

    .attributes-window .modal-header {

        padding: 0px 5px 10px 5px !important;

        gap: 2px;

        flex-wrap: wrap;
    }

        #attributes-title {
            font-size: 16px;
            flex: 1;    
            min-width: 100px;
            white-space: nowrap;    
            overflow: hidden;    
            text-overflow: ellipsis;
        }

    

    .attributes-actions {

        display: flex;

        align-items: center;

        gap: 3px;
    }

    .btn-download-main {

        padding: 4px 8px;

        font-size: 13px;
    }

    
    .close-attributes-modal {

        width: 20px !important;
        height: 20px !important;

        color: #444;
        margin-right: 0;

        font-size: 14px;

        display: flex;
        align-items: center;
        justify-content: center;
    }

    .minimized-attributes-modal {

        width: 20px !important;
        height: 20px !important;

        color: #444;
        margin-right: 0;

        font-size: 14px;

        display: flex;
        align-items: center;
        justify-content: center;
    }


    #attributes-content {

        overflow: auto;
    }

    #attributes-table {

        font-size: 13px;
    }
    .help-cards{
        grid-template-columns: repeat(auto-fill,minmax(350px,1fr));
    }
}


/* =========================
   CONTROL SELECCIÓN
   ========================= */

.selection-control {
    position: absolute;
    top: 9px;
    right: 217px;
    z-index: 1000;
}

.selection-btn {
    width: 36px;
    height: 36px;
    border: solid 1px #29324b;
    border-radius: 4px;
    background: white;
    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    box-shadow: 0 2px 8px rgba(0,0,0,.25);

    transition: .2s;
}

.selection-btn:hover {
    /* transform: scale(1.05); */
    background-color: #e9e9e9;
}

.selection-btn.active {
    background: #e4c204;
    color: white;
}
/* =========================
   FILA SELECCIONADA
   ========================= */

#attributes-table tr.selected-row {
    background-color: rgba(255, 204, 0, 0.25);
    font-weight: 600;
}

#attributes-table tr.selected-row:hover {
    background-color: rgba(255, 204, 0, 0.4);
}

.selected-separator {
    background: #f3f3f3;
    color: #01374c;
    font-weight: bold;
    text-align: center;
}

/* =========================
   Ventana atributos
   ========================= */

.attributes-window {

    position: absolute;

    top: 80px;
    left: 80px;

    width: 70%;
    max-height: 70vh;

    background: white;

    border-radius: 10px;

    box-shadow:
        0 4px 25px rgba(0,0,0,.25);

    z-index: 5000;

    overflow: hidden;

    display: flex;
    flex-direction: column;
}

/* =========================
   Header draggable
   ========================= */

.attributes-window .modal-header {

    cursor: move;

    user-select: none;

    /* background: #01374c;

    color: white; */

    padding: 0px 15px 10px 15px;

    display: flex;

    align-items: center;

    justify-content: space-between;
}

/* =========================
   Contenido
   ========================= */

#attributes-content {

    overflow: auto;

    max-height: calc(70vh - 60px);

    background: white;
}

/* =========================
   Minimizado
   ========================= */

.attributes-window.minimized {
    width: 400px;
    height: auto;
    overflow: visible;
}

.attributes-window.minimized #attributes-content {

    display: none;
}

/* =========================
   Acciones ventana
   ========================= */

.window-actions {

    display: flex;
    gap: 8px;
}

/* .minimized-attributes-modal {

    background: transparent !important;

    border: none !important;

    width: 32px;
    height: 32px;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 20px;

    line-height: 1;

    cursor: pointer;

    color: #444;

    margin-right: 5px;
} */

.attributes-window.minimized #attributes-title {

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;

    max-width: 220px;
}

/*//////modal de ayudas*/
.help-cards{
    display:grid;
    grid-template-columns: repeat(auto-fill,minmax(500px,1fr));
    gap:20px;
    margin-top:15px;
}

.help-card{
    background:#fff;
    border:1px solid #ddd;
    border-radius:12px;
    padding:15px;
    /* box-shadow:0 2px 8px rgba(0,0,0,.08); */
    transition:.2s;
}

.help-card:hover{
    transform:translateY(-3px);
    /* box-shadow:0 5px 15px rgba(0,0,0,.15); */
}

.help-card h4{
    color:#01374c;
    margin-bottom:12px;
    font-size:17px;
    font-weight: 500;
}

.help-card video{
    width:100%;
    border-radius:8px;
    margin-bottom:12px;
}

.help-card p{
    color:#666;
    font-size:14px;
    line-height:1.5;
}

.header-with-button{
    display:flex;
    align-items:center;
    justify-content:space-between;
}

/* .btn-help{
    width:32px;
    height:32px;
    border:none;
    border-radius:50%;
    background:#01374c;
    color:#fff;
    cursor:pointer;

    display:flex;
    align-items:center;
    justify-content:center;

    transition:.2s;
}

.btn-help:hover{
    background:#02597c;
    transform:scale(1.05);
} */
.btn-help{
    width: 32px;
    height: 32px;

    display:flex;
    justify-content:center;
    align-items:center;

    border:none;
    border-radius:6px;

    background:#01374c;
    color:#ffebbf;

    font-size:20px;
    font-weight:bold;
    font-family:serif;

    cursor:pointer;

    transition:.2s;
}

.btn-help:hover{
    background:#02597c;
}

.help-header{
    display:flex;
    justify-content:space-between;
    align-items:center;

    border-bottom:1px solid #ddd;
    padding-bottom:15px;
}

.help-title{
    display:flex;
    align-items:center;

    background:#2d4053;
    color:#fff5e6;

    padding:6px 20px 6px 0px;

    border-radius:0 40px 40px 0;

    /* box-shadow:0 2px 8px rgba(0,0,0,.15); */
}

.help-title-icon{
    width:52px;
    height:38px;

    /* background:white; */
    color:#2d4053;

    display:flex;
    align-items:center;
    justify-content:center;

    /* font-size:22px;

    border-radius:4px;

    margin-right:14px; */
}
.help-title-icon img{
    width: 30px;
}
.help-title h3{
    margin:0;
    font-size:1.1rem;
    font-weight:700;
}










