/**
 * Trading Card Animations & Effects
 * 
 * Features:
 * - Holographic shine effect (diagonal gradient sweep)
 * - Floating particles animation
 * - Ranking badge pulse (gold glow for Rank 1)
 * - 3D flip animation with perspective
 * - Backface visibility handling
 * 
 * @package BarbiereModern
 * @since 2.6.0
 */

/* ============================================ */
/* 3D TRANSFORM UTILITIES                      */
/* ============================================ */

.perspective-1000 {
    perspective: 1000px;
    -webkit-perspective: 1000px;
}

.preserve-3d {
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
}

.backface-hidden {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.rotate-y-180 {
    transform: rotateY(180deg);
    -webkit-transform: rotateY(180deg);
}

/* ============================================ */
/* HOLOGRAPHIC SHINE EFFECT                   */
/* ============================================ */

@keyframes holoShine {
    0% {
        background-position: -200% -200%;
        opacity: 0;
    }
    10% {
        opacity: 0.3;
    }
    50% {
        background-position: 200% 200%;
        opacity: 0.5;
    }
    90% {
        opacity: 0.3;
    }
    100% {
        background-position: 200% 200%;
        opacity: 0;
    }
}

.holo-shine {
    background: linear-gradient(
        135deg,
        transparent 0%,
        transparent 30%,
        rgba(255, 255, 255, 0.1) 40%,
        rgba(230, 69, 143, 0.2) 50%,
        rgba(251, 233, 38, 0.2) 55%,
        rgba(255, 255, 255, 0.1) 60%,
        transparent 70%,
        transparent 100%
    );
    background-size: 400% 400%;
    animation: holoShine 4s ease-in-out infinite;
}

/* ============================================ */
/* FLOATING PARTICLES                         */
/* ============================================ */

@keyframes particleFloat {
    0% {
        transform: translateY(0) translateX(0) scale(1);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    50% {
        opacity: 0.8;
        transform: translateY(-250px) translateX(20px) scale(1.2);
    }
    80% {
        opacity: 0.5;
    }
    100% {
        transform: translateY(-500px) translateX(-20px) scale(0.8);
        opacity: 0;
    }
}

.particle {
    will-change: transform, opacity;
    transform: translateZ(0); /* GPU acceleration */
}

/* Responsive: Reduce particle intensity on mobile */
@media (max-width: 1024px) {
    .particles-container .particle:nth-child(n+7) {
        display: none; /* Hide particles 7+ on mobile */
    }
}

/* ============================================ */
/* RANKING BADGE PULSE (Rank 1 Only)         */
/* ============================================ */

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 30px rgba(250, 204, 21, 0.8),
                    0 0 60px rgba(250, 204, 21, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 40px rgba(250, 204, 21, 1),
                    0 0 80px rgba(250, 204, 21, 0.6),
                    0 0 120px rgba(250, 204, 21, 0.3);
    }
}

.badge-pulse {
    animation: badgePulse 2s ease-in-out infinite;
}

/* ============================================ */
/* CARD FLIP ANIMATION                        */
/* ============================================ */

.trading-card-inner {
    transition: transform 0.7s cubic-bezier(0.4, 0.0, 0.2, 1);
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    /* Force hardware acceleration on iOS */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.trading-card-front,
.trading-card-back {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    /* Force hardware acceleration */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Ensure back is rotated 180deg by default */
.trading-card-back {
    transform: rotateY(180deg) translateZ(0);
    -webkit-transform: rotateY(180deg) translateZ(0);
}

/* ============================================ */
/* NEON GLOW ENHANCEMENTS                     */
/* ============================================ */

.trading-card-front:hover,
.trading-card-back:hover {
    box-shadow: 0 0 30px rgba(230, 69, 143, 0.6),
                0 0 60px rgba(251, 233, 38, 0.3),
                inset 0 0 40px rgba(230, 69, 143, 0.1);
}

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

/* Mobile: Smaller card, reduced effects */
@media (max-width: 1024px) {
    /* Trading Card keeps its full height */
    .trading-card-scene:not(.award-card-scene) {
        height: 450px !important;
    }
    
    /* Award Cards get compact height (controlled by Tailwind) */
    .award-card-scene {
        /* height is controlled by Tailwind h-[140px] md:h-[220px] */
    }
    
    /* Reduce holographic intensity */
    .holo-shine {
        opacity: 0.5;
    }
    
    /* FLIP ANIMATION - DON'T override inline styles! */
    .trading-card-inner {
        /* Keep 3D transform enabled for flip */
        transform-style: preserve-3d !important;
        -webkit-transform-style: preserve-3d !important;
        /* DO NOT set transform here - let Alpine.js handle it */
    }
    
    /* Ensure front/back are properly positioned on iOS */
    .trading-card-front {
        transform: rotateY(0deg) translateZ(1px) !important;
        -webkit-transform: rotateY(0deg) translateZ(1px) !important;
    }
    
    .trading-card-back {
        transform: rotateY(180deg) translateZ(1px) !important;
        -webkit-transform: rotateY(180deg) translateZ(1px) !important;
    }
}

/* Tablet: Medium size */
@media (min-width: 768px) and (max-width: 1023px) {
    .trading-card-scene {
        height: 500px !important;
    }
}

/* ============================================ */
/* ACCESSIBILITY                              */
/* ============================================ */

/* Reduce motion for users with motion sensitivity */
@media (prefers-reduced-motion: reduce) {
    .holo-shine,
    .particle,
    .badge-pulse {
        animation: none !important;
    }
    
    .trading-card-inner {
        transition: none !important;
    }
}

/* Focus styles for flip button */
button:focus-visible {
    outline: 2px solid rgba(230, 69, 143, 0.8);
    outline-offset: 2px;
}
