/* FORÇAR VISIBILIDADE DO MODAL DE EDIÇÃO DE BANNERS */
#bannerEditModal {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  z-index: 99999 !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background-color: rgba(0, 0, 0, 0.8) !important;
}

#bannerEditModal .modal-content {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  z-index: 100000 !important;
  background-color: white !important;
  margin: 5vh auto !important;
  padding: 20px !important;
  border-radius: 8px !important;
  width: 90% !important;
  max-width: 800px !important;
  max-height: 80vh !important;
  overflow-y: auto !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5) !important;
}

/* REDUÇÃO DOS BANNERS POR CATEGORIA NO ADMIN */
.category-banners {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
  gap: 1rem !important;
  margin-top: 1rem !important;
}

.category-banner-item {
  max-width: 200px !important;
  margin: 0.5rem !important;
  background: white !important;
  border-radius: 8px !important;
  padding: 1rem !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
  border: 1px solid #e0e6ed !important;
  text-align: center !important;
}

.category-banner-item h4 {
  font-size: 0.8rem !important;
  margin-bottom: 0.5rem !important;
  color: #374151 !important;
  font-weight: 600 !important;
}

.banner-image-preview {
  width: 180px !important;
  height: 100px !important;
  max-width: 180px !important;
  max-height: 100px !important;
  position: relative !important;
  border-radius: 8px !important;
  overflow: hidden !important;
  border: 1px solid #e0e6ed !important;
  margin-bottom: 0.5rem !important;
}

.banner-image-preview img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

.banner-image-preview button {
  font-size: 0.7rem !important;
  padding: 0.3rem 0.5rem !important;
  position: absolute !important;
  bottom: 0.5rem !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
}

/* REDUÇÃO GLOBAL DOS BOTÕES - TODAS AS VERSÕES - ALTA ESPECIFICIDADE */
.product-card-container .add-to-cart-standalone,
.product-card-wrapper .add-to-cart-standalone,
.special-offer-card .add-to-cart-standalone,
.add-to-cart-standalone {
  padding: 0.36rem 0 !important; /* ~10% mais fino */
  font-size: 0.66rem !important; /* ~6% menor que 0.7rem */
  min-height: 31px !important; /* ~10% menor */
  max-height: 31px !important; /* Forçar altura máxima */
  border-radius: 6px !important; /* Bordas menores */
  font-weight: 600 !important;
  letter-spacing: 0.3px !important;
  line-height: 1.2 !important; /* Linha compacta */
  text-transform: uppercase !important;
}

.product-card-container .add-to-cart-standalone i,
.product-card-wrapper .add-to-cart-standalone i,
.special-offer-card .add-to-cart-standalone i,
.add-to-cart-standalone i {
  font-size: 0.7rem !important; /* acompanha a redução da fonte */
  margin-right: 0.3rem !important;
}

.product-cart-button {
  width: 30px !important; /* Bem menor */
  height: 30px !important;
  font-size: 0.8rem !important;
}

/* Para telas maiores que iPhone 12 Pro - botões ligeiramente maiores que mobile */
@media (max-width: 768px) and (min-width: 391px) {
  
  /* Apenas prevenir overflow horizontal */
  body {
    overflow-x: hidden;
  }
  
  .products-container {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
  
  /* Botões um pouco maiores que mobile mas menores que desktop */
  .add-to-cart-standalone {
    padding: 0.45rem 0 !important;
    font-size: 0.75rem !important;
    min-height: 36px !important;
    border-radius: 9px !important;
  }
  
  .product-cart-button {
    width: 32px !important;
    height: 32px !important;
    font-size: 0.85rem !important;
  }
  
  .add-to-cart-standalone i {
    font-size: 0.8rem !important;
  }
}

/* CORREÇÃO DEFINITIVA PARA iPhone 12 Pro e iPhone SE (390px e menores) */
@media (max-width: 390px) {
  /* Evita overflow horizontal e garante layout fluido */
  .products-container,
  .category-section {
    padding: 0 !important;
    margin: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }

  /* Containers com gap reduzido e colunas 2x fluidas */
  .category-products,
  .products-grid,
  .special-offers-container {
    gap: 0.2rem !important;
    padding: 0.1rem !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important; /* 2 colunas no mobile */
  }

  /* Os itens do grid não devem ter largura fixa em vw */
  .category-products .product-card-container,
  .products-grid .product-card-container,
  .special-offers-container .product-card-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
  }

  /* Cards seguem a largura do item do grid */
  .product-card,
  .special-offer-card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }

  /* Botões ainda mais compactos para estes devices */
  .add-to-cart-standalone {
    width: 100% !important;
    margin: 0.05rem 0 !important;
    padding: 0.28rem 0 !important; /* menor espessura no mobile */
    font-size: 0.58rem !important; /* fonte menor no mobile */
    min-height: 28px !important;
    border-radius: 6px !important;
    box-sizing: border-box !important;
  }

  .product-cart-button {
    width: 28px !important;
    height: 28px !important;
    font-size: 0.75rem !important;
  }
}

/* Para telas muito pequenas (iPhone SE antigo - 320px) */
@media (max-width: 320px) {
  .category-products,
  .products-grid,
  .special-offers-container {
    gap: 0.1rem !important;
    padding: 0.05rem !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .category-products .product-card-container,
  .products-grid .product-card-container,
  .special-offers-container .product-card-wrapper,
  .special-offers-container .special-offer-card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
  }

  /* Botões ultra-compactos para telas muito pequenas */
  .add-to-cart-standalone {
    padding: 0.3rem 0 !important;
    font-size: 0.6rem !important;
    min-height: 30px !important;
    border-radius: 6px !important;
  }

  .product-cart-button {
    width: 26px !important;
    height: 26px !important;
    font-size: 0.7rem !important;
  }

  .add-to-cart-standalone i {
    font-size: 0.65rem !important;
  }
}

/* OVERRIDE FINAL - MÁXIMA PRIORIDADE PARA GARANTIR APLICAÇÃO */
body .add-to-cart-standalone,
html .add-to-cart-standalone,
* .add-to-cart-standalone {
  width: 95% !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding: 0.4rem 0 !important;
  font-size: 0.7rem !important;
  min-height: 34px !important;
  max-height: 34px !important;
  border-radius: 6px !important;
  line-height: 1.2 !important;
  font-weight: 600 !important;
  letter-spacing: 0.3px !important;
}

body .add-to-cart-standalone i,
html .add-to-cart-standalone i,
* .add-to-cart-standalone i {
  font-size: 0.75rem !important;
  margin-right: 0.3rem !important;
}

body .product-cart-button,
html .product-cart-button,
* .product-cart-button {
  width: 30px !important;
  height: 30px !important;
  font-size: 0.8rem !important;
}