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

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

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

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

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    60% {
        transform: translateY(-10px);
    }
}

/* Apply animations */
.logo {
    animation: fadeIn 1s ease-out;
}

.hero-content h1 {
    animation: slideInFromLeft 1s ease-out;
}

.hero-content p {
    animation: slideInFromLeft 1s ease-out 0.2s;
    animation-fill-mode: both;
}

.hero-buttons {
    animation: slideInFromLeft 1s ease-out 0.4s;
    animation-fill-mode: both;
}

.hero-image {
    animation: slideInFromRight 1s ease-out 0.2s;
    animation-fill-mode: both;
}

.feature-card, .service-item, .testimonial-item {
    animation: fadeIn 0.8s ease-out;
}

.feature-icon {
    animation: pulse 2s infinite;
}

.btn-cta {
    animation: pulse 2s infinite;
}

/* Hover effects */
.service-item img {
    transition: transform 0.5s ease;
}

.service-item:hover img {
    transform: scale(1.05);
}

.btn {
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.btn:hover::after {
    transform: translateX(0);
}

/* Scroll animations */
.feature-cards > div,
.services-grid > div,
.testimonial-slider > div,
.benefits-grid > div,
.levels-container > div {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.feature-cards > div.visible,
.services-grid > div.visible,
.testimonial-slider > div.visible,
.benefits-grid > div.visible,
.levels-container > div.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Animation for FAQ accordions */
.faq-question i {
    transition: transform 0.3s ease;
}

.faq-item.active .faq-question i {
    transform: rotate(45deg);
}

/* Loading spinner for buttons when processing */
.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Mobile menu animations */
@keyframes slideDown {
    from {
        max-height: 0;
        opacity: 0;
    }
    to {
        max-height: 300px;
        opacity: 1;
    }
}

.mobile-nav-active nav ul {
    display: flex;
    flex-direction: column;
    width: 100%;
    animation: slideDown 0.3s ease-out forwards;
}

/* JavaScript to make these animations work */
document.addEventListener('DOMContentLoaded', function() {
    // FAQ accordions
    const faqItems = document.querySelectorAll('.faq-item');
    
    faqItems.forEach(item => {
        const question = item.querySelector('.faq-question');
        
        question.addEventListener('click', () => {
            item.classList.toggle('active');
        });
    });
    
    // Scroll animations
    const animatedElements = document.querySelectorAll('.feature-cards > div, .services-grid > div, .testimonial-slider > div, .benefits-grid > div, .levels-container > div');
    
    function checkScroll() {
        animatedElements.forEach(el => {
            const elementTop = el.getBoundingClientRect().top;
            const windowHeight = window.innerHeight;
            
            if (elementTop < windowHeight * 0.9) {
                el.classList.add('visible');
            }
        });
    }
    
    // Run on load
    checkScroll();
    
    // Run on scroll
    window.addEventListener('scroll', checkScroll);
    
    // Mobile menu
    const mobileMenuIcon = document.querySelector('.mobile-menu-icon');
    const header = document.querySelector('header');
    
    if (mobileMenuIcon) {
        mobileMenuIcon.addEventListener('click', () => {
            header.classList.toggle('mobile-nav-active');
        });
    }
});