/* ============================================
   Chamax Pack Animation CSS - Estilo Pokémon TCG
   Com animação de desintegração
   ============================================ */

/* Container principal da animação */
.chamax-pack-animation {
    position: relative;
    margin: 20px auto;
    width: 100%;
}

/* Container que empilha as partes */
.chamax-animation-container {
    position: relative;
    display: inline-block;
    width: 100%;
}

/* Cada parte da imagem */
.chamax-animation-part {
    position: relative;
    width: 100%;
    line-height: 0;
}

.chamax-animation-part img {
    display: block;
    width: 100%;
    height: auto;
}

/* Wrapper do SEAL com a camada brilhante */
.chamax-part-seal-wrapper {
    position: relative;
    width: 100%;
}

/* Camada de brilho estilo Pokémon TCG */
.chamax-shine-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    z-index: 3;
    pointer-events: none;
    overflow: hidden;
    
    background: linear-gradient(
        90deg,
        transparent 0%,
        transparent 20%,
        rgba(255, 255, 255, 0.05) 30%,
        rgba(255, 255, 255, 0.3) 40%,
        rgba(255, 255, 255, 0.8) 45%,
        rgba(255, 223, 0, 0.9) 50%,
        rgba(255, 255, 255, 0.8) 55%,
        rgba(255, 255, 255, 0.3) 60%,
        rgba(255, 255, 255, 0.05) 70%,
        transparent 80%,
        transparent 100%
    );
    
    background-size: 200% 100%;
    background-position: -100% 0;
}

/* Efeito de partículas brilhantes */
.chamax-shine-layer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.8) 0%, transparent 3%),
        radial-gradient(circle at 40% 70%, rgba(255, 255, 255, 0.6) 0%, transparent 2%),
        radial-gradient(circle at 60% 40%, rgba(255, 255, 255, 0.9) 0%, transparent 2.5%),
        radial-gradient(circle at 80% 60%, rgba(255, 255, 255, 0.7) 0%, transparent 2%),
        radial-gradient(circle at 30% 80%, rgba(255, 255, 255, 0.5) 0%, transparent 2%),
        radial-gradient(circle at 70% 20%, rgba(255, 255, 255, 0.8) 0%, transparent 3%);
    opacity: 0;
    animation: sparkle 0.6s ease-in-out;
}

.chamax-seal-reveal {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 2;
    overflow: hidden;
}

.chamax-seal-reveal img {
    display: block;
    width: 100%;
    height: auto;
}

.chamax-seal-reveal::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 0%;
    height: 100%;
    background: transparent;
}

/* Camada de impacto branco (novo efeito) */
.chamax-impact-flash {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 20%,
        rgba(255, 255, 255, 0.95) 50%,
        rgba(255, 255, 255, 0.3) 80%,
        transparent 100%
    );
    opacity: 0;
    z-index: 4;
    pointer-events: none;
    filter: blur(2px);
}

/* Remove overlays artificiais */
.chamax-part-top,
.chamax-part-bottom {
    position: relative;
    transition: filter 0.2s ease;
}

/* ============================================
   ANIMAÇÕES PRINCIPAIS
   ============================================ */

/* Animação do brilho que percorre */
@keyframes shineReveal {
    0% {
        opacity: 0;
        background-position: -100% 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
        background-position: 100% 0;
    }
    100% {
        opacity: 0;
        background-position: 100% 0;
    }
}

/* Animação das partículas */
@keyframes sparkle {
    0%, 100% {
        opacity: 0;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Animação de revelação do seal */
@keyframes revealSeal {
    0% {
        width: 0%;
    }
    100% {
        width: 100%;
    }
}

@keyframes clipReveal {
    0% {
        clip-path: inset(0 0% 0 0);
    }
    100% {
        clip-path: inset(0 0 0 100%);
    }
}

/* Animação do impacto branco (novo) */
@keyframes impactFlash {
    0% {
        opacity: 0;
        width: 0%;
    }
    20% {
        opacity: 1;
        width: 120%;
    }
    100% {
        opacity: 0;
        width: 150%;
    }
}

/* ============================================
   ANIMAÇÕES DE DESINTEGRAÇÃO
   ============================================ */

/* TOP e SEAL desintegram para CIMA juntos */
@keyframes disintegrateTop {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0px);
    }
    30% {
        opacity: 0.8;
        filter: blur(1px);
    }
    60% {
        opacity: 0.4;
        transform: translateY(-30px) scale(0.95);
        filter: blur(3px);
    }
    100% {
        opacity: 0;
        transform: translateY(-80px) scale(0.85);
        filter: blur(8px);
    }
}

/* BOTTOM desliza para baixo rapidamente (sem desintegração) */
@keyframes slideDownQuick {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(60px);
    }
}

/* ============================================
   ESTADOS DA ANIMAÇÃO
   ============================================ */

/* Durante o brilho */
.chamax-pack-animation.animating .chamax-seal-reveal::after {
    animation: revealSeal var(--animation-duration, 2000ms) ease-in-out forwards;
}

.chamax-pack-animation.animating .chamax-shine-layer {
    animation: shineReveal var(--animation-duration, 2000ms) ease-out forwards;
}

.chamax-pack-animation.animating .chamax-seal-reveal {
    animation: clipReveal var(--animation-duration, 2000ms) ease-in-out forwards;
}

/* Efeito de impacto branco após o brilho */
.chamax-pack-animation.impact-flash .chamax-impact-flash {
    animation: impactFlash var(--impact-duration, 300ms) ease-out forwards;
}

/* TOP e SEAL desintegrando juntos */
.chamax-pack-animation.disintegrating-top .chamax-part-top,
.chamax-pack-animation.disintegrating-top .chamax-part-seal-wrapper {
    animation: disintegrateTop var(--disintegrate-duration, 600ms) ease-out forwards;
}

/* BOTTOM deslizando para baixo */
.chamax-pack-animation.sliding-bottom .chamax-part-bottom {
    animation: slideDownQuick var(--slide-duration, 250ms) ease-in forwards;
}

/* ============================================
   ESTILOS DOS EFEITOS (5 VARIAÇÕES)
   ============================================ */

/* Azul Mágico */
.chamax-pack-animation.blue-magic .chamax-shine-layer {
    background: linear-gradient(
        90deg,
        transparent 0%,
        transparent 20%,
        rgba(0, 150, 255, 0.05) 30%,
        rgba(0, 200, 255, 0.4) 40%,
        rgba(100, 220, 255, 0.8) 45%,
        rgba(200, 240, 255, 0.9) 50%,
        rgba(100, 220, 255, 0.8) 55%,
        rgba(0, 200, 255, 0.4) 60%,
        rgba(0, 150, 255, 0.05) 70%,
        transparent 80%,
        transparent 100%
    );
    background-size: 200% 100%;
    background-position: -100% 0;
}

/* Arco-íris (Raro) */
.chamax-pack-animation.rainbow .chamax-shine-layer {
    background: linear-gradient(
        90deg,
        transparent 0%,
        transparent 15%,
        rgba(255, 0, 0, 0.3) 25%,
        rgba(255, 127, 0, 0.4) 30%,
        rgba(255, 255, 0, 0.5) 35%,
        rgba(0, 255, 0, 0.6) 40%,
        rgba(0, 255, 255, 0.7) 45%,
        rgba(255, 255, 255, 0.9) 50%,
        rgba(0, 255, 255, 0.7) 55%,
        rgba(0, 0, 255, 0.6) 60%,
        rgba(139, 0, 255, 0.5) 65%,
        rgba(255, 0, 255, 0.4) 70%,
        rgba(255, 0, 0, 0.3) 75%,
        transparent 85%,
        transparent 100%
    );
    background-size: 200% 100%;
    background-position: -100% 0;
}

/* Dourado Premium */
.chamax-pack-animation.golden-premium .chamax-shine-layer {
    background: linear-gradient(
        90deg,
        transparent 0%,
        transparent 20%,
        rgba(218, 165, 32, 0.1) 30%,
        rgba(255, 215, 0, 0.4) 40%,
        rgba(255, 235, 59, 0.7) 45%,
        rgba(255, 255, 255, 0.9) 50%,
        rgba(255, 235, 59, 0.7) 55%,
        rgba(255, 215, 0, 0.4) 60%,
        rgba(218, 165, 32, 0.1) 70%,
        transparent 80%,
        transparent 100%
    );
    background-size: 200% 100%;
    background-position: -100% 0;
}

/* Roxo Místico */
.chamax-pack-animation.purple-mystic .chamax-shine-layer {
    background: linear-gradient(
        90deg,
        transparent 0%,
        transparent 20%,
        rgba(138, 43, 226, 0.1) 30%,
        rgba(147, 51, 234, 0.4) 40%,
        rgba(168, 85, 247, 0.7) 45%,
        rgba(220, 180, 255, 0.9) 50%,
        rgba(168, 85, 247, 0.7) 55%,
        rgba(147, 51, 234, 0.4) 60%,
        rgba(138, 43, 226, 0.1) 70%,
        transparent 80%,
        transparent 100%
    );
    background-size: 200% 100%;
    background-position: -100% 0;
}

/* ============================================
   CONTROLES DA ANIMAÇÃO
   ============================================ */

.chamax-animation-controls {
    text-align: center;
    margin-top: 20px;
}

.chamax-animation-play-btn {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.chamax-animation-play-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.chamax-animation-play-btn:active {
    transform: translateY(0);
}

.chamax-animation-play-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.chamax-animation-play-btn .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

/* Estado: Animação em progresso */
.chamax-pack-animation.animating .chamax-animation-play-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

/* Estado: Completo */
.chamax-pack-animation.completed .chamax-animation-play-btn {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

/* ============================================
   RESPONSIVO
   ============================================ */

@media (max-width: 768px) {
    .chamax-animation-play-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
}

/* ============================================
   EFEITO DE FADE IN AO CARREGAR
   ============================================ */

.chamax-pack-animation {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Modo admin - estilo diferente para o botão */
.wp-admin .chamax-animation-play-btn {
    background: linear-gradient(135deg, #2271b1 0%, #135e96 100%);
}

.wp-admin .chamax-animation-play-btn:hover {
    box-shadow: 0 6px 20px rgba(34, 113, 177, 0.6);
}