/* ============================================
   ESTILO MODERNO 2026 - CON VARIABLES CSS
   ============================================ */

:root {
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-success: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-gold: linear-gradient(135deg, #f5af19 0%, #f12711 100%);
    --gradient-bg: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    
    --color-luck: #ffcc00;
    
    --glass-bg: rgba(255, 255, 255, 0.25);
    --glass-border: rgba(255, 255, 255, 0.18);
    --text-dark: #2c3e50;
    --text-light: #ffffff;
    
    /* Variables para el viewport (actualizadas por JS) */
    --vh: 1vh;
    --dvh: 100vh;
}

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

html {
    height: 100%;
    min-height: -webkit-fill-available;
}

body {
    font-family: 'Poppins', 'Segoe UI', system-ui, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: var(--dvh);
    height: auto;
    margin: 0;
    padding: 16px;
    position: relative;
    overflow-x: hidden;
}

/* Fondo PRINCIPAL - Usando la variable --dvh */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100vh;
    height: var(--dvh);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-attachment: fixed;
    background-size: cover;
    background-position: center;
    z-index: -2;
}

/* Segunda capa de fondo */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100vh;
    height: var(--dvh);
    background: radial-gradient(circle at 20% 50%, rgba(255,255,255,0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

/* Contenedor principal */
.container {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border-radius: 32px;
    border: 1px solid var(--glass-border);
    padding: 2rem;
    width: 100%;
    max-width: 650px;
    position: relative;
    z-index: 1;
    box-shadow: 0 25px 45px rgba(0, 0, 0, 0.2);
    margin: 20px auto;
}

/* Título principal */
h1 {
    color: white;
    font-size: 2rem;
    margin-bottom: 1.5rem;
    font-weight: 800;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

/* Estilo para "SUERTE A TODOS" */
h1.luck-message {
    color: var(--color-luck);
    font-size: 2rem;
    text-shadow: 0 0 15px rgba(255,204,0,0.5);
    animation: luckPulse 0.8s ease-in-out infinite;
    margin: 0.5rem 0 1.5rem 0;
}

@keyframes luckPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

/* Formulario */
.form-section {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

label {
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: block;
}

textarea, input[type="number"] {
    background: rgba(255, 255, 255, 0.95);
    border: none;
    padding: 0.9rem 1rem;
    border-radius: 16px;
    font-size: 1rem;
    color: var(--text-dark);
    transition: all 0.2s ease;
    width: 100%;
    font-family: inherit;
}

textarea:focus, input[type="number"]:focus {
    outline: none;
    transform: scale(1.01);
    box-shadow: 0 0 10px rgba(102,126,234,0.3);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

.options-container {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.option-item {
    flex: 1;
    background: rgba(255,255,255,0.15);
    padding: 0.8rem;
    border-radius: 16px;
}

.option-item label {
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
    text-align: center;
}

.option-item input[type="number"] {
    text-align: center;
    padding: 0.6rem;
}

#participant-count {
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(4px);
    display: inline-block;
    padding: 0.4rem 1rem;
    border-radius: 40px;
    font-size: 0.85rem;
    color: white;
    font-weight: 600;
    text-align: center;
    margin: 0 auto;
}

/* Botón principal */
#draw-button {
    background: var(--gradient-gold);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 40px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    max-width: 280px;
    margin: 0.5rem auto 0;
    display: block;
}

#draw-button:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
}

/* Sección de resultados */
.result-section {
    margin-top: 2rem;
    text-align: center;
}

.result-section.hidden {
    display: none;
}

/* Contador circular */
.countdown-circle {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 120px;
    height: 120px;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(8px);
    border-radius: 50%;
    font-size: 3rem;
    font-weight: bold;
    color: white;
    margin: 1rem auto;
    animation: countPulse 1s infinite;
}

@keyframes countPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Contenedor de ganadores */
.winners-container {
    background: rgba(255,255,255,0.95);
    border-radius: 24px;
    padding: 1.5rem;
    margin-top: 1rem;
    animation: slideUp 0.3s ease;
}

.winners-container.hidden {
    display: none;
}

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

#winner-list {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: winner-counter;
}

#winner-list li {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    margin: 0.8rem 0;
    padding: 0.8rem 1rem 0.8rem 2.8rem;
    border-radius: 40px;
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    position: relative;
    word-break: break-word;
}

#winner-list li::before {
    counter-increment: winner-counter;
    content: counter(winner-counter);
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    background: var(--gradient-gold);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.button-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.button-group button {
    flex: 1;
    min-width: 140px;
    padding: 0.8rem;
    border-radius: 40px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.button-group button:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
}

#reset-button {
    background: var(--gradient-secondary);
    color: white;
}

#copy-button {
    background: var(--gradient-success);
    color: white;
}

/* ============================================ */
/* EFECTOS SECUENCIALES */
/* ============================================ */

.curtain-effect {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: var(--dvh);
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    z-index: 999;
    pointer-events: none;
    animation: curtainOpen 0.6s ease forwards;
}

@keyframes curtainOpen {
    0% {
        clip-path: circle(0% at 50% 50%);
    }
    100% {
        clip-path: circle(150% at 50% 50%);
        opacity: 0;
    }
}

.falling-confetti {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: var(--dvh);
    pointer-events: none;
    z-index: 1000;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    opacity: 0.9;
    animation: fall linear forwards;
}

@keyframes fall {
    0% {
        transform: translateY(-10vh) rotate(0deg);
        opacity: 0.9;
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

/* Clases utilitarias */
.hidden {
    display: none !important;
}

.hidden-form label,
.hidden-form textarea,
.hidden-form #participant-count,
.hidden-form .options-container,
.hidden-form #draw-button {
    display: none;
}

/* ============================================ */
/* RESPONSIVE */
/* ============================================ */

/* Tablets */
@media (max-width: 768px) {
    body {
        padding: 16px;
    }
    
    .container { 
        padding: 1.5rem;
    }
    
    h1 { font-size: 1.6rem; }
    h1.luck-message { font-size: 1.6rem; }
    .countdown-circle { width: 100px; height: 100px; font-size: 2.5rem; }
}

/* Móviles */
@media (max-width: 550px) {
    body { 
        padding: 12px;
    }
    
    .container { 
        padding: 1.2rem;
    }
    
    h1 { font-size: 1.3rem; }
    h1.luck-message { font-size: 1.3rem; }
    
    .options-container { 
        flex-direction: column;
        gap: 0.8rem;
    }
    
    .option-item {
        width: 100%;
    }
    
    .countdown-circle { 
        width: 80px; 
        height: 80px; 
        font-size: 2rem; 
    }
    
    .button-group { 
        flex-direction: column;
        gap: 0.6rem;
    }
    
    .button-group button { 
        width: 100%;
        min-width: auto;
    }
    
    #winner-list li {
        font-size: 0.85rem;
        padding: 0.7rem 0.7rem 0.7rem 2.2rem;
    }
    
    #winner-list li::before {
        width: 22px;
        height: 22px;
        font-size: 0.7rem;
        left: 8px;
    }
}

/* Safari y Chrome en iOS - fix adicional */
@supports (-webkit-touch-callout: none) {
    body {
        min-height: -webkit-fill-available;
    }
}

/* Prevenir zoom en inputs móviles */
@media (max-width: 768px) {
    input, textarea, button {
        font-size: 16px !important;
    }
}