/* Estilos específicos para a página de catálogo */

/* Cabeçalho fixo */
header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: white;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Título do catálogo */
.titulo-catalogo {
  background-color: #d6a66d;
  color: white;
  text-align: center;
  padding: 30px 0;
  margin-bottom: 30px;
}

.titulo-catalogo p {
  font-size: 23px;
  font-weight: 700;
}

/* Banner rotativo */
.slide {
  width: 100vw;
  height: 400px;
  overflow: hidden;
  position: relative;
}

.slide-container {
  width: 300%;
  height: 100%;
  display: flex;
  animation: slideShow 24s infinite;
}

.slide-item {
  width: 33.333%;
  height: 100%;
}

.slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Banner mobile */
.slide-mobile {
  display: none;
  width: 100vw;
  height: 300px;
  overflow: hidden;
}

.slide-mobile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@keyframes slideShow {
  0%, 30% { transform: translateX(0); }
  33.33%, 63.33% { transform: translateX(-33.333%); }
  66.66%, 96.66% { transform: translateX(-66.666%); }
  100% { transform: translateX(0); }
}

/* Container do catálogo */
.catalogo-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Linhas de produtos - CORREÇÃO APLICADA AQUI */
.linha-produtos {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  margin-bottom: 40px;
  gap: 20px;
}

/* Cards de produtos */
.produto {
  background: white;
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
  width: calc(25% - 20px);
  max-width: 280px; /* Limita o tamanho máximo */
  min-width: 260px; /* Garante um tamanho mínimo */
  padding: 15px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

/* Quando há poucos produtos, ajusta o tamanho automaticamente */
.linha-produtos:has(.produto:nth-child(1):nth-last-child(1)) .produto {
  /* Quando há apenas 1 produto */
  width: 280px;
}

.linha-produtos:has(.produto:nth-child(2):nth-last-child(1)) .produto {
  /* Quando há apenas 2 produtos */
  width: calc(50% - 10px);
  max-width: 320px;
}

.linha-produtos:has(.produto:nth-child(3):nth-last-child(1)) .produto {
  /* Quando há apenas 3 produtos */
  width: calc(33.33% - 15px);
  max-width: 300px;
}

/* Produtos ocultos durante a busca - usar visibility ao invés de display */
.produto[style*="display: none"] {
  display: none !important;
}

/* Alternativa mais específica para produtos filtrados */
.produto.produto-oculto {
  visibility: hidden;
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0 !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

.produto:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.produto-imagem {
  height: 250px;
  overflow: hidden;
  border-radius: 8px;
  margin-bottom: 15px;
  position: relative;
}

.produto-imagem img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.5s ease;
  position: absolute;
  top: 0;
  left: 0;
}

.produto-imagem .img-frente {
  opacity: 1;
  z-index: 2;
}

.produto-imagem .img-costas {
  opacity: 0;
  z-index: 1;
}

.produto:hover .produto-imagem .img-frente {
  opacity: 0;
}

.produto:hover .produto-imagem .img-costas {
  opacity: 1;
}

.produto h2 {
  font-size: 18px;
  margin-bottom: 0px;
  color: #333;
  height: 50px;
  display: flex;
  align-items: center;
}

.produto h4 {
  font-size: 14px;
  color: #666;
  margin-bottom: 10px;
}

.produto s {
  color: #999;
  font-size: 16px;
  margin-bottom: 5px;
  display: block;
}

.preco {
  font-size: 22px;
  font-weight: 700;
  color: #d6a66d;
  margin-bottom: 15px;
}

.produto button {
  background-color: #d6a66d;
  color: white;
  border: none;
  border-radius: 5px;
  padding: 10px 15px;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  margin-top: auto;
  width: 100%;
}

.produto button:hover {
  background-color: #b98a54;
}

/* Garantir que o layout flex funcione corretamente durante buscas */
.linha-produtos:after {
  content: "";
  flex: auto;
}

/* Correção específica para quando há poucos produtos após filtro */
.catalogo-container .linha-produtos {
  align-content: flex-start;
}

/* Estilos para quando não há resultados de busca */
.no-results {
  width: 100%;
  text-align: center;
  padding: 40px 20px;
  background: #f8f9fa;
  border-radius: 10px;
  margin: 20px 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.no-results h3 {
  color: #333;
  margin-bottom: 10px;
  font-size: 20px;
}

.no-results p {
  color: #666;
  margin-bottom: 15px;
}

.no-results button {
  background-color: #d6a66d;
  color: white;
  border: none;
  border-radius: 5px;
  padding: 10px 20px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s ease;
}

.no-results button:hover {
  background-color: #b98a54;
}

/* Estilos responsivos */
@media (max-width: 1024px) {
  .produto {
    width: calc(33.33% - 20px);
  }
}

@media (max-width: 768px) {
  /* Mostrar banner mobile e esconder desktop */
  .slide {
    display: none;
  }
  
  .slide-mobile {
    display: block;
  }
  
  /* Ajustar container do catálogo para mobile */
  .catalogo-container {
    padding: 15px;
  }
  
  /* Reduzir gap entre produtos */
  .linha-produtos {
    gap: 15px;
    margin-bottom: 30px;
  }
  
  /* Configurar produtos para mobile - 2 por linha */
  .produto {
    width: calc(50% - 8px);
    min-width: unset;
    max-width: unset;
    padding: 12px;
  }
  
  /* Remover regras específicas de quantidade no mobile */
  .linha-produtos:has(.produto:nth-child(1):nth-last-child(1)) .produto,
  .linha-produtos:has(.produto:nth-child(2):nth-last-child(1)) .produto,
  .linha-produtos:has(.produto:nth-child(3):nth-last-child(1)) .produto {
    width: calc(50% - 8px);
    max-width: unset;
  }

  .produto h2 {
    font-size: 16px;
    height: 40px;
  }

  .produto-imagem {
    height: 200px;
  }
}

@media (max-width: 480px) {
  /* Manter estrutura de container */
  .catalogo-container {
    padding: 10px;
  }
  
  /* Reduzir ainda mais o gap */
  .linha-produtos {
    gap: 10px;
    margin-bottom: 25px;
  }
  
  /* Produtos menores mas ainda 2 por linha */
  .produto {
    width: calc(50% - 5px);
    padding: 10px;
  }
  
  /* Garantir que regras específicas não interfiram */
  .linha-produtos:has(.produto:nth-child(1):nth-last-child(1)) .produto,
  .linha-produtos:has(.produto:nth-child(2):nth-last-child(1)) .produto,
  .linha-produtos:has(.produto:nth-child(3):nth-last-child(1)) .produto {
    width: calc(50% - 5px);
    max-width: unset;
  }
  
  .titulo-catalogo h1 {
    font-size: 24px;
  }
  
  .titulo-catalogo p {
    font-size: 16px;
  }

  .produto h2 {
    font-size: 14px;
    height: 35px;
  }

  .produto-imagem {
    height: 180px;
  }

  .preco {
    font-size: 18px;
  }

  .produto button {
    font-size: 12px;
    padding: 8px 12px;
  }
}