/* 🎆 Advanced Cracker Animations for Sri Kanda Crackers 🎆 */

/* Cracker Blasting Container */
.cracker-effects-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

/* Continuous Rocket Animations */
.rocket-trail {
    position: absolute;
    width: 4px;
    height: 20px;
    background: linear-gradient(to top, #ff6b35, #f7931e, #ffd700);
    border-radius: 2px;
    animation: rocketFly 3s linear infinite;
    box-shadow: 0 0 10px #ff6b35;
}

.rocket-trail::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -2px;
    width: 8px;
    height: 8px;
    background: #ffd700;
    border-radius: 50%;
    box-shadow: 0 0 15px #ffd700;
}

.rocket-trail::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: -1px;
    width: 6px;
    height: 15px;
    background: linear-gradient(to bottom, transparent, #ff6b35, #ff4500);
    border-radius: 0 0 3px 3px;
    filter: blur(1px);
}

@keyframes rocketFly {
    0% {
        bottom: -30px;
        opacity: 0;
        transform: translateX(0) scale(0.5);
    }
    10% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    70% {
        opacity: 1;
        transform: translateX(var(--drift, 0px)) scale(1);
    }
    100% {
        bottom: 60vh;
        opacity: 0;
        transform: translateX(var(--drift, 0px)) scale(1.2);
    }
}

/* Sparkler Effects */
.sparkler {
    position: absolute;
    width: 2px;
    height: 2px;
    background: #ffd700;
    border-radius: 50%;
    animation: sparkle 2s linear infinite;
    box-shadow: 0 0 6px #ffd700;
}

@keyframes sparkle {
    0% {
        bottom: -10px;
        opacity: 0;
        transform: scale(0);
    }
    20% {
        opacity: 1;
        transform: scale(1);
    }
    80% {
        opacity: 1;
        transform: scale(1.5);
    }
    100% {
        bottom: 80vh;
        opacity: 0;
        transform: scale(0);
    }
}

/* Explosion Effects */
.explosion {
    position: absolute;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    animation: explode 1.5s ease-out forwards;
    pointer-events: none;
}

@keyframes explode {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    50% {
        transform: scale(1);
        opacity: 0.8;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* Particle Effects */
.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    animation: particleFly 1s ease-out forwards;
    pointer-events: none;
}

@keyframes particleFly {
    0% {
        transform: scale(1) translate(0, 0);
        opacity: 1;
    }
    100% {
        transform: scale(0) translate(var(--dx, 0px), var(--dy, 0px));
        opacity: 0;
    }
}

/* Product Click Animation */
.product-burst {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: radial-gradient(circle, #ffd700, #ff6b35, transparent);
    animation: productBurst 0.8s ease-out forwards;
    pointer-events: none;
    z-index: 1000;
}

@keyframes productBurst {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.2) rotate(180deg);
        opacity: 0.8;
    }
    100% {
        transform: scale(2) rotate(360deg);
        opacity: 0;
    }
}

/* Firework Burst */
.firework {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    animation: fireworkBurst 2s ease-out forwards;
}

@keyframes fireworkBurst {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    15% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(0) translate(var(--fx, 0px), var(--fy, 0px));
        opacity: 0;
    }
}

/* Color Variations */
.color-gold { background: #ffd700; box-shadow: 0 0 10px #ffd700; }
.color-red { background: #ff4500; box-shadow: 0 0 10px #ff4500; }
.color-green { background: #32cd32; box-shadow: 0 0 10px #32cd32; }
.color-blue { background: #1e90ff; box-shadow: 0 0 10px #1e90ff; }
.color-purple { background: #9932cc; box-shadow: 0 0 10px #9932cc; }
.color-orange { background: #ff6b35; box-shadow: 0 0 10px #ff6b35; }

/* Mobile Optimizations */
@media (max-width: 768px) {
    .rocket-trail {
        width: 3px;
        height: 15px;
    }
    
    .explosion {
        width: 60px;
        height: 60px;
    }
    
    .product-burst {
        width: 40px;
        height: 40px;
    }
    
    .particle {
        width: 3px;
        height: 3px;
    }
}

/* Reduce animations for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    .rocket-trail,
    .sparkler,
    .explosion,
    .particle,
    .product-burst,
    .firework {
        animation-duration: 0.1s;
        animation-iteration-count: 1;
    }
}

/* Performance optimizations */
.cracker-effects-container * {
    will-change: transform, opacity;
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Glow effects for better visibility */
.glow-effect {
    filter: drop-shadow(0 0 5px currentColor);
}

/* Trail effects */
.trail-effect {
    background: linear-gradient(to top, transparent, currentColor);
    filter: blur(0.5px);
}

/* Burst patterns */
.burst-pattern-1 { --dx: 50px; --dy: -30px; }
.burst-pattern-2 { --dx: -40px; --dy: -45px; }
.burst-pattern-3 { --dx: 30px; --dy: -60px; }
.burst-pattern-4 { --dx: -50px; --dy: -20px; }
.burst-pattern-5 { --dx: 0px; --dy: -70px; }
.burst-pattern-6 { --dx: 60px; --dy: -10px; }
.burst-pattern-7 { --dx: -30px; --dy: -55px; }
.burst-pattern-8 { --dx: 45px; --dy: -40px; }

/* Firework patterns */
.firework-pattern-1 { --fx: 80px; --fy: -60px; }
.firework-pattern-2 { --fx: -70px; --fy: -80px; }
.firework-pattern-3 { --fx: 60px; --fy: -100px; }
.firework-pattern-4 { --fx: -90px; --fy: -40px; }
.firework-pattern-5 { --fx: 0px; --fy: -120px; }
.firework-pattern-6 { --fx: 100px; --fy: -20px; }
.firework-pattern-7 { --fx: -60px; --fy: -90px; }
.firework-pattern-8 { --fx: 80px; --fy: -70px; }

/* Rocket drift patterns */
.rocket-drift-1 { --drift: 20px; }
.rocket-drift-2 { --drift: -30px; }
.rocket-drift-3 { --drift: 15px; }
.rocket-drift-4 { --drift: -25px; }
.rocket-drift-5 { --drift: 35px; }
.rocket-drift-6 { --drift: -15px; }
.rocket-drift-7 { --drift: 25px; }
.rocket-drift-8 { --drift: -35px; }
