/* Variables globales */
:root {
    --primary-color: #ff6b00;
    --secondary-color: #0062ff;
    --accent-color: #ff007a;
    --background-color: #121212;
    --text-color: #ffffff;
    /* Variable de contador eliminada */
    --card-bg: rgba(30, 30, 30, 0.8);
    --success-color: #00c853;
}

/* Tema claro */
.light-theme {
    --background-color: #f5f5f5;
    --text-color: #121212;
    /* Variable de contador eliminada */
    --card-bg: rgba(240, 240, 240, 0.9);
}

/* Reset y estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: 'Montserrat', sans-serif;
    background-color: #121212;
    color: var(--text-color);
    overflow-x: hidden;
    overflow-y: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('assets/brico.png');
    background-size: 50%;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.1;
    z-index: -1;
    animation: logoFloat 15s infinite ease-in-out;
}

@keyframes logoFloat {
    0% {
        transform: scale(1) translate(0, 0) rotate(0deg);
        opacity: 0.05;
    }
    25% {
        transform: scale(1.02) translate(5px, 5px) rotate(1deg);
        opacity: 0.07;
    }
    50% {
        transform: scale(1.04) translate(0, 10px) rotate(0deg);
        opacity: 0.09;
    }
    75% {
        transform: scale(1.02) translate(-5px, 5px) rotate(-1deg);
        opacity: 0.07;
    }
    100% {
        transform: scale(1) translate(0, 0) rotate(0deg);
        opacity: 0.05;
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Encabezado y logo */
header {
    padding: 20px 0;
    margin-bottom: 20px;
}

.logo-container {
    display: flex;
    justify-content: center;
    position: relative;
    padding: 10px;
    height: 80px;
    width: 80%;
    max-width: 400px;
    margin: 0 auto;
    border-radius: 15px;
    overflow: hidden;
    animation: logoGlow 3s infinite alternate;
    background: linear-gradient(135deg, 
        rgba(255, 107, 0, 0.1), 
        rgba(255, 0, 122, 0.1), 
        rgba(0, 98, 255, 0.1)
    );
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
}

.logo-container::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 15px;
    padding: 2px;
    background: linear-gradient(135deg, 
        rgba(255, 107, 0, 0.8), 
        rgba(255, 0, 122, 0.8), 
        rgba(0, 98, 255, 0.8)
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    box-shadow: 0 0 20px rgba(255, 107, 0, 0.5);
    animation: borderAnimation 5s infinite;
}

.logo-container:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(255, 107, 0, 0.7);
}

@keyframes borderAnimation {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.logo-img {
    height: 100%;
    max-width: 100%;
    object-fit: contain;
    transform: scale(0.9);
    transition: transform 0.3s;
    filter: drop-shadow(0 0 8px rgba(255, 107, 0, 0.5));
}

.logo-container:hover .logo-img {
    transform: scale(1);
    filter: drop-shadow(0 0 15px rgba(255, 107, 0, 0.8));
}

@keyframes logoGlow {
    0% {
        box-shadow: 0 0 10px rgba(255, 107, 0, 0.3), 
                  0 0 20px rgba(255, 0, 122, 0.2);
    }
    100% {
        box-shadow: 0 0 20px rgba(255, 107, 0, 0.5), 
                  0 0 40px rgba(255, 0, 122, 0.3);
    }
}

/* Secciones principales */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    height: calc(100vh - 140px); /* Altura calculada para evitar scroll */
    overflow: hidden; /* Evitar overflow */
}

section {
    padding: 20px 0;
    text-align: center;
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: opacity 0.5s, visibility 0.5s;
}

section.active {
    opacity: 1;
    visibility: visible;
    position: absolute;
    z-index: 10;
}

/* Sección de bienvenida */
.welcome-section {
    opacity: 1;
    visibility: visible;
    position: relative;
}

.title {
    font-size: 3.5rem;
    font-weight: 900;
    margin-bottom: 20px;
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.subtitle {
    font-size: 1.5rem;
    max-width: 800px;
    margin: 0 auto 40px;
    line-height: 1.6;
}

.cta-container {
    margin-top: 40px;
    animation: fadeIn 1s 2.5s both;
}

.cta-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s, background-color 0.3s;
    box-shadow: 0 10px 20px rgba(255, 107, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.cta-button::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    opacity: 0;
    z-index: 0;
    transition: opacity 0.5s;
}

.cta-button:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 25px rgba(255, 107, 0, 0.5);
    background-color: #ff8c33;
}

.cta-button:hover::before {
    opacity: 1;
    animation: rotateGradient 2s infinite linear;
}

@keyframes rotateGradient {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.cta-button.secondary {
    background-color: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 5px 15px rgba(255, 107, 0, 0.2);
}

.cta-button.secondary:hover {
    background-color: rgba(255, 107, 0, 0.1);
    box-shadow: 0 8px 20px rgba(255, 107, 0, 0.3);
}

/* Espacio para el botón de comenzar */
.cta-container {
    margin-top: 60px;
}

/* Eliminado el estilo .time:before ya que no se usa más */

.label {
    font-size: 0.9rem;
    text-transform: uppercase;
    font-weight: 600;
}

/* Sección de loader */
.loader-section {
    /* Por defecto está oculta por las propiedades de section */
    transition: opacity 0.3s ease-in-out;
}

.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 800px;
}

.loader-title {
    font-size: 2.2rem;
    margin-bottom: 30px;
    color: var(--primary-color);
    text-shadow: 0 0 15px rgba(255, 107, 0, 0.4);
    font-weight: 800;
    letter-spacing: 1px;
    animation: textGlow 2s infinite alternate;
}

@keyframes textGlow {
    0% {
        text-shadow: 0 0 10px rgba(255, 107, 0, 0.4);
    }
    100% {
        text-shadow: 0 0 25px rgba(255, 107, 0, 0.8);
    }
}

.modern-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 350px;
    height: 350px;
    background: radial-gradient(circle at center, rgba(36, 36, 36, 0.9) 0%, rgba(18, 18, 18, 0.95) 70%);
    border-radius: 50%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 
                0 0 50px rgba(255, 107, 0, 0.3), 
                0 0 100px rgba(255, 0, 122, 0.2);
    margin-bottom: 2rem;
    opacity: 1; /* Asegurar que sea visible */
    transition: opacity 0.3s ease-in;
}

.spinner-container {
    position: relative;
    width: 250px;
    height: 250px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.spinner-ring {
    position: absolute;
    border: 6px solid transparent;
    border-radius: 50%;
    animation: spin 1.5s linear infinite;
    box-shadow: 0 0 20px rgba(255, 107, 0, 0.5);
    opacity: 1; /* Asegurar que los anillos sean visibles */
}

.spinner-ring:nth-child(1) {
    width: 220px;
    height: 220px;
    border-top: 6px solid var(--primary-color);
    border-left: 6px solid var(--primary-color);
    animation-duration: 3s;
}

.spinner-ring:nth-child(2) {
    width: 180px;
    height: 180px;
    border-top: 6px solid var(--secondary-color);
    border-right: 6px solid var(--secondary-color);
    animation-duration: 2s;
    animation-direction: reverse;
}

.spinner-ring:nth-child(3) {
    width: 140px;
    height: 140px;
    border-bottom: 6px solid var(--accent-color);
    border-left: 6px solid var(--accent-color);
    animation-duration: 1.5s;
}

.pulse-ring {
    position: absolute;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 70%);
    animation: pulse 2s ease-out infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.lottery-numbers {
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, #ff6b00, #ff007a);
    border-radius: 50%;
    z-index: 10;
    box-shadow: 0 0 30px rgba(255, 107, 0, 0.7);
    overflow: hidden;
}

.number-shuffle {
    font-size: 5rem;
    font-weight: 900;
    color: white;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
    animation: numberPulse 0.5s infinite alternate;
    padding: 20px;
    background: rgba(255, 107, 0, 0.2);
    border-radius: 15px;
    min-width: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 15px auto;
}

@keyframes numberPulse {
    0% {
        transform: scale(0.95);
        opacity: 0.9;
    }
    100% {
        transform: scale(1.05);
        opacity: 1;
        text-shadow: 0 0 20px rgba(255, 255, 255, 1);
    }
}

.loader-message {
    position: absolute;
    bottom: 0;
    width: 100%;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-top: 20px;
}

.progress-bar {
    width: 80%;
    height: 6px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin: 15px auto 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 10px;
    box-shadow: 0 0 10px var(--accent-color);
}

.loader-animation, .circle, .lottery-drum, .drum-container, .number-container {
    display: none;
}

/* Sección del ganador */
.winner-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    background: radial-gradient(circle at center, rgba(36, 36, 36, 0.9) 0%, rgba(18, 18, 18, 0.95) 70%);
    border-radius: 20px;
   
    position: relative;
    overflow: hidden;
    border: none;
}

.winner-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 107, 0, 0.1) 0%, transparent 30%);
    animation: rotate 20s linear infinite;
    z-index: -1;
}

@keyframes rotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.winner-title {
    font-size: 3.2rem;
    color: #00ff9d; /* Verde vivo, como en la imagen */
    margin-bottom: 30px;
    text-shadow: 0 0 15px rgba(0, 255, 157, 0.5);
    font-weight: 800;
    letter-spacing: 2px;
}

.winner-number-container {
    margin: 10px auto 20px;
    width: 100%;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.winner-label {
    font-size: 1.8rem;
    display: block;
    margin-bottom: 15px;
    letter-spacing: 1px;
    white-space: normal;
    word-spacing: 4px;
    font-weight: 500;
    text-align: center;
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.winner-label span {
    display: inline-block;
    padding: 0 5px;
    margin: 0 2px;
}

.winner-number {
    font-size: 5.5rem;
    font-weight: 900;
    margin: 0;
    color: #ffffff;
    text-shadow: 0 0 20px rgba(255, 107, 0, 0.9);
    position: relative;
    display: inline-block;
    padding: 20px 40px;
    border-radius: 20px;
    background: linear-gradient(45deg, #ff6b00, #ff007a);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    letter-spacing: 3px;
}

.winner-number::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-radius: 22px;
    background: linear-gradient(45deg, #ff6b00, #ff007a, #0062ff);
    opacity: 0.8;
    filter: blur(5px);
    z-index: -1;
}

.winner-name {
    font-size: 2.5rem;
    font-weight: 700;
    margin-top: 15px;
    margin-bottom: 10px;
    color: white;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.codigo-sorteo-container {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.codigo-label {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.8);
}

.codigo-sorteo {
    font-size: 2rem;
    font-weight: 700;
    color: var(--secondary-color);
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 20px;
    border-radius: 10px;
    letter-spacing: 2px;
}

.permanent-glow {
    animation: permanent-glow 2s infinite alternate;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.9);
}

@keyframes permanent-glow {
    from {
        text-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
        filter: brightness(1);
    }
    to {
        text-shadow: 0 0 40px rgba(255, 255, 255, 1), 0 0 70px rgba(255, 107, 0, 0.9);
        filter: brightness(1.3);
    }
}

.winner-message {
    max-width: 600px;
    margin: 0 auto 20px;
    font-size: 1.1rem;
    line-height: 1.5;
}

.social-share {
    margin: 30px 0;
}

.social-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
}

.social-button {
    padding: 10px 20px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    color: white;
    transition: transform 0.3s, box-shadow 0.3s;
}

.social-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.facebook {
    background-color: #1877f2;
}

.twitter {
    background-color: #1da1f2;
}

.whatsapp {
    background-color: #25d366;
}

.buttons-container {
    display: flex;
    gap: 20px;
    margin-top: 30px;
}

.next-events-button {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1.1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.3s;
    margin-right: 10px;
}

.next-events-button:hover {
    background-color: var(--primary-color);
    transform: scale(1.05);
}

.reset-button {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1.1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.3s;
}

.reset-button:hover {
    background-color: var(--primary-color);
    transform: scale(1.05);
}

/* Estilos para la sección del ganador */
.winner-display {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px auto;
    position: relative;
    width: 100%;
    max-width: 500px;
    padding: 0 60px; /* Dar espacio para el texto */
}

.ganaste-text {
    font-size: 2.2rem;
    font-weight: 600;
    color: #ffffff;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.6);
    position: absolute;
    right: 10px;
    margin-left: 15px;
    letter-spacing: 1px;
    opacity: 0; /* Inicialmente invisible, se mostrará con animación */
    padding: 5px 15px;
}

/* Ajuste de winner-number para la nueva estructura */
.winner-number {
    font-size: 5.5rem;
    font-weight: 900;
    margin: 0;
    color: #ffffff;
    text-shadow: 0 0 20px rgba(255, 107, 0, 0.9);
    position: relative;
    display: inline-block;
    padding: 20px 40px;
    border-radius: 20px;
    background: linear-gradient(45deg, #ff6b00, #ff007a);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    letter-spacing: 3px;
    z-index: 1;
}

/* Footer */
footer {
    padding: 20px 0;
    text-align: center;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Animaciones adicionales */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-10px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(10px);
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 10px var(--accent-color);
    }
    50% {
        box-shadow: 0 0 30px var(--accent-color);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .title {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
        margin-bottom: 20px;
    }
    
    /* Estilos adicionales para dispositivos móviles */
    .cta-container {
        margin-top: 30px;
    }
    
    .time {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .loader-title, .winner-title {
        font-size: 1.8rem;
    }
    
    .lottery-numbers {
        width: 60px;
        height: 60px;
    }
    
    .winner-number {
        font-size: 3.5rem;
    }
    
    .winner-message {
        font-size: 0.9rem;
    }
    
    .social-buttons {
        flex-wrap: wrap;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1.4rem;
    }
    
    /* Estilos adicionales para pantallas pequeñas */
    .cta-container {
        margin-top: 20px;
    }
    
    .time {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .social-buttons {
        flex-direction: column;
    }
    
    .winner-number {
        font-size: 3rem;
    }
    
    .winner-name {
        font-size: 1.8rem;
    }
}

/* Estilos de la sección del ganador */
.winner-title {
    font-size: 3.5rem;
    font-weight: 900;
    margin-bottom: 20px;
    background: linear-gradient(45deg, var(--success-color), var(--primary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.winner-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

.winner-number {
    font-size: 6rem;
    font-weight: 900;
    color: #ffffff;
    background: linear-gradient(45deg, #ff0000, #ff6b00);
    margin: 20px 0 10px;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.7), 0 0 20px rgba(255, 107, 0, 0.7);
    padding: 10px 20px;
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.5);
    animation: pulse 2s infinite;
}

.winner-name {
    font-size: 3rem;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(45deg, #0062ff, #ff007a);
    margin-bottom: 20px;
    padding: 8px 16px;
    border-radius: 8px;
    text-shadow: 0 0 8px rgba(0, 98, 255, 0.7), 0 0 16px rgba(255, 0, 122, 0.7);
    box-shadow: 0 0 20px rgba(0, 98, 255, 0.5);
}

.winner-message {
    margin-bottom: 30px;
    font-size: 1.2rem;
    line-height: 1.6;
}
