* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4a90e2;
    --secondary-color: #7b68ee;
    --success-color: #50c878;
    --danger-color: #e74c3c;
    --text-color: #333;
    --bg-color: #f5f7fa;
    --card-bg: #ffffff;
    --border-color: #e0e0e0;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow-hover);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px 20px;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1rem;
    opacity: 0.95;
    font-weight: 300;
}

.loading {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    border: 4px solid rgba(102, 126, 234, 0.2);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--border-color);
    margin-bottom: 10px;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.progress-text {
    text-align: center;
    padding: 10px 20px;
    color: #666;
    font-size: 0.9rem;
}

.cuestionario-container {
    padding: 30px 20px;
}

.seccion {
    margin-bottom: 40px;
    display: none;
}

.seccion.activa {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.seccion-titulo {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.pregunta {
    margin-bottom: 30px;
    padding: 20px;
    background: var(--bg-color);
    border-radius: 12px;
    border-left: 4px solid var(--primary-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pregunta:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow);
}

.pregunta-principal {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--primary-color);
    line-height: 1.5;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
}

.pregunta-texto {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 15px;
    color: var(--text-color);
    line-height: 1.5;
}

.opciones {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 15px;
}

.opcion {
    position: relative;
}

.opcion input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.opcion label {
    display: block;
    padding: 12px 16px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.opcion label:hover {
    border-color: var(--primary-color);
    background: #f0f4ff;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.opcion input[type="radio"]:checked + label {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
}

/* Estilos para checkboxes (opción múltiple) */
.opcion input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.opcion input[type="checkbox"]:checked + label {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
}

/* Estilos para campos numéricos */
.opcion.numero {
    max-width: 300px;
}

.opcion.numero input[type="number"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.opcion.numero input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.opcion.numero label {
    display: block;
    margin-top: 8px;
    font-size: 0.9rem;
    color: #666;
    font-weight: normal;
}

/* Instrucciones */
.instrucciones {
    background: #e8f4f8;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 0.9rem;
    color: #555;
    border-left: 3px solid var(--primary-color);
    font-style: italic;
}

/* Preguntas informativas */
.pregunta.informativa {
    border-left-color: #4a90e2;
    background: #f8f9fa;
}

.pregunta.informativa .pregunta-texto {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 10px;
}

/* Texto informativo */
.texto-informativo {
    background: #ffffff;
    padding: 20px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 4px solid var(--primary-color);
    line-height: 1.8;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.texto-informativo p {
    margin: 0;
    color: var(--text-color);
    font-size: 0.95rem;
}

/* Campos de texto, email y fecha */
.opcion.texto,
.opcion.email,
.opcion.fecha {
    max-width: 100%;
    margin-top: 10px;
}

.opcion.texto input[type="text"],
.opcion.email input[type="email"],
.opcion.fecha input[type="date"] {
    width: 100%;
    max-width: 500px;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
    font-family: inherit;
}

/* Estilo para inputs inválidos */
.input-invalid {
    border-color: var(--danger-color) !important;
    box-shadow: 0 0 0 4px rgba(231,76,60,0.06) !important;
    background: #fff6f6;
}

.opcion.texto input[type="text"]:focus,
.opcion.email input[type="email"]:focus,
.opcion.fecha input[type="date"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.formato-fecha {
    display: block;
    margin-top: 8px;
    font-size: 0.85rem;
    color: #666;
    font-style: italic;
}

/* Checkbox de consentimiento */
.opcion.consentimiento {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 15px;
    padding: 15px;
    background: #fff;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.opcion.consentimiento:hover {
    border-color: var(--primary-color);
    background: #f0f4ff;
}

.opcion.consentimiento input[type="checkbox"] {
    position: relative;
    opacity: 1;
    width: 20px;
    height: 20px;
    min-width: 20px;
    margin-top: 2px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: var(--primary-color);
}

.opcion.consentimiento input[type="checkbox"]:checked {
    accent-color: var(--primary-color);
}

.opcion.consentimiento input[type="checkbox"]:checked ~ .consentimiento-label {
    color: var(--text-color);
    font-weight: normal;
}

.opcion.consentimiento .consentimiento-label {
    display: block;
    padding: 0;
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-color);
    font-weight: normal;
    transition: none;
    transform: none;
}

.opcion.consentimiento .consentimiento-label:hover {
    background: transparent;
    border: none;
    transform: none;
    box-shadow: none;
}

.opcion.consentimiento input[type="checkbox"]:checked ~ .consentimiento-label {
    color: var(--text-color);
    font-weight: normal;
}

/* Mejoras para opciones con texto largo */
.opciones {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 15px;
}

@media (max-width: 768px) {
    .opciones {
        grid-template-columns: 1fr;
    }
    
    .opcion.numero {
        max-width: 100%;
    }
}

.form-actions {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    max-width: 200px;
}

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

.btn-primary:hover {
    background: #357abd;
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #45b869;
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn:active {
    transform: translateY(0);
}

.resultado-container {
    padding: 60px 20px;
    text-align: center;
}

.resultado-box {
    background: var(--bg-color);
    padding: 40px;
    border-radius: 12px;
    border: 2px solid var(--success-color);
}

.resultado-box h2 {
    color: var(--success-color);
    font-size: 2rem;
    margin-bottom: 20px;
}

.resultado-box p {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: #666;
}

/* Análisis y recomendaciones */
.analisis-box {
    background: #f0f9ff;
    padding: 25px;
    border-radius: 12px;
    border-left: 5px solid var(--primary-color);
    margin-top: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.analisis-box h3 {
    color: var(--primary-color);
    font-size: 1.3rem;
    margin-bottom: 15px;
    font-weight: 600;
}

.recomendaciones-texto {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-color);
}

.recomendaciones-texto p {
    margin-bottom: 15px;
    text-align: justify;
}

.recomendaciones-texto p:last-child {
    margin-bottom: 0;
    font-weight: 500;
    color: var(--primary-color);
}

/* Video educativo */
.video-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

#video-container h4 {
    font-size: 1.1rem;
    font-weight: 600;
}

#video-descripcion {
    font-style: italic;
    color: #666;
}

.error {
    background: #fee;
    color: var(--danger-color);
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
    border-left: 4px solid var(--danger-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .cuestionario-container {
        padding: 20px 15px;
    }

    .seccion-titulo {
        font-size: 1.1rem;
    }

    .pregunta {
        padding: 15px;
    }

    .pregunta-texto {
        font-size: 1rem;
    }

    .opciones {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .opcion label {
        padding: 14px 16px;
        font-size: 0.95rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn {
        max-width: 100%;
        width: 100%;
    }

    .resultado-box {
        padding: 30px 20px;
    }

    .resultado-box h2 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.75rem;
    }

    .pregunta-texto {
        font-size: 0.95rem;
    }

    .opcion label {
        font-size: 0.85rem;
        padding: 12px 14px;
    }
}

/* Animaciones adicionales */
.pregunta.respondida {
    border-left-color: var(--success-color);
    background: #f0f9f4;
}

.pregunta.respondida .pregunta-texto::after {
    content: " ✓";
    color: var(--success-color);
    font-weight: bold;
}




