/* Advanced Animations for Avasellink Landing Page */

/* Scroll-triggered animations */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

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

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

/* Initial states for animated elements */
.problem-card,
.service-card,
.advantage-card,
.result-item,
.stat-item,
.contact-method {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Animated state */
.animate-in .problem-card,
.animate-in .service-card,
.animate-in .advantage-card,
.animate-in .result-item,
.animate-in .stat-item,
.animate-in .contact-method,
section.animate-in .problem-card,
section.animate-in .service-card,
section.animate-in .advantage-card,
section.animate-in .stat-item {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered animations */
.problems-grid .problem-card:nth-child(1) { transition-delay: 0.1s; }
.problems-grid .problem-card:nth-child(2) { transition-delay: 0.2s; }
.problems-grid .problem-card:nth-child(3) { transition-delay: 0.3s; }
.problems-grid .problem-card:nth-child(4) { transition-delay: 0.4s; }
.problems-grid .problem-card:nth-child(5) { transition-delay: 0.5s; }

.services-grid .service-card:nth-child(1) { transition-delay: 0.1s; }
.services-grid .service-card:nth-child(2) { transition-delay: 0.3s; }
.services-grid .service-card:nth-child(3) { transition-delay: 0.5s; }

.advantages-grid .advantage-card:nth-child(1) { transition-delay: 0.1s; }
.advantages-grid .advantage-card:nth-child(2) { transition-delay: 0.2s; }
.advantages-grid .advantage-card:nth-child(3) { transition-delay: 0.3s; }
.advantages-grid .advantage-card:nth-child(4) { transition-delay: 0.4s; }
.advantages-grid .advantage-card:nth-child(5) { transition-delay: 0.5s; }

/* ROI Calculator animation */
.calculator-results.updated {
    animation: pulseGlow 1s ease-in-out;
}

@keyframes pulseGlow {
    0% { box-shadow: 0 0 0 0 rgba(0, 102, 255, 0.4); }
    50% { box-shadow: 0 0 20px 10px rgba(0, 102, 255, 0.2); }
    100% { box-shadow: 0 0 0 0 rgba(0, 102, 255, 0); }
}



/* Button hover animations */
.cta-primary,
.cta-secondary,
.calculate-btn,
.submit-btn {
    position: relative;
    overflow: hidden;
}

.cta-primary::before,
.calculate-btn::before,
.submit-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transition: width 0.6s, height 0.6s, top 0.6s, left 0.6s;
    transform: translate(-50%, -50%);
}

.cta-primary:hover::before,
.calculate-btn:hover::before,
.submit-btn:hover::before {
    width: 300px;
    height: 300px;
    top: 50%;
    left: 50%;
}

/* Loading animations */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* Hero globe enhanced animations */
.ai-globe::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(
        from 0deg,
        transparent,
        rgba(0, 102, 255, 0.1),
        transparent,
        rgba(0, 212, 255, 0.1),
        transparent
    );
    animation: rotate 20s linear infinite;
    pointer-events: none;
}

.ai-globe::after {
    content: '';
    position: absolute;
    inset: 20px;
    border-radius: 50%;
    background: radial-gradient(
        circle at 30% 30%,
        rgba(0, 102, 255, 0.2),
        transparent 70%
    );
    animation: float 4s ease-in-out infinite alternate;
}

/* Hero stats animations */
.stat-item {
    animation: statFloat 4s ease-in-out infinite;
}

.stat-item:nth-child(1) { animation-delay: 0s; }
.stat-item:nth-child(2) { animation-delay: 1s; }
.stat-item:nth-child(3) { animation-delay: 2s; }

@keyframes statFloat {
    0%, 100% { 
        transform: translateY(0px);
    }
    50% { 
        transform: translateY(-3px);
    }
}

/* Card hover enhancements */
.problem-card:hover,
.service-card:hover,
.advantage-card:hover {
    transform: translateY(-10px) scale(1.02);
}

.stat-item:hover {
    transform: translateY(-5px) scale(1.05);
}

.service-card:hover .service-icon {
    transform: rotate(5deg) scale(1.05);
}

.advantage-card:hover .advantage-number {
    animation: bounceNumber 0.6s ease-in-out;
}

@keyframes bounceNumber {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Section title animations */
.section-title {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

/* Progressive enhancement animations */
@media (prefers-reduced-motion: no-preference) {
    .hero-title {
        animation: typeWriter 2s steps(40, end);
        overflow: hidden;
        white-space: nowrap;
        border-right: 2px solid var(--primary-color);
    }
    
    @keyframes typeWriter {
        from { width: 0; }
        to { width: 100%; }
    }
}

/* Background particles animation */
.hero::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20px 30px, rgba(255, 255, 255, 0.1), transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(0, 102, 255, 0.2), transparent),
        radial-gradient(1px 1px at 90px 40px, rgba(0, 212, 255, 0.1), transparent),
        radial-gradient(1px 1px at 130px 80px, rgba(255, 107, 53, 0.1), transparent);
    background-repeat: repeat;
    background-size: 200px 100px;
    animation: particleFloat 20s linear infinite;
    pointer-events: none;
    opacity: 0.3;
}

@keyframes particleFloat {
    0% { transform: translateY(0px) translateX(0px); }
    33% { transform: translateY(-30px) translateX(10px); }
    66% { transform: translateY(-20px) translateX(-10px); }
    100% { transform: translateY(0px) translateX(0px); }
}

/* Mobile specific animations */
@media (max-width: 768px) {
    .ai-globe {
        animation: mobileFloat 6s ease-in-out infinite;
    }
    
    @keyframes mobileFloat {
        0%, 100% { transform: translateY(0px) rotate(0deg); }
        50% { transform: translateY(-15px) rotate(180deg); }
    }
    
    .hero-title {
        animation: none; /* Disable typewriter on mobile */
        white-space: normal;
        border-right: none;
    }
}

/* Performance optimizations */
.problem-card,
.service-card,
.advantage-card {
    will-change: transform, opacity;
}

.ai-globe,
.satellite,
.orbit {
    will-change: transform;
}

/* Accessibility - respect user preferences */
@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;
    }
    
    .ai-globe::before,
    .ai-globe::after,
    .orbit,
    .satellite {
        animation: none !important;
    }
}