/* --- Estilos Generales --- */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');

* {
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 20px;
    background: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
    color: #ffffff;
    text-align: center;
}

/* --- Encabezado --- */
.header {
    margin-bottom: 40px;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
}

.header p {
    font-size: 1.2rem;
    color: #e0e0e0;
}

/* --- Contenedor de Votación --- */
.voting-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

/* --- Tarjetas de Opción --- */
.option {
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 15px;
    padding: 0;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
}

.option.winning {
    box-shadow: 0 0 25px 5px #ffd700; /* Borde dorado para el ganador */
    transform: scale(1.05);
}

/* --- Visualización de Opciones (Sin Botones) --- */
.option-display {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(255, 195, 0, 0.1), rgba(252, 163, 17, 0.05));
    text-align: center;
}

.option-display img {
    max-width: 100px;
    height: auto;
    display: block;
    margin: 0 auto;
}

.option-info {
    text-align: center;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.option h2 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
    color: #ffffff;
    text-align: center;
    width: 100%;
}

.counter {
    font-size: 1.2rem;
    font-weight: bold;
    color: #ffd700; /* Color dorado para los votos */
    margin: 5px 0 0 0;
    text-align: center;
    width: 100%;
}

/* --- Botones de Votación (Solo para voting.html) --- */
.vote-button {
    background-color: transparent;
    color: inherit;
    border: none;
    padding: 0;
    border-radius: 15px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(255, 195, 0, 0.1), rgba(252, 163, 17, 0.05));
    text-align: center;
}

.vote-button:hover:not(:disabled) {
    background-color: rgba(252, 163, 17, 0.2);
    transform: scale(1.02);
}

.vote-button:active:not(:disabled) {
    transform: scale(0.98);
}

.vote-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.vote-button img {
    max-width: 100px;
    height: auto;
    transition: transform 0.3s ease;
    display: block;
    margin: 0 auto;
}

.vote-button:hover:not(:disabled) img {
    transform: scale(1.05);
}

/* --- Controles del Docente (QR y Reinicio) --- */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 50px auto 20px;
    flex-wrap: wrap; /* Para que se adapte en móviles */
    gap: 20px;
}

.qr-container {
    background-color: #ffffff;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    color: #333;
}

#qrcode {
    width: 128px;
    height: 128px;
    margin: 10px auto 0;
}

#qrcode img {
    margin: auto; /* Centra la imagen del QR */
}

#reset-button {
    background-color: #d62828;
    color: white;
    padding: 15px 30px;
    font-size: 1.1rem;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#reset-button:hover {
    background-color: #e74c3c;
}

/* --- Pie de Página --- */
footer {
    margin-top: 190px;
    color: #ccc;
    font-style: italic;
}

/* --- Página de Votación (Móvil) --- */
.voting-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.voting-header {
    margin-bottom: 20px;
}

.voting-header h1 {
    font-size: 1.8rem;
}

.voting-header p {
    font-size: 1rem;
}

.voting-mobile {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    max-width: 100%;
    flex: 1;
    align-content: center;
}

.voting-mobile .option {
    padding: 0;
    min-height: 150px;
}

.voting-mobile .vote-button {
    height: 100%;
    gap: 5px;
    padding: 15px;
    text-align: center;
}

.voting-mobile .vote-button img {
    max-width: 80px;
    display: block;
    margin: 0 auto;
}

.voting-mobile .option h2 {
    font-size: 1rem;
    margin: 0;
    text-align: center;
    width: 100%;
}

/* --- Mensaje de Confirmación --- */
#confirmation-message {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 1000;
}

.confirmation-hidden {
    display: none !important;
}

.confirmation-visible {
    display: flex !important;
    animation: confirmationSlideIn 0.3s ease-out;
}

@keyframes confirmationSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.confirmation-box {
    background-color: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    color: #14213d;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.confirmation-box h2 {
    font-size: 1.8rem;
    margin: 0 0 15px 0;
    color: #fca311;
}

.confirmation-box p {
    font-size: 1.1rem;
    margin: 10px 0;
}

/* --- Diseño Responsivo --- */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }

    .controls {
        flex-direction: column-reverse; /* El botón de reinicio arriba del QR en móvil */
        align-items: center;
    }

    .voting-mobile {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 10px;
    }

    .voting-mobile .option {
        min-height: 140px;
    }

    .voting-mobile .vote-button {
        padding: 10px;
    }

    .voting-mobile .vote-button img {
        max-width: 70px;
    }

    .voting-mobile .option h2 {
        font-size: 0.9rem;
    }
}
