/* =========================================================
   RULETA.CSS
   HAZLO FACIL TRAVEL — Módulo de Sorteo
   Propósito: Estilos del modal de ruleta, overlay, confeti
             y botón de admin. Usa los tokens de variables.css
========================================================= */

/* =========================================================
   BOTÓN ADMIN — visible solo cuando el JS lo activa
========================================================= */

#btnAdminRuleta {

    /* Oculto por defecto; JS lo muestra si es admin */
    display: none;

    position: fixed;
    bottom: 120px;
    right: 30px;

    z-index: 9998;

    width: 70px;
    height: 70px;

    border-radius: 50%;
    border: none;
    cursor: pointer;

    background: linear-gradient(135deg, #FFD700, #FF8C00);

    color: #020814;

    font-size: 1.6rem;

    box-shadow:
        0 0 0 0 rgba(255,215,0,.55),
        0 10px 30px rgba(0,0,0,.45);

    animation: pulseGold 2.2s ease-in-out infinite;

    transition: transform .3s ease, box-shadow .3s ease;

}

#btnAdminRuleta:hover {

    transform: scale(1.12) rotate(-8deg);

    box-shadow:
        0 0 35px rgba(255,215,0,.65),
        0 15px 40px rgba(0,0,0,.5);

}

@keyframes pulseGold {

    0%   { box-shadow: 0 0 0 0   rgba(255,215,0,.55), 0 10px 30px rgba(0,0,0,.45); }
    60%  { box-shadow: 0 0 0 18px rgba(255,215,0,0),   0 10px 30px rgba(0,0,0,.45); }
    100% { box-shadow: 0 0 0 0   rgba(255,215,0,.55), 0 10px 30px rgba(0,0,0,.45); }

}

/* =========================================================
   OVERLAY DEL MODAL
========================================================= */

#ruletaOverlay {

    position: fixed;
    inset: 0;
    z-index: 999990;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 16px;

    background: rgba(2, 8, 20, .88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

    opacity: 0;
    visibility: hidden;

    transition: opacity .45s ease, visibility .45s ease;

}

#ruletaOverlay.is-visible {

    opacity: 1;
    visibility: visible;

}

/* =========================================================
   MODAL INTERNO
========================================================= */

#ruletaModal {

    position: relative;

    width: 100%;
    max-width: 720px;
    max-height: 94vh;

    border-radius: 32px;
    border: 1px solid rgba(255, 215, 0, .18);

    background:
        linear-gradient(
            145deg,
            rgba(8, 20, 50, .96),
            rgba(2, 8, 20, .98)
        );

    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);

    box-shadow:
        0 40px 100px rgba(0,0,0,.7),
        0 0 0 1px rgba(255,215,0,.08),
        inset 0 1px 0 rgba(255,255,255,.06);

    overflow: hidden;

    display: flex;
    flex-direction: column;
    align-items: center;

    padding: 50px 40px 45px;
    gap: 28px;

    transform: scale(.88) translateY(30px);
    opacity: 0;
    transition:
        transform .55s cubic-bezier(.34,1.56,.64,1),
        opacity .45s ease;

    will-change: transform, opacity;

}

#ruletaOverlay.is-visible #ruletaModal {

    transform: scale(1) translateY(0);
    opacity: 1;

}

/* =========================================================
   BOTÓN CERRAR MODAL
========================================================= */

#ruletaClose {

    position: absolute;
    top: 16px;
    right: 16px;

    width: 42px;
    height: 42px;

    border-radius: 50%;
    border: 1.5px solid rgba(255,255,255,.18);
    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    background: rgba(2,8,20,.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);

    color: #fff;
    font-size: 1.1rem;

    z-index: 10;

    transition: background .25s ease, transform .3s ease, box-shadow .25s ease;

}

#ruletaClose:hover {

    background: rgba(255,47,91,.85);
    border-color: rgba(255,47,91,.6);
    transform: scale(1.12) rotate(90deg);
    box-shadow: 0 0 18px rgba(255,47,91,.5);

}

/* =========================================================
   ENCABEZADO DEL MODAL
========================================================= */

.ruleta-header {

    text-align: center;
    width: 100%;

}

.ruleta-header h2 {

    font-family: 'Montserrat', sans-serif;
    font-size: clamp(1.5rem, 4vw, 2.2rem);
    font-weight: 900;
    letter-spacing: -1px;
    line-height: 1.15;

    background: linear-gradient(135deg, #FFD700, #FF8C00, #FFD700);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;

    animation: shimmerGold 3s linear infinite;

}

@keyframes shimmerGold {

    0%   { background-position: 0%   center; }
    100% { background-position: 200% center; }

}

.ruleta-header p {

    margin-top: 8px;
    font-size: .95rem;
    color: rgba(255,255,255,.65);
    letter-spacing: .5px;

}

/* =========================================================
   CONTENEDOR CANVAS + INDICADOR
========================================================= */

.ruleta-wheel-wrap {

    position: relative;

    width: 380px;
    height: 380px;

    /* Centrado por flex del padre */
    flex-shrink: 0;

}

/* Canvas de la ruleta */
#ruletaCanvas {

    width: 100%;
    height: 100%;
    border-radius: 50%;

    filter: drop-shadow(0 0 22px rgba(255,215,0,.28));

    transition: filter .4s ease;

}

#ruletaCanvas.spinning {

    filter: drop-shadow(0 0 40px rgba(255,215,0,.55));

}

/* Puntero / flecha indicadora */
.ruleta-pointer {

    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);

    width: 0;
    height: 0;

    border-left: 16px solid transparent;
    border-right: 16px solid transparent;
    border-top: 32px solid #FFD700;

    filter: drop-shadow(0 4px 10px rgba(255,215,0,.6));

    z-index: 5;

}

/* Círculo central de la ruleta */
.ruleta-center {

    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);

    width: 52px;
    height: 52px;
    border-radius: 50%;

    background: linear-gradient(135deg, #FFD700, #FF8C00);
    border: 4px solid rgba(2,8,20,.9);

    box-shadow:
        0 0 20px rgba(255,215,0,.5),
        inset 0 2px 4px rgba(255,255,255,.3);

    display: flex;
    align-items: center;
    justify-content: center;

    z-index: 6;

    font-size: 1.3rem;
    color: #020814;

}

/* =========================================================
   BOTÓN GIRAR
========================================================= */

#btnGirar {

    width: 100%;
    max-width: 340px;

    height: 66px;

    border: none;
    border-radius: 999px;
    cursor: pointer;

    background: linear-gradient(135deg, #FFD700 0%, #FF8C00 50%, #FFD700 100%);
    background-size: 200% auto;

    color: #020814;

    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;

    position: relative;
    overflow: hidden;

    transition: transform .3s ease, box-shadow .3s ease, background-position .6s ease;

    box-shadow:
        0 8px 30px rgba(255,165,0,.45),
        inset 0 1px 0 rgba(255,255,255,.35);

}

#btnGirar::before {

    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;

    background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);

    transition: .7s ease;

}

#btnGirar:hover::before {
    left: 120%;
}

#btnGirar:hover {

    transform: translateY(-4px);
    background-position: right center;
    box-shadow: 0 14px 40px rgba(255,165,0,.6);

}

#btnGirar:active {

    transform: scale(.97);

}

#btnGirar:disabled {

    opacity: .65;
    cursor: not-allowed;
    transform: none;

}

/* =========================================================
   GANADOR — panel resultado
========================================================= */

#ruletaGanador {

    display: none;

    width: 100%;
    max-width: 460px;

    padding: 30px 35px;

    border-radius: 24px;

    background: rgba(255,215,0,.07);
    border: 1px solid rgba(255,215,0,.25);

    text-align: center;

    animation: fadeUp .7s ease forwards;

}

@keyframes fadeUp {

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

}

.ganador-emoji {
    font-size: 3.5rem;
    display: block;
    margin-bottom: 12px;
    animation: bounceIn .6s cubic-bezier(.34,1.56,.64,1) forwards;
}

@keyframes bounceIn {

    0%   { transform: scale(0); }
    70%  { transform: scale(1.18); }
    100% { transform: scale(1); }

}

.ganador-label {

    font-size: .8rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: rgba(255,215,0,.75);
    margin-bottom: 10px;

}

.ganador-nombre {

    font-family: 'Montserrat', sans-serif;
    font-size: clamp(1.4rem, 4vw, 2rem);
    font-weight: 900;
    color: #FFD700;

    text-shadow: 0 0 25px rgba(255,215,0,.5);

}

.ganador-email {

    margin-top: 6px;
    font-size: .9rem;
    color: rgba(255,255,255,.65);
    word-break: break-all;

}

.ganador-whatsapp {

    margin-top: 5px;
    font-size: .9rem;
    color: #25D366;

}

/* =========================================================
   LISTA DE PARTICIPANTES (scroll interno)
========================================================= */

.ruleta-count {

    font-size: .85rem;
    color: rgba(255,255,255,.5);
    letter-spacing: 1px;

}

/* =========================================================
   CONFETI — canvas fijo sobre todo
========================================================= */

#confettiCanvas {

    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999999;

    /* Oculto por defecto */
    opacity: 0;
    transition: opacity .4s ease;

}

#confettiCanvas.activo {

    opacity: 1;

}

/* =========================================================
   LOADING SPINNER
========================================================= */

.ruleta-spinner {

    width: 36px;
    height: 36px;

    border: 4px solid rgba(255,215,0,.2);
    border-top-color: #FFD700;
    border-radius: 50%;

    animation: spinLoader .8s linear infinite;

    display: none;

}

@keyframes spinLoader {
    to { transform: rotate(360deg); }
}

/* =========================================================
   DECORACIÓN — línea dorada separadora
========================================================= */

.ruleta-divider {

    width: 80px;
    height: 3px;
    border-radius: 99px;

    background: linear-gradient(90deg, transparent, #FFD700, transparent);

    margin: 0 auto;

}

/* =========================================================
   GLOW AMBIENTAL DEL MODAL
========================================================= */

#ruletaModal::before {

    content: '';
    position: absolute;
    top: -80px;
    left: 50%;
    transform: translateX(-50%);

    width: 420px;
    height: 220px;
    border-radius: 50%;

    background: radial-gradient(circle, rgba(255,165,0,.12), transparent 70%);
    filter: blur(50px);

    pointer-events: none;
    z-index: 0;

}

/* Todo el contenido del modal por encima del glow */
#ruletaModal > * {
    position: relative;
    z-index: 2;
}

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

@media (max-width: 768px) {

    #ruletaModal {
        padding: 40px 24px 36px;
        border-radius: 26px;
        max-width: 96vw;
    }

    .ruleta-wheel-wrap {
        width: 300px;
        height: 300px;
    }

    #btnAdminRuleta {
        width: 60px;
        height: 60px;
        font-size: 1.35rem;
        right: 20px;
        bottom: 108px;
    }

    #btnGirar {
        height: 60px;
        font-size: .88rem;
    }

}

@media (max-width: 480px) {

    #ruletaModal {
        padding: 36px 18px 30px;
    }

    .ruleta-wheel-wrap {
        width: 260px;
        height: 260px;
    }

    .ruleta-header h2 {
        font-size: 1.35rem;
    }

    #ruletaGanador {
        padding: 22px 20px;
    }

    .ganador-nombre {
        font-size: 1.3rem;
    }

}
