/* ============================================
   CSS ANIMATIONS & MICRO-INTERACTIONS
   Pure CSS animations - no dependencies
   ============================================ */

/* ===========================================
   KEYFRAME DEFINITIONS
   =========================================== */

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

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

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

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

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

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

/* Pulse animations */
@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 5px currentColor;
    }
    50% {
        box-shadow: 0 0 15px currentColor, 0 0 25px currentColor;
    }
}

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

/* Bounce */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

@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(-2px); }
    20%, 40%, 60%, 80% { transform: translateX(2px); }
}

/* Typing cursor */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

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

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

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

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

/* Ripple effect */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

/* Dot loading */
@keyframes dotPulse {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Wave effect for loading dots */
@keyframes wave {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}


/* ===========================================
   UTILITY CLASSES
   =========================================== */

/* Animation delays */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }

/* Animation durations */
.duration-fast { animation-duration: 0.15s; }
.duration-normal { animation-duration: 0.3s; }
.duration-slow { animation-duration: 0.5s; }

/* Apply animations */
.animate-fadeIn { animation: fadeIn 0.3s ease-out; }
.animate-fadeInUp { animation: fadeInUp 0.4s ease-out; }
.animate-fadeInDown { animation: fadeInDown 0.4s ease-out; }
.animate-fadeInScale { animation: fadeInScale 0.3s ease-out; }
.animate-slideInLeft { animation: slideInLeft 0.4s ease-out; }
.animate-slideInRight { animation: slideInRight 0.4s ease-out; }
.animate-bounce { animation: bounce 0.6s ease-in-out; }
.animate-bounceIn { animation: bounceIn 0.5s ease-out; }
.animate-pulse { animation: pulse 1.5s ease-in-out infinite; }
.animate-float { animation: float 3s ease-in-out infinite; }
.animate-spin { animation: spin 1s linear infinite; }


/* ===========================================
   ENHANCED LOADING STATES
   =========================================== */

/* Skeleton loading shimmer */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-tertiary) 25%,
        var(--bg-secondary) 50%,
        var(--bg-tertiary) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

/* Loading dots */
.loading-dots {
    display: inline-flex;
    gap: 4px;
}

.loading-dots span {
    width: 6px;
    height: 6px;
    background: var(--accent-blue);
    border-radius: 50%;
    animation: wave 1.2s ease-in-out infinite;
}

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

/* Typing indicator with better animation */
.typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.typing-dots span {
    width: 5px;
    height: 5px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: dotPulse 1.4s ease-in-out infinite;
}

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


/* ===========================================
   BUTTON INTERACTIONS
   =========================================== */

/* Ripple effect container */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
}

.btn-ripple:active::after {
    animation: ripple 0.4s ease-out;
}

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

.btn-lift:hover {
    transform: translateY(-2px);
}

.btn-lift:active {
    transform: translateY(0);
}


/* ===========================================
   CARD INTERACTIONS
   =========================================== */

/* Card hover effect */
.card-hover {
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Card with glow on hover */
.card-glow:hover {
    box-shadow: var(--shadow-lg), 0 0 20px var(--accent-blue-bg);
    border-color: var(--accent-blue);
}


/* ===========================================
   INPUT FOCUS EFFECTS
   =========================================== */

/* Focus ring animation */
.focus-ring {
    position: relative;
}

.focus-ring::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: inherit;
    border: 2px solid transparent;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    pointer-events: none;
}

.focus-ring:focus-within::before {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--accent-blue-bg);
}


/* ===========================================
   STAGGER ANIMATIONS (for lists)
   =========================================== */

/* Apply to container, children get staggered delay */
.stagger-children > * {
    opacity: 0;
    animation: fadeInUp 0.4s ease-out forwards;
}

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


/* ===========================================
   TRANSITION UTILITIES
   =========================================== */

.transition-all {
    transition: all var(--transition-normal);
}

.transition-fast {
    transition: all var(--transition-fast);
}

.transition-colors {
    transition: color var(--transition-fast),
                background-color var(--transition-fast),
                border-color var(--transition-fast);
}

.transition-transform {
    transition: transform var(--transition-fast);
}

.transition-opacity {
    transition: opacity var(--transition-fast);
}


/* ===========================================
   HOVER REVEAL
   =========================================== */

/* Container that reveals children on hover */
.hover-reveal {
    position: relative;
}

.hover-reveal .reveal-content {
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.hover-reveal:hover .reveal-content {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}


/* ===========================================
   SCROLL ANIMATIONS
   =========================================== */

/* Elements that animate when scrolled into view */
.scroll-animate {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-animate.visible {
    opacity: 1;
    transform: translateY(0);
}


/* ===========================================
   ICON ANIMATIONS
   =========================================== */

/* Rotating refresh icon */
.icon-spin {
    animation: spin 1s linear infinite;
}

/* Bounce on hover */
.icon-bounce:hover {
    animation: bounce 0.4s ease;
}

/* Pulse on hover */
.icon-pulse:hover {
    animation: pulseScale 0.4s ease;
}
