/* Animations de base */
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes rainbowShift {
    0% { background-position: 0% 50%; filter: hue-rotate(0deg); }
    25% { background-position: 25% 75%; filter: hue-rotate(90deg); }
    50% { background-position: 100% 50%; filter: hue-rotate(180deg); }
    75% { background-position: 75% 25%; filter: hue-rotate(270deg); }
    100% { background-position: 0% 50%; filter: hue-rotate(360deg); }
}

@keyframes lightningFlow {
    0% { 
        background-position: 0% 0%; 
        filter: brightness(1) saturate(1) contrast(1); 
    }
    20% { 
        background-position: 100% 0%; 
        filter: brightness(1.2) saturate(1.3) contrast(1.1); 
    }
    40% { 
        background-position: 100% 100%; 
        filter: brightness(0.9) saturate(0.8) contrast(0.9); 
    }
    60% { 
        background-position: 0% 100%; 
        filter: brightness(1.1) saturate(1.1) contrast(1.05); 
    }
    80% { 
        background-position: 0% 50%; 
        filter: brightness(1.3) saturate(1.4) contrast(1.2); 
    }
    100% { 
        background-position: 0% 0%; 
        filter: brightness(1) saturate(1) contrast(1); 
    }
}

@keyframes gentleFlow {
    0% { background-position: 0% 20%; filter: hue-rotate(0deg) brightness(1) saturate(1.1); }
    33% { background-position: 100% 60%; filter: hue-rotate(30deg) brightness(1.1) saturate(1.2); }
    66% { background-position: 20% 100%; filter: hue-rotate(-15deg) brightness(0.95) saturate(1.05); }
    100% { background-position: 0% 20%; filter: hue-rotate(0deg) brightness(1) saturate(1.1); }
}

@keyframes horizontalSweep {
    0% { 
        background-position: 0% 50%; 
    }
    50% { 
        background-position: 100% 50%; 
    }
    100% { 
        background-position: 0% 50%; 
    }
}

@keyframes softGradientFlow {
    0% { background-position: 0% 0%; filter: brightness(1) saturate(1.1); }
    25% { background-position: 100% 0%; filter: brightness(1.05) saturate(1.2); }
    50% { background-position: 100% 100%; filter: brightness(0.98) saturate(1.05); }
    75% { background-position: 0% 100%; filter: brightness(1.02) saturate(1.15); }
    100% { background-position: 0% 0%; filter: brightness(1) saturate(1.1); }
}

@keyframes radialZoom {
    0% { 
        background-size: 100% 100%; 
        filter: brightness(1) saturate(1) hue-rotate(0deg); 
    }
    25% { 
        background-size: 110% 110%; 
        filter: brightness(1.1) saturate(1.2) hue-rotate(15deg); 
    }
    50% { 
        background-size: 120% 120%; 
        filter: brightness(0.95) saturate(0.9) hue-rotate(-10deg); 
    }
    75% { 
        background-size: 105% 105%; 
        filter: brightness(1.05) saturate(1.1) hue-rotate(20deg); 
    }
    100% { 
        background-size: 100% 100%; 
        filter: brightness(1) saturate(1) hue-rotate(0deg); 
    }
}

@keyframes overlayPulse {
    0% { opacity: 0.15; }
    50% { opacity: 0.25; }
    100% { opacity: 0.15; }
}

@keyframes floatingBubbles {
    0% { transform: translateY(0px) rotate(0deg); opacity: 0.7; }
    33% { transform: translateY(-10px) rotate(120deg); opacity: 1; }
    66% { transform: translateY(5px) rotate(240deg); opacity: 0.8; }
    100% { transform: translateY(0px) rotate(360deg); opacity: 0.7; }
}

/* Floating Shapes */
.floating-shapes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.floating-shapes span {
    position: absolute;
    display: block;
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    animation: floatingBubbles 6s infinite linear;
}

.floating-shapes span:nth-child(1) {
    left: 10%;
    animation-delay: 0s;
    animation-duration: 8s;
    width: 15px;
    height: 15px;
}

.floating-shapes span:nth-child(2) {
    left: 20%;
    animation-delay: 2s;
    animation-duration: 12s;
    width: 25px;
    height: 25px;
}

.floating-shapes span:nth-child(3) {
    left: 30%;
    animation-delay: 4s;
    animation-duration: 10s;
    width: 18px;
    height: 18px;
}

.floating-shapes span:nth-child(4) {
    left: 40%;
    animation-delay: 6s;
    animation-duration: 14s;
    width: 22px;
    height: 22px;
}

.floating-shapes span:nth-child(5) {
    left: 50%;
    animation-delay: 8s;
    animation-duration: 9s;
    width: 16px;
    height: 16px;
}

.floating-shapes span:nth-child(6) {
    left: 60%;
    animation-delay: 10s;
    animation-duration: 11s;
    width: 20px;
    height: 20px;
}

.floating-shapes span:nth-child(7) {
    left: 70%;
    animation-delay: 12s;
    animation-duration: 13s;
    width: 24px;
    height: 24px;
}

.floating-shapes span:nth-child(8) {
    left: 80%;
    animation-delay: 14s;
    animation-duration: 15s;
    width: 17px;
    height: 17px;
}

.floating-shapes span:nth-child(9) {
    left: 90%;
    animation-delay: 16s;
    animation-duration: 7s;
    width: 21px;
    height: 21px;
}

.floating-shapes span:nth-child(10) {
    left: 95%;
    animation-delay: 18s;
    animation-duration: 16s;
    width: 19px;
    height: 19px;
}

/* Animations spécifiques aux sections */
.hero-animated {
    background: var(--bg-animated-hero);
    background-size: 400% 400%;
    animation: gradientShift 8s ease infinite;
}

.about-animated {
    background: var(--bg-animated-about);
    background-size: 600% 600%;
    animation: gentleFlow 12s ease-in-out infinite;
}

.skills-animated {
    background: var(--bg-animated-skills);
    background-size: 300% 300%;
    animation: radialZoom 10s ease-in-out infinite;
}

.projects-animated {
    background: var(--bg-animated-projects);
    background-size: 800% 800%;
    animation: rainbowShift 15s linear infinite;
}

.education-animated {
    background: var(--bg-animated-education);
    background-size: 600% 600%;
    animation: gentleFlow 14s ease-in-out infinite;
}

.contact-animated {
    background: var(--bg-animated-contact);
    background-size: 500% 500%;
    animation: lightningFlow 9s ease-in-out infinite;
}

/* Overlay pour améliorer la lisibilité */
.animated-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.2);
    animation: overlayPulse 4s ease-in-out infinite;
    z-index: 2;
}

/* Footer */
.footer {
    background: var(--text-dark);
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: auto;
}

.footer p {
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
}

/* Responsive animations */
@media (max-width: 768px) {
    .floating-shapes span {
        width: 12px;
        height: 12px;
    }
    
    .floating-shapes span:nth-child(even) {
        width: 8px;
        height: 8px;
    }
    
    /* Réduire l'intensité des animations sur mobile */
    .hero-animated {
        animation-duration: 12s;
    }
    
    .about-animated {
        animation-duration: 16s;
    }
    
    .skills-animated {
        animation-duration: 14s;
    }
    
    .projects-animated {
        animation-duration: 20s;
    }
    
    .contact-animated {
        animation-duration: 13s;
    }
}

/* Animation des bulles flottantes */
@keyframes floatingBubbles {
    0% {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) scale(1);
        opacity: 0;
    }
}

/* Préférences de mouvement réduit */
@media (prefers-reduced-motion: reduce) {
    .floating-shapes span,
    .floating-bubbles span,
    .hero-animated,
    .about-animated,
    .skills-animated,
    .projects-animated,
    .contact-animated,
    .animated-overlay {
        animation: none;
    }
    
    .floating-shapes,
    .floating-bubbles {
        display: none;
    }
}