/* ===================================
   VARIABLES CSS
   =================================== */
:root {
    --color-primary: #2c3e50;
    --color-primary-dark: #1a242f;
    --color-secondary: #bbb;
    --color-secondary-dark: #888;
    --color-background: #f4f4f4;
    --color-white: #fff;
    --color-text: #222;
    --color-border: #ccc;
    --color-shadow: rgba(0, 0, 0, 0.1);
    
    --bg-form-blue: #eef6fa;
    --bg-form-green: #f6f9ee;
    --bg-form-gray: #f6f6fa;
    --bg-light: #f9f9f9;
    --bg-item: #e3eafc;
    
    --color-success: #27ae60;
    --color-warning: #f39c12;
    --color-danger: #e74c3c;
    --color-info: #3498db;
    
    --border-radius: 8px;
    --border-radius-sm: 4px;
    --transition: all 0.3s ease;
}

/* ===================================
   ESTILOS GENERALES
   =================================== */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: var(--color-background);
    color: var(--color-text);
    padding-bottom: 80px;
    line-height: 1.6;
}

/* ===================================
   HEADER Y NAVEGACIÓN
   =================================== */
header {
    background: var(--color-primary);
    color: var(--color-white);
    padding: 1.5em 0;
    text-align: center;
    box-shadow: 0 2px 8px var(--color-shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 {
    margin: 0 0 0.5em 0;
    font-size: 2em;
}

nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    gap: 1.5em;
    flex-wrap: wrap;
}

nav a {
    color: var(--color-white);
    text-decoration: none;
    font-weight: bold;
    padding: 0.5em 1em;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

nav a:hover {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
}

/* ===================================
   CONTENEDOR PRINCIPAL
   =================================== */
main {
    max-width: 1100px;
    margin: 2em auto;
    background: var(--color-white);
    padding: 2.5em;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px var(--color-shadow);
}

section {
    margin-bottom: 3em;
    scroll-margin-top: 80px;
}

section h2 {
    color: var(--color-primary);
    border-bottom: 3px solid var(--color-primary);
    padding-bottom: 0.5em;
    margin-bottom: 1em;
}

section h3 {
    color: var(--color-primary);
    margin-top: 1.5em;
}

hr {
    border: none;
    border-top: 2px solid #e0e0e0;
    margin: 2em 0;
}

/* ===================================
   ESTILOS COMUNES DE FORMULARIOS
   =================================== */
label {
    font-weight: bold;
    display: block;
    margin-bottom: 0.5em;
}

select {
    padding: 8px 12px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--color-border);
    font-size: 1em;
    transition: var(--transition);
    cursor: pointer;
}

select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.1);
}

textarea {
    width: 100%;
    padding: 10px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--color-border);
    font-family: inherit;
    font-size: 1em;
    resize: vertical;
    min-height: 80px;
    max-height: 300px;
    transition: var(--transition);
}

textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.1);
}

/* ===================================
   BOTONES
   =================================== */
button,
input[type="button"] {
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-weight: bold;
    font-size: 1em;
    transition: var(--transition);
    margin-right: 10px;
    margin-top: 10px;
}

#verificar-reflexion,
#verificar-analogias,
#verificar-quiz-conceptos,
#verificar-caso,
#verificar-autoevaluacion,
#comparar-paises,
#enviar-foro {
    background: var(--color-primary);
    color: var(--color-white);
}

#verificar-reflexion:hover,
#verificar-analogias:hover,
#verificar-quiz-conceptos:hover,
#verificar-caso:hover,
#verificar-autoevaluacion:hover,
#comparar-paises:hover,
#enviar-foro:hover {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--color-shadow);
}

#limpiar-reflexion,
#limpiar-analogias,
#limpiar-quiz-conceptos,
#limpiar-caso,
#limpiar-autoevaluacion,
#limpiar-comparacion,
#limpiar-foro {
    background: var(--color-secondary);
    color: var(--color-text);
}

#limpiar-reflexion:hover,
#limpiar-analogias:hover,
#limpiar-quiz-conceptos:hover,
#limpiar-caso:hover,
#limpiar-autoevaluacion:hover,
#limpiar-comparacion:hover,
#limpiar-foro:hover {
    background: var(--color-secondary-dark);
    color: var(--color-white);
    transform: translateY(-2px);
}

/* ===================================
   SIMULADOR BÁSICO
   =================================== */
#simulador-form {
    background: var(--bg-form-blue);
    padding: 1.5em;
    border-radius: var(--border-radius);
    box-shadow: 0 1px 4px rgba(44, 62, 80, 0.08);
    margin-bottom: 1.5em;
}

#simulador-form label {
    display: inline-block;
    width: 150px;
    font-weight: bold;
    margin-bottom: 1em;
}

#simulador-form input[type="range"] {
    width: 200px;
    margin: 0 10px;
    cursor: pointer;
}

#indicadores-salud {
    margin-top: 1.5em;
    background: var(--bg-light);
    border-radius: var(--border-radius);
    padding: 1.5em;
    box-shadow: 0 1px 4px rgba(44, 62, 80, 0.05);
}

#indicadores-salud h4 {
    margin-top: 0;
    color: var(--color-primary);
}

#indicadores-salud ul {
    list-style: none;
    padding: 0;
}

#indicadores-salud li {
    margin-bottom: 0.8em;
    font-size: 1.1em;
    padding: 0.5em;
    background: white;
    border-radius: var(--border-radius-sm);
    border-left: 4px solid var(--color-primary);
}

/* ===================================
   BOTONES MODO AVANZADO
   =================================== */
.modo-avanzado-container,
.modo-basico-container {
    text-align: center;
    margin: 2em 0;
}

.btn-avanzado,
.btn-volver {
    padding: 15px 30px;
    font-size: 1.1em;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: bold;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-avanzado:hover,
.btn-volver:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-volver {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 4px 15px rgba(245, 87, 108, 0.4);
}

.btn-volver:hover {
    box-shadow: 0 6px 20px rgba(245, 87, 108, 0.6);
}

/* ===================================
   SIMULADOR AVANZADO
   =================================== */
.simulador-avanzado {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    padding: 2em;
    border-radius: var(--border-radius);
    margin-top: 2em;
    border: 2px solid #667eea;
    transition: var(--transition);
}

.simulador-avanzado.oculto {
    display: none;
}

.simulador-avanzado h3 {
    text-align: center;
    color: #667eea;
    font-size: 1.8em;
    margin-bottom: 0.5em;
}

.descripcion-avanzada {
    text-align: center;
    color: #666;
    margin-bottom: 2em;
    font-size: 1.05em;
}

/* ===================================
   SISTEMA DE PESTAÑAS
   =================================== */
.tabs-container {
    margin-bottom: 2em;
}

.tabs {
    display: flex;
    gap: 0.5em;
    flex-wrap: wrap;
    justify-content: center;
    background: var(--bg-light);
    padding: 1em;
    border-radius: var(--border-radius);
}

.tab-button {
    padding: 12px 20px;
    background: white;
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-weight: bold;
    transition: var(--transition);
    font-size: 0.95em;
}

.tab-button:hover {
    background: var(--bg-form-blue);
    border-color: var(--color-info);
    transform: translateY(-2px);
}

.tab-button.active {
    background: var(--color-info);
    color: white;
    border-color: var(--color-info);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

/* ===================================
   CONTENIDO DE PESTAÑAS
   =================================== */
.tab-content-container {
    background: white;
    padding: 2em;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px var(--color-shadow);
    min-height: 400px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tab-content h4 {
    color: var(--color-primary);
    margin-bottom: 1.5em;
    font-size: 1.4em;
    border-bottom: 2px solid var(--color-primary);
    padding-bottom: 0.5em;
}

/* ===================================
   INDICADORES INDIVIDUALES
   =================================== */
.indicador-item {
    margin-bottom: 2em;
    padding: 1.5em;
    background: var(--bg-light);
    border-radius: var(--border-radius-sm);
    border-left: 4px solid var(--color-info);
    transition: var(--transition);
}

.indicador-item:hover {
    background: #f0f8ff;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.2);
}

.indicador-item label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 1.05em;
    margin-bottom: 1em;
    color: var(--color-text);
}

.indicador-item input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #ddd;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
}

.indicador-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-info);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
}

.indicador-item input[type="range"]::-webkit-slider-thumb:hover {
    background: #2980b9;
    transform: scale(1.2);
}

.indicador-item input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-info);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: none;
}

.valor-indicador {
    display: inline-block;
    min-width: 40px;
    text-align: center;
    font-weight: bold;
    color: var(--color-info);
    background: white;
    padding: 5px 10px;
    border-radius: var(--border-radius-sm);
    margin-left: 10px;
}

/* ===================================
   ICONOS DE INFORMACIÓN (TOOLTIPS)
   =================================== */
.info-icon {
    cursor: pointer;
    background: var(--color-info);
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    font-weight: bold;
    transition: var(--transition);
    margin-left: 8px;
}

.info-icon:hover {
    background: #2980b9;
    transform: scale(1.2);
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.4);
}

/* ===================================
   MODAL PARA TOOLTIPS
   =================================== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 2em;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
    position: relative;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
}

.close-modal:hover,
.close-modal:focus {
    color: var(--color-danger);
    transform: rotate(90deg);
}

.modal-content h3 {
    color: var(--color-primary);
    margin-top: 0;
    border-bottom: 2px solid var(--color-info);
    padding-bottom: 0.5em;
}

.modal-content p {
    margin: 1em 0;
    line-height: 1.6;
}

.modal-sistema,
.modal-fuente,
.modal-rango {
    background: var(--bg-light);
    padding: 0.8em;
    border-radius: var(--border-radius-sm);
    margin: 0.5em 0;
    border-left: 4px solid var(--color-info);
}

/* ===================================
   INDICADORES RESULTANTES AVANZADOS
   =================================== */
.indicadores-avanzados {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2em;
    border-radius: var(--border-radius);
    margin-top: 2em;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.indicadores-avanzados h4 {
    margin-top: 0;
    text-align: center;
    font-size: 1.5em;
    margin-bottom: 1em;
}

.resultados-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1em;
    margin-bottom: 1.5em;
}

.resultado-item {
    background: rgba(255, 255, 255, 0.15);
    padding: 1.5em;
    border-radius: var(--border-radius-sm);
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: var(--transition);
}

.resultado-item:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-5px);
}

.resultado-label {
    display: block;
    font-size: 1em;
    margin-bottom: 0.5em;
    opacity: 0.9;
}

.resultado-valor {
    display: block;
    font-size: 2.5em;
    font-weight: bold;
}

.estado-salud {
    background: rgba(255, 255, 255, 0.2);
    padding: 1em;
    border-radius: var(--border-radius-sm);
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.estado-salud p {
    margin: 0;
    font-size: 1.1em;
}

/* ===================================
   JUEGO DE ANALOGÍAS
   =================================== */
#juego-analogias-form {
    background: var(--bg-form-green);
    padding: 1.5em;
    border-radius: var(--border-radius);
    box-shadow: 0 1px 4px rgba(44, 62, 80, 0.08);
}

.analogias-item {
    margin-bottom: 1.5em;
    padding: 1em;
    background: white;
    border-radius: var(--border-radius-sm);
}

.analogias-item label {
    display: block;
    font-weight: bold;
    margin-bottom: 0.5em;
}

.analogias-item select {
    width: 100%;
    max-width: 400px;
}

.analogias-item span {
    display: block;
    margin-top: 0.5em;
    font-size: 1em;
    font-weight: bold;
}

/* ===================================
   QUIZ INTERACTIVO
   =================================== */
#quiz-conceptos-form {
    background: var(--bg-form-gray);
    padding: 1.5em;
    border-radius: var(--border-radius);
    box-shadow: 0 1px 4px rgba(44, 62, 80, 0.08);
}

.quiz-item {
    margin-bottom: 1.5em;
    padding: 1em;
    background: white;
    border-radius: var(--border-radius-sm);
}

.quiz-item label {
    display: block;
    font-weight: bold;
    margin-bottom: 0.5em;
}

.quiz-item select {
    width: 100%;
    max-width: 500px;
    margin-top: 0.5em;
}

.quiz-item span {
    display: block;
    margin-top: 0.5em;
    font-size: 1em;
    font-weight: bold;
}

/* ===================================
   PREGUNTA DE REFLEXIÓN
   =================================== */
#reflexion-form {
    background: var(--bg-form-gray);
    padding: 1.5em;
    border-radius: var(--border-radius);
    box-shadow: 0 1px 4px rgba(44, 62, 80, 0.08);
}

#respuesta-reflexion {
    width: 100%;
    margin-bottom: 1em;
}

#feedback-reflexion {
    margin-top: 1em;
    padding: 1em;
    font-size: 1.1em;
    font-weight: bold;
    border-radius: var(--border-radius-sm);
    background: var(--bg-light);
}

/* ===================================
   ESTUDIO DE CASO INTERACTIVO
   =================================== */
#caso-form {
    background: var(--bg-form-green);
    padding: 1.5em;
    border-radius: var(--border-radius);
    box-shadow: 0 1px 4px rgba(44, 62, 80, 0.08);
}

#caso-decision {
    width: 100%;
    max-width: 600px;
    padding: 8px 12px;
    margin-top: 0.5em;
    margin-bottom: 1em;
}

#feedback-caso {
    margin-top: 1em;
    padding: 1em;
    font-size: 1.1em;
    font-weight: bold;
    border-radius: var(--border-radius-sm);
    background: var(--bg-light);
}

/* ===================================
   COMPARACIÓN DE INDICADORES
   =================================== */
#comparacion-paises-form {
    background: var(--bg-form-green);
    padding: 1.5em;
    border-radius: var(--border-radius);
    box-shadow: 0 1px 4px rgba(44, 62, 80, 0.08);
}

#comparacion-paises-form label {
    display: inline-block;
    font-weight: bold;
    margin-right: 10px;
    margin-bottom: 1em;
}

#comparacion-paises-form select {
    margin-right: 20px;
    margin-bottom: 1em;
}

#resultado-comparacion {
    margin-top: 1.5em;
}

#resultado-comparacion table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1em;
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 2px 8px var(--color-shadow);
}

#resultado-comparacion th,
#resultado-comparacion td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: center;
}

#resultado-comparacion th {
    background: var(--color-primary);
    color: white;
    font-weight: bold;
}

#resultado-comparacion tr:nth-child(even) {
    background: #f9f9f9;
}

#resultado-comparacion tr:hover {
    background: #f0f0f0;
}

/* ===================================
   CONCLUSIONES Y RECOMENDACIONES
   =================================== */
.conclusiones-actividades {
    background: var(--bg-form-green);
    padding: 1.5em;
    border-radius: var(--border-radius);
    box-shadow: 0 1px 4px rgba(44, 62, 80, 0.08);
}

#form-autoevaluacion textarea,
#form-foro textarea {
    width: 100%;
    margin-bottom: 1em;
}

#feedback-autoevaluacion {
    margin-top: 1em;
    padding: 1em;
    font-size: 1.05em;
    font-weight: bold;
    border-radius: var(--border-radius-sm);
    background: var(--bg-light);
}

#foro-lista {
    margin-top: 1.5em;
}

.foro-item {
    background: var(--bg-item);
    border-radius: var(--border-radius-sm);
    padding: 1em;
    margin-bottom: 0.8em;
    font-size: 1em;
    border-left: 4px solid var(--color-primary);
    transition: var(--transition);
}

.foro-item:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 8px var(--color-shadow);
}

/* ===================================
   FOOTER
   =================================== */
footer {
    background: var(--color-primary);
    color: var(--color-white);
    text-align: center;
    padding: 1.5em 0;
    margin-top: 3em;
    box-shadow: 0 -2px 8px var(--color-shadow);
}

footer p {
    margin: 0;
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */
@media (max-width: 768px) {
    main {
        padding: 1.5em;
        margin: 1em;
    }
    
    nav ul {
        flex-direction: column;
        gap: 0.5em;
    }
    
    #simulador-form label {
        width: 100%;
        display: block;
        margin-bottom: 0.5em;
    }
    
    #simulador-form input[type="range"] {
        width: 100%;
    }
    
    .analogias-item select,
    .quiz-item select,
    #caso-decision {
        width: 100%;
    }
    
    button,
    input[type="button"] {
        width: 100%;
        margin-right: 0;
        margin-bottom: 0.5em;
    }
    
    #comparacion-paises-form label,
    #comparacion-paises-form select {
        display: block;
        width: 100%;
        margin-bottom: 1em;
    }
    
    .tabs {
        flex-direction: column;
    }
    
    .tab-button {
        width: 100%;
        text-align: center;
    }
    
    .resultados-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        margin: 20% auto;
        padding: 1.5em;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5em;
    }
    
    section h2 {
        font-size: 1.3em;
    }
    
    #resultado-comparacion table {
        font-size: 0.9em;
    }
    
    .btn-avanzado,
    .btn-volver {
        padding: 12px 20px;
        font-size: 1em;
    }
    
    .tab-content-container {
        padding: 1em;
    }
    
    .indicador-item {
        padding: 1em;
    }
}