/* Global Animation Utilities */

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

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

/* Slide animations */
@keyframes slideInUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

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

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

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

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

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

@keyframes bounceSubtle {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-4px);
    }
}

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

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

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

@keyframes pulseSubtle {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

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

/* Shimmer effect */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

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

/* Wiggle animation */
@keyframes wiggle {
    0%,
    100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-5deg);
    }
    75% {
        transform: rotate(5deg);
    }
}

/* Glow effect */
@keyframes glow {
    0%,
    100% {
        box-shadow: 0 0 5px rgba(34, 197, 94, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(34, 197, 94, 0.8);
    }
}

/* Utility classes */
.animate-fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

.animate-fade-out {
    animation: fadeOut 0.3s ease-in-out;
}

.animate-slide-in-up {
    animation: slideInUp 0.3s ease-out;
}

.animate-slide-in-down {
    animation: slideInDown 0.3s ease-out;
}

.animate-slide-in-left {
    animation: slideInLeft 0.3s ease-out;
}

.animate-slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

.animate-scale-in {
    animation: scaleIn 0.2s ease-out;
}

.animate-scale-out {
    animation: scaleOut 0.2s ease-out;
}

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

.animate-bounce-subtle {
    animation: bounceSubtle 0.5s ease-in-out;
}

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

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

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

.animate-shimmer {
    animation: shimmer 2s linear infinite;
}

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

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

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

.animate-rubber-band {
    animation: rubberBand 0.8s ease;
}

.animate-jello {
    animation: jello 0.9s ease;
}

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

.animate-swing {
    animation: swing 1s ease;
}

.animate-flip {
    animation: flip 1s ease;
}

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

/* Hover utilities */
.hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.hover-scale {
    transition: transform 0.2s ease;
}

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

.hover-scale-sm {
    transition: transform 0.2s ease;
}

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

.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.5);
}

/* Stagger animations for lists */
.stagger-fade-in > * {
    animation: fadeIn 0.4s ease-in-out;
    animation-fill-mode: backwards;
}

.stagger-fade-in > *:nth-child(1) {
    animation-delay: 0.05s;
}
.stagger-fade-in > *:nth-child(2) {
    animation-delay: 0.1s;
}
.stagger-fade-in > *:nth-child(3) {
    animation-delay: 0.15s;
}
.stagger-fade-in > *:nth-child(4) {
    animation-delay: 0.2s;
}
.stagger-fade-in > *:nth-child(5) {
    animation-delay: 0.25s;
}
.stagger-fade-in > *:nth-child(6) {
    animation-delay: 0.3s;
}
.stagger-fade-in > *:nth-child(7) {
    animation-delay: 0.35s;
}
.stagger-fade-in > *:nth-child(8) {
    animation-delay: 0.4s;
}

/* Smooth transitions */
.transition-smooth {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.transition-fast {
    transition: all 0.15s ease;
}

.transition-slow {
    transition: all 0.5s ease;
}

.transition-bounce {
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Button animations */
.btn-animated {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-animated:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.btn-animated:active {
    transform: scale(0.97);
}

/* Card animations */
.card-interactive {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-interactive:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

/* Icon animations */
.icon-bounce:hover {
    animation: bounceSubtle 0.5s ease-in-out;
}

.icon-spin:hover {
    animation: rotate 1s linear infinite;
}

.icon-wiggle:hover {
    animation: wiggle 0.5s ease-in-out;
}

/* Loading skeleton shimmer */
.skeleton {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.05) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

/* Loading dots animation */
@keyframes loadingDots {
    0%,
    20% {
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

.loading-dots span {
    animation: loadingDots 1.4s infinite;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

/* Spinner animation */
@keyframes spinner {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.spinner {
    animation: spinner 1s linear infinite;
}

/* Progress bar animation */
@keyframes progress {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.progress-indeterminate {
    animation: progress 1.5s ease-in-out infinite;
}

/* Gradient text animation */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.gradient-text {
    background: linear-gradient(
        90deg,
        #22c55e,
        #10b981,
        #14b8a6,
        #06b6d4,
        #0ea5e9,
        #3b82f6,
        #6366f1,
        #8b5cf6,
        #a855f7,
        #d946ef,
        #ec4899,
        #f43f5e,
        #ef4444,
        #f97316,
        #f59e0b,
        #eab308,
        #84cc16,
        #22c55e
    );
    background-size: 400% 400%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 10s ease infinite;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
