/*
 * French ECU - Styles animation 3D
 * Optimisations et effets pour Three.js
 */

/* === CONTAINER ANIMATION 3D === */
#animation-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

#animation-container canvas {
    display: block !important;
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
}

/* === OPTIMISATIONS PERFORMANCE === */
#animation-container * {
    will-change: transform, opacity;
    backface-visibility: hidden;
    perspective: 1000px;
    transform-style: preserve-3d;
}

/* === OVERLAY EFFECTS === */
.content-overlay {
    position: relative;
    z-index: 10;
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(1px);
}

/* === PARTICULES FLOTTANTES === */
.floating-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--accent-color);
    border-radius: 50%;
    opacity: 0.3;
    animation: float-particle 10s infinite linear;
}

.particle:nth-child(2n) {
    background: var(--primary-color);
    animation-duration: 15s;
}

.particle:nth-child(3n) {
    background: var(--secondary-color);
    animation-duration: 12s;
}

@keyframes float-particle {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.3;
    }
    90% {
        opacity: 0.3;
    }
    100% {
        transform: translateY(-10vh) rotate(360deg);
        opacity: 0;
    }
}

/* === EFFETS DE LUMIÈRE === */
.light-effect {
    position: absolute;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, var(--accent-color) 0%, transparent 70%);
    border-radius: 50%;
    opacity: 0.1;
    pointer-events: none;
    animation: pulse-light 4s ease-in-out infinite;
}

@keyframes pulse-light {
    0%, 100% {
        transform: scale(1);
        opacity: 0.1;
    }
    50% {
        transform: scale(1.5);
        opacity: 0.2;
    }
}

/* === RESPONSIVE ANIMATION === */
@media (max-width: 768px) {
    #animation-container {
        /* Réduction de la complexité sur mobile */
        filter: blur(0.5px);
        opacity: 0.8;
    }
    
    .particle {
        display: none; /* Désactiver particules sur mobile */
    }
    
    .light-effect {
        width: 100px;
        height: 100px;
    }
}

@media (max-width: 480px) {
    #animation-container {
        opacity: 0.6;
        filter: blur(1px);
    }
}

/* === PRÉFÉRENCES UTILISATEUR === */
@media (prefers-reduced-motion: reduce) {
    #animation-container {
        display: none !important;
    }
    
    .particle,
    .light-effect {
        animation: none !important;
    }
    
    body {
        background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    }
}

/* Mode économie d'énergie */
@media (prefers-reduced-motion: reduce) {
    #animation-container canvas {
        animation-play-state: paused;
    }
}

/* === OPTIMISATIONS GPU === */
#animation-container,
#animation-container canvas {
    transform: translateZ(0);
    will-change: transform;
}

/* === LOADING STATE === */
.animation-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--accent-color);
    font-size: 1.2rem;
    z-index: 5;
    animation: pulse 2s infinite;
}

.animation-loading::after {
    content: "Chargement de l'animation 3D...";
}

/* Cache le loader une fois l'animation chargée */
.animation-loaded .animation-loading {
    display: none;
}

/* === EFFETS INTERACTIFS === */
.interactive-glow {
    position: absolute;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(0, 212, 255, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 5;
}

/* === FALLBACK === */
.no-webgl #animation-container {
    background: linear-gradient(135deg, 
        rgba(74, 144, 226, 0.1) 0%, 
        rgba(123, 104, 238, 0.1) 50%, 
        rgba(0, 212, 255, 0.1) 100%);
}

.no-webgl #animation-container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 20%, rgba(74, 144, 226, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(123, 104, 238, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 60%, rgba(0, 212, 255, 0.2) 0%, transparent 50%);
    animation: fallback-animation 10s ease-in-out infinite;
}

@keyframes fallback-animation {
    0%, 100% { 
        opacity: 0.5;
        transform: scale(1);
    }
    50% { 
        opacity: 0.8;
        transform: scale(1.1);
    }
}