/* ===== KEYFRAMES ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes tooltipSlideIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Animations de cuisine */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px) rotate(-1deg); }
    75% { transform: translateX(2px) rotate(1deg); }
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.2); }
    50% { transform: scale(1); }
    75% { transform: scale(1.1); }
}

/* Loading animations */
@keyframes loading-progress {
    0% {
        width: 0%;
        transform: translateX(-100%);
    }
    50% {
        width: 100%;
        transform: translateX(0%);
    }
    100% {
        width: 100%;
        transform: translateX(100%);
    }
}

@keyframes skeleton-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Ripple effect */
@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Toast progress */
@keyframes toastProgress {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

/* Shimmer effect */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Glow pulse */
@keyframes glow-pulse {
    0%, 100% {
        box-shadow: 0 0 5px rgba(16, 185, 129, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(16, 185, 129, 0.6);
    }
}

/* Bounce in */
@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Slide bounce */
@keyframes slideBounce {
    0% {
        transform: translateX(-100px);
        opacity: 0;
    }
    60% {
        transform: translateX(20px);
        opacity: 1;
    }
    100% {
        transform: translateX(0);
    }
}

/* Rotation */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Scale pulse */
@keyframes scalePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* ===== CLASSES D'ANIMATION ===== */
.animate-fade-in {
    animation: fadeIn var(--transition-slow) ease-out;
}

.animate-fade-in-up {
    animation: fadeInUp var(--transition-slow) ease-out;
}

.animate-slide-in-right {
    animation: slideInRight var(--transition-slow) ease-out;
}

.animate-slide-in-left {
    animation: slideInLeft var(--transition-slow) ease-out;
}

.animate-bounce-in {
    animation: bounceIn var(--transition-bounce) ease-out;
}

.animate-shimmer {
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

.animate-glow-pulse {
    animation: glow-pulse 2s infinite ease-in-out;
}

.animate-rotate {
    animation: rotate 2s linear infinite;
}

.animate-scale-pulse {
    animation: scalePulse 2s infinite ease-in-out;
}

/* ===== HOVER EFFECTS ===== */
.hover-lift {
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.hover-glow {
    transition: all var(--transition-normal);
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

.hover-scale {
    transition: transform var(--transition-normal);
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-rotate {
    transition: transform var(--transition-normal);
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

/* ===== TRANSITIONS PERSONNALISÉES ===== */
.transition-all {
    transition: all var(--transition-normal);
}

.transition-colors {
    transition: color var(--transition-normal), background-color var(--transition-normal), border-color var(--transition-normal);
}

.transition-transform {
    transition: transform var(--transition-normal);
}

.transition-bounce {
    transition: all var(--transition-bounce);
}

/* ===== STATES AVEC ANIMATIONS ===== */
.loading-state {
    position: relative;
    overflow: hidden;
}

.loading-state::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: shimmer 2s infinite;
}

.error-shake {
    animation: shake 0.5s ease-in-out;
}

.success-bounce {
    animation: bounceIn 0.6s ease-out;
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* ===== 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;
    }
    
    .animate-shimmer,
    .animate-glow-pulse,
    .animate-rotate,
    .animate-scale-pulse {
        animation: none;
    }
}

/* ===== STAGGER ANIMATIONS ===== */
.stagger-children > * {
    animation-delay: calc(var(--stagger-delay, 100ms) * var(--stagger-index, 0));
}

.recipe-grid .recipe-card:nth-child(1) { --stagger-index: 0; }
.recipe-grid .recipe-card:nth-child(2) { --stagger-index: 1; }
.recipe-grid .recipe-card:nth-child(3) { --stagger-index: 2; }
.recipe-grid .recipe-card:nth-child(4) { --stagger-index: 3; }
.recipe-grid .recipe-card:nth-child(5) { --stagger-index: 4; }
.recipe-grid .recipe-card:nth-child(6) { --stagger-index: 5; }

/* ===== PARALLAX ET TRANSFORMS 3D ===== */
.parallax-element {
    transform-style: preserve-3d;
    perspective: 1000px;
}

.tilt-on-hover {
    transition: transform var(--transition-normal);
}

.tilt-on-hover:hover {
    transform: perspective(1000px) rotateX(5deg) rotateY(5deg) translateZ(10px);
}/* =====
 ANIMATIONS AMÉLIORÉES ===== */

/* Animation d'entrée pour les cartes de recettes */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Animation pour les boutons */
@keyframes buttonPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(245, 147, 50, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(245, 147, 50, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(245, 147, 50, 0);
    }
}

.btn-primary:focus {
    animation: buttonPulse 1.5s infinite;
}

/* Animation pour les favoris */
@keyframes heartBeat {
    0% {
        transform: scale(1);
    }
    14% {
        transform: scale(1.3);
    }
    28% {
        transform: scale(1);
    }
    42% {
        transform: scale(1.3);
    }
    70% {
        transform: scale(1);
    }
}

.favorite-btn.active {
    animation: heartBeat 1.2s ease-in-out;
}

/* Animation pour le chargement des recettes */
@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.skeleton-card {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite linear;
}

/* Animation pour les tags */
@keyframes tagSlideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.recipe-tag {
    animation: tagSlideIn 0.4s ease-out forwards;
    animation-delay: calc(var(--tag-index, 0) * 100ms);
}

/* Animation pour les images */
@keyframes imageLoad {
    from {
        opacity: 0;
        filter: blur(5px);
    }
    to {
        opacity: 1;
        filter: blur(0);
    }
}

.recipe-thumbnail {
    animation: imageLoad 0.5s ease-out;
}

/* Animation pour les toasts */
@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.toast {
    animation: toastSlideIn 0.3s ease-out;
}

.toast.removing {
    animation: toastSlideOut 0.3s ease-in forwards;
}

/* Animation pour les modals */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(4px);
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-overlay {
    animation: modalFadeIn 0.3s ease-out;
}

.modal-content {
    animation: modalSlideIn 0.3s ease-out;
}

/* Animation pour les éléments qui apparaissent */
.fade-in {
    animation: fadeInScale 0.5s ease-out;
}

/* Animation pour les statistiques */
@keyframes countUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.stat-number {
    animation: countUp 0.8s ease-out;
}

/* Réduire les animations pour les utilisateurs qui les préfèrent */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}/* 
===== ANIMATIONS POUR RECETTES OPTIMISÉES ===== */
@keyframes recipeSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.recipe-layout-optimized {
    animation: recipeSlideIn 0.6s ease-out;
}

.recipe-top-section {
    animation: recipeSlideIn 0.8s ease-out;
}

.recipe-sidebar {
    animation: recipeSlideIn 1s ease-out;
}

/* Animation pour le scroll automatique */
@keyframes highlightSection {
    0% {
        background-color: transparent;
    }
    50% {
        background-color: rgba(245, 147, 50, 0.1);
    }
    100% {
        background-color: transparent;
    }
}

.recipe-content-panel.highlight {
    animation: highlightSection 2s ease-out;
}