/* ============================================
   Animations
   ============================================ */

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

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

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

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

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

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

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

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

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    25% {
        transform: translate(30px, -30px) rotate(5deg);
    }
    50% {
        transform: translate(-20px, 20px) rotate(-5deg);
    }
    75% {
        transform: translate(20px, 10px) rotate(3deg);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 115, 230, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(0, 115, 230, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 115, 230, 0);
    }
}

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

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(0, 115, 230, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(0, 115, 230, 0.8);
    }
}

/* Animation Classes */
.animate-fade-in {
    animation: fadeIn var(--transition-base) forwards;
}

.animate-fade-out {
    animation: fadeOut var(--transition-base) forwards;
}

.animate-slide-up {
    animation: slideUp var(--transition-base) forwards;
}

.animate-slide-down {
    animation: slideDown var(--transition-base) forwards;
}

.animate-slide-in-right {
    animation: slideInRight var(--transition-base) forwards;
}

.animate-slide-in-left {
    animation: slideInLeft var(--transition-base) forwards;
}

.animate-scale-in {
    animation: scaleIn var(--transition-base) forwards;
}

.animate-scale-out {
    animation: scaleOut var(--transition-base) forwards;
}

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

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

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

/* Staggered animations for lists */
.stagger-animation > * {
    opacity: 0;
    animation: slideUp var(--transition-base) forwards;
}

.stagger-animation > *:nth-child(1) { animation-delay: 0ms; }
.stagger-animation > *:nth-child(2) { animation-delay: 50ms; }
.stagger-animation > *:nth-child(3) { animation-delay: 100ms; }
.stagger-animation > *:nth-child(4) { animation-delay: 150ms; }
.stagger-animation > *:nth-child(5) { animation-delay: 200ms; }
.stagger-animation > *:nth-child(6) { animation-delay: 250ms; }
.stagger-animation > *:nth-child(7) { animation-delay: 300ms; }
.stagger-animation > *:nth-child(8) { animation-delay: 350ms; }
.stagger-animation > *:nth-child(9) { animation-delay: 400ms; }
.stagger-animation > *:nth-child(10) { animation-delay: 450ms; }

/* Hover transitions */
.hover-lift {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

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

.hover-scale {
    transition: transform var(--transition-base);
}

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

.hover-glow {
    transition: box-shadow var(--transition-base);
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(0, 115, 230, 0.3);
}

/* Page transitions */
.page-enter {
    opacity: 0;
    transform: translateX(20px);
}

.page-enter-active {
    opacity: 1;
    transform: translateX(0);
    transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.page-exit {
    opacity: 1;
    transform: translateX(0);
}

.page-exit-active {
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity var(--transition-slow), transform var(--transition-slow);
}

/* Skeleton loading animation */
.skeleton {
    background: linear-gradient(
        90deg,
        rgba(0, 115, 230, 0.05) 25%,
        rgba(0, 115, 230, 0.1) 50%,
        rgba(0, 115, 230, 0.05) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

.skeleton-text:last-child {
    width: 70%;
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.skeleton-card {
    height: 80px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .gradient-orb {
        animation: none;
    }
}
