/* Performance-Optimized Animations */
/* استخدام transform و opacity فقط للحصول على أفضل أداء */

/* Hero Section Animations */
@keyframes fadeInUp {
    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 scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

/* Pulse Animation for CTAs */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Floating Animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Loading Animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Hero Section Classes */
.hero-title {
    animation: fadeInUp 0.8s ease-out;
    animation-fill-mode: both;
}

.hero-subtitle {
    animation: fadeInUp 0.8s ease-out 0.2s;
    animation-fill-mode: both;
}

.hero-description {
    animation: fadeInUp 0.8s ease-out 0.4s;
    animation-fill-mode: both;
}

.hero-cta {
    animation: fadeInUp 0.8s ease-out 0.6s;
    animation-fill-mode: both;
}

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

/* Service Cards Hover Effects */
.service-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    will-change: transform;
}

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

.service-icon {
    transition: transform 0.3s ease;
    will-change: transform;
}

.service-card:hover .service-icon {
    transform: scale(1.1);
}

/* Platforms Section Styles */
.platforms-grid {
    display: grid;
    gap: 2rem;
}

.platform-card {
    background: white;
    border-radius: 0.75rem;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
}

.platform-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    border-color: #d1d5db;
}

.platform-logo {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.platform-card:hover .platform-logo {
    transform: scale(1.1);
}

.platform-logo svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

/* Responsive adjustments for platforms */
@media (max-width: 768px) {
    .platforms-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }
    
    .platform-card {
        padding: 1.5rem 1rem;
    }
    
    .platform-logo {
        width: 3rem;
        height: 3rem;
        margin-bottom: 0.75rem;
    }
    
    .platform-card h3 {
        font-size: 0.9rem;
        line-height: 1.2;
    }
}

@media (max-width: 640px) {
    .platforms-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .platform-card {
        padding: 1.25rem 0.75rem;
    }
    
    .platform-logo {
        width: 2.5rem;
        height: 2.5rem;
        margin-bottom: 0.5rem;
    }
    
    .platform-card h3 {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .platforms-grid {
        gap: 0.5rem;
    }
    
    .platform-card {
        padding: 1rem 0.5rem;
        border-radius: 0.5rem;
    }
    
    .platform-logo {
        width: 2rem;
        height: 2rem;
        margin-bottom: 0.5rem;
    }
    
    .platform-card h3 {
        font-size: 0.8rem;
        font-weight: 600;
    }
}

@media (max-width: 360px) {
    .platforms-grid {
        gap: 0.25rem;
    }
    
    .platform-card {
        padding: 0.75rem 0.25rem;
    }
    
    .platform-logo {
        width: 1.75rem;
        height: 1.75rem;
    }
    
    .platform-card h3 {
        font-size: 0.75rem;
    }
}

/* General Mobile Responsive Improvements */
@media (max-width: 768px) {
    /* Section padding adjustments */
    section {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }
    
    /* Text size adjustments */
    .section-title {
        line-height: 1.2;
        margin-bottom: 1rem;
    }
    
    /* Service cards responsive */
    .services-grid .service-card {
        padding: 1.5rem 1rem;
    }
    
    .service-card h3 {
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
    }
    
    .service-card p {
        font-size: 0.9rem;
        line-height: 1.5;
    }
    
    /* Pricing cards responsive */
    .pricing-grid .pricing-card {
        padding: 1.5rem 1rem;
    }
    
    .pricing-card h3 {
        font-size: 1.2rem;
    }
    
    .pricing-card .price {
        font-size: 2rem;
    }
}

@media (max-width: 640px) {
    /* Further mobile optimizations */
    section {
        padding-top: 2.5rem !important;
        padding-bottom: 2.5rem !important;
    }
    
    /* Hero section adjustments */
    .hero-content h1 {
        font-size: 1.75rem;
        line-height: 1.2;
    }
    
    .hero-content p {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
    
    /* Button adjustments */
    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }
    
    /* Stats adjustments */
    .stats-grid .stats-item h3 {
        font-size: 1.5rem;
    }
    
    .stats-grid .stats-item p {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    /* Small mobile optimizations */
    section {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
    
    /* Typography adjustments */
    h1 {
        font-size: 1.5rem !important;
    }
    
    h2 {
        font-size: 1.25rem !important;
    }
    
    h3 {
        font-size: 1.1rem !important;
    }
    
    p {
        font-size: 0.9rem !important;
    }
    
    /* Card adjustments */
    .service-card,
    .pricing-card,
    .testimonial-card {
        padding: 1rem 0.75rem;
        margin-bottom: 1rem;
    }
    
    /* Navigation adjustments */
    .mobile-menu {
        padding: 1rem;
    }
    
    .mobile-menu a {
        padding: 0.75rem 0;
        font-size: 1rem;
    }
}

@media (max-width: 360px) {
    /* Extra small mobile optimizations */
    .px-mobile {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    
    section {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }
    
    /* Ultra compact cards */
    .service-card,
    .pricing-card,
    .platform-card {
        padding: 0.75rem 0.5rem;
    }
    
    /* Button adjustments */
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
    
    /* Text adjustments */
    h1 {
        font-size: 1.25rem !important;
    }
    
    h2 {
        font-size: 1.1rem !important;
    }
    
    p {
        font-size: 0.85rem !important;
        line-height: 1.4;
    }
}

/* Stats Counter Animation */
.stats-item {
    animation: countUp 0.6s ease-out;
    animation-fill-mode: both;
}

.stats-item:nth-child(1) { animation-delay: 0.1s; }
.stats-item:nth-child(2) { animation-delay: 0.2s; }
.stats-item:nth-child(3) { animation-delay: 0.3s; }
.stats-item:nth-child(4) { animation-delay: 0.4s; }

/* Mobile Navigation Improvements */
@media (max-width: 768px) {
    /* Header adjustments */
    header {
        padding: 0.75rem 0;
    }
    
    .logo {
        font-size: 1.25rem;
    }
    
    /* Mobile menu improvements */
    .mobile-menu {
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(10px);
        border-radius: 0 0 1rem 1rem;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    }
    
    .mobile-menu a {
        display: block;
        padding: 1rem 1.5rem;
        border-bottom: 1px solid #f3f4f6;
        transition: all 0.3s ease;
    }
    
    .mobile-menu a:hover {
        background: #f8fafc;
        transform: translateX(0.5rem);
    }
    
    .mobile-menu a:last-child {
        border-bottom: none;
    }
}

@media (max-width: 480px) {
    /* Compact mobile menu */
    .mobile-menu a {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }
    
    /* Header logo adjustment */
    .logo {
        font-size: 1.1rem;
    }
    
    /* Menu button adjustment */
    .menu-toggle {
        padding: 0.5rem;
    }
}

/* Contact Section Mobile Improvements */
@media (max-width: 768px) {
    .contact-grid {
        gap: 2rem;
    }
    
    .contact-info {
        text-align: center;
    }
    
    .contact-item {
        justify-content: center;
        margin-bottom: 1.5rem;
    }
}

@media (max-width: 480px) {
    .contact-grid {
        gap: 1.5rem;
    }
    
    .contact-item {
        flex-direction: column;
        align-items: center;
        text-align: center;
        margin-bottom: 1rem;
    }
    
    .contact-item svg {
        margin-bottom: 0.5rem;
        margin-left: 0;
    }
}

/* Footer Mobile Improvements */
@media (max-width: 768px) {
    footer {
        text-align: center;
        padding: 2rem 0;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    footer {
        padding: 1.5rem 0;
    }
    
    .footer-content p {
        font-size: 0.85rem;
    }
}

/* CTA Button Animations */
.cta-button {
    transition: all 0.3s ease;
    will-change: transform;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

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

/* Testimonial Cards */
.testimonial-card {
    transition: transform 0.3s ease;
    will-change: transform;
}

.testimonial-card:hover {
    transform: scale(1.02);
}

/* Pricing Cards */
.pricing-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    will-change: transform;
}

.pricing-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

/* Scroll Triggered Animations */
.fade-in-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* Loading Animation */
.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

#loading-overlay {
    transition: opacity 0.3s ease;
}

/* Performance Optimizations - ENSURE VISIBILITY */
.animated-element {
    will-change: auto;
    backface-visibility: visible;
    perspective: none;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Safe hover animations that don't hide content */
.service-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

.service-icon {
    transition: transform 0.3s ease;
}

.service-card:hover .service-icon {
    transform: scale(1.1);
}

/* Scroll-triggered animations - DISABLED FOR CONTENT VISIBILITY */
.fade-in-on-scroll {
    opacity: 1 !important;
    transform: translateY(0) !important;
    transition: none !important;
}

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

.fade-in-on-scroll.animate-on-scroll.visible {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .hero-title,
    .hero-subtitle,
    .hero-description,
    .hero-cta {
        animation-duration: 0.6s;
    }
    
    .service-card:hover,
    .testimonial-card:hover,
    .pricing-card:hover {
        transform: none;
    }
    
    .service-card:active {
        transform: scale(0.98);
    }
}