/* RESET Y BLOQUEO DE SCROLL GLOBAL */
* { box-sizing: border-box; }
html, body {
    height: 100%; width: 100%; margin: 0; padding: 0;
    overflow: hidden; font-family: 'Segoe UI', sans-serif;
    background-color: #b1f8dd;
}

/* OCULTAR CAPAS POR DEFECTO */
#contenedor-principal, #modal-jurado, .vista-voto {
    display: none;
}

/* PANTALLA DE INICIO CENTRADA */
#pantalla-inicio {
    height: 100vh; width: 100vw;
    display: flex; flex-direction: column;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 40px 20px;
    text-align: center;
    z-index: 10;
}

.login-box {
    flex-grow: 1;
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    width: 100%; max-width: 400px;
}

#pantalla-inicio img { height: 120px; margin-bottom: 20px; }
#pantalla-inicio h1 { color: #007bff; font-size: 1.8rem; margin: 0 0 10px 0; }

input {
    width: 100%; max-width: 300px; padding: 18px; font-size: 1.3rem;
    border: 2px solid #007bff; border-radius: 12px;
    margin-bottom: 20px; text-align: center;
}

.btn-principal {
    width: 100%; max-width: 300px; padding: 18px; background: #007bff; color: white;
    border: none; border-radius: 50px; font-weight: bold; font-size: 1.1rem;
}

.footer-jurado { width: 100%; padding-top: 10px; }
.btn-discreto { background: none; border: none; color: #999; text-decoration: underline; }

/* DISEÑO DEL TARJETÓN */
#contenedor-principal {
    height: 100vh;
    width: 100vw;
    display: none; /* Se activa por JS */
    flex-direction: column;
    background-color: #f8f9fa;
    align-items: center; /* CENTRA TODO EL CONTENIDO HORIZONTALMENTE */
}

.vista-voto {
    display: flex;
    flex-direction: column;
    width: 100%; /* Asegura que ocupe todo el ancho */
    height: 100%;
}

.header-voto {
    flex-shrink: 0;
    margin: 0;
    padding: 20px;
    background: #007bff;
    color: white;
    width: 100%; /* Ocupa todo el ancho */
    box-sizing: border-box;
    text-align: center; /* Centra el texto del título */
}

.header-voto h1 {
    margin: 0;
    font-size: 1.5rem;
    text-transform: uppercase;
}

/* EL MOTOR DEL SCROLL: Ajustado para no tirarse a la derecha */
.grid-candidatos {
    flex-grow: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: grid;
    /* Esto crea columnas automáticas y las centra */
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); 
    gap: 20px;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
    justify-items: center; /* Centra cada tarjeta dentro de su celda */
    align-content: start;
}


.grid-candidatos {
    flex-grow: 1; overflow-y: auto; padding: 20px;
    display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
    gap: 15px; align-content: start;
}

.candidato {
    background: white; border: 2px solid #007bff; border-radius: 15px;
    padding: 10px; text-align: center;
}

.candidato img { width: 100%; border-radius: 10px; }

/* MODAL JURADO */
#modal-jurado {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: white; z-index: 1000;
}

.modal-interno { padding: 30px; height: 100%; overflow-y: auto; display: flex; flex-direction: column; }
.btn-cerrar { background: #6c757d; color: white; border: none; padding: 10px; border-radius: 5px; align-self: flex-start; }
.btn-excel { background: #28a745; color: white; border: none; padding: 15px; border-radius: 10px; margin-top: 20px; } 

#custom-alert {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); /* Fondo oscuro transparente */
    display: flex; justify-content: center; align-items: center;
    z-index: 9999;
}

.alert-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    width: 80%;
    max-width: 320px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.alert-content p {
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 20px;
}

.alert-content button {
    background: #007bff;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 50px;
    font-weight: bold;
    cursor: pointer;
}

#alert-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn-azul { background: #007bff; color: white; border: none; padding: 12px 20px; border-radius: 50px; font-weight: bold; cursor: pointer; }
.btn-gris { background: #6c757d; color: white; border: none; padding: 12px 20px; border-radius: 50px; font-weight: bold; cursor: pointer; }

.custom-modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex; justify-content: center; align-items: center;
    z-index: 10000;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 20px;
    text-align: center;
    width: 85%;
    max-width: 350px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
}

.modal-content h3 { margin-top: 0; color: #007bff; }

.modal-content input {
    width: 100%;
    padding: 12px;
    margin: 15px 0;
    border: 2px solid #ddd;
    border-radius: 10px;
    text-align: center;
    font-size: 1.1rem;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn-azul { background: #007bff; color: white; border: none; padding: 12px 20px; border-radius: 50px; font-weight: bold; cursor: pointer; flex: 1; }
.btn-gris { background: #6c757d; color: white; border: none; padding: 12px 20px; border-radius: 50px; font-weight: bold; cursor: pointer; flex: 1; }