/* Scroll Animations CSS
 * CSS-first animations with accessibility support
 * Uses transforms and opacity for smooth performance
 */

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
    .animate-fade-in,
    .animate-slide-up,
    .animate-slide-down,
    .animate-slide-left,
    .animate-slide-right,
    .animate-scale-in,
    .animate-counter,
    .animate-stagger {
        animation: none !important;
        transition: none !important;
        transform: none !important;
        opacity: 1 !important;
    }
}

/* Base animation setup */
.animate-fade-in,
.animate-slide-up,
.animate-slide-down,
.animate-slide-left,
.animate-slide-right,
.animate-scale-in {
    opacity: 0;
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Stagger elements handled separately to prevent initial transition */
.animate-stagger {
    opacity: 0;
}

/* Remove redundant rules - handled by main stagger rules */

/* Fallback removed - using progressive enhancement instead */

/* Fade In Animation */
.animate-fade-in {
    opacity: 0;
}

.animate-fade-in.animate-visible {
    opacity: 1;
}

/* Slide Up Animation */
.animate-slide-up {
    opacity: 0;
    transform: translateY(30px);
}

.animate-slide-up.animate-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Slide Down Animation */
.animate-slide-down {
    opacity: 0;
    transform: translateY(-30px);
}

.animate-slide-down.animate-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Slide Left Animation */
.animate-slide-left {
    opacity: 0;
    transform: translateX(30px);
}

.animate-slide-left.animate-visible {
    opacity: 1;
    transform: translateX(0);
}

/* Slide Right Animation */
.animate-slide-right {
    opacity: 0;
    transform: translateX(-30px);
}

.animate-slide-right.animate-visible {
    opacity: 1;
    transform: translateX(0);
}

/* Scale In Animation */
.animate-scale-in {
    opacity: 0;
    transform: scale(0.95);
}

.animate-scale-in.animate-visible {
    opacity: 1;
    transform: scale(1);
}

/* Stagger Animation Support */
.animate-stagger {
    opacity: 0;
    transform: translateY(20px);
    /* No transition on initial state to prevent fade-out effect */
}

.animate-stagger.animate-visible {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Stagger delays */
.animate-stagger:nth-child(1) { transition-delay: 0.1s; }
.animate-stagger:nth-child(2) { transition-delay: 0.2s; }
.animate-stagger:nth-child(3) { transition-delay: 0.3s; }
.animate-stagger:nth-child(4) { transition-delay: 0.4s; }
.animate-stagger:nth-child(5) { transition-delay: 0.5s; }
.animate-stagger:nth-child(6) { transition-delay: 0.6s; }
.animate-stagger:nth-child(7) { transition-delay: 0.7s; }
.animate-stagger:nth-child(8) { transition-delay: 0.8s; }
.animate-stagger:nth-child(9) { transition-delay: 0.9s; }

/* Counter Animation */
.animate-counter {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease;
}

.animate-counter.animate-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Pulse Animation for CTAs */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.animate-pulse {
    animation: pulse 2s infinite;
}

.animate-pulse:hover {
    animation: none;
}

/* Floating Animation */
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

/* Bounce Animation */
@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translateY(0);
    }
    40%, 43% {
        transform: translateY(-10px);
    }
    70% {
        transform: translateY(-5px);
    }
    90% {
        transform: translateY(-2px);
    }
}

.animate-bounce {
    animation: bounce 2s infinite;
}

/* Lazy Loading Animation Support */
.lazy-loading {
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.lazy-loaded {
    opacity: 1;
}

.lazy-error {
    opacity: 0.3;
    background-color: #f8f9fa;
}

/* Background lazy loading */
.bg-loading {
    background-color: #f8f9fa;
    background-image: linear-gradient(90deg, #f8f9fa 0%, #e9ecef 50%, #f8f9fa 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.bg-loaded {
    animation: none;
    background-color: transparent;
}

/* Performance optimizations */
.animate-fade-in,
.animate-slide-up,
.animate-slide-down,
.animate-slide-left,
.animate-slide-right,
.animate-scale-in,
.animate-stagger {
    will-change: transform, opacity;
}

.animate-visible {
    will-change: auto;
}

/* Section-specific animations */
.solution-cards .animate-stagger {
    transform: translateY(30px) scale(0.95);
}

.solution-cards .animate-stagger.animate-visible {
    transform: translateY(0) scale(1);
}

.trust-indicators .animate-counter {
    transform: scale(0.8);
}

.trust-indicators .animate-counter.animate-visible {
    transform: scale(1);
}

/* FAQ Animation - Bootstrap Accordion Compatible (no transition on initial state) */
.faq-item.animate-stagger,
.accordion-item.animate-stagger {
    opacity: 0 !important;
    transform: translateY(15px);
    /* No transition to prevent fade-out effect */
}

.faq-item.animate-stagger.animate-visible,
.accordion-item.animate-stagger.animate-visible {
    opacity: 1 !important;
    transform: translateY(0);
    transition: all 0.4s ease;
}

/* Ensure accordion collapse animations work properly */
.faq-item .accordion-collapse,
.accordion-item .accordion-collapse {
    opacity: 1 !important;
    transform: none !important;
}

.faq-item .accordion-button,
.faq-item .accordion-body,
.accordion-item .accordion-button,
.accordion-item .accordion-body {
    opacity: 1 !important;
    transform: none !important;
}

/* Bootstrap accordion override for service-faqs (no initial transition) */
.service-faqs .accordion-item.animate-stagger {
    opacity: 0 !important;
    transform: translateY(15px);
    /* No transition to prevent fade-out effect */
}

.service-faqs .accordion-item.animate-stagger.animate-visible {
    opacity: 1 !important;
    transform: translateY(0);
    transition: all 0.4s ease;
}

.service-faqs .accordion-collapse,
.service-faqs .accordion-button,
.service-faqs .accordion-body {
    opacity: 1 !important;
    transform: none !important;
}

/* Hero Animation - removed, handled by progressive enhancement */

/* Card hover enhancements */
.solution-card,
.guidance-card,
.benefit-item {
    transition: all 0.3s ease;
}

.solution-card:hover,
.guidance-card:hover,
.benefit-item:hover {
    transform: translateY(-5px);
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .animate-slide-up,
    .animate-slide-down,
    .animate-slide-left,
    .animate-slide-right,
    .animate-stagger {
        transform: translateY(15px);
    }
    
    .animate-slide-up.animate-visible,
    .animate-slide-down.animate-visible,
    .animate-slide-left.animate-visible,
    .animate-slide-right.animate-visible,
    .animate-stagger.animate-visible {
        transform: translateY(0);
    }
    
    /* Reduce animation duration on mobile */
    .animate-fade-in,
    .animate-slide-up,
    .animate-slide-down,
    .animate-slide-left,
    .animate-slide-right,
    .animate-scale-in,
    .animate-stagger {
        transition-duration: 0.4s;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .animate-fade-in,
    .animate-slide-up,
    .animate-slide-down,
    .animate-slide-left,
    .animate-slide-right,
    .animate-scale-in,
    .animate-stagger {
        opacity: 1;
        transform: none;
    }
}