/**
 * Performance Optimization CSS
 * Reduces animations and transitions for better performance on low-end devices
 */

/* Detect low-end devices and reduce motion preference */
@media (prefers-reduced-motion: reduce), (max-width: 768px) {
    /* Disable all transitions */
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    /* Disable transform on hover */
    *:hover {
        transform: none !important;
    }
    
    /* Disable box-shadow animations */
    *:hover {
        box-shadow: none !important;
    }
    
    /* Keep essential hover states but without animation */
    a:hover, button:hover {
        opacity: 0.8 !important;
    }
}

/* Performance mode for all devices - simpler hover effects */
.performance-mode {
    /* Disable all animations */
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
    
    /* Simple hover states */
    a:hover, button:hover {
        opacity: 0.8 !important;
        transform: none !important;
    }
    
    /* Remove gradient animations */
    .gradient-animated {
        animation: none !important;
    }
    
    /* Disable parallax effects */
    .parallax {
        transform: none !important;
    }
    
    /* Simplify card hover */
    .card:hover, .server-card:hover {
        transform: none !important;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
    }
    
    /* Disable pulse animations */
    .pulse, .online-indicator {
        animation: none !important;
    }
}

/* Mobile optimizations - always active on mobile */
@media (max-width: 768px) {
    /* Reduce transition times */
    * {
        transition-duration: 0.1s !important;
    }
    
    /* Disable all keyframe animations */
    * {
        animation-name: none !important;
    }
    
    /* Simplify hover states */
    .server-card:hover,
    .game-btn:hover,
    .mod-btn:hover {
        transform: none !important;
        background-color: rgba(102, 126, 234, 0.2) !important;
    }
    
    /* Remove shadow transitions */
    *:hover {
        box-shadow: initial !important;
    }
    
    /* Optimize scrolling */
    body {
        scroll-behavior: auto !important;
    }
    
    /* Disable backdrop filters on mobile */
    .modal-backdrop,
    .blur-background {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        background: rgba(0, 0, 0, 0.8) !important;
    }
    
    /* Simplify gradients */
    .gradient-bg {
        background: #1a1d29 !important;
    }
}

/* GPU optimization */
.hardware-accelerated {
    transform: translateZ(0);
    will-change: auto !important;
}

/* Remove unnecessary GPU layers */
.no-gpu {
    will-change: auto !important;
    transform: none !important;
}

/* Optimize font rendering */
body {
    text-rendering: optimizeSpeed;
    -webkit-font-smoothing: subpixel-antialiased;
}

/* Reduce paint areas */
.static-element {
    contain: layout style paint;
}

/* Optimize images */
img {
    content-visibility: auto;
    contain-intrinsic-size: 500px;
}

/* Disable blur effects on low-end */
@media (max-width: 768px), (prefers-reduced-motion: reduce) {
    .blur,
    .backdrop-blur {
        filter: none !important;
        backdrop-filter: none !important;
    }
}

/* Simple button states without animation */
.btn-simple:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    transition: none !important;
}

/* Optimize table hover */
tr:hover {
    background-color: rgba(255, 255, 255, 0.02) !important;
    transition: none !important;
}

/* Disable tooltip animations */
.tooltip {
    animation: none !important;
}

/* Optimize dropdown performance */
.dropdown-menu {
    animation: none !important;
    transition: none !important;
}

/* Reduce reflows on hover */
a, button, .clickable {
    will-change: auto !important;
}

/* Force hardware acceleration on critical elements only */
.hero-section,
.main-content {
    transform: translate3d(0, 0, 0);
}

/* Disable non-essential animations */
.decorative-animation,
.background-animation,
.floating-element {
    animation: none !important;
}
