/* ============================================================================
   ANIMATIONS AND TRANSITIONS
   ============================================================================ */

/* Base animation classes */
.animate-on-scroll {
    opacity: 0;
    transition: all 1s var(--ease-out);
}

.animate-on-scroll.fade-up {
    transform: translateY(80px);
}

.animate-on-scroll.slide-left {
    transform: translateX(-80px);
}

.animate-on-scroll.slide-right {
    transform: translateX(80px);
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0) translateX(0);
}

/* Keyframe animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(80px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-80px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(80px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
        transform: translate3d(0, 0, 0);
    }
    40%, 43% {
        animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
        transform: translate3d(0, -30px, 0);
    }
    70% {
        animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
        transform: translate3d(0, -15px, 0);
    }
    90% {
        transform: translate3d(0, -4px, 0);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes glow {
    from {
        box-shadow: 0 0 20px rgba(234, 179, 8, 0.2);
    }
    to {
        box-shadow: 0 0 30px rgba(234, 179, 8, 0.4);
    }
}

@keyframes shimmer {
    0% {
        background-position: -468px 0;
    }
    100% {
        background-position: 468px 0;
    }
}

/* Background grid animation */
@keyframes grid-flow {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

/* Ripple effect for button clicks */
@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Card hover animations */
.expand-card {
    transition: all 0.4s var(--ease-spring);
}

.expand-card:hover {
    animation: float 2s ease-in-out infinite;
}

/* Icon animations */
.card-icon {
    transition: all 0.3s var(--ease-spring);
}

.expand-card:hover .card-icon {
    animation: bounce 0.6s ease;
}

/* Loading animations */
.loading-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.loading-spin {
    animation: spin 1s linear infinite;
}

.loading-bounce {
    animation: bounce 1s infinite;
}

/* Glow effects */
.glow {
    animation: glow 2s ease-in-out infinite alternate;
}

.glow-on-hover:hover {
    animation: glow 0.3s ease-in-out forwards;
}

/* Shimmer effect for loading states */
.shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 400% 100%;
    animation: shimmer 1.5s infinite;
}

/* Stagger animations for lists */
.stagger-animation > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-animation > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-animation > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-animation > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-animation > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-animation > *:nth-child(6) { animation-delay: 0.6s; }

/* Page transition animations */
.page-transition {
    transition: all 0.6s var(--ease-out);
}

.page-enter {
    opacity: 0;
    transform: translateX(100%);
}

.page-enter-active {
    opacity: 1;
    transform: translateX(0);
}

.page-exit {
    opacity: 1;
    transform: translateX(0);
}

.page-exit-active {
    opacity: 0;
    transform: translateX(-100%);
}

/* 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;
    }
    
    .bg-grid {
        animation: none;
    }
    
    .animate-on-scroll {
        opacity: 1;
        transform: none;
    }
}

/* Performance optimizations */
.hardware-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000;
}

.will-animate {
    will-change: transform, opacity;
}

/* Hover effects for better interactivity */
.interactive-element {
    transition: all 0.3s var(--ease-spring);
}

.interactive-element:hover {
    transform: translateY(-2px);
}

.interactive-element:active {
    transform: translateY(0);
}

/* Focus animations for accessibility */
.focus-visible {
    outline: 2px solid var(--gold-400);
    outline-offset: 2px;
    transition: outline-offset 0.2s ease;
}

.focus-visible:focus {
    outline-offset: 4px;
}

/* Micro-interactions */
.micro-bounce:hover {
    animation: bounce 0.6s ease;
}

.micro-pulse:hover {
    animation: pulse 1s ease;
}

.micro-glow:hover {
    animation: glow 0.8s ease-in-out;
}

/* Loading skeletons */
.skeleton {
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0.1) 25%, 
        rgba(255, 255, 255, 0.2) 50%, 
        rgba(255, 255, 255, 0.1) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-text:last-child {
    width: 60%;
}

/* Card expansion animations */
.card-expand-enter {
    max-height: 0;
    opacity: 0;
}

.card-expand-enter-active {
    max-height: 2000px;
    opacity: 1;
    transition: all 0.5s var(--ease-out);
}

.card-expand-exit {
    max-height: 2000px;
    opacity: 1;
}

.card-expand-exit-active {
    max-height: 0;
    opacity: 0;
    transition: all 0.3s var(--ease-out);
}