/* ==========================================================================
   SEÇÃO DE ANÚNCIOS (CLASSIFICADOS) - DESIGN DE ALTA FIDELIDADE
   ========================================================================== */

.anuncios-section {
  padding: 60px 0;
  background-color: #f8fafc; /* Slate 50 */
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  position: relative;
}

.anuncios-header {
  text-align: center;
  margin-bottom: 35px;
}

.anuncios-header h2 {
  font-family: var(--font-family-serif);
  font-size: 2rem;
  font-weight: 700;
  color: #0f172a; /* Slate 900 */
  margin-bottom: 8px;
  position: relative;
  display: inline-block;
}

.anuncios-header h2::after {
  content: '';
  display: block;
  width: 60px;
  height: 4px;
  background-color: var(--color-primary, #ffc107);
  margin: 8px auto 0 auto;
  border-radius: 2px;
}

.anuncios-header p {
  color: #64748b; /* Slate 500 */
  font-size: 0.95rem;
  max-width: 500px;
  margin: 0 auto;
}

/* Pílulas de filtro dinâmicas */
.anuncios-filters {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 35px;
  padding: 0 16px;
}

.filter-btn {
  background-color: #ffffff;
  color: #475569; /* Slate 600 */
  border: 1.5px solid #cbd5e1;
  padding: 8px 20px;
  border-radius: 30px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.filter-btn:hover {
  background-color: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
  transform: translateY(-1px);
}

.filter-btn.active {
  background-color: var(--color-primary, #ffc107);
  border-color: var(--color-primary, #ffc107);
  color: #0b0f19;
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

/* Swiper Carrossel em Anúncios */
.anuncios-swiper {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 4px 45px 4px;
  position: relative;
}

.anuncios-swiper .swiper-slide {
  height: auto;
  display: flex;
}

.anuncios-swiper .anuncio-card {
  width: 100%;
}

.anuncios-pagination {
  position: relative !important;
  margin-top: 20px;
  bottom: 0 !important;
}

.anuncios-pagination .swiper-pagination-bullet {
  background: #cbd5e1 !important;
  opacity: 0.7 !important;
  width: 8px !important;
  height: 8px !important;
  transition: all 0.3s ease;
}

.anuncios-pagination .swiper-pagination-bullet-active {
  background: var(--color-primary, #ffc107) !important;
  opacity: 1 !important;
  transform: scale(1.25);
  width: 18px !important;
  border-radius: 4px !important;
}

.anuncios-swiper .swiper-button-next,
.anuncios-swiper .swiper-button-prev {
  color: #0f172a;
  background-color: rgba(255, 255, 255, 0.95);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

.anuncios-swiper .swiper-button-next:after,
.anuncios-swiper .swiper-button-prev:after {
  font-size: 16px;
  font-weight: bold;
}

.anuncios-swiper .swiper-button-next:hover,
.anuncios-swiper .swiper-button-prev:hover {
  background-color: #ffffff;
  color: var(--color-primary, #ffc107);
  transform: scale(1.08);
}

/* Grid de anúncios (Fallback) */
.anuncios-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 30px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Card de Anúncio */
.anuncio-card {
  background-color: #ffffff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.05);
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.15);
}

.anuncio-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.1);
  border-color: #cbd5e1;
}

/* Container de Imagens com Carrossel Integrado */
.ad-image-container {
  width: 100%;
  height: 200px;
  position: relative;
  overflow: hidden;
  background-color: #f1f5f9;
}

.ad-slides-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.ad-slide {
  min-width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.5s ease;
}

.anuncio-card:hover .ad-slide {
  transform: scale(1.04);
}

/* Badges sobrepostos na imagem */
.ad-category-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  background-color: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 30px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 10;
}

.ad-photo-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  background-color: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  color: #ffffff;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 10;
}

/* Setas do carrossel na imagem */
.ad-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.85);
  border: none;
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 11;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.ad-nav-btn:hover {
  background-color: #ffffff;
  color: var(--color-primary, #ffc107);
}

.ad-nav-btn.prev { left: 8px; }
.ad-nav-btn.next { right: 8px; }

.ad-image-container:hover .ad-nav-btn {
  opacity: 1;
  visibility: visible;
}

/* Corpo do Card */
.ad-card-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.ad-card-body h3 {
  font-family: var(--font-family-serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 8px 0;
  line-height: 1.3;
}

.ad-card-body p {
  color: #475569; /* Slate 600 */
  font-size: 0.88rem;
  line-height: 1.5;
  margin: 0 0 16px 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex-grow: 1;
}

/* Rodapé do Card */
.ad-card-footer {
  margin-top: auto;
  border-top: 1px solid #f1f5f9;
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Bloco de Preço */
.ad-price-tag {
  display: flex;
  flex-direction: column;
}

.ad-price-label {
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8; /* Slate 400 */
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ad-price-val {
  font-size: 1.2rem;
  font-weight: 800;
  color: #0f172a;
}

/* Botão de Ação do WhatsApp */
.ad-contact-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: #25d366;
  color: #ffffff;
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 700;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(37, 211, 102, 0.15);
}

.ad-contact-btn:hover {
  background-color: #20ba5a;
  box-shadow: 0 6px 14px rgba(37, 211, 102, 0.3);
  transform: translateY(-1px);
}

/* Estado vazio da Seção */
.ad-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  background: #ffffff;
  border-radius: 16px;
  border: 1px dashed #cbd5e1;
  color: #64748b;
}

.ad-empty-state i {
  font-size: 36px;
  color: #94a3b8;
  margin-bottom: 12px;
}

.ad-empty-state p {
  margin: 0;
  font-size: 14px;
}

/* ==========================================================================
   MEDIA QUERIES - ANÚNCIOS RESPONSIVOS
   ========================================================================== */

@media (max-width: 580px) {
  .anuncios-section {
    padding: 40px 0;
  }

  .anuncios-header h2 {
    font-size: 1.6rem;
  }

  .anuncios-filters {
    gap: 8px;
    margin-bottom: 24px;
    overflow-x: auto;
    justify-content: flex-start;
    padding: 4px 16px;
    -webkit-overflow-scrolling: touch;
  }

  /* Impede que as pílulas quebrem no mobile, criando um slider horizontal */
  .filter-btn {
    white-space: nowrap;
    padding: 6px 16px;
    font-size: 12.5px;
  }

  .anuncios-grid {
    gap: 20px;
    padding: 0 16px;
  }

  .ad-image-container {
    height: 180px;
  }

  .ad-nav-btn {
    opacity: 1;
    visibility: visible;
    width: 24px;
    height: 24px;
    font-size: 10px;
  }
}

/* ==========================================================================
   MODAL DE DETALHES DO ANÚNCIO (CLASSIFICADOS)
   ========================================================================== */
.ad-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  z-index: 10005;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 16px;
  box-sizing: border-box;
}

.ad-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.ad-modal-card {
  background-color: #ffffff;
  border-radius: 20px;
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-sizing: border-box;
}

.ad-modal-overlay.active .ad-modal-card {
  transform: scale(1);
}

.ad-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(241, 245, 249, 0.9);
  border: none;
  font-size: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #475569;
  z-index: 10;
  transition: all 0.2s ease;
}

.ad-modal-close:hover {
  background-color: #e2e8f0;
  color: #0f172a;
}

.ad-modal-body {
  display: grid;
  grid-template-columns: 1fr;
  box-sizing: border-box;
}

@media (min-width: 768px) {
  .ad-modal-body {
    grid-template-columns: 380px 1fr;
  }
}

.ad-modal-media {
  background-color: #f8fafc;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  justify-content: center;
}

.ad-modal-main-img-wrapper {
  width: 100%;
  height: 250px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  background-color: #ffffff;
}

.ad-modal-main-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ad-modal-thumbnails {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  width: 100%;
  padding-bottom: 8px;
}

.ad-thumb {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  object-fit: cover;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
}

.ad-thumb.active {
  border-color: var(--color-primary, #ffc107);
  box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
}

.ad-modal-info {
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
}

.ad-category-badge-modal {
  display: inline-block;
  align-self: flex-start;
  background-color: #f1f5f9;
  color: #475569;
  padding: 4px 12px;
  border-radius: 30px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.ad-modal-title {
  font-family: var(--font-family-serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 16px 0;
  line-height: 1.3;
}

.ad-modal-price {
  font-size: 1.6rem;
  font-weight: 800;
  color: #d97706; /* Laranja escuro */
  margin-bottom: 20px;
}

.ad-modal-desc {
  font-size: 0.92rem;
  line-height: 1.6;
  color: #475569;
  margin: 0 0 24px 0;
  white-space: pre-line;
}

.ad-modal-footer {
  margin-top: auto;
}

/* ==========================================================================
   LIGHTBOX DE ANÚNCIOS (AMPLIAÇÃO DE IMAGEM)
   ========================================================================== */
.image-modal {
  display: none;
  position: fixed;
  z-index: 10010;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(5px);
  opacity: 0;
  transition: opacity 0.3s ease;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.image-modal.active {
  display: flex;
  opacity: 1;
}

.image-modal .modal-content {
  margin: auto;
  display: block;
  max-width: 90%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.image-modal.active .modal-content {
  transform: scale(1);
}

.image-modal .close-modal {
  position: absolute;
  top: 20px;
  right: 25px;
  color: #f1f1f1;
  font-size: 35px;
  font-weight: bold;
  cursor: pointer;
  z-index: 10011;
  transition: 0.3s;
}

.image-modal .close-modal:hover,
.image-modal .close-modal:focus {
  color: var(--color-primary, #ffc107);
  text-decoration: none;
}

