/* ============================================================
   ENCUESTA DE INTENCIÓN DE VOTO - HOJA DE ESTILOS
   ============================================================
   Estructura:
   1. Reset y base
   2. Contenedores generales
   3. Tipografía
   4. Formularios
   5. Captcha
   6. Botones
   7. Mensajes
   8. Tarjetas de candidatos
   9. Info del votante
   10. Resultados (tabla y barras)
   11. Pantalla de gracias
   12. Responsive
   13. Utilidades
   ============================================================ */

/* ============================================================
   1. RESET Y BASE
   ============================================================ */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, Arial, sans-serif;
    background: linear-gradient(135deg, #f0f2f5 0%, #e4e7ec 100%);
    color: #333;
    line-height: 1.5;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   2. CONTENEDORES GENERALES
   ============================================================ */

.contenedor {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    padding: 40px;
    max-width: 600px;
    width: 100%;
    animation: fadeIn 0.4s ease-out;
}

.resultados {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 30px 40px;
    max-width: 900px;
    width: 100%;
    animation: fadeIn 0.4s ease-out;
}

.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    padding: 50px 40px;
    max-width: 500px;
    width: 100%;
    text-align: center;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================
   3. TIPOGRAFÍA
   ============================================================ */

h1 {
    font-size: 22px;
    color: #b22222;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 8px;
}

.subtitulo {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 25px;
}

/* ============================================================
   4. FORMULARIOS
   ============================================================ */

label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: #333;
    margin-bottom: 8px;
}

input[type="text"],
input[type="number"],
input[type="email"] {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    background: #fafafa;
    color: #333;
    margin-bottom: 20px;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus {
    outline: none;
    border-color: #b22222;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(178, 34, 34, 0.1);
}

input[type="text"]::placeholder {
    color: #aaa;
}

/* ============================================================
   5. CAPTCHA
   ============================================================ */

.captcha-box {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.captcha-box img {
    height: 50px;
    border-radius: 8px;
    border: 1px solid #ccc;
    background: #f5f5f5;
    cursor: pointer;
}

.captcha-box input {
    flex: 1;
    margin-bottom: 0;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 600;
}

.btn-refresh {
    background: none;
    border: none;
    color: #b22222;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    padding: 0;
    margin-bottom: 20px;
    transition: color 0.2s;
}

.btn-refresh:hover {
    color: #8b1a1a;
    text-decoration: underline;
}

/* ============================================================
   6. BOTONES
   ============================================================ */

.btn {
    display: block;
    width: 100%;
    padding: 14px 20px;
    background: #2457E6;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.btn:hover {
    background: #8b1a1a;
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-votar {
    display: inline-block;
    padding: 14px 30px;
    background: #2457E6;
    color: #fff;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(178, 34, 34, 0.3);
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
}

.btn-votar:hover {
    background: #8b1a1a;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(178, 34, 34, 0.4);
}

/* ============================================================
   7. MENSAJES
   ============================================================ */

.error,
.info,
.exito {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 20px;
    border-left: 4px solid;
}

.error {
    background: #ffe6e6;
    color: #b22222;
    border-left-color: #b22222;
}

.info {
    background: #e6f7ff;
    color: #005c99;
    border-left-color: #005c99;
}

.exito {
    background: #e6f7e6;
    color: #2a6e2a;
    border-left-color: #2a6e2a;
}

/* ============================================================
   8. TARJETAS DE CANDIDATOS
   ============================================================ */

.candidato {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    margin-bottom: 12px;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.candidato:hover {
    border-color: #b22222;
    background: #fff5f5;
    transform: translateX(3px);
}

.candidato input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: #b22222;
    cursor: pointer;
    flex-shrink: 0;
}

.candidato-info {
    flex: 1;
    min-width: 0;
}

.candidato-lista {
    font-size: 14px;
    font-weight: 700;
    color: #b22222;
    margin-bottom: 2px;
}

.candidato-nombre {
    font-size: 16px;
    font-weight: 500;
    color: #333;
}

.candidato-partido {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}

/* ============================================================
   9. INFO DEL VOTANTE
   ============================================================ */

.votante-info {
    padding: 15px 20px;
    background: #f0f8f0;
    border: 1px solid #b8d8b8;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.votante-info strong {
    color: #2a6e2a;
    font-size: 16px;
}

/* ============================================================
   10. RESULTADOS (TABLA Y BARRAS)
   ============================================================ */

.encabezado {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 15px;
    margin-bottom: 25px;
    border-bottom: 3px solid #1a237e;
}

.encabezado h1 {
    font-size: 26px;
    color: #1a237e;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 0;
}

.encabezado .anio {
    font-size: 28px;
    font-weight: 800;
    color: #1a237e;
}

.cabecera-tabla {
    display: grid;
    grid-template-columns: 40px 1fr 120px 120px;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 2px solid #e0e0e0;
    font-size: 13px;
    font-weight: 700;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cabecera-tabla .col-votos,
.cabecera-tabla .col-porcentaje {
    text-align: right;
}

.fila {
    display: grid;
    grid-template-columns: 40px 1fr 120px 120px;
    gap: 10px;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid #eee;
    transition: background 0.15s;
}

.fila:hover {
    background: #fafafa;
}

.punto {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    margin-left: 5px;
}

.nombre {
    font-size: 15px;
    font-weight: 600;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.votos {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.porcentaje {
    font-size: 14px;
    font-weight: 700;
    color: #1a237e;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.barra-contenedor {
    grid-column: 2 / 4;
    height: 10px;
    background: #e8eaed;
    border-radius: 6px;
    overflow: hidden;
    margin-top: 6px;
}

.barra {
    height: 100%;
    border-radius: 6px;
    min-width: 2px;
    transition: width 1s ease-out;
}

/* ============================================================
   11. PANTALLA DE GRACIAS
   ============================================================ */

.icono {
    font-size: 60px;
    line-height: 1;
    margin-bottom: 20px;
}

.card h1 {
    font-size: 24px;
    color: #2a6e2a;
    margin-bottom: 10px;
}

.card p {
    font-size: 15px;
    color: #666;
    line-height: 1.6;
}

.card.error h1 {
    color: #b22222;
}

/* ============================================================
   12. RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
    .contenedor,
    .card {
        padding: 30px 25px;
    }

    h1 {
        font-size: 20px;
    }

    .card h1 {
        font-size: 22px;
    }

    .icono {
        font-size: 50px;
    }
}

@media (max-width: 700px) {
    .resultados {
        padding: 20px 18px;
    }

    .encabezado h1 {
        font-size: 20px;
    }

    .encabezado .anio {
        font-size: 22px;
    }

    .cabecera-tabla,
    .fila {
        grid-template-columns: 30px 1fr 80px 90px;
        gap: 6px;
    }

    .cabecera-tabla {
        font-size: 11px;
    }

    .nombre {
        font-size: 13px;
    }

    .votos,
    .porcentaje {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
        padding-top: 20px;
        align-items: flex-start;
    }

    .contenedor,
    .card {
        padding: 25px 20px;
        border-radius: 10px;
    }

    h1 {
        font-size: 18px;
    }

    .subtitulo {
        font-size: 13px;
    }

    .card h1 {
        font-size: 20px;
    }

    .icono {
        font-size: 45px;
    }

    input[type="text"],
    input[type="number"],
    input[type="email"] {
        padding: 12px 14px;
        font-size: 16px;
    }

    .captcha-box {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .captcha-box img {
        height: 45px;
        width: auto;
        align-self: center;
    }

    .candidato {
        padding: 12px;
        gap: 12px;
    }

    .candidato-nombre {
        font-size: 15px;
    }

    .btn {
        padding: 13px 18px;
        font-size: 15px;
    }

    /* Resultados en móvil: ocultar columna de votos */
    .fila .votos,
    .cabecera-tabla .col-votos {
        display: none;
    }

    .cabecera-tabla,
    .fila {
        grid-template-columns: 25px 1fr 80px;
    }

    .barra-contenedor {
        grid-column: 2 / 4;
    }
}

/* ============================================================
   13. UTILIDADES
   ============================================================ */

.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.oculto {
    display: none;
}