/* Mobile Performance Optimization CSS */
/* Este arquivo deve ser incluído APÓS os estilos principais */

/* Otimizações críticas para mobile */
@media (max-width: 768px) {
  
  /* Reduzir altura do banner em mobile para carregamento mais rápido */
  .banner-webmotors {
    height: 250px !important;
    background-attachment: scroll !important; /* Remove parallax que é pesado em mobile */
    background-size: cover !important;
    background-position: center !important;
  }
  
  /* Otimizar formulário de busca para mobile */
  .busca-webmotors {
    padding: 20px 15px !important;
    margin-top: -50px !important;
    margin-bottom: 30px !important;
    border-radius: 10px !important;
  }
  
  .busca-webmotors .row {
    gap: 10px !important;
  }
  
  .busca-webmotors .form-select {
    height: 42px !important;
    font-size: 14px !important;
    padding: 8px 12px !important;
  }
  
  .busca-webmotors .btn-danger {
    height: 42px !important;
    font-size: 14px !important;
    padding: 8px 16px !important;
  }
  
  /* Otimizar grid de produtos para mobile */
  .product-area .row {
    margin-left: -8px !important;
    margin-right: -8px !important;
  }
  
  .product-area .row > * {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }
  
  /* Otimizar cards de produtos */
  .product-default {
    margin-bottom: 20px !important;
    padding: 12px !important;
    border-radius: 8px !important;
  }
  
  /* Otimizar imagens para carregamento mais rápido */
  .product-img {
    margin-bottom: 10px !important;
    height: 180px !important;
    overflow: hidden !important;
  }
  
  .product-img img {
    width: 100% !important;
    height: 180px !important;
    object-fit: cover !important;
    transition: none !important; /* Remove transições pesadas em mobile */
  }
  
  /* Lazy loading container otimizado - SEM SPINNER */
  .lazy-container {
    background: #f8f9fa !important;
    min-height: 180px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  /* Otimizar texto e tipografia */
  .product-category {
    font-size: 11px !important;
    margin-bottom: 6px !important;
  }
  
  .product-title {
    font-size: 14px !important;
    line-height: 1.3 !important;
    margin-bottom: 8px !important;
  }
  
  .product-title a {
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
  }
  
  /* Otimizar seção de autor */
  .author {
    margin-bottom: 10px !important;
  }
  
  .author img {
    width: 20px !important;
    height: 20px !important;
  }
  
  .author span {
    font-size: 11px !important;
  }
  
  /* Otimizar lista de ícones */
  .product-icon-list {
    gap: 8px !important;
    margin-bottom: 10px !important;
    flex-wrap: wrap !important;
  }
  
  .product-icon-list li {
    font-size: 10px !important;
    background: #f8f9fa !important;
    padding: 3px 6px !important;
    border-radius: 3px !important;
    flex: 1 !important;
    min-width: 0 !important;
  }
  
  .product-icon-list li span {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  
  /* Otimizar preços */
  .product-price {
    margin-bottom: 10px !important;
  }
  
  .new-price {
    font-size: 16px !important;
  }
  
  .old-price {
    font-size: 12px !important;
  }
  
  /* Otimizar botão WhatsApp */
  .whatsapp-btn {
    padding: 8px 12px !important;
    font-size: 12px !important;
    border-radius: 6px !important;
  }
  
  .whatsapp-btn svg {
    width: 14px !important;
    height: 14px !important;
  }
  
  /* Otimizar localização */
  .car-location {
    font-size: 10px !important;
    padding: 3px 6px !important;
    margin-bottom: 8px !important;
  }
  
  /* Otimizar navegação de tabs */
  .tabs-navigation {
    margin-bottom: 15px !important;
  }
  
  .nav-tabs {
    border: none !important;
    gap: 5px !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
  }
  
  .nav-tabs .nav-item {
    margin-bottom: 5px !important;
  }
  
  .nav-tabs .nav-link {
    padding: 6px 12px !important;
    font-size: 12px !important;
    border-radius: 15px !important;
    border: 1px solid #dee2e6 !important;
    background: #f8f9fa !important;
    color: #6c757d !important;
    white-space: nowrap !important;
  }
  
  .nav-tabs .nav-link.active {
    background: #dc3545 !important;
    border-color: #dc3545 !important;
    color: white !important;
  }
  
  /* Otimizar título da seção */
  .section-title h2 {
    font-size: 22px !important;
    margin-bottom: 20px !important;
  }
  
  /* Remover animações pesadas em mobile */
  .product-default:hover {
    transform: none !important;
  }
  
  .product-default:hover .product-img img {
    transform: none !important;
  }
  
  /* Otimizar container principal */
  .container {
    padding-left: 15px !important;
    padding-right: 15px !important;
  }
  
  /* Otimizar seção de produtos */
  .product-area {
    padding-bottom: 40px !important;
  }
}

/* Otimizações para telas muito pequenas */
@media (max-width: 480px) {
  .banner-webmotors {
    height: 200px !important;
  }
  
  .busca-webmotors {
    padding: 15px 10px !important;
    margin-top: -30px !important;
  }
  
  .container {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }
  
  .product-default {
    padding: 10px !important;
  }
  
  .product-img {
    height: 160px !important;
  }
  
  .product-img img {
    height: 160px !important;
  }
  
  .lazy-container {
    min-height: 160px !important;
  }
  
  .section-title h2 {
    font-size: 18px !important;
  }
  
  .nav-tabs .nav-link {
    padding: 4px 8px !important;
    font-size: 11px !important;
  }
}

/* Otimizações de performance críticas */

/* Preload de fontes críticas */
@font-face {
  font-family: 'FontAwesome';
  font-display: swap;
}

/* Otimizar lazy loading - SEM SPINNER */
.lazyload {
  opacity: 0;
  transition: opacity 0.3s;
}

.lazyloaded {
  opacity: 1;
}

/* REMOVIDO: Placeholder com spinner para imagens não carregadas */
.lazy-container::before {
  display: none; /* Spinner removido completamente */
}

/* Otimizações de scroll */
html {
  scroll-behavior: smooth;
}

/* Reduzir motion para usuários que preferem */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Otimizações de acessibilidade */
.btn:focus,
.form-select:focus,
.nav-link:focus {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

/* Otimizar carregamento de imagens */
img {
  max-width: 100%;
  height: auto;
}

/* Otimizar renderização de texto */
body {
  text-rendering: optimizeSpeed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Otimizar compositing */
.product-default,
.banner-webmotors,
.busca-webmotors {
  will-change: auto;
}

/* Otimizações específicas para WebKit (Safari mobile) */
@supports (-webkit-touch-callout: none) {
  .banner-webmotors {
    background-attachment: scroll !important;
  }
  
  .product-img img {
    transform: translateZ(0);
  }
}

/* Otimizações para dispositivos com tela de alta densidade */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .product-img img {
    image-rendering: -webkit-optimize-contrast;
  }
}

/* Critical CSS inline - deve ser movido para o <head> */
.critical-above-fold {
  .banner-webmotors {
    height: 250px;
    background-size: cover;
    background-position: center;
  }
  
  .busca-webmotors {
    background: #fff;
    border-radius: 10px;
    padding: 20px 15px;
    margin-top: -50px;
    position: relative;
    z-index: 10;
  }
}

