/**
 * StoryCraft - Animations
 * Toutes les animations, transitions et keyframes
 * @version 2.0
 */

/* === KEYFRAMES PRINCIPALES === */

/* Animation de rebond amusante pour les enfants */
@keyframes bounce {
    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Animation de tremblement */
@keyframes wiggle {
    0%,
    7% {
        transform: rotateZ(0);
    }
    15% {
        transform: rotateZ(-15deg);
    }
    20% {
        transform: rotateZ(10deg);
    }
    25% {
        transform: rotateZ(-10deg);
    }
    30% {
        transform: rotateZ(6deg);
    }
    35% {
        transform: rotateZ(-4deg);
    }
    40%,
    100% {
        transform: rotateZ(0);
    }
}

/* Animation arc-en-ciel */
@keyframes rainbow {
    0% {
        filter: hue-rotate(0deg);
    }
    100% {
        filter: hue-rotate(360deg);
    }
}

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

/* Animation spéciale pour les emojis du hero */
@keyframes heroEmojisFloat {
    0%,
    100% {
        transform: translateX(-50%) translateY(0px);
        opacity: 0.08;
    }
    25% {
        transform: translateX(-52%) translateY(-3px);
        opacity: 0.12;
    }
    50% {
        transform: translateX(-50%) translateY(-6px);
        opacity: 0.15;
    }
    75% {
        transform: translateX(-48%) translateY(-3px);
        opacity: 0.12;
    }
}

/* Animation de scintillement */
@keyframes sparkle {
    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

/* Animation d'entrée par la gauche */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Animation d'apparition avec scale */
@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Animation de lueur */
@keyframes glow {
    0%,
    100% {
        box-shadow: 0 0 10px rgba(255, 107, 157, 0.3);
    }
    50% {
        box-shadow: 0 0 25px rgba(255, 107, 157, 0.6);
    }
}

/* Animation de clignotement */
@keyframes twinkle {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

/* Animation de pulsation */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Animation de secousse */
@keyframes shake {
    0%,
    100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

/* Animation de fondu d'entrée */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animation de rotation */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Animation de confettis */
@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Animation de lueur pour cartes */
@keyframes cardGlow {
    0%,
    100% {
        box-shadow: var(--shadow-light);
    }
    50% {
        box-shadow: var(--shadow-fun);
    }
}

/* Animation d'entrée avec rebond */
@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale3d(0.3, 0.3, 0.3);
    }
    20% {
        transform: scale3d(1.1, 1.1, 1.1);
    }
    40% {
        transform: scale3d(0.9, 0.9, 0.9);
    }
    60% {
        opacity: 1;
        transform: scale3d(1.03, 1.03, 1.03);
    }
    80% {
        transform: scale3d(0.97, 0.97, 0.97);
    }
    100% {
        opacity: 1;
        transform: scale3d(1, 1, 1);
    }
}

/* Animation de remplissage progressif */
@keyframes progress-fill {
    0% {
        width: 0%;
    }
    100% {
        width: var(--progress-width, 0%);
    }
}

/* Animation de lueur pour scrollbar */
@keyframes scrollbarGlow {
    0%,
    100% {
        box-shadow: 0 0 5px rgba(255, 107, 157, 0.3);
    }
    50% {
        box-shadow: 0 0 15px rgba(255, 107, 157, 0.6);
    }
}

/* Animation pour éléments de modèle */
@keyframes modelFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Classes utilitaires pour appliquer les animations */
.animate-bounce {
    animation: bounce 2s ease-in-out infinite;
}

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

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

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

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

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

.animate-twinkle {
    animation: twinkle 1.5s ease-in-out infinite;
}

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

.animate-slideIn {
    animation: slideIn 0.6s ease-out;
}

.animate-popIn {
    animation: popIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.animate-fadeIn {
    animation: fadeIn 0.6s ease-out;
}

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

.animate-rainbow {
    animation: rainbow 3s ease infinite;
}

/* === TRANSITIONS === */

/* Transitions de base pour tous les éléments interactifs */
.transition-all {
    transition: all var(--animation-duration) ease;
}

.transition-colors {
    transition:
        color var(--animation-duration) ease,
        background-color var(--animation-duration) ease,
        border-color var(--animation-duration) ease;
}

.transition-transform {
    transition: transform var(--animation-duration) ease;
}

.transition-opacity {
    transition: opacity var(--animation-duration) ease;
}

.transition-shadow {
    transition: box-shadow var(--animation-duration) ease;
}

/* Transitions avec délais échelonnés */
.stagger-1 {
    animation-delay: 0.1s;
}
.stagger-2 {
    animation-delay: 0.2s;
}
.stagger-3 {
    animation-delay: 0.3s;
}
.stagger-4 {
    animation-delay: 0.4s;
}
.stagger-5 {
    animation-delay: 0.5s;
}

/* === EFFETS HOVER === */

/* Effet de survol avec transformation */
.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-medium);
}

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

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(255, 107, 157, 0.4);
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

/* === EFFETS SPÉCIAUX === */

/* Effet de particules brillantes */
.sparkle-effect {
    position: relative;
    overflow: hidden;
}

.sparkle-effect::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shine 2s ease-in-out infinite;
    z-index: 1;
}

@keyframes shine {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Effet de vague */
.wave-effect {
    position: relative;
    overflow: hidden;
}

.wave-effect::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, transparent 0%, rgba(255, 107, 157, 0.1) 50%, transparent 100%);
    transform: scale(0);
    transition: transform 0.6s ease;
    pointer-events: none;
}

.wave-effect:active::after {
    transform: scale(2);
}

/* === PREFERS 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;
    }
}

/* === PERFORMANCE OPTIMIZATIONS === */

/* Optimisation GPU pour les animations */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
}

/* Classes pour les animations complexes */
.will-animate {
    will-change: transform, opacity;
}

.will-animate-complete {
    will-change: auto;
}
