/* ============================================================================
 * MÓDULO: STYLE.CSS - Hoja de Estilos Globales e Interfaz Responsiva
 * ============================================================================
 * ¿Qué hace este módulo?:
 *   Controla el diseño visual, la tipografía, las animaciones y la adaptabilidad
 *   fluida para escritorios y dispositivos móviles en IdeoTest.
 *
 * ¿Para qué sirve?:
 *   Asegura un escalado proporcional en dispositivos móviles mediante la función
 *   clamp() combinada con unidades vw, al tiempo que fija topes máximos en
 *   monitores de escritorio para evitar tipografías sobreescaladas.
 *
 * Última modificación: 15/08/2026 22:52
 * ============================================================================ */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: clamp(10px, 3vw, 30px);
}

.container { max-width: 1000px; margin: 0 auto; }

.btn, .btn-rectificar {
    display: inline-block;
    padding: 12px 25px;
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-weight: bold;
    transition: transform 0.2s;
    border: none;
    cursor: pointer;
}
.btn { background: #667eea; }
.btn:hover { transform: scale(1.02); }
.btn-rectificar { background: #ff9800; }
.btn-rectificar:hover { transform: scale(1.02); background: #f57c00; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulseWarning { 0%, 100% { background-color: #ffebee; } 50% { background-color: #ffcdd2; } }

/* ---------- Landing ---------- */
.landing {
    background: white;
    border-radius: 30px;
    padding: clamp(20px, 4vw, 40px);
    max-width: 700px;
    width: 100%;
    margin: 0 auto;
    box-shadow: 0 30px 80px rgba(0,0,0,0.3);
    text-align: center;
    animation: fadeInUp 0.8s ease;
}
.logo-icon { font-size: clamp(3em, 10vw, 4em) !important; margin-bottom: 15px; }
.landing h1 { font-size: clamp(1.8em, 6vw, 2.2em) !important; color: #333; margin-bottom: 5px; }
.landing .subtitle { font-size: clamp(0.85em, 3.5vw, 0.95em) !important; color: #666; margin-bottom: 15px; }
.badges { display: flex; justify-content: center; gap: 15px; flex-wrap: wrap; margin-bottom: 20px; }
.badge {
    background: #f0f4ff;
    padding: 8px 20px;
    border-radius: 30px;
    font-size: clamp(0.75em, 3vw, 0.9em) !important;
    font-weight: 600;
    color: #667eea;
}
.badge.green { background: #e8f5e9; color: #2e7d32; }
.badge.orange { background: #fff3e0; color: #e65100; }
.badge.blue { background: #e3f2fd; color: #0d47a1; }
.descripcion {
    text-align: left;
    margin: 15px 0 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
    font-size: clamp(0.85em, 3.5vw, 0.95em) !important;
    line-height: 1.7;
    color: #444;
}
.descripcion strong { color: #333; }
.niveles-landing { display: flex; gap: 15px; margin: 15px 0; flex-wrap: wrap; justify-content: center; }
.nivel-btn-landing {
    flex: 1;
    min-width: 140px;
    padding: 12px 25px !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 15px;
    font-size: clamp(1em, 4vw, 1.1em) !important;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
    display: block;
}
.nivel-btn-landing:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4); }
.nivel-btn-landing small { display: block; font-weight: normal; font-size: 0.7em; opacity: 0.8; margin-top: 5px; }

/* ---------- Formulario / Header / Progreso ---------- */
.header { text-align: center; color: white; margin-bottom: 30px; padding-top: 20px; }
.header h1 { font-size: clamp(1.5em, 5vw, 2em); margin-bottom: 10px; }
.header p { font-size: clamp(0.85em, 3vw, 1em); opacity: 0.9; }
.header .rectificar-tag { display: inline-block; background: #ff9800; padding: 5px 15px; border-radius: 20px; font-size: 0.8em; font-weight: bold; margin-top: 5px; }

.nivel-selector { display: flex; gap: 15px; margin-bottom: 20px; flex-wrap: wrap; justify-content: center; }
.nivel-btn {
    flex: 1; min-width: 120px; padding: 15px 20px; background: rgba(255,255,255,0.2);
    border: 2px solid white; border-radius: 15px; color: white; text-align: center;
    cursor: pointer; transition: all 0.3s; text-decoration: none; display: block;
}
.nivel-btn:hover { background: rgba(255,255,255,0.4); transform: translateY(-2px); }
.nivel-btn.activo { background: white; color: #667eea; font-weight: bold; }
.nivel-btn h3 { font-size: 1.2em; margin-bottom: 5px; }
.nivel-btn p { font-size: 0.8em; opacity: 0.8; }

.progress-container {
    position: sticky; top: 0; z-index: 1000;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 15px 20px; margin: 0 -20px 20px -20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    border-bottom: 1px solid rgba(255,255,255,0.2);
}
.progress-wrapper { max-width: 800px; margin: 0 auto; }
.progress-stats { display: flex; justify-content: space-between; margin-bottom: 8px; color: white; font-size: 0.9em; font-weight: bold; }
.progress-bar-fixed { background: rgba(255,255,255,0.3); height: 8px; border-radius: 4px; overflow: hidden; }
.progress-fill-fixed { background: white; height: 100%; border-radius: 4px; transition: width 0.3s ease; width: 0%; }
.pregunta-actual { font-size: 0.8em; opacity: 0.9; }

.question-card {
    background: white; border-radius: 20px; padding: 25px; margin-bottom: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1); animation: fadeIn 0.5s ease;
    scroll-margin-top: 80px; position: relative;
}
.question-card.rectificar { border-left: 4px solid #ff9800; }
.question-number {
    background: #667eea; color: white; width: 40px; height: 40px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center; font-weight: bold; margin-bottom: 15px;
}
.question-text { font-size: clamp(1em, 3.5vw, 1.15em); font-weight: 600; margin-bottom: 25px; color: #333; line-height: 1.4; }
.slider-container { margin-top: 20px; position: relative; }

/* NO / SÍ labels */
.no-si-labels {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-bottom: 10px;
    font-weight: bold;
    font-size: clamp(0.8em, 2.5vw, 0.95em);
}
.label-no {
    grid-column: 1 / 4;
    text-align: center;
}
.label-si {
    grid-column: 5 / 8;
    text-align: center;
}

/* Iconos clicables */
.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: clamp(1.8em, 6vw, 2.2em);
    color: #888;
    cursor: pointer;
    padding: 5px 0;
}
.icono-opcion {
    transition: all 0.2s ease;
    padding: 5px;
    border-radius: 50%;
    line-height: 1;
    user-select: none;
}
.icono-opcion:hover {
    transform: scale(1.2);
    background: rgba(0,0,0,0.05);
}
.icono-opcion.seleccionado {
    background: #27ae60;
    color: white;
    box-shadow: 0 2px 10px rgba(39, 174, 96, 0.4);
    transform: scale(1.1);
}

/* Slider oculto */
.slider { display: none; }
.slider-value { display: none; }

/* Controles adicionales de formulario */
.form-group.comunidad-selector select {
    padding: 10px !important;
    border-radius: 10px !important;
    border: 2px solid #667eea !important;
    font-size: clamp(0.85em, 3vw, 0.95em) !important;
    background: white !important;
    min-width: min(100%, 320px) !important;
}

.form-group.comunidad-selector div {
    font-size: clamp(0.75em, 2.8vw, 0.85em) !important;
}

.consentimiento-container {
    margin: 20px auto !important;
    max-width: 700px !important;
    font-size: clamp(0.8em, 3vw, 0.9em) !important;
    color: #fff !important;
}

.consentimiento-container input[type="checkbox"] {
    width: clamp(16px, 4vw, 20px) !important;
    height: clamp(16px, 4vw, 20px) !important;
    margin-top: 2px !important;
}

.btn-submit {
    width: 100%; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white; border: none; padding: 16px; font-size: clamp(0.95em, 3.5vw, 1.1em); font-weight: bold;
    border-radius: 12px; cursor: pointer; margin-top: 20px; transition: transform 0.2s;
}
.btn-submit:active { transform: scale(0.98); }
.btn-submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-submit.cargando { opacity: 0.8; cursor: wait; }

.info { background: rgba(255,255,255,0.15); padding: 15px; border-radius: 12px; margin-top: 20px; text-align: center; color: white; font-size: 0.85em; }

/* ---------- Resultado ---------- */
.result-card { background: white; border-radius: 25px; padding: 30px; margin-bottom: 20px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); animation: slideUp 0.5s ease; }
.result-card h1 { font-size: clamp(1.4em, 4vw, 1.8em); text-align: center; margin-bottom: 10px; color: #333; }
.fecha { text-align: center; color: #888; font-size: 0.85em; margin-bottom: 30px; }
.contador { text-align: center; color: #888; font-size: 0.8em; margin-bottom: 10px; }

.confianza-alta { background: #e8f5e9; border-left: 5px solid #4caf50; color: #2e7d32; }
.confianza-media { background: #fffde7; border-left: 5px solid #ffc107; color: #f57f17; }
.confianza-baja { background: #fff3e0; border-left: 5px solid #ff9800; color: #e65100; }
.confianza-muy-baja { background: #ffebee; border-left: 5px solid #f44336; color: #c62828; animation: pulseWarning 1s ease-in-out 3; }
.confianza { text-align: center; padding: 15px; border-radius: 15px; margin: 20px 0; }

.barra-ideologica-container { margin: 25px 0; padding: 20px; background: #f8f9fa; border-radius: 20px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.barra-ideologica-titulo { text-align: center; font-weight: bold; margin-bottom: 15px; color: #333; font-size: 0.95em; }
.barra-ideologica {
    position: relative; height: 30px; border-radius: 15px; overflow: visible; margin: 10px 0;
    background: linear-gradient(to right, #e74c3c 0%, #e74c3c 15%, #e67e22 15%, #e67e22 30%, #f1c40f 30%, #f1c40f 45%, #2ecc71 45%, #2ecc71 55%, #3498db 55%, #3498db 70%, #2980b9 70%, #2980b9 85%, #1a5276 85%, #1a5276 100%);
}
.barra-ideologica-marcador { position: absolute; top: 50%; transform: translate(-50%, -50%); z-index: 10; display: flex; flex-direction: column; align-items: center; transition: left 0.5s ease; }
.marcador-punto { width: 18px; height: 18px; background: white; border: 3px solid #333; border-radius: 50%; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.marcador-valor { position: absolute; top: -32px; white-space: nowrap; background: #667eea; color: white; padding: 4px 12px; border-radius: 20px; font-size: 0.8em; font-weight: bold; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.barra-ideologica-centro { position: absolute; left: 50%; top: -5px; bottom: -5px; width: 2px; background: rgba(0,0,0,0.3); z-index: 5; }
.barra-ideologica-labels { display: flex; justify-content: space-between; margin-top: 10px; font-size: 0.75em; color: #666; padding: 0 5px; }
.barra-ideologica-etiqueta { text-align: center; margin-top: 15px; font-size: 0.9em; padding: 8px; background: #f0f0f0; border-radius: 12px; }

.top3-container { display: flex; gap: 15px; margin: 30px 0; flex-wrap: wrap; justify-content: center; }
.partido-card { flex: 1; min-width: 170px; border-radius: 20px; padding: 15px; text-align: center; color: white; transition: transform 0.3s; }
.partido-card:hover { transform: translateY(-5px); }
.partido-card h3 { font-size: 0.8em; opacity: 0.9; margin-bottom: 5px; }
.partido-card .porcentaje { font-size: 1.8em; font-weight: bold; margin: 8px 0; }

.debug-info { background: #f0f0f0; margin: 0 auto; text-align:center; padding: 15px; border-radius: 10px; margin: 20px 0; font-family: monospace; font-size: 0.85em; }
.analisis-ia { background: #f0f4ff; border-radius: 20px; padding: 25px; margin: 25px 0; border-left: 5px solid #667eea; }
.analisis-ia h3 { color: #667eea; margin-bottom: 15px; }
.analisis-ia .contenido { font-size: 0.95em; line-height: 1.7; color: #333; white-space: pre-line; }
.izquierda { color: #8B0000; font-weight: bold; }
.derecha { color: #1B4432; font-weight: bold; }
.botones-container { text-align: center; margin-top: 30px; display: flex; gap: 15px; justify-content: center; flex-wrap: wrap; }

.tabla-partidos { width: 100%; border-collapse: collapse; margin-top: 20px; }
.tabla-partidos th, .tabla-partidos td { padding: 10px; border-bottom: 1px solid #eee; text-align: left; font-size: 0.9em; }
.tabla-partidos th { background: #f5f5f5; font-weight: bold; }
.color-dot { display: inline-block; width: 16px; height: 16px; border-radius: 50%; margin-right: 10px; vertical-align: middle; }

.aviso-error { background: #ffebee; border-left: 5px solid #f44336; color: #c62828; padding: 15px; border-radius: 10px; margin: 20px 0; }

/* ---------- Pie de página (Footer) Global ---------- */
footer, .footer-landing {
    margin: clamp(20px, 4vw, 30px) auto !important;
    padding: 10px !important;
    text-align: center !important;
    font-size: clamp(0.75em, 2.5vw, 0.85em) !important;
    color: #888 !important;
}

footer a, .footer-landing a {
    color: #667eea !important;
    margin: 0 10px !important;
    text-decoration: none !important;
}

footer a:hover, .footer-landing a:hover {
    text-decoration: underline !important;
}

/* ---------- Responsive ---------- */
@media (max-width: 700px) {
    .top3-container { flex-direction: column; }
    .result-card { padding: 4vw; }
    .partido-card { min-width: auto; }
    .barra-ideologica { height: 25px; }
    .marcador-punto { width: 16px; height: 16px; }
    .barra-ideologica-labels { font-size: 0.75em; }
    .analisis-ia { padding: 20px; }
    .botones-container { flex-direction: column; align-items: center; }
}
@media (max-width: 600px) {
    body { padding: 10px; padding-top: 10px; }
    .landing { padding: 25px 15px; }
    .niveles-landing { flex-direction: column; }
    .nivel-btn-landing { min-width: auto; }
    .question-card { padding: 15px; }
    .progress-container { padding: 10px 15px; margin: 0 -10px 15px -10px; }
    .slider-labels { font-size: 2em; }
}

@media (min-width: 600px) {
    .btn-comparar {
        padding: 5px 12px !important;
        font-size: 0.85rem !important;
    }
}

/* Etiqueta de eje */
.eje-etiqueta {
    position: absolute;
    top: 8px;
    right: 12px;
    color: white;
    font-size: 0.65em;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    opacity: 0.8;
    z-index: 2;
    pointer-events: none;
    display: inline-block;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}