/**
 * Animações do Sorteio — Overlay, Roleta e Resultado
 */

/* ===== Overlay Fullscreen ===== */
.sorteio-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    transition: background 0.5s ease;
    pointer-events: none;
}

.sorteio-overlay.ativo {
    display: flex;
    pointer-events: all;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.sorteio-modal {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* ===== Container de Animação ===== */
.animacao-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* ===== Roleta Vertical ===== */
.roleta-vertical {
    position: relative;
    width: 400px;
    height: 300px;
    overflow: hidden;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(10, 132, 255, 0.3);
    box-shadow:
        0 0 60px rgba(10, 132, 255, 0.2),
        inset 0 0 30px rgba(0, 0, 0, 0.3);
}

.roleta-vertical::before,
.roleta-vertical::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 80px;
    z-index: 2;
    pointer-events: none;
}

.roleta-vertical::before {
    top: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent);
}

.roleta-vertical::after {
    bottom: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
}

.roleta-vertical-highlight {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 70px;
    transform: translateY(-50%);
    border-top: 2px solid var(--cor-secundaria, #0A84FF);
    border-bottom: 2px solid var(--cor-secundaria, #0A84FF);
    background: rgba(10, 132, 255, 0.08);
    z-index: 1;
    pointer-events: none;
    box-shadow: 0 0 30px rgba(10, 132, 255, 0.3);
}

.roleta-track {
    transition: none;
    will-change: transform;
}

.roleta-item {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    padding: 0 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== Roleta Horizontal ===== */
.roleta-horizontal {
    position: relative;
    width: 90%;
    max-width: 800px;
    height: 120px;
    overflow: hidden;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(10, 132, 255, 0.3);
    box-shadow: 0 0 60px rgba(10, 132, 255, 0.2);
}

.roleta-horizontal .roleta-track {
    display: flex;
    height: 100%;
}

.roleta-horizontal .roleta-item {
    min-width: 200px;
    height: 100%;
    flex-shrink: 0;
    font-size: 1.3rem;
}

.roleta-horizontal-highlight {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 200px;
    transform: translateX(-50%);
    border-left: 2px solid var(--cor-secundaria, #0A84FF);
    border-right: 2px solid var(--cor-secundaria, #0A84FF);
    background: rgba(10, 132, 255, 0.08);
    z-index: 1;
    pointer-events: none;
    box-shadow: 0 0 30px rgba(10, 132, 255, 0.3);
}

/* ===== Globo Giratório ===== */
.globo-container {
    position: relative;
    width: 350px;
    height: 350px;
}

.globo-esfera {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background:
        radial-gradient(circle at 30% 30%, rgba(10, 132, 255, 0.4), transparent 60%),
        radial-gradient(circle at 70% 70%, rgba(0, 90, 169, 0.3), transparent 60%),
        linear-gradient(135deg, rgba(0, 90, 169, 0.6), rgba(10, 132, 255, 0.4));
    border: 3px solid rgba(10, 132, 255, 0.5);
    box-shadow:
        0 0 80px rgba(10, 132, 255, 0.3),
        inset 0 0 40px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    will-change: transform;
}

.globo-nome {
    position: absolute;
    font-weight: 700;
    font-size: 0.85rem;
    color: white;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
    white-space: nowrap;
    transform-origin: center;
}

.globo-centro {
    position: absolute;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid var(--cor-secundaria, #0A84FF);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 800;
    color: white;
    z-index: 2;
    box-shadow: 0 0 30px rgba(10, 132, 255, 0.5);
}

/* ===== Caça-níquel (Slot Machine) ===== */
.slot-machine {
    display: flex;
    gap: 1rem;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 24px;
    border: 2px solid rgba(10, 132, 255, 0.3);
    box-shadow: 0 0 60px rgba(10, 132, 255, 0.2);
}

.slot-reel {
    width: 180px;
    height: 200px;
    overflow: hidden;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(10, 132, 255, 0.2);
    position: relative;
}

.slot-reel::before,
.slot-reel::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 60px;
    z-index: 2;
    pointer-events: none;
}

.slot-reel::before {
    top: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent);
}

.slot-reel::after {
    bottom: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
}

.slot-reel .roleta-item {
    height: 60px;
    font-size: 1.1rem;
}

/* ===== Cartas Embaralhando ===== */
.cartas-container {
    position: relative;
    width: 300px;
    height: 400px;
    perspective: 1000px;
}

.carta {
    position: absolute;
    width: 260px;
    height: 160px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: var(--gradient-primary, linear-gradient(135deg, #005AA9, #0A84FF));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.2);
    will-change: transform;
    text-align: center;
    padding: 1rem;
}

/* ===== Resultado ===== */
.resultado-container {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.resultado-inner {
    text-align: center;
    padding: 3rem;
}

.trofeu {
    font-size: 5rem;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 30px rgba(255, 215, 0, 0.6));
}

.resultado-parabens {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 900;
    letter-spacing: 0.3em;
    color: #FFD700;
    text-shadow: 0 0 40px rgba(255, 215, 0, 0.4);
    margin-bottom: 0.5rem;
}

.resultado-label {
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.2em;
    margin-bottom: 1rem;
}

.resultado-vencedor {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.5rem, 7vw, 5rem);
    font-weight: 900;
    background: linear-gradient(135deg, #FFD700, #FFA500, #FFD700);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 2rem;
    line-height: 1.2;
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.3));
}

.btn-novo-sorteio {
    border-radius: 50px !important;
    padding: 1rem 2.5rem !important;
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: 0 8px 30px rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.btn-novo-sorteio:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 40px rgba(255, 255, 255, 0.3);
}

/* ===== Efeitos ===== */
.glow-effect {
    animation: glowPulse 1.5s ease-in-out infinite;
}

.shake-effect {
    animation: shakeAnim 0.5s ease-in-out;
}

.explosion-ring {
    position: absolute;
    border-radius: 50%;
    border: 3px solid var(--cor-secundaria, #0A84FF);
    animation: explosionRing 1s ease-out forwards;
    pointer-events: none;
}

@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 30px rgba(10, 132, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 60px rgba(10, 132, 255, 0.6), 0 0 100px rgba(10, 132, 255, 0.3);
    }
}

@keyframes shakeAnim {
    0%, 100% { transform: translateX(0); }
    10% { transform: translateX(-8px) rotate(-1deg); }
    20% { transform: translateX(8px) rotate(1deg); }
    30% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    50% { transform: translateX(-4px); }
    60% { transform: translateX(4px); }
    70% { transform: translateX(-2px); }
    80% { transform: translateX(2px); }
}

@keyframes explosionRing {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }
    100% {
        width: 600px;
        height: 600px;
        opacity: 0;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.3);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Modo Evento — Animações maiores */
body.modo-evento .roleta-vertical {
    width: 600px;
    height: 450px;
}

body.modo-evento .roleta-item {
    height: 90px;
    font-size: 2rem;
}

body.modo-evento .roleta-vertical-highlight {
    height: 90px;
}

body.modo-evento .globo-container {
    width: 500px;
    height: 500px;
}

body.modo-evento .globo-centro {
    width: 160px;
    height: 160px;
    font-size: 1.6rem;
}

body.modo-evento .trofeu {
    font-size: 7rem;
}

body.modo-evento .resultado-vencedor {
    font-size: clamp(3rem, 8vw, 6rem);
}

body.modo-evento .slot-reel {
    width: 240px;
    height: 260px;
}

body.modo-evento .slot-reel .roleta-item {
    height: 80px;
    font-size: 1.5rem;
}

body.modo-evento .carta {
    width: 340px;
    height: 200px;
    font-size: 1.8rem;
}

/* Responsividade das animações */
@media (max-width: 768px) {
    .roleta-vertical {
        width: 90vw;
        height: 250px;
    }

    .roleta-item {
        font-size: 1.2rem;
    }

    .globo-container {
        width: 280px;
        height: 280px;
    }

    .slot-machine {
        flex-direction: column;
        align-items: center;
    }

    .slot-reel {
        width: 90vw;
        max-width: 300px;
    }
}

@media (min-width: 1920px) {
    .roleta-vertical {
        width: 500px;
        height: 380px;
    }

    .roleta-item {
        font-size: 1.8rem;
    }
}

@media (min-width: 3840px) {
    .roleta-vertical {
        width: 800px;
        height: 550px;
    }

    .roleta-item {
        font-size: 2.5rem;
        height: 100px;
    }

    .globo-container {
        width: 600px;
        height: 600px;
    }
}
