/* Animations de fond Tech/IA/Darkness - Version Imposante et Stylée */

/* Fond principal avec dégradés complexes */
.tech-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
    background: 
        radial-gradient(ellipse at top left, rgba(124, 58, 237, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(0, 212, 255, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at center, rgba(34, 197, 94, 0.05) 0%, transparent 70%),
        linear-gradient(135deg, #0a0f1c 0%, #1e293b 30%, #0f172a 70%, #0a0f1c 100%);
    animation: background-pulse 20s ease-in-out infinite;
}

@keyframes background-pulse {
    0%, 100% {
        filter: brightness(1) contrast(1);
    }
    50% {
        filter: brightness(1.1) contrast(1.05);
    }
}

/* Grille neurale imposante */
.neural-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(0, 212, 255, 0.15) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 212, 255, 0.15) 1px, transparent 1px),
        linear-gradient(rgba(124, 58, 237, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(124, 58, 237, 0.08) 1px, transparent 1px);
    background-size: 120px 120px, 120px 120px, 40px 40px, 40px 40px;
    animation: grid-flow 30s linear infinite, grid-pulse 8s ease-in-out infinite;
}

@keyframes grid-flow {
    0% {
        background-position: 0 0, 0 0, 0 0, 0 0;
    }
    100% {
        background-position: 120px 120px, 120px 120px, 40px 40px, 40px 40px;
    }
}

@keyframes grid-pulse {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 0.6;
    }
}

/* Particules IA flottantes avec trails */
.tech-particles {
    position: absolute;
    width: 100%;
    height: 100%;
}

.tech-particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: var(--primary);
    border-radius: 50%;
    opacity: 0.8;
    animation: float-tech-enhanced 20s linear infinite;
    box-shadow: 
        0 0 6px var(--primary),
        0 0 12px var(--primary),
        0 0 18px rgba(0, 212, 255, 0.3);
}

.tech-particle::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 50%;
    width: 1px;
    height: 20px;
    background: linear-gradient(to bottom, var(--primary), transparent);
    transform: translateX(-50%);
}

.tech-particle:nth-child(even) {
    background: var(--accent);
    box-shadow: 
        0 0 6px var(--accent),
        0 0 12px var(--accent),
        0 0 18px rgba(124, 58, 237, 0.3);
    animation-duration: 25s;
    animation-delay: -8s;
}

.tech-particle:nth-child(3n) {
    background: #22c55e;
    box-shadow: 
        0 0 6px #22c55e,
        0 0 12px #22c55e,
        0 0 18px rgba(34, 197, 94, 0.3);
    animation-duration: 15s;
    animation-delay: -12s;
}

@keyframes float-tech-enhanced {
    0% {
        transform: translateY(100vh) translateX(0) rotate(0deg) scale(0);
        opacity: 0;
    }
    5% {
        opacity: 0.8;
        transform: translateY(95vh) translateX(10px) rotate(10deg) scale(1);
    }
    95% {
        opacity: 0.6;
        transform: translateY(-5vh) translateX(150px) rotate(350deg) scale(1.2);
    }
    100% {
        transform: translateY(-10vh) translateX(200px) rotate(360deg) scale(0);
        opacity: 0;
    }
}

/* Connexions neurales avec pulsations */
.neural-connections {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.neural-line {
    position: absolute;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), rgba(0, 212, 255, 0.5), var(--primary), transparent);
    animation: neural-pulse-enhanced 4s ease-in-out infinite;
    box-shadow: 0 0 10px var(--primary);
}

.neural-line:nth-child(1) {
    top: 15%;
    left: 0;
    width: 70%;
    animation-delay: 0s;
    transform: rotate(5deg);
}

.neural-line:nth-child(2) {
    top: 35%;
    right: 0;
    width: 60%;
    animation-delay: 1.5s;
    background: linear-gradient(90deg, transparent, var(--accent), rgba(124, 58, 237, 0.5), var(--accent), transparent);
    box-shadow: 0 0 10px var(--accent);
    transform: rotate(-3deg);
}

.neural-line:nth-child(3) {
    top: 55%;
    left: 15%;
    width: 65%;
    animation-delay: 3s;
    background: linear-gradient(90deg, transparent, #22c55e, rgba(34, 197, 94, 0.5), #22c55e, transparent);
    box-shadow: 0 0 10px #22c55e;
    transform: rotate(2deg);
}

.neural-line:nth-child(4) {
    top: 75%;
    right: 10%;
    width: 55%;
    animation-delay: 0.8s;
    transform: rotate(-4deg);
}

@keyframes neural-pulse-enhanced {
    0%, 100% {
        opacity: 0;
        transform: scaleX(0) rotate(var(--rotation, 0deg));
        filter: blur(1px);
    }
    25% {
        opacity: 0.6;
        transform: scaleX(0.3) rotate(var(--rotation, 0deg));
        filter: blur(0.5px);
    }
    50% {
        opacity: 1;
        transform: scaleX(1) rotate(var(--rotation, 0deg));
        filter: blur(0px);
    }
    75% {
        opacity: 0.8;
        transform: scaleX(0.7) rotate(var(--rotation, 0deg));
        filter: blur(0.5px);
    }
}

/* Codes hexadécimaux défilants */
.binary-rain {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.binary-column {
    position: absolute;
    top: -100%;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 14px;
    font-weight: 500;
    color: var(--primary);
    opacity: 0.4;
    animation: binary-fall-enhanced 12s linear infinite;
    white-space: nowrap;
    text-shadow: 0 0 8px currentColor;
    letter-spacing: 2px;
}

.binary-column:nth-child(odd) {
    color: var(--accent);
    animation-duration: 18s;
    font-size: 12px;
}

.binary-column:nth-child(3n) {
    color: #22c55e;
    animation-duration: 10s;
    font-size: 16px;
}

@keyframes binary-fall-enhanced {
    0% {
        transform: translateY(-100vh) rotateX(0deg);
        opacity: 0;
    }
    5% {
        opacity: 0.6;
    }
    15% {
        opacity: 0.8;
        transform: translateY(-80vh) rotateX(5deg);
    }
    85% {
        opacity: 0.3;
        transform: translateY(80vh) rotateX(-5deg);
    }
    100% {
        transform: translateY(100vh) rotateX(0deg);
        opacity: 0;
    }
}

/* Scan holographique multiple */
.holographic-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background: 
        linear-gradient(
            45deg,
            transparent 30%,
            rgba(0, 212, 255, 0.08) 40%,
            rgba(0, 212, 255, 0.12) 50%,
            rgba(0, 212, 255, 0.08) 60%,
            transparent 70%
        ),
        linear-gradient(
            -45deg,
            transparent 30%,
            rgba(124, 58, 237, 0.06) 40%,
            rgba(124, 58, 237, 0.1) 50%,
            rgba(124, 58, 237, 0.06) 60%,
            transparent 70%
        );
    animation: holographic-scan-enhanced 15s linear infinite;
}

@keyframes holographic-scan-enhanced {
    0% {
        transform: translateX(-150%) translateY(-50%);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateX(150%) translateY(50%);
        opacity: 0;
    }
}

/* Flux de données avec vitesse variable */
.data-streams {
    position: absolute;
    width: 100%;
    height: 100%;
}

.data-packet {
    position: absolute;
    width: 6px;
    height: 30px;
    background: linear-gradient(to bottom, var(--primary), rgba(0, 212, 255, 0.3), transparent);
    animation: data-flow-enhanced 8s linear infinite;
    opacity: 0.7;
    border-radius: 3px;
    box-shadow: 0 0 8px var(--primary);
}

.data-packet:nth-child(even) {
    background: linear-gradient(to bottom, var(--accent), rgba(124, 58, 237, 0.3), transparent);
    animation-duration: 12s;
    box-shadow: 0 0 8px var(--accent);
    width: 4px;
    height: 25px;
}

.data-packet:nth-child(3n) {
    background: linear-gradient(to bottom, #22c55e, rgba(34, 197, 94, 0.3), transparent);
    animation-duration: 6s;
    box-shadow: 0 0 8px #22c55e;
    width: 8px;
    height: 35px;
}

@keyframes data-flow-enhanced {
    0% {
        transform: translateY(-30px) translateX(0) scaleY(0);
        opacity: 0;
    }
    10% {
        opacity: 0.8;
        transform: translateY(10vh) translateX(20px) scaleY(1);
    }
    90% {
        opacity: 0.4;
        transform: translateY(80vh) translateX(80px) scaleY(1.2);
    }
    100% {
        transform: translateY(100vh) translateX(100px) scaleY(0);
        opacity: 0;
    }
}

/* Nœuds réseau avec ondulations */
.network-nodes {
    position: absolute;
    width: 100%;
    height: 100%;
}

.network-node {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: node-pulse-enhanced 4s ease-in-out infinite;
    box-shadow: 
        0 0 10px var(--primary),
        0 0 20px rgba(0, 212, 255, 0.3),
        0 0 30px rgba(0, 212, 255, 0.1);
}

.network-node::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    border: 1px solid var(--primary);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    animation: node-ripple 4s ease-in-out infinite;
}

.network-node:nth-child(even) {
    background: var(--accent);
    animation-delay: 2s;
    box-shadow: 
        0 0 10px var(--accent),
        0 0 20px rgba(124, 58, 237, 0.3),
        0 0 30px rgba(124, 58, 237, 0.1);
}

.network-node:nth-child(even)::before {
    border-color: var(--accent);
}

.network-node:nth-child(3n) {
    background: #22c55e;
    animation-delay: 1.3s;
    box-shadow: 
        0 0 10px #22c55e,
        0 0 20px rgba(34, 197, 94, 0.3),
        0 0 30px rgba(34, 197, 94, 0.1);
}

.network-node:nth-child(3n)::before {
    border-color: #22c55e;
}

@keyframes node-pulse-enhanced {
    0%, 100% {
        opacity: 0.4;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.3);
    }
}

@keyframes node-ripple {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    25% {
        opacity: 0.6;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(2);
    }
}

/* Effet de distorsion subtile */
.tech-background::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(0, 212, 255, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(124, 58, 237, 0.02) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(34, 197, 94, 0.01) 0%, transparent 50%);
    animation: distortion 25s ease-in-out infinite;
}

@keyframes distortion {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        filter: blur(0px);
    }
    50% {
        transform: scale(1.02) rotate(0.5deg);
        filter: blur(0.5px);
    }
}

/* Responsive - Moins d'effets sur mobile */
@media (max-width: 768px) {
    .tech-particle {
        animation-duration: 12s;
        width: 2px;
        height: 2px;
    }
    
    .neural-grid {
        background-size: 80px 80px, 80px 80px, 25px 25px, 25px 25px;
    }
    
    .binary-column {
        font-size: 10px;
        letter-spacing: 1px;
    }
    
    .data-packet {
        width: 4px;
        height: 20px;
    }
    
    .network-node {
        width: 6px;
        height: 6px;
    }
}

/* Performance - Pause tout quand pas visible */
@media (prefers-reduced-motion: reduce) {
    .tech-particle,
    .neural-line,
    .binary-column,
    .data-packet,
    .network-node,
    .holographic-overlay,
    .neural-grid,
    .tech-background,
    .tech-background::after {
        animation: none !important;
    }
    
    .neural-grid {
        opacity: 0.2;
    }
    
    .tech-background {
        background: linear-gradient(135deg, #0a0f1c 0%, #1e293b 50%, #0a0f1c 100%);
    }
}