/*
 * ============================================
 * ANIMATIONS.CSS - ANIMATION LIBRARY
 * Smooth, performant micro-interactions
 * ============================================
 */

/* ============================================
   KEYFRAME ANIMATIONS
   ============================================ */

/* Fade Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scale Animations */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes scaleUp {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.05);
    }
}

/* Slide Animations */
@keyframes slideInUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
    }

    to {
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

/* Bounce Animation */
@keyframes bounce {

    0%,
    20%,
    53%,
    100% {
        animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
        transform: translateY(0);
    }

    40%,
    43% {
        animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
        transform: translateY(-15px);
    }

    70% {
        animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
        transform: translateY(-8px);
    }

    80% {
        transform: translateY(0);
    }

    90% {
        transform: translateY(-4px);
    }
}

/* Pulse Animation */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes pulseScale {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* Shake Animation */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

/* Spin Animation */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Float Animation */
@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Glow Animation */
@keyframes glow {

    0%,
    100% {
        box-shadow: 0 0 5px rgba(14, 165, 233, 0.3);
    }

    50% {
        box-shadow: 0 0 20px rgba(14, 165, 233, 0.6),
            0 0 30px rgba(14, 165, 233, 0.4);
    }
}

/* Shimmer Animation (Loading Effect) */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* Progress Bar Animation */
@keyframes progressBar {
    0% {
        width: 0%;
    }

    100% {
        width: 100%;
    }
}

/* Ripple Animation */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 0.5;
    }

    100% {
        transform: scale(4);
        opacity: 0;
    }
}

/* ============================================
   ANIMATION UTILITY CLASSES
   ============================================ */

/* Base Animation Properties */
.animate {
    animation-duration: 0.5s;
    animation-fill-mode: both;
}

.animate-fast {
    animation-duration: 0.3s;
}

.animate-slow {
    animation-duration: 0.8s;
}

.animate-slower {
    animation-duration: 1.2s;
}

.animate-delay-1 {
    animation-delay: 0.1s;
}

.animate-delay-2 {
    animation-delay: 0.2s;
}

.animate-delay-3 {
    animation-delay: 0.3s;
}

.animate-delay-4 {
    animation-delay: 0.4s;
}

.animate-delay-5 {
    animation-delay: 0.5s;
}

.animate-infinite {
    animation-iteration-count: infinite;
}

/* Specific Animations */
.animate-fadeIn {
    animation-name: fadeIn;
}

.animate-fadeInUp {
    animation-name: fadeInUp;
}

.animate-fadeInDown {
    animation-name: fadeInDown;
}

.animate-fadeInLeft {
    animation-name: fadeInLeft;
}

.animate-fadeInRight {
    animation-name: fadeInRight;
}

.animate-scaleIn {
    animation-name: scaleIn;
}

.animate-bounce {
    animation-name: bounce;
}

.animate-pulse {
    animation-name: pulse;
}

.animate-shake {
    animation-name: shake;
}

.animate-spin {
    animation-name: spin;
    animation-duration: 1s;
    animation-timing-function: linear;
}

.animate-float {
    animation-name: float;
    animation-duration: 3s;
}

.animate-glow {
    animation-name: glow;
    animation-duration: 2s;
}

/* ============================================
   HOVER TRANSITION UTILITIES
   ============================================ */

/* Lift on Hover */
.hover-lift {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

/* Scale on Hover */
.hover-scale {
    transition: transform var(--transition-base);
}

.hover-scale:hover {
    transform: scale(1.05);
}

/* Glow on Hover */
.hover-glow {
    transition: box-shadow var(--transition-base);
}

.hover-glow:hover {
    box-shadow: var(--shadow-glow);
}

/* Rotate on Hover */
.hover-rotate {
    transition: transform var(--transition-base);
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

/* Image Zoom on Hover (Parent Container) */
.hover-zoom-img {
    overflow: hidden;
}

.hover-zoom-img img {
    transition: transform 0.5s ease;
}

.hover-zoom-img:hover img {
    transform: scale(1.1);
}

/* Brightness on Hover */
.hover-bright {
    transition: filter var(--transition-base);
}

.hover-bright:hover {
    filter: brightness(1.1);
}

/* ============================================
   LOADING SKELETONS
   ============================================ */
.skeleton {
    background: linear-gradient(90deg,
            var(--gray-200) 25%,
            var(--gray-100) 50%,
            var(--gray-200) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

.skeleton-title {
    height: 1.5em;
    width: 60%;
    margin-bottom: 0.8em;
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
}

.skeleton-image {
    width: 100%;
    height: 200px;
}

.skeleton-card {
    height: 300px;
}

/* ============================================
   SCROLL ANIMATIONS (Intersection Observer)
   ============================================ */

/* Elements start hidden */
[data-animate] {
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-animate="fadeUp"] {
    transform: translateY(30px);
}

[data-animate="fadeDown"] {
    transform: translateY(-30px);
}

[data-animate="fadeLeft"] {
    transform: translateX(-30px);
}

[data-animate="fadeRight"] {
    transform: translateX(30px);
}

[data-animate="scaleIn"] {
    transform: scale(0.9);
}

/* When visible */
[data-animate].is-visible {
    opacity: 1;
    transform: translateY(0) translateX(0) scale(1);
}

/* ============================================
   REDUCED MOTION SUPPORT
   ============================================ */
@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;
    }
}

/* ============================================
   INTERSECTION OBSERVER SCRIPT (Inline)
   ============================================ */
/* 
Add this to your JS:

document.addEventListener('DOMContentLoaded', () => {
    const animatedElements = document.querySelectorAll('[data-animate]');
    
    const observer = new IntersectionObserver((entries) => {
        entries.forEach(entry => {
            if (entry.isIntersecting) {
                entry.target.classList.add('is-visible');
                observer.unobserve(entry.target);
            }
        });
    }, { threshold: 0.1, rootMargin: '0px 0px -50px 0px' });
    
    animatedElements.forEach(el => observer.observe(el));
});
*/