/* Keyframe Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.6;
    }
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
    100% {
        transform: translateY(0px);
    }
}

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

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(37, 99, 235, 0.2);
    }
    50% {
        box-shadow: 0 0 20px rgba(37, 99, 235, 0.4);
    }
}

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

/* Animation Classes */
.slide-in-left {
    animation: slideInLeft 0.8s ease-out forwards;
    opacity: 0;
}

.slide-in-right {
    animation: slideInRight 0.8s ease-out forwards;
    opacity: 0;
}

/* Intersection Observer Animation Classes */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease-out;
}

.animate-on-scroll.in-view {
    opacity: 1;
    transform: translateY(0);
}

.animate-on-scroll.slide-left {
    transform: translateX(-50px);
}

.animate-on-scroll.slide-left.in-view {
    transform: translateX(0);
}

.animate-on-scroll.slide-right {
    transform: translateX(50px);
}

.animate-on-scroll.slide-right.in-view {
    transform: translateX(0);
}

.animate-on-scroll.scale {
    transform: scale(0.8);
}

.animate-on-scroll.scale.in-view {
    transform: scale(1);
}

/* Staggered animations for groups */
.stagger-children > * {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease-out;
}

.stagger-children.in-view > *:nth-child(1) { transition-delay: 0.1s; }
.stagger-children.in-view > *:nth-child(2) { transition-delay: 0.2s; }
.stagger-children.in-view > *:nth-child(3) { transition-delay: 0.3s; }
.stagger-children.in-view > *:nth-child(4) { transition-delay: 0.4s; }
.stagger-children.in-view > *:nth-child(5) { transition-delay: 0.5s; }

.stagger-children.in-view > * {
    opacity: 1;
    transform: translateY(0);
}

/* Hover animations */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.3);
}

/* Loading animations */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

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

/* Chart animations */
.chart-animate {
    animation: fadeIn 1s ease-out;
}

.chart-line {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: drawLine 2s ease-out forwards;
}

@keyframes drawLine {
    to {
        stroke-dashoffset: 0;
    }
}

.chart-bar {
    transform: scaleY(0);
    transform-origin: bottom;
    animation: growBar 1s ease-out forwards;
}

@keyframes growBar {
    to {
        transform: scaleY(1);
    }
}

/* Scroll-triggered animations */
.parallax {
    transform: translateY(0);
    transition: transform 0.1s linear;
}

/* Mobile animation adjustments */
@media (max-width: 768px) {
    .slide-in-left,
    .slide-in-right,
    .animate-on-scroll {
        animation-duration: 0.6s;
    }
    
    .hover-lift:hover {
        transform: translateY(-3px);
    }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .data-point {
        animation: none;
    }
    
    .hero-background {
        animation: none;
    }
    
    .hover-lift:hover,
    .hover-glow:hover {
        transform: none;
        box-shadow: none;
    }
    
    .parallax {
        transform: none !important;
    }
}

/* High performance animations */
.gpu-accelerated {
    will-change: transform, opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Focus animations for accessibility */
.focus-ring {
    transition: box-shadow 0.2s ease;
}

.focus-ring:focus {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3);
    outline: none;
}

/* Page transition animations */
.page-enter {
    opacity: 0;
    transform: translateY(20px);
}

.page-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.3s ease;
}

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

.page-exit-active {
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
}

.animate-in.fadeIn {
    opacity: 1;
    transform: translateY(0);
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}

.typing-cursor {
    display: inline;
    font-weight: bold;
    animation: blink 1s infinite;
}
