/* --- Reset Básico y Estilos Generales --- */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    background-color: #e9f0f3;
    color: #3a3a3a;
    line-height: 1.6;
    font-size: 16px; /* Base font size */
}

.page-wrapper { /* Nuevo contenedor para el header y el contenido principal + panel */
    max-width: 1600px; /* Ancho máximo de toda la página */
    margin: 0 auto;
    background-color: #f8f9fa; /* Un fondo ligeramente diferente para el wrapper */
}

.container {
    width: 100%;
    background-color: #ffffff;
    display: flex;
    flex-wrap: nowrap;
    box-shadow: 0 0 15px rgba(0,0,0,0.05); /* Sombra más sutil */
    border-radius: 0 0 12px 12px; /* Redondeo abajo ya que header está fuera */
}

/* --- Header --- */
header {
    background: linear-gradient(135deg, #00796b, #004d40);
    color: white;
    padding: 25px 20px; /* Ajustado */
    text-align: center;
    border-radius: 12px 12px 0 0; /* Redondeo solo arriba */
}

header h1 {
    margin: 0 0 8px 0;
    font-size: 2.2em; /* Ligeramente más pequeño */
    font-weight: 600;
}

header p {
    font-size: 1.05em;
    opacity: 0.95;
    margin: 0;
}

/* --- Área Principal de Contenido y Pestañas --- */
.main-content-area {
    flex-grow: 1;
    padding: 20px; /* Padding reducido */
    box-sizing: border-box;
    min-width: 0; 
}

/* --- Navegación por Pestañas --- */
.tab-navigation {
    display: flex;
    background-color: #f0f4f8;
    border-bottom: 3px solid #00796b;
    margin-bottom: 20px; /* Espacio reducido */
    border-radius: 6px; /* Redondeo completo */
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.tab-link {
    background-color: transparent;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 12px 15px; /* Padding reducido */
    transition: background-color 0.3s, color 0.3s, border-bottom-color 0.3s;
    font-size: 0.95em; /* Ligeramente más pequeño */
    font-weight: 500;
    color: #495057;
    flex-grow: 1;
    text-align: center;
    border-right: 1px solid #d4dce2;
    border-bottom: 3px solid transparent; /* Para el efecto active */
}
.tab-link:last-child {
    border-right: none;
}

.tab-link:hover {
    background-color: #e2e8ec;
    color: #005a52;
}

.tab-link.active {
    background-color: #00796b;
    color: white;
    font-weight: 600;
    border-bottom-color: #004d40; /* Borde más oscuro para la pestaña activa */
}

/* --- Contenido de las Pestañas --- */
.tab-content {
    display: none;
    animation: fadeInContent 0.5s ease-out;
    padding: 5px 0; /* Padding reducido */
}

@keyframes fadeInContent {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.tab-content.active-content {
    display: block;
}

.tab-content h2 {
    color: #004d40;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.6em;
    border-bottom: 1px solid #00796b;
    padding-bottom: 8px;
}

.tab-content p {
    margin-bottom: 12px;
    color: #454545;
    font-size: 1em;
}

.highlight { color: #d84315; font-weight: bold; }
.icon { font-size: 1.2em; margin-right: 8px; vertical-align: middle; }

/* --- Estilos Específicos de Pestañas --- */
.resource-summary {
    background-color: #e0f2f1;
    padding: 15px;
    border-radius: 6px;
    margin: 15px 0;
    border: 1px solid #b2dfdb;
}
.resource-summary h3 { margin-top: 0; color: #004d40; font-size: 1.1em; }
.resource-summary ul { list-style-type: none; padding-left: 0; }
.resource-summary li { margin-bottom: 6px; font-size: 0.95em; }

.indicators-preview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); /* Más pequeñas */
    gap: 8px;
    margin: 15px 0;
    text-align: center;
}
.indicators-preview > div {
    background-color: #f9f9f9;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #eee;
    font-size: 0.9em;
}
.indicators-preview .icon { font-size: 1.6em; display: block; margin-bottom: 3px; color: #00796b; }

/* Sliders y Outputs */
.allocation-sliders, .production-method-choice, .distribution-sliders {
    margin: 20px 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* Ajustar minmax */
    gap: 15px;
}
.slider-group, .method-option {
    margin-bottom: 0;
    padding: 12px;
    background-color: #fdfdfd;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}
.slider-group label, .method-option label { display: block; margin-bottom: 6px; font-weight: 500; color: #333; font-size: 0.95em;}
.slider-group input[type="range"], .method-option input[type="range"] { width: 100%; cursor: pointer; margin-top: 3px; }
.slider-group output, .method-option output { font-weight: bold; color: #00796b; margin-left: 5px; }
.method-option small { display: block; font-size: 0.85em; color: #666; margin-top: 4px; }

.remaining-points, #porcentajeTotalDistribuido {
    font-size: 1.05em;
    color: #d84315;
    font-weight: bold;
    display: block;
    margin-top: 15px;
    text-align: center;
    padding: 8px;
    background-color: #fff5e6;
    border-radius: 4px;
}

.current-impact-section { /* Contenedor de los impactos parciales */
    margin-top: 15px;
    padding: 12px;
    background-color: #fffde7; /* Amarillo muy pálido */
    border-left: 4px solid #ffc107; /* Amarillo */
    border-radius: 4px;
}
.current-impact-section h4 { margin-top: 0; color: #795548; font-size: 1.1em; margin-bottom: 10px;}
.current-impact-grid { /* Grid para los indicadores parciales */
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
}
.current-impact-grid p { margin: 3px 0; font-size: 0.95em; }
.indicator-value { font-weight: bold; color: #00796b; } /* Para valores en impacto parcial */

/* Pestaña Resultados */
.final-indicators {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); /* Ajustado */
    gap: 15px;
    margin-bottom: 20px;
}
.indicator-card {
    background-color: #e0f7fa;
    padding: 15px; /* Reducido */
    border-radius: 8px;
    text-align: center;
    border: 1px solid #b2ebf2;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.indicator-card .icon { font-size: 2.5em; color: #00796b; margin-bottom: 8px; display: block; }
.indicator-card div:not(.icon) { font-size: 0.95em; color: #004d40; margin-bottom: 4px; }
.indicator-card .indicator-value-final { font-size: 1.3em; font-weight: bold; color: #00796b; }

.analysis-section { margin-top: 20px; padding: 18px; background-color: #f1f8e9; border: 1px solid #c8e6c9; border-radius: 6px; }
.analysis-section h3 { color: #33691e; margin-top: 0; font-size: 1.2em; }
.analysis-section h4 { color: #558b2f; margin-top: 12px; font-size: 1.1em; }
.analysis-section ul { list-style-type: '👉 '; padding-left: 20px; }
.analysis-section li { margin-bottom: 7px; font-size: 0.95em;}

/* Botones */
.next-tab-button, .action-button {
    display: block;
    margin: 20px auto 5px auto; /* Margen reducido */
    padding: 10px 25px; /* Padding ajustado */
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    min-width: 180px;
}
.next-tab-button:hover, .action-button:hover { background-color: #0056b3; }
.action-button#resetButtonSimulador { background-color: #dc3545; }
.action-button#resetButtonSimulador:hover { background-color: #c82333; }

/* --- Panel Lateral de Indicadores --- */
.indicators-panel-main {
    flex-basis: 280px; /* Ancho reducido */
    flex-shrink: 0;
    background-color: #f8f9fa;
    padding: 20px;
    border-left: 1px solid #dee2e6;
    box-sizing: border-box;
    border-radius: 0 12px 12px 0;
}
.indicators-panel-main h2 { margin-top: 0; color: #004d40; font-size: 1.4em; text-align: center; margin-bottom: 18px; }
.indicator { margin-bottom: 18px; font-size: 0.9em; }
.indicator .icon { font-size: 1.4em; margin-right: 8px; color: #00796b; vertical-align: middle; }
.indicator .value { font-weight: bold; color: #00796b; font-size: 1em; }
.indicator-bar-container { width: 100%; height: 12px; background-color: #e9ecef; border-radius: 6px; overflow: hidden; margin-top: 5px; border: 1px solid #ced4da;}
.indicator-bar { height: 100%; background-color: #26a69a; border-radius: 6px; transition: width 0.4s ease-in-out; }
#mainIndicatorFelicidad .indicator-bar { background-color: #ffca28; }
#mainIndicatorRecursos .indicator-bar { background-color: #66bb6a; }

/* --- Footer --- */
footer {
    text-align: center;
    margin-top: 25px;
    padding: 15px;
    font-size: 0.9em;
    color: #777;
    border-top: 1px solid #e0e0e0;
    /* Si el header está fuera del .page-wrapper, el footer también debería estarlo */
    /* o el .page-wrapper es el contenedor absoluto */
}

/* --- Responsividad --- */
@media (max-width: 1200px) { /* Ajustar el punto de quiebre para el panel lateral */
    .container {
        flex-direction: column;
    }
    .indicators-panel-main {
        flex-basis: auto;
        width: 100%;
        border-left: none;
        border-top: 1px solid #dee2e6;
        margin-top: 20px;
        border-radius: 8px; /* Redondeo completo cuando está abajo */
    }
    /* Ajustar redondeo del header si es parte del page-wrapper que no es flex */
    .page-wrapper > header { border-radius: 12px 12px 0 0; }
    .container { border-radius: 0 0 12px 12px; } /* Si header está fuera */
}

@media (max-width: 768px) {
    .allocation-sliders, .production-method-choice, .distribution-sliders, .final-indicators, .indicators-preview, .current-impact-grid {
        grid-template-columns: 1fr; /* Una columna en móvil */
    }
     .main-content-area { padding: 15px; }
     header h1 { font-size: 1.9em; }
     .tab-content h2 { font-size: 1.4em; }
}

@media (max-width: 600px) {
    .tab-navigation {
        flex-direction: column;
    }
    .tab-link {
        border-right: none;
        border-bottom: 1px solid #d4dce2;
        text-align: left;
        padding: 10px 15px;
    }
    .tab-link.active {
        border-bottom: 3px solid #004d40; /* Borde más oscuro para activa */
    }
    .next-tab-button, .action-button {
        width: 100%;
        box-sizing: border-box;
    }
}