/**
 * Theme Effects - Subtle animated backgrounds for premium themes
 * @package ChaletMontagne
 */

(function() {
    'use strict';

    // Get theme effect from body data attribute
    const body = document.body;
    const themeEffect = body.dataset.themeEffect || '';

    if (!themeEffect) return;

    // Effects that need JavaScript animation
    const jsEffects = ['gold-shimmer'];

    if (!jsEffects.includes(themeEffect)) return;

    // Create effects container
    const effectsContainer = document.createElement('div');
    effectsContainer.className = 'theme-effects-container';
    effectsContainer.style.cssText = `
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        pointer-events: none;
        z-index: 0;
        overflow: hidden;
    `;
    body.insertBefore(effectsContainer, body.firstChild);

    /**
     * Gold Shimmer Effect - Luxe Absolu Theme
     * Subtle floating gold particles
     */
    function createGoldShimmer() {
        const particleCount = 15;

        // Add CSS for particles
        const style = document.createElement('style');
        style.textContent = `
            .theme-gold-particle {
                position: absolute;
                width: 3px;
                height: 3px;
                background: #D4AF37;
                border-radius: 50%;
                opacity: 0;
                animation: goldFloat 8s ease-in-out infinite;
            }

            @keyframes goldFloat {
                0%, 100% {
                    opacity: 0;
                    transform: translateY(0) scale(0.5);
                }
                20% {
                    opacity: 0.6;
                }
                50% {
                    opacity: 0.3;
                    transform: translateY(-100px) scale(1);
                }
                80% {
                    opacity: 0.6;
                }
            }
        `;
        document.head.appendChild(style);

        // Create particles
        for (let i = 0; i < particleCount; i++) {
            const particle = document.createElement('div');
            particle.className = 'theme-gold-particle';
            particle.style.left = Math.random() * 100 + '%';
            particle.style.top = 50 + Math.random() * 50 + '%';
            particle.style.animationDelay = Math.random() * 8 + 's';
            particle.style.animationDuration = (6 + Math.random() * 6) + 's';
            effectsContainer.appendChild(particle);
        }
    }

    // Initialize based on theme effect
    switch (themeEffect) {
        case 'gold-shimmer':
            createGoldShimmer();
            break;
    }

})();
