/* ============================================================
   Animations & Keyframes
   ============================================================ */

/* ---- Core Keyframes ---- */
@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes slide-in-right {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slide-out-right {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(20px); opacity: 0; }
}

@keyframes slide-in-left {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slide-in-up {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes slide-in-down {
    from { transform: translateY(-10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes pulse-glow {
    0%, 100% { 
        opacity: 1;
        box-shadow: 0 0 8px currentColor;
    }
    50% { 
        opacity: 0.7;
        box-shadow: 0 0 20px currentColor;
    }
}

@keyframes badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes skeleton-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes orbit {
    from { transform: rotate(0deg) translateX(8px) rotate(0deg); }
    to { transform: rotate(360deg) translateX(8px) rotate(-360deg); }
}

@keyframes progress-fill {
    from { width: 0%; }
    to { width: var(--target-width, 100%); }
}

@keyframes bounce-in {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes ripple {
    0% { transform: scale(0.8); opacity: 1; }
    100% { transform: scale(2.5); opacity: 0; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

@keyframes dash-flow {
    to { stroke-dashoffset: -20; }
}

@keyframes counter-up {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---- Utility Animation Classes ---- */
.animate-fade-in {
    animation: fade-in 0.3s ease forwards;
}
.animate-slide-in-right {
    animation: slide-in-right 0.3s ease forwards;
}
.animate-slide-in-left {
    animation: slide-in-left 0.3s ease forwards;
}
.animate-slide-in-up {
    animation: slide-in-up 0.3s ease forwards;
}
.animate-slide-in-down {
    animation: slide-in-down 0.3s ease forwards;
}
.animate-bounce-in {
    animation: bounce-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.animate-spin {
    animation: spin 1s linear infinite;
}
.animate-pulse {
    animation: pulse-glow 2s ease-in-out infinite;
}
.animate-float {
    animation: float 3s ease-in-out infinite;
}

/* ---- Staggered Entry ---- */
.stagger-enter > * {
    opacity: 0;
    animation: slide-in-up 0.3s ease forwards;
}
.stagger-enter > *:nth-child(1) { animation-delay: 0ms; }
.stagger-enter > *:nth-child(2) { animation-delay: 50ms; }
.stagger-enter > *:nth-child(3) { animation-delay: 100ms; }
.stagger-enter > *:nth-child(4) { animation-delay: 150ms; }
.stagger-enter > *:nth-child(5) { animation-delay: 200ms; }
.stagger-enter > *:nth-child(6) { animation-delay: 250ms; }
.stagger-enter > *:nth-child(7) { animation-delay: 300ms; }
.stagger-enter > *:nth-child(8) { animation-delay: 350ms; }

/* ---- Route Line Animation (Ant Path) ---- */
.route-line-animated {
    animation: dash-flow 1s linear infinite;
}

/* ---- View Transition ---- */
.view-enter {
    animation: fade-in 0.2s ease, slide-in-up 0.3s ease;
}
.view-exit {
    animation: fade-out 0.15s ease forwards;
}

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .skeleton {
        animation: none;
        background: var(--color-bg-tertiary);
    }
}
