/* ===============================
   MOBILE ANIMATIONS CSS
   =============================== */

/* Animation keyframes */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
        transform: translateY(0);
    }
    40%, 43% {
        animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
        transform: translateY(-30px);
    }
    70% {
        animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
        transform: translateY(-15px);
    }
    90% {
        transform: translateY(-4px);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-10px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(10px);
    }
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
    100% {
        transform: translateY(0px);
    }
}

@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(99, 102, 241, 0.6);
    }
}

@keyframes shimmer {
    0% {
        background-position: -100% 0;
    }
    100% {
        background-position: 100% 0;
    }
}

@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-90deg);
    }
    to {
        opacity: 1;
        transform: rotate(0deg);
    }
}

/* AOS Animation Classes */
[data-aos="fade-up"] {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-aos="fade-up"].aos-animate {
    opacity: 1;
    transform: translateY(0);
}

[data-aos="fade-down"] {
    opacity: 0;
    transform: translateY(-30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-aos="fade-down"].aos-animate {
    opacity: 1;
    transform: translateY(0);
}

[data-aos="fade-left"] {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-aos="fade-left"].aos-animate {
    opacity: 1;
    transform: translateX(0);
}

[data-aos="fade-right"] {
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-aos="fade-right"].aos-animate {
    opacity: 1;
    transform: translateX(0);
}

[data-aos="zoom-in"] {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-aos="zoom-in"].aos-animate {
    opacity: 1;
    transform: scale(1);
}

[data-aos="zoom-out"] {
    opacity: 0;
    transform: scale(1.1);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-aos="zoom-out"].aos-animate {
    opacity: 1;
    transform: scale(1);
}

/* Mobile-specific animations */
.mobile-fade-in {
    animation: fadeInUp 0.6s ease-out;
}

.mobile-slide-in {
    animation: slideInLeft 0.5s ease-out;
}

.mobile-bounce {
    animation: bounce 1s ease-out;
}

.mobile-pulse {
    animation: pulse 2s infinite;
}

.mobile-float {
    animation: float 3s ease-in-out infinite;
}

/* Button animations */
.btn-primary,
.btn-hero,
.btn-secondary {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-primary::after,
.btn-hero::after,
.btn-secondary::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.btn-primary:active::after,
.btn-hero:active::after,
.btn-secondary:active::after {
    width: 300px;
    height: 300px;
}

/* Card hover animations */
.product-card,
.service-item,
.benefit-item {
    transition: all 0.3s ease;
}

.product-card:hover,
.service-item:hover,
.benefit-item:hover {
    animation: none;
}

/* Loading animations */
.loading-dots {
    display: inline-block;
}

.loading-dots::after {
    content: '';
    animation: loadingDots 1.5s infinite;
}

@keyframes loadingDots {
    0%, 20% {
        content: '.';
    }
    40% {
        content: '..';
    }
    60%, 100% {
        content: '...';
    }
}

/* Micro-interactions */
.micro-bounce:hover {
    animation: bounce 0.6s ease;
}

.micro-shake:hover {
    animation: shake 0.5s ease;
}

.micro-pulse:hover {
    animation: pulse 0.6s ease;
}

/* Navigation animations */
.mobile-nav {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-nav.active {
    animation: slideInLeft 0.3s ease-out;
}

.nav-link {
    transition: all 0.2s ease;
    position: relative;
}

.nav-link::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-400);
    transition: width 0.3s ease;
}

.nav-link:hover::before,
.nav-link.active::before {
    width: 100%;
}

/* Progress animations */
.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 2px;
    transition: width 0.3s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shimmer 2s infinite;
}

/* Scroll animations */
.scroll-indicator {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    transform-origin: left;
    transform: scaleX(0);
    z-index: 101;
    transition: transform 0.1s ease;
}

/* Testimonial slider animations */
.testimonials-slider {
    position: relative;
    overflow: hidden;
}

.testimonial-card {
    transition: all 0.5s ease;
}

.testimonial-card:not(.active) {
    transform: translateX(100px);
    opacity: 0;
}

.testimonial-card.active {
    transform: translateX(0);
    opacity: 1;
}

/* FAQ animations */
.faq-item {
    transition: all 0.3s ease;
}

.faq-answer {
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.faq-icon {
    transition: transform 0.3s ease;
}

/* Form animations */
.form-group {
    position: relative;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    animation: inputFocus 0.3s ease;
}

@keyframes inputFocus {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
    }
}

/* WhatsApp floating button animations */
.whatsapp-float {
    animation: float 3s ease-in-out infinite;
    transition: all 0.3s ease;
}

.whatsapp-float:hover {
    animation: none;
    transform: scale(1.1);
}

.whatsapp-float::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: conic-gradient(from 0deg, #25D366, transparent, #25D366);
    border-radius: 50%;
    z-index: -1;
    animation: rotateGlow 3s linear infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.whatsapp-float:hover::before {
    opacity: 1;
}

@keyframes rotateGlow {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Mobile-specific performance optimizations */
@media (max-width: 768px) {
    /* Reduce animations on mobile for better performance */
    .mobile-reduce-motion * {
        animation-duration: 0.3s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.2s !important;
    }
}

/* Prefers reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .whatsapp-float,
    .mobile-pulse,
    .mobile-float {
        animation: none !important;
    }
    
    .progress-fill::after {
        animation: none !important;
    }
}

/* Touch feedback animations */
.touch-feedback {
    position: relative;
    overflow: hidden;
}

.touch-feedback::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.3s ease;
}

.touch-feedback:active::before {
    width: 200px;
    height: 200px;
}

/* Staggered animations */
.stagger-animation {
    animation-fill-mode: backwards;
}

.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; }

/* Mobile menu animations */
.menu-toggle span {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Scroll snap animations */
.scroll-snap-section {
    scroll-snap-align: start;
    transition: all 0.3s ease;
}

/* Loading skeleton animations */
.skeleton {
    background: linear-gradient(90deg, 
        rgba(203, 213, 225, 0.1) 25%, 
        rgba(203, 213, 225, 0.2) 50%, 
        rgba(203, 213, 225, 0.1) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ========================================
   RELIABILITY IMPROVEMENTS FOR RELOADS
   ======================================== */

/* Simplified AOS for better reliability on F5 reload */
[data-aos] {
    opacity: 0.4 !important;
    transition: opacity 0.3s ease, transform 0.3s ease !important;
}

[data-aos="fade-up"] {
    transform: translateY(15px) !important;
}

[data-aos="fade-down"] {
    transform: translateY(-15px) !important;
}

[data-aos="fade-left"] {
    transform: translateX(-15px) !important;
}

[data-aos="fade-right"] {
    transform: translateX(15px) !important;
}

[data-aos="zoom-in"] {
    transform: scale(0.96) !important;
}

[data-aos="zoom-out"] {
    transform: scale(1.04) !important;
}

/* When animated, show everything properly */
[data-aos].aos-animate {
    opacity: 1 !important;
    transform: translateY(0) translateX(0) scale(1) !important;
}

/* Force show critical content immediately - for F5 reload reliability */
.force-visible,
.section-container,
.products-grid,
.services-grid,
.benefits-content {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Backup styles for critical elements */
.service-item,
.product-card,
.benefit-item,
.stat-item,
.faq-item {
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
}

/* Override for prefers-reduced-motion - show everything immediately */
@media (prefers-reduced-motion: reduce) {
    [data-aos] {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}
