/* ================================
   ANIMATIONS AVANCÉES POUR COMPANION
   ================================ */

/* Animation de particules flottantes pour le background */
.floating-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.particle {
    position: absolute;
    display: block;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
}

.particle:nth-child(1) { left: 20%; animation-delay: 0s; animation-duration: 6s; }
.particle:nth-child(2) { left: 40%; animation-delay: 2s; animation-duration: 8s; }
.particle:nth-child(3) { left: 60%; animation-delay: 4s; animation-duration: 7s; }
.particle:nth-child(4) { left: 80%; animation-delay: 1s; animation-duration: 9s; }

@keyframes float {
    0%, 100% { 
        transform: translateY(100vh) scale(0); 
        opacity: 0; 
    }
    10% { 
        opacity: 0.5; 
        transform: scale(1); 
    }
    90% { 
        opacity: 0.5; 
    }
    100% { 
        transform: translateY(-100px) scale(0); 
        opacity: 0; 
    }
}

/* Animation de morphing pour les formes */
.morph-shape {
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    animation: morph 8s ease-in-out infinite;
}

@keyframes morph {
    0% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
    50% { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
    100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
}

/* Animation de pulsation pour les éléments critiques */
.pulse-critical {
    animation: pulseCritical 2s ease-in-out infinite;
}

@keyframes pulseCritical {
    0%, 100% { 
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
        transform: scale(1.02);
    }
}

/* Animation de typing pour les textes */
.typing-animation {
    overflow: hidden;
    border-right: 3px solid #667eea;
    white-space: nowrap;
    margin: 0 auto;
    animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: #667eea; }
}

/* Animation de rotation 3D pour les icônes */
.rotate-3d {
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.rotate-3d:hover {
    transform: rotateY(180deg);
}

/* Animation de vague pour les boutons */
.wave-effect {
    position: relative;
    overflow: hidden;
}

.wave-effect::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.wave-effect:hover::before {
    left: 100%;
}

/* Animation de parallax pour les sections */
.parallax-element {
    transform: translateZ(0);
    transition: transform 0.1s ease-out;
}

/* Animation de loading skeleton améliorée */
.loading-skeleton-advanced {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loadingAdvanced 1.5s infinite;
    border-radius: 8px;
}

@keyframes loadingAdvanced {
    0% {
        background-position: 200% 0;
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
    100% {
        background-position: -200% 0;
        opacity: 1;
    }
}

/* Animation de bounce pour les alertes */
.bounce-in {
    animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Animation de slide pour les notifications */
.slide-notification {
    animation: slideNotification 0.5s ease-out;
}

@keyframes slideNotification {
    0% {
        transform: translateX(100%);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Animation de zoom pour les modales */
.zoom-modal {
    animation: zoomModal 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes zoomModal {
    0% {
        opacity: 0;
        transform: scale(0.7);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Animation de flip pour les cartes */
.flip-card {
    perspective: 1000px;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 16px;
}

.flip-card-back {
    transform: rotateY(180deg);
}

/* Animation de progress bar */
.progress-animated {
    position: relative;
    overflow: hidden;
}

.progress-animated::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background-image: linear-gradient(
        -45deg,
        rgba(255, 255, 255, 0.2) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.2) 75%,
        transparent 75%,
        transparent
    );
    background-size: 50px 50px;
    animation: progressMove 1s linear infinite;
}

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

/* Animation de glow pour les éléments importants */
.glow-effect {
    animation: glowPulse 2s ease-in-out infinite alternate;
}

@keyframes glowPulse {
    from {
        box-shadow: 0 0 5px #667eea, 0 0 10px #667eea, 0 0 15px #667eea;
    }
    to {
        box-shadow: 0 0 10px #667eea, 0 0 20px #667eea, 0 0 30px #667eea;
    }
}

/* Animation de text reveal */
.text-reveal {
    overflow: hidden;
    position: relative;
}

.text-reveal::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #667eea;
    animation: textReveal 1.5s cubic-bezier(0.77, 0, 0.175, 1) forwards;
}

@keyframes textReveal {
    0% {
        left: 0;
        right: 0;
    }
    50% {
        left: 0;
        right: 0;
    }
    100% {
        left: 100%;
        right: 0;
    }
}

/* Responsive animations */
@media (max-width: 768px) {
    .floating-particles {
        display: none;
    }
    
    .morph-shape {
        animation-duration: 4s;
    }
    
    .typing-animation {
        animation-duration: 2s;
    }
}

/* Préférences de mouvement réduit */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .floating-particles,
    .morph-shape,
    .typing-animation {
        animation: none !important;
    }
}
