/**
 * Mobile Optimization CSS
 * Specifically targets mobile performance improvements
 * Add this file AFTER your main CSS file
 */

/* Critical rendering path optimization */
@media (max-width: 767px) {
    /* Apply hardware acceleration for smoother performance */
    .game-card,
    .provider-logo-item,
    .btn-auth,
    .progress-fill,
    .banner-swiper {
        -webkit-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
        will-change: transform;
        backface-visibility: hidden;
    }
    
    /* Reduce animation complexity and duration */
    .fade-in {
        animation-duration: 0.3s !important;
        animation-delay: 0s !important; /* Override individual delays */
    }
    
    /* Better tap targets for mobile - improves usability */
    .play-btn-hover,
    .btn-pola,
    .dropdown-item,
    .load-more-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Load more button better feedback */
    .load-more-btn.loading {
        opacity: 0.8;
        pointer-events: none;
    }
    
    /* Disable transform effects that cause repaints */
    .game-card:hover,
    .btn-auth:hover,
    .footer-social a:hover,
    .game-card:active,
    .btn-auth:active,
    .footer-social a:active {
        transform: none !important;
        box-shadow: var(--card-shadow) !important;
    }
    
    /* Disable image scaling that causes repaints */
    .game-card:hover .game-img,
    .game-card:hover .game-img-placeholder,
    .provider-logo-item:hover .provider-logo {
        transform: none !important;
    }
    
    /* Disable gradient border animation - very expensive on mobile */
    .game-card::before {
        display: none !important;
    }
    
    /* Simplify card shadow */
    .game-card {
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
    }
    
    /* Disable expensive RTP progress animations */
    .progress-fill {
        animation: none !important;
        background-size: 100% 100% !important;
    }
    
    /* Remove shine effect - extremely expensive on mobile */
    .progress-fill::after,
    .rtp-progress-container::before,
    .footer-line::after {
        display: none !important;
    }
    
    /* Simplify counter animations */
    .count-up, .count-down {
        animation: none !important;
        transition: color 0.3s ease;
    }
    
    /* Optimize player count updates */
    .online-players {
        transition: color 0.3s ease;
    }
    
    /* Optimize placeholder/error state for images */
    .game-img-placeholder {
        background-image: none !important;
        background-color: #1a1a1a !important;
    }
    
    /* Hide all fireflies except the first one to reduce GPU load */
    .firefly {
        display: none;
    }
    
    .firefly:first-child {
        display: block;
        animation-duration: 20s !important;
    }
    
    /* Disable animation for RTP pulse */
    .progress-time, .progress-label {
        animation: none !important;
    }
    
    /* Simplify footer waves - extremely GPU intensive */
    .footer-waves {
        height: 5px;
    }
    
    .wave {
        animation-duration: 60s !important;
        height: 5px;
    }
    
    /* Simplify play button animation */
    .play-btn-hover {
        animation: none !important;
        box-shadow: none !important;
    }
    
    /* Make overlay partially visible by default to avoid repaints */
    .play-button-overlay {
        opacity: 0.6 !important;
    }
    
    /* Improve scroll performance by disabling certain effects */
    .section-title::before,
    .section-title::after,
    .btn-pola::before,
    .btn-auth::before {
        display: none !important;
    }
    
    /* Fix very small screens */
    @media (max-width: 400px) {
        .col-6 {
            flex: 0 0 100%;
            max-width: 100%;
        }
        
        .swiper-button-next, 
        .swiper-button-prev {
            display: none;
        }
    }
}

/* Lazy loading support */
.lazy-loading {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lazy-loaded {
    opacity: 1;
}

/* Loading placeholder animation - more efficient than complex shimmers */
.loading-placeholder {
    background: #151515;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0.7;
}

/* Use prefers-reduced-motion to respect user preferences */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
    
    .wave, .firefly {
        display: none !important;
    }
}

/* Batch processing support - used by JS to optimize repaints */
.batch-processed {
    transition: none !important;
}

/* Focus state for accessibility */
button:focus, a:focus, .game-card:focus {
    outline: 2px solid var(--primary-color);
}

/* Fix for some mobile browsers (safari) */
@supports (-webkit-touch-callout: none) {
    .game-card, .provider-logo-item {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
    
    .banner-img {
        -webkit-transform: none !important;
        transform: none !important;
    }
}

/* Memory optimization - remove transform scale animations */
@media (max-width: 767px) {
    .warning-icon {
        animation: none !important;
    }
    
    .provider-swiper {
        height: auto !important;
    }
    
    .btn-pola:hover, .btn-auth:hover, .badge-item:hover {
        transform: none !important;
    }
    
    .load-more-btn:hover {
        transform: none !important;
        box-shadow: none !important;
    }
    
    .footer-social a:hover {
        transform: none !important;
        box-shadow: none !important;
    }
    
    .game-img-container:hover .play-button-overlay {
        opacity: 0.9 !important;
    }
    
    .modal-content {
        box-shadow: none !important;
    }
}

/* Loading optimization */
.load-more-btn.loading {
    position: relative;
}

.load-more-btn.loading::after {
    content: "...";
    position: absolute;
    right: 10px;
}

/* Critical path rendering fix for mobile */
.banner-container,
#games-container {
    min-height: 120px;
}

/* Reduce RAM usage with content visibility */
.footer-section {
    content-visibility: auto;
    contain-intrinsic-size: 0 500px;
}

/* Fix layout shifts on load */
.game-img {
    aspect-ratio: 1;
}