/* --- Súper Encabezado Global --- */
.global-super-header {
    background-color: #fff;
    border-bottom: 2px solid #009640;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    font-family: 'Century Gothic', sans-serif;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    z-index: 1000;
    position: relative;
}

.super-header-title {
    font-weight: 700;
    color: var(--text-color, #5B5B5B);
    font-size: 0.95em;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.super-header-selector {
    display: flex;
    align-items: center;
    gap: 12px;
}

.super-header-selector label {
    font-size: 0.85em;
    font-weight: 700;
    color: var(--text-color, #5B5B5B);
    margin: 0;
    letter-spacing: 0.5px;
}

.year-selector-pill {
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid #ccc;
    background-color: #f8f9fa;
    color: var(--text-color, #5B5B5B);
    font-weight: 700;
    outline: none;
    cursor: pointer;
    font-size: 0.9em;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
    min-width: 100px;
    text-align: center;
}

.year-selector-pill:hover, .year-selector-pill:focus {
    border-color: var(--primary-color, #F58634);
    background-color: #fff;
    box-shadow: 0 0 0 2px rgba(245, 134, 52, 0.2);
}

/* --- Contenedor Principal y Tabs --- */
#app-container {
    padding: 1rem;
    flex-grow: 1;
    overflow: hidden; /* Para que el sidebar no desborde */
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  height: 100%;
}

/* --- Estructura de Fila y Columna --- */
.row-container {
    display: flex;
    flex-wrap: nowrap; /* Prevent wrapping */
    height: 100%;
}

.col-sm-4 {
    width: 33.33%;
    padding: 0 15px;
    box-sizing: border-box;
    height: 100%;
    flex-shrink: 0; /* Prevent sidebar from shrinking */
}

.col-sm-8 {
    width: 66.66%;
    padding: 0 15px;
    box-sizing: border-box;
    height: 100%;
    flex-grow: 1; /* Allow main panel to grow */
    transition: width 0.3s ease;
}

/* --- Panel Principal y Mapas --- */
.main-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.mobile-filters-btn {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: #fff;
    color: var(--text-color);
    font-weight: 700;
    font-size: 0.85rem;
    padding: 8px 12px;
    margin: 6px 0 8px;
    align-self: flex-start;
    cursor: pointer;
}

.mobile-info-btn {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: #fff;
    color: var(--text-color);
    font-weight: 700;
    font-size: 0.85rem;
    padding: 8px 12px;
    margin: 6px 0 8px;
    cursor: pointer;
}

.mobile-action-bar {
    display: none;
    gap: 8px;
    width: 100%;
}

.mobile-sidebar-backdrop {
    display: none;
}

.map-container {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* --- Pestaña de Mapas Comparativos --- */
.compare-container {
    display: flex;
    width: 100%;
    gap: 1rem;
    height: 100%;
}

.compare-map-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.mobile-map-switch {
    display: none;
    gap: 8px;
    justify-content: center;
    padding: 8px 10px;
}

.mobile-map-switch-btn {
    border: 1px solid #cfd5dc;
    border-radius: 20px;
    background: #fff;
    color: var(--text-color);
    font-weight: 700;
    font-size: 0.85rem;
    padding: 6px 12px;
    cursor: pointer;
}

.mobile-map-switch-btn.active {
    background: #009640;
    border-color: #009640;
    color: #fff;
}

#tab-evolution {
    height: 100%;
    overflow: hidden;
}

#tab-evolution .row-container {
    height: 100%;
}

.evolution-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
}

.evolution-controls {
    padding: 8px 20px;
    background: var(--card-bg, #fff);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 20;
}

.evolution-controls-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.evolution-controls-row {
    display: flex;
    align-items: center;
}

.evolution-controls-row-metric {
    gap: 8px;
}

.evolution-controls-row-years {
    gap: 10px;
}

@media (max-width: 900px) {
    .global-super-header {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 8px 10px;
    }

    .super-header-title {
        order: 1;
        width: 100%;
        font-size: 0.72rem;
        text-align: left;
        letter-spacing: 0.2px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .super-header-selector {
        order: 2;
        justify-content: space-between;
        gap: 8px;
        flex-wrap: wrap;
    }

    .super-header-selector label {
        font-size: 0.75rem;
    }

    .year-selector-pill {
        min-width: 86px;
        padding: 6px 12px;
    }

    #app-container {
        padding: 0.6rem;
        overflow: auto;
    }

    .tab-header {
        margin-bottom: 10px;
        padding: 0 8px;
    }

    .tab-header nav {
        overflow-x: auto;
        scrollbar-width: none;
    }

    .tab-header nav::-webkit-scrollbar {
        display: none;
    }

    .tab-button,
    .about-button {
        white-space: nowrap;
        padding: 10px 12px;
        font-size: 0.9rem;
        min-height: 44px;
    }

    #tab-vulnerability .row-container {
        flex-direction: row;
        align-items: stretch;
        gap: 8px;
    }

    #tab-vulnerability .col-sm-4 {
        width: auto;
        min-width: 0;
        max-width: none;
        padding: 0;
        flex: 0 0 auto;
    }

    #tab-vulnerability .col-sm-8 {
        width: auto;
        min-width: 0;
        padding: 0;
        flex: 1 1 auto;
    }

    #tab-compare .col-sm-4,
    #tab-compare .col-sm-8,
    #tab-evolution .col-sm-4,
    #tab-evolution .col-sm-8 {
        width: 100%;
        padding: 0;
    }

    .main-panel {
        min-height: 62vh;
    }

    .map-container {
        min-height: 56vh;
    }

    .mobile-filters-btn,
    .mobile-info-btn,
    .mobile-action-bar,
    .mobile-sidebar-backdrop {
        display: none !important;
    }

    .mobile-map-switch {
        display: flex;
    }

    #tab-compare .row-container,
    #tab-evolution .row-container {
        flex-direction: column;
    }

    #tab-compare .compare-container,
    #tab-evolution .compare-container {
        gap: 8px;
    }

    .compare-map-wrapper.mobile-hidden {
        display: none !important;
    }
}
