/**
 * Vitrine de produtos - Loja Virtual
 * Grid responsivo e cards padronizados. Escopo: .shop-products
 * NÃO usar classe .rows junto com .shop-products (conflito com grade.css)
 */

/* ========== Seções - espaçamento consistente, sem colisão ========== */
.shop-section {
  margin-bottom: 2.5rem;
  clear: both;
}

/* Container da grade - display:grid (sem .rows) */
.shop-products {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  width: 100%;
  max-width: 100%;
  padding: 0;
  margin: 0;
}

@media (min-width: 576px) {
  .shop-products {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) {
  .shop-products {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
}

@media (min-width: 992px) {
  .shop-products {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1200px) {
  .shop-products {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Card de produto - BEM, flex-column, altura consistente */
.shop-products .product-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}

/* Media: imagem + ações - altura definida pelo thumb */
.shop-products .product-card__media,
.shop-products .product-card__inner {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

/* Container da imagem - altura fixa, evita layout shift */
/* Especificidade alta para sobrescrever .destaques .caixa .thumb */
.shop-products .product-card__thumb,
.destaques .shop-products .product-card__thumb,
.categorias .shop-products .product-card__thumb {
  width: 100% !important;
  height: 180px;
  min-height: 180px;
  max-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #f5f5f5;
  border-radius: 8px;
  flex-shrink: 0;
}

@media (max-width: 575px) {
  .shop-products .product-card__thumb {
    height: 160px;
    min-height: 160px;
    max-height: 160px;
  }
}

.shop-products .product-card__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

/* Fallback quando imagem quebra/404 - já tratado via onerror, mas garante que o container não colapse */
.shop-products .product-card__thumb img[alt="Sem imagem"] {
  opacity: 0.7;
}

/* Ícones de ação - posição fixa, não sobrepõe conteúdo */
.shop-products .product-card__opcoes {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 2;
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.shop-products .product-card__opcoes li {
  display: block;
}

.shop-products .product-card__opcoes li svg {
  width: 22px;
  height: 22px;
}

.shop-products .product-card__opcoes li a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  transition: background 0.2s ease;
}

.shop-products .product-card__opcoes li a:hover {
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* Body: título + preço - altura mínima para alinhamento */
.shop-products .product-card__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 1rem;
  min-height: 0;
  text-align: center;
}

/* Título - máximo 2 linhas com ellipsis */
.shop-products .product-card__title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0.75rem 0 0.5rem;
  padding: 0;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 2.7em;
}

/* Preço - dentro do body */
.shop-products .product-card__preco {
  display: block;
  text-align: center;
  padding: 0.5rem 0 0;
}

/* Footer: botão sempre no rodapé do card */
.shop-products .product-card__footer,
.shop-products .product-card__actions {
  margin-top: auto;
  padding: 1rem 1rem 1.25rem;
  flex-shrink: 0;
}

/* Badge "Destaque" - sutil, não altera altura do card */
.shop-products .product-card__badge {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 2;
  background: #FF7E46;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 6px rgba(255, 126, 70, 0.35);
}

/* Garante que seções da loja usem o grid */
.shop-products.destaques .product-card__inner,
.shop-products.categorias .product-card__inner,
.destaques .shop-products .product-card__inner,
.destaques.categorias .shop-products .product-card__inner {
  /* Herda estilos do .caixa existente */
}

/* Evitar overflow horizontal em qualquer tela */
.shop-products,
.shop-products * {
  max-width: 100%;
  box-sizing: border-box;
}

/* ========== FIX: Botões clicáveis em mobile/tablet ========== */
/* touch-action: manipulation remove delay de 300ms e evita que toque seja interpretado como swipe */
/* z-index garante que ícones fiquem acima de possíveis overlays */
.shop-products .product-card__opcoes {
  z-index: 10;
  pointer-events: auto;
}
.shop-products .product-card__opcoes li a,
.shop-products .product-card__footer .btn,
.shop-products .product-card__actions .btn {
  touch-action: manipulation;
  pointer-events: auto;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

/* ========== Rodapé não invadir conteúdo ========== */
.loja-main {
  padding-bottom: 5rem;
}
@media (max-width: 768px) {
  .loja-main {
    padding-bottom: 6rem;
  }
}
