/* ==================== PERFORMANCE OPTIMIZATIONS ==================== */
/* GPU-Accelerated Animations & Mouse Lag Fixes */
/* Load this AFTER style-20251107.css to override heavy animations */

/* === GPU ACCELERATION FOR ALL ANIMATED ELEMENTS === */

/* Force GPU layer for logo */
.premium-logo {
    will-change: transform, opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Disable heavy logo animations (drop-shadow, filter) - Keep only lightweight hover */
.premium-logo::before,
.premium-logo::after {
    animation: none !important; /* Disable subtleLightPlay */
    opacity: 0 !important; /* Disable pseudo-element overlays */
}

.premium-logo:hover {
    transform: scale(1.02) translateZ(0); /* Lightweight scale only */
    filter: none !important; /* Remove drop-shadow filters */
}

.premium-logo:active {
    transform: scale(0.98) translateZ(0);
}

/* === PRODUCT CARDS - GPU ACCELERATED === */
.product-card {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Remove heavy box-shadow animations, use transform only */
.product-card:hover {
    transform: translateY(-4px) translateZ(0) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important; /* Static shadow */
}

/* === CHATBOT BUTTON - DISABLE HEAVY PULSE === */
@keyframes chatbotPulse {
    /* Override with lightweight transform-only pulse */
    0%, 100% { 
        transform: scale(1) translateZ(0); 
    }
    50% { 
        transform: scale(1.02) translateZ(0); 
    }
}

/* Remove box-shadow from chatbot pulse */
.chatbot-trigger {
    will-change: transform;
    transform: translateZ(0);
}

.chatbot-trigger:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3) !important; /* Static shadow */
}

/* === CART BADGE - LIGHTWEIGHT PULSE === */
@keyframes badge-pulse {
    /* Simplified - transform only */
    0%, 100% { 
        transform: scale(1) translateZ(0); 
    }
    50% { 
        transform: scale(1.05) translateZ(0); 
    }
}

.cart-badge {
    will-change: transform;
    transform: translateZ(0);
}

/* === WHATSAPP BUTTON - DISABLE HEAVY PULSE === */
@keyframes whatsappPulse {
    /* Lightweight transform-only pulse */
    0%, 100% { 
        transform: scale(1) translateZ(0); 
    }
    50% { 
        transform: scale(1.03) translateZ(0); 
    }
}

/* Remove box-shadow from whatsappPulse */
.whatsapp-button {
    will-change: transform;
    transform: translateZ(0);
}

.whatsapp-button:hover {
    box-shadow: 0 8px 35px rgba(192, 192, 192, 1) !important; /* Static shadow */
}

/* === DISABLE HEAVY FILTER ANIMATIONS === */
@keyframes logoShine {
    /* Disabled - filter: drop-shadow is CPU-heavy */
    0%, 100% { 
        opacity: 1; 
    }
}

/* === METALLIC FLOW - REDUCE FREQUENCY === */
@keyframes metallicFlow {
    0%, 100% { 
        background-position: 0% 50%;
    }
    50% { 
        background-position: 100% 50%;
    }
}

/* Reduce animation speed on metallic backgrounds */
.hero-section,
[class*="metallic-gradient"] {
    animation-duration: 20s !important; /* Slower = less CPU */
}

/* === BUTTONS - GPU ACCELERATED HOVERS === */
button,
.btn,
.cta-button,
.secondary-button {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

button:hover,
.btn:hover,
.cta-button:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important; /* Static shadow */
}

/* === REMOVE BACKDROP-FILTER ON LOW-END DEVICES === */
@media (max-width: 1024px) {
    [class*="backdrop-filter"],
    .glassmorphism {
        backdrop-filter: none !important;
        background: rgba(0, 0, 0, 0.85) !important;
    }
}

/* === GPU ACCELERATION FOR ALL TRANSITIONS === */
* {
    /* Force GPU compositing for smoother animations */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Ensure all transforms use GPU */
[style*="transform"] {
    will-change: transform;
    transform: translateZ(0);
}

/* === DISABLE ANIMATIONS ON REDUCED MOTION PREFERENCE === */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* === SMOOTH SCROLLING WITH HARDWARE ACCELERATION === */
html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

body {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* === DISABLE EXPENSIVE ANIMATIONS ON DESKTOP === */
@media (min-width: 1024px) {
    /* Disable continuous background animations on desktop for better mouse performance */
    .hero-section::before,
    .section-background::before {
        animation: none !important;
    }
    
    /* Reduce metallic flow on desktop */
    [class*="metallic"] {
        animation-duration: 30s !important;
    }
}

/* === OPTIMIZED HOVER EFFECTS - TRANSFORM/OPACITY ONLY === */
.hover-lift {
    will-change: transform;
    transform: translateZ(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
    transform: translateY(-2px) translateZ(0);
}

/* === IMAGE OPTIMIZATION === */
img {
    will-change: auto; /* Don't pre-allocate GPU memory for all images */
    transform: translateZ(0);
}

img:hover {
    will-change: transform;
}

/* === REMOVE SHIMMER ANIMATION FROM BUTTONS === */
@keyframes shimmer {
    /* Disabled - CSS gradient animations are CPU-heavy */
    0%, 100% { opacity: 0; }
}

/* === PERFORMANCE HINTS === */
.performance-critical {
    will-change: transform, opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.no-gpu-hint {
    will-change: auto;
}

/* === SMOOTH OUT ALL TRANSITIONS === */
* {
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* === REDUCE PAINT FREQUENCY === */
.static-shadow {
    /* Use box-shadow without animation - cheaper than filter */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* === DISABLE HEAVY ANIMATIONS ON SCROLL === */
.scroll-reveal {
    /* Keep visibility animations but disable heavy effects */
    animation: fadeIn 0.6s ease-out !important;
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(10px) translateZ(0); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0) translateZ(0); 
    }
}

/* === ULTRA-SMOOTH CART DRAWER === */
/* Note: Cart drawer transforms handled by base CSS (style-20251107.css) to avoid conflicts */
.cart-drawer.active {
    will-change: transform;
    transform: translateX(0) translateZ(0) !important; /* GPU-accelerated when visible */
    backface-visibility: hidden;
}

/* === NAVIGATION - GPU ACCELERATED === */
nav,
header,
.navbar {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* === REMOVE FILTER FROM IMAGES === */
img,
picture,
svg {
    filter: none !important; /* Disable any filter animations */
}

/* === PERFORMANCE MONITORING INDICATOR === */
#performance-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 255, 0, 0.1);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    color: #0f0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#performance-indicator.visible {
    opacity: 1;
}

/* === PRELOADER OPTIMIZATION === */
#preloader {
    will-change: opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* === FINAL PERFORMANCE BOOST === */
/* Disable all pseudo-element animations that use filter/box-shadow */
*::before,
*::after {
    will-change: auto;
}

/* Only enable will-change on active hover/focus */
*:hover::before,
*:hover::after,
*:focus::before,
*:focus::after {
    will-change: transform, opacity;
}
