/**
 * DORA Design System - Animations Standards
 * Version: 2.0
 *
 * Animations centralisées pour éviter les duplications.
 * Support pour prefers-reduced-motion intégré.
 */

/* ========================================
   KEYFRAMES - Entrées
   ======================================== */

/* Fade In */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Fade In Up */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In Down */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In Left */
@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-24px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Fade In Right */
@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(24px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scale In */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Scale In Bounce */
@keyframes scaleInBounce {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Slide In Up */
@keyframes slideInUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* Slide In Down */
@keyframes slideInDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

/* ========================================
   KEYFRAMES - Attention/Pulse
   ======================================== */

/* Pulse CTA (Orange) */
@keyframes pulse-cta {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 107, 53, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(255, 107, 53, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 107, 53, 0);
    }
}

/* Pulse Primary (Bleu) */
@keyframes pulse-primary {
    0% {
        box-shadow: 0 0 0 0 rgba(74, 144, 217, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(74, 144, 217, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(74, 144, 217, 0);
    }
}

/* Pulse générique */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Bounce */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

/* Shake (pour erreurs) */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    20%, 60% {
        transform: translateX(-4px);
    }
    40%, 80% {
        transform: translateX(4px);
    }
}

/* ========================================
   KEYFRAMES - Chargement
   ======================================== */

/* Spinner */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Shimmer (skeleton loading) */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Progress */
@keyframes progress {
    from {
        width: 0%;
    }
    to {
        width: 100%;
    }
}

/* ========================================
   KEYFRAMES - Effets spéciaux
   ======================================== */

/* Shine (reflet sur boutons) */
@keyframes shine {
    0% {
        left: -100%;
    }
    50%, 100% {
        left: 100%;
    }
}

/* Glow */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(74, 144, 217, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(74, 144, 217, 0.5);
    }
}

/* Float */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* ========================================
   CLASSES D'ANIMATION
   ======================================== */

/* Entrées */
.animate-fadeIn {
    animation: fadeIn var(--duration-moderate, 300ms) var(--ease-out, ease-out) both;
}

.animate-fadeInUp {
    animation: fadeInUp var(--duration-slow, 500ms) var(--ease-out, ease-out) both;
}

.animate-fadeInDown {
    animation: fadeInDown var(--duration-slow, 500ms) var(--ease-out, ease-out) both;
}

.animate-fadeInLeft {
    animation: fadeInLeft var(--duration-slow, 500ms) var(--ease-out, ease-out) both;
}

.animate-fadeInRight {
    animation: fadeInRight var(--duration-slow, 500ms) var(--ease-out, ease-out) both;
}

.animate-scaleIn {
    animation: scaleIn var(--duration-moderate, 300ms) var(--ease-bounce, cubic-bezier(0.175, 0.885, 0.32, 1.275)) both;
}

.animate-slideInUp {
    animation: slideInUp var(--duration-moderate, 300ms) var(--ease-out, ease-out) both;
}

/* Attention */
.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.animate-pulse-cta {
    animation: pulse-cta 2s ease-in-out infinite;
}

.animate-bounce {
    animation: bounce 1s ease-in-out infinite;
}

.animate-shake {
    animation: shake 0.5s ease-in-out;
}

/* Chargement */
.animate-spin {
    animation: spin 1s linear infinite;
}

.animate-shimmer {
    background: linear-gradient(
        90deg,
        var(--color-neutral-200, #E5E7EB) 0%,
        var(--color-neutral-100, #F3F4F6) 50%,
        var(--color-neutral-200, #E5E7EB) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

/* Effets */
.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-glow {
    animation: glow 2s ease-in-out infinite;
}

/* ========================================
   DELAYS D'ANIMATION
   ======================================== */

.animate-delay-100 { animation-delay: 100ms; }
.animate-delay-200 { animation-delay: 200ms; }
.animate-delay-300 { animation-delay: 300ms; }
.animate-delay-400 { animation-delay: 400ms; }
.animate-delay-500 { animation-delay: 500ms; }
.animate-delay-700 { animation-delay: 700ms; }
.animate-delay-1000 { animation-delay: 1000ms; }

/* Stagger pour listes (children) */
.animate-stagger > *:nth-child(1) { animation-delay: 0ms; }
.animate-stagger > *:nth-child(2) { animation-delay: 100ms; }
.animate-stagger > *:nth-child(3) { animation-delay: 200ms; }
.animate-stagger > *:nth-child(4) { animation-delay: 300ms; }
.animate-stagger > *:nth-child(5) { animation-delay: 400ms; }
.animate-stagger > *:nth-child(6) { animation-delay: 500ms; }

/* ========================================
   TRANSITIONS UTILITAIRES
   ======================================== */

.transition-none { transition: none; }
.transition-all { transition: all var(--duration-moderate, 300ms) var(--ease-in-out, ease); }
.transition-colors { transition: color, background-color, border-color var(--duration-fast, 150ms) var(--ease-in-out, ease); }
.transition-opacity { transition: opacity var(--duration-moderate, 300ms) var(--ease-in-out, ease); }
.transition-transform { transition: transform var(--duration-moderate, 300ms) var(--ease-in-out, ease); }
.transition-shadow { transition: box-shadow var(--duration-moderate, 300ms) var(--ease-in-out, ease); }

/* ========================================
   HOVER EFFECTS
   ======================================== */

.hover-lift {
    transition: transform var(--duration-moderate, 300ms) var(--ease-out, ease-out),
                box-shadow var(--duration-moderate, 300ms) var(--ease-out, ease-out);
}

.hover-lift:hover {
    transform: translateY(-4px);
}

.hover-scale {
    transition: transform var(--duration-moderate, 300ms) var(--ease-out, ease-out);
}

.hover-scale:hover {
    transform: scale(1.02);
}

.hover-glow {
    transition: box-shadow var(--duration-moderate, 300ms) var(--ease-out, ease-out);
}

.hover-glow:hover {
    box-shadow: var(--shadow-glow, 0 0 40px rgba(74, 144, 217, 0.3));
}

/* ========================================
   SCROLL ANIMATIONS (Intersection Observer)
   ======================================== */

/* Par défaut: invisible */
[data-animate] {
    opacity: 0;
}

/* Quand visible */
[data-animate].is-visible {
    opacity: 1;
}

[data-animate="fadeInUp"].is-visible {
    animation: fadeInUp var(--duration-slow, 500ms) var(--ease-out, ease-out) both;
}

[data-animate="fadeInLeft"].is-visible {
    animation: fadeInLeft var(--duration-slow, 500ms) var(--ease-out, ease-out) both;
}

[data-animate="fadeInRight"].is-visible {
    animation: fadeInRight var(--duration-slow, 500ms) var(--ease-out, ease-out) both;
}

[data-animate="scaleIn"].is-visible {
    animation: scaleIn var(--duration-moderate, 300ms) var(--ease-bounce, cubic-bezier(0.175, 0.885, 0.32, 1.275)) both;
}

/* ========================================
   REDUCED MOTION
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    [data-animate] {
        opacity: 1 !important;
        transform: none !important;
    }

    .animate-pulse,
    .animate-pulse-cta,
    .animate-bounce,
    .animate-float,
    .animate-glow,
    .animate-spin,
    .animate-shimmer {
        animation: none !important;
    }
}
