/**
 * SEO CMS - Animations
 * Animações e transições reutilizáveis
 * Version: 4.0
 */

/* ============================================
   KEYFRAME ANIMATIONS
   ============================================ */

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

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeSlideDown {
    from {
        opacity: 0;
        transform: translateY(-16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeSlideLeft {
    from {
        opacity: 0;
        transform: translateX(16px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeSlideRight {
    from {
        opacity: 0;
        transform: translateX(-16px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes scaleOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Slide */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutLeft {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(-100%);
        opacity: 0;
    }
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

@keyframes spinReverse {
    from { transform: rotate(360deg); }
    to { transform: rotate(0deg); }
}

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

@keyframes pulseScale {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 0 0 var(--color-accent-glow);
    }
    50% {
        box-shadow: 0 0 20px 5px var(--color-accent-glow);
    }
}

@keyframes pulseRing {
    0% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(245, 158, 11, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
    }
}

/* Bounce */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
        animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
    }
    50% {
        transform: translateY(-25%);
        animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
    }
}

@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);
    }
}

/* Shake */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

@keyframes shakeX {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
}

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

/* Glitch */
@keyframes glitch {
    0%, 90%, 100% { transform: translateX(0); }
    92% { transform: translateX(-3px); }
    94% { transform: translateX(3px); }
    96% { transform: translateX(-2px); }
    98% { transform: translateX(2px); }
}

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

/* Ping */
@keyframes ping {
    75%, 100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* ============================================
   ANIMATION CLASSES
   ============================================ */

/* Apply animations */
.animate-none { animation: none; }
.animate-spin { animation: spin 1s linear infinite; }
.animate-ping { animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite; }
.animate-pulse { animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.animate-bounce { animation: bounce 1s infinite; }

.animate-fade-in { 
    opacity: 1; /* fallback */
    animation: fadeIn var(--duration-normal, 200ms) var(--ease-out, ease-out) forwards; 
}
.animate-fade-out { animation: fadeOut var(--duration-normal) var(--ease-out) forwards; }
.animate-fade-up { 
    opacity: 1; /* fallback */
    animation: fadeSlideUp var(--duration-slow, 300ms) var(--ease-out-expo, ease-out) forwards; 
}
.animate-fade-down { animation: fadeSlideDown var(--duration-slow) var(--ease-out-expo) forwards; }
.animate-fade-left { animation: fadeSlideLeft var(--duration-slow) var(--ease-out-expo) forwards; }
.animate-fade-right { animation: fadeSlideRight var(--duration-slow) var(--ease-out-expo) forwards; }

.animate-scale-in { animation: scaleIn var(--duration-normal) var(--ease-out-expo) forwards; }
.animate-scale-out { animation: scaleOut var(--duration-normal) var(--ease-out) forwards; }
.animate-pop-in { animation: popIn var(--duration-slow) var(--ease-spring) forwards; }

.animate-slide-in-right { animation: slideInRight var(--duration-slow) var(--ease-out-expo) forwards; }
.animate-slide-out-right { animation: slideOutRight var(--duration-slow) var(--ease-out) forwards; }
.animate-slide-in-left { animation: slideInLeft var(--duration-slow) var(--ease-out-expo) forwards; }
.animate-slide-out-left { animation: slideOutLeft var(--duration-slow) var(--ease-out) forwards; }
.animate-slide-in-up { animation: slideInUp var(--duration-slow) var(--ease-out-expo) forwards; }
.animate-slide-in-down { animation: slideInDown var(--duration-slow) var(--ease-out-expo) forwards; }

.animate-shake { animation: shake 0.5s ease-in-out; }
.animate-shimmer {
    background: linear-gradient(
        90deg,
        var(--color-bg-hover) 25%,
        var(--color-bg-active) 50%,
        var(--color-bg-hover) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

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

/* Entrance animations with staggered delays */
.animate-in {
    opacity: 0;
    animation: fadeSlideUp 0.5s var(--ease-out-expo) forwards;
}

.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.3s; }
.stagger-7 { animation-delay: 0.35s; }
.stagger-8 { animation-delay: 0.4s; }
.stagger-9 { animation-delay: 0.45s; }
.stagger-10 { animation-delay: 0.5s; }

/* Animation duration modifiers */
.animate-duration-fast { animation-duration: var(--duration-fast) !important; }
.animate-duration-normal { animation-duration: var(--duration-normal) !important; }
.animate-duration-slow { animation-duration: var(--duration-slow) !important; }
.animate-duration-slower { animation-duration: var(--duration-slower) !important; }

/* Animation delay modifiers */
.animate-delay-100 { animation-delay: 100ms; }
.animate-delay-200 { animation-delay: 200ms; }
.animate-delay-300 { animation-delay: 300ms; }
.animate-delay-500 { animation-delay: 500ms; }
.animate-delay-1000 { animation-delay: 1000ms; }

/* Animation iteration */
.animate-once { animation-iteration-count: 1; }
.animate-infinite { animation-iteration-count: infinite; }

/* ============================================
   HOVER TRANSITIONS
   ============================================ */
.hover-lift {
    transition: transform var(--duration-normal) var(--ease-out-expo);
}
.hover-lift:hover {
    transform: translateY(-4px);
}

.hover-scale {
    transition: transform var(--duration-normal) var(--ease-out-expo);
}
.hover-scale:hover {
    transform: scale(1.05);
}

.hover-glow {
    transition: box-shadow var(--duration-normal) var(--ease-out);
}
.hover-glow:hover {
    box-shadow: var(--shadow-glow-md);
}

.hover-brighten {
    transition: filter var(--duration-normal) var(--ease-out);
}
.hover-brighten:hover {
    filter: brightness(1.1);
}

/* ============================================
   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-in,
    .animate-fade-in,
    .animate-fade-up,
    .animate-scale-in,
    .animate-slide-in-right,
    .animate-slide-in-left {
        opacity: 1;
        transform: none;
        animation: none;
    }
}
