/* ========================================
   FLEETZ - PERFORMANCE OTTIMIZZAZIONI MOBILE
   ======================================== */

/* ===== GPU ACCELERATION ===== */
.gpu-accelerated,
.message-bubble,
.chat-input,
.navigation {
  will-change: transform !important;
  transform: translateZ(0) !important;
  -webkit-transform: translateZ(0) !important;
  backface-visibility: hidden !important;
  -webkit-backface-visibility: hidden !important;
}

/* ===== CONTENIMENTO LAYOUT ===== */
.contain-layout {
  contain: layout style paint !important;
}

.contain-strict {
  contain: strict !important;
}

/* ===== OTTIMIZZAZIONI RENDERING ===== */
.optimize-rendering {
  image-rendering: -webkit-optimize-contrast !important;
  image-rendering: crisp-edges !important;
  text-rendering: optimizeSpeed !important;
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
}

/* ===== LAZY LOADING CONTENT ===== */
.lazy-content {
  content-visibility: auto !important;
  contain-intrinsic-size: 1px 200px !important;
}

/* ===== RIDUZIONE ANIMAZIONI PER LOW-END ===== */
@media screen and (max-width: 480px) and (max-height: 854px) {
  /* Dispositivi low-end detection */
  .reduce-animations * {
    animation-duration: 0.1s !important;
    animation-delay: 0s !important;
    transition-duration: 0.1s !important;
    transition-delay: 0s !important;
  }
  
  /* Disabilita blur costosi */
  .backdrop-blur,
  .blur-effect {
    backdrop-filter: none !important;
    filter: none !important;
    background-color: rgba(0, 0, 0, 0.8) !important;
  }
  
  /* Semplifica ombre */
  .box-shadow,
  .drop-shadow {
    box-shadow: none !important;
    filter: none !important;
  }
}

/* ===== MEMORY OPTIMIZATION ===== */
.memory-efficient {
  pointer-events: auto !important;
  isolation: isolate !important;
}

/* ===== BATTERY SAVING MODE ===== */
@media (prefers-reduced-motion: reduce) {
  .battery-save * {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }
}

/* ===== CPU INTENSIVE OPERATIONS THROTTLING ===== */
.throttle-cpu {
  animation-play-state: paused !important;
  transition: opacity 0.1s ease !important;
}

/* ===== NETWORK AWARE LOADING ===== */
@media (max-width: 768px) {
  /* Riduce qualità immagini su mobile */
  .network-optimized img {
    image-rendering: auto !important;
    max-width: 100% !important;
    height: auto !important;
  }
}

/* ===== TOUCH OPTIMIZATION ===== */
.touch-optimized {
  -webkit-tap-highlight-color: transparent !important;
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  user-select: none !important;
  touch-action: manipulation !important;
}

/* ===== SCROLL PERFORMANCE ===== */
.scroll-performance {
  overflow-anchor: none !important;
  scroll-behavior: auto !important;
}

/* ===== COMPOSITOR LAYERS ===== */
.force-layer {
  transform: translateZ(0) !important;
  opacity: 0.99 !important;
  filter: blur(0) !important;
}

/* ===== PAINT CONTAINMENT ===== */
.paint-containment {
  contain: paint !important;
  isolation: isolate !important;
}

/* ===== FONT LOADING OPTIMIZATION ===== */
.font-display-swap {
  font-display: swap !important;
}

/* ===== CRITICAL CSS INLINE ===== */
.critical-inline {
  font-family: system-ui, -apple-system, sans-serif !important;
  line-height: 1.5 !important;
  color: #ffffff !important;
  background-color: #000000 !important;
}

/* ===== INTERSECTION OBSERVER OPTIMIZATION ===== */
.io-observe {
  margin: 100px 0 !important; /* Root margin per preloading */
}

/* ===== PASSIVE EVENT LISTENERS ===== */
.passive-events {
  touch-action: auto !important;
  pointer-events: auto !important;
}

/* ===== REDUCE REFLOWS ===== */
.no-reflow {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
}

/* ===== VENDOR PREFIX OPTIMIZATION ===== */
.vendor-optimized {
  -webkit-transform: translateZ(0) !important;
  -moz-transform: translateZ(0) !important;
  -ms-transform: translateZ(0) !important;
  transform: translateZ(0) !important;
}