/**
 * anuncios.css
 * Estilos para a seção de anúncios
 */

/* ============================================
   ESTILOS GERAIS DA PÁGINA DE ANÚNCIOS
   ============================================ */

.hero--anuncios {
  background: linear-gradient(135deg, #22c55e 0%, #15803d 100%);
  color: white;
}

.hero--anuncios .hero__title {
  color: white;
}

.hero--anuncios .hero__description {
  color: rgba(255, 255, 255, 0.9);
}

/* ============================================
   SEÇÃO DE FILTROS
   ============================================ */

.anuncios-filtros {
  background: white;
  padding: 20px;
  margin: -15px auto 20px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  max-width: 1200px;
  width: calc(100% - 40px);
  position: relative;
  z-index: 10;
}

.filtro-container {
  margin-bottom: 25px;
}

.search-input {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1em;
  font-family: "Poppins", sans-serif;
  transition: all 0.3s ease;
}

.search-input:focus {
  outline: none;
  border-color: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.filtro-categorias {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  padding: 20px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.categoria-btn {
  padding: 10px 16px;
  border: 2px solid #e5e7eb;
  background: white;
  border-radius: 25px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #374151;
  pointer-events: auto;
  font-family: "Poppins", sans-serif;
  outline: none;
}

.categoria-btn:hover {
  border-color: #10b981;
  background: #f0fdf4;
  color: #10b981;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.categoria-btn.active {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border-color: #059669;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
  transform: translateY(-2px);
}

.categoria-btn.active:hover {
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
}

.btn-categoria {
  padding: 10px 20px;
  border: 2px solid #e0e0e0;
  background: white;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
  font-family: "Poppins", sans-serif;
  color: #333;
  font-size: 0.95em;
}

.btn-categoria:hover {
  border-color: #22c55e;
  color: #22c55e;
  background: rgba(34, 197, 94, 0.05);
}

.btn-categoria.ativo {
  background: #22c55e;
  color: white;
  border-color: #22c55e;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

/* ============================================
   CONTAINER E SEÇÃO PRINCIPAL
   ============================================ */

#anuncios-container {
  width: 100%;
  padding: 20px;
}

/* ============================================
   GRID E CARDS DE ANÚNCIOS
   ============================================ */

.anuncios-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  margin: 20px 0;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

/* Card de Anúncio */
.anuncio-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
  cursor: pointer;
  position: relative;
}

.anuncio-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  transform: translateY(-6px);
  border-color: #22c55e;
}

.anuncio-card::after {
  content: "Ver Detalhes";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(34, 197, 94, 0.9);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1.1rem;
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 12px;
  backdrop-filter: blur(2px);
  pointer-events: none;
}

.anuncio-card:hover::after {
  opacity: 1;
}

/* Imagem do Anúncio */
.anuncio-imagem {
  width: 100%;
  height: 200px;
  overflow: hidden;
  background: #f5f5f5;
}

.anuncio-imagem img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.anuncio-card:hover .anuncio-imagem img {
  transform: scale(1.05);
}

/* Conteúdo do Anúncio */
.anuncio-conteudo {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

/* Header do Anúncio */
.anuncio-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

/* Título */
.anuncio-titulo {
  margin: 0;
  font-size: 1.1em;
  font-weight: bold;
  color: #333;
  flex-grow: 1;
  word-break: break-word;
}

/* Categoria */
.anuncio-categoria {
  background: #22c55e;
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75em;
  white-space: nowrap;
}

/* Preço */
.anuncio-preco {
  font-size: 0.95em;
  color: #999;
  margin: 5px 0 0 0;
}

.anuncio-preco {
  font-size: 1.4em;
  font-weight: bold;
  color: #22c55e;
  margin: 10px 0;
}

/* Descrição */
.anuncio-descricao {
  color: #666;
  font-size: 0.95em;
  margin: 10px 0;
  flex-grow: 1;
  line-height: 1.4;
}

/* Localização */
.anuncio-localizacao {
  color: #666;
  font-size: 0.9em;
  margin: 8px 0;
}

/* Footer do Anúncio */
.anuncio-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #eee;
}

/* Botão Link do Produto */
.btn-link {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: white;
  padding: 10px 16px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95em;
  transition: all 0.3s ease;
  display: inline-block;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.btn-link:hover {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  box-shadow: 0 6px 16px rgba(34, 197, 94, 0.4);
  transform: translateY(-2px);
  color: white;
}

.btn-link:active {
  transform: translateY(0);
}

/* ============================================
   INFORMAÇÕES E FOOTER
   ============================================ */

.anuncios-section {
  padding: 30px 20px;
  background: #f8f9fa;
  margin: 0 20px 30px;
  border-radius: 12px;
}

.anuncios-info {
  text-align: center;
  padding: 30px 20px;
  color: #666;
  font-size: 0.95em;
  background: white;
  border-radius: 8px;
  margin: 0 auto;
  max-width: 1200px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.anuncios-info p {
  margin: 0;
}

.anuncios-info span {
  color: #22c55e;
  font-weight: 600;
}

/* ============================================
   LOADING E ESTADOS
   ============================================ */

.anuncio-loading {
  width: 40px;
  height: 40px;
  margin: 0 auto;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #22c55e;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Botões de Contato */
.btn-whatsapp,
.btn-telefone,
.btn-link {
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.85em;
  font-weight: bold;
  transition: all 0.2s ease;
  display: inline-block;
  border: none;
  cursor: pointer;
}

.btn-whatsapp {
  background: #25d366;
  color: white;
}

.btn-whatsapp:hover {
  background: #20ba5a;
  transform: scale(1.05);
}

.btn-telefone {
  background: #2196f3;
  color: white;
}

.btn-telefone:hover {
  background: #0b7dda;
  transform: scale(1.05);
}

.btn-link {
  background: #22c55e;
  color: white;
}

.btn-link:hover {
  background: #15803d;
  transform: scale(1.05);
}

/* Estado Vazio */
.anuncio-vazio {
  text-align: center;
  color: #999;
  padding: 40px 20px;
  font-size: 1.1em;
}

/* Estado de Erro */
.anuncio-erro {
  background: #ffebee;
  border: 2px solid #f44336;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  color: #c62828;
  margin: 20px 0;
}

.anuncio-erro p {
  margin: 0 0 10px 0;
  font-weight: bold;
}

.anuncio-erro small {
  color: #d32f2f;
}

/* ============================================
   RESPONSIVIDADE
   ============================================ */

@media (max-width: 1024px) {
  .anuncios-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }

  .anuncios-filtros {
    width: calc(100% - 40px);
    padding: 20px;
    margin: 20px auto;
  }
}

@media (max-width: 768px) {
  .anuncios-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
  }

  .anuncio-imagem {
    height: 150px;
  }

  .anuncios-filtros {
    width: calc(100% - 30px);
    padding: 20px 15px;
    margin: 20px auto;
  }

  .filtro-categorias {
    justify-content: center;
  }

  .btn-categoria {
    padding: 8px 16px;
    font-size: 0.9em;
  }

  .anuncios-section {
    margin: 0 15px 15px;
  }

  .search-input {
    font-size: 16px; /* Previne zoom no iOS */
  }
}

@media (max-width: 480px) {
  .anuncios-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .anuncio-card {
    border-radius: 8px;
  }

  .anuncio-imagem {
    height: 200px;
  }

  .anuncios-filtros {
    width: calc(100% - 20px);
    padding: 15px 10px;
    margin: 15px auto;
  }

  .filtro-categorias {
    flex-direction: column;
  }

  .btn-categoria {
    width: 100%;
    justify-content: center;
  }

  .anuncio-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .anuncio-contatos {
    width: 100%;
    flex-wrap: wrap;
  }

  .btn-whatsapp,
  .btn-telefone,
  .btn-link {
    flex: 1;
    min-width: 100px;
    text-align: center;
  }
}

/* Replace/add category button styles: */

.categorias-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  padding: 20px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.categoria-btn {
  padding: 10px 16px;
  border: 2px solid #e5e7eb;
  background: white;
  border-radius: 25px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #374151;
}

.categoria-btn:hover {
  border-color: #10b981;
  background: #f0fdf4;
  color: #10b981;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.categoria-btn.active {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border-color: #059669;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
  transform: translateY(-2px);
}

.categoria-btn.active:hover {
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .categorias-buttons {
    flex-direction: row;
    overflow-x: auto;
    padding: 15px;
    gap: 8px;
  }

  .categoria-btn {
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 13px;
  }

  .categoria-btn::-webkit-scrollbar {
    height: 4px;
  }

  .categoria-btn::-webkit-scrollbar-track {
    background: #f1f5f9;
  }

  .categoria-btn::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
  }
}
