/**
 * Estilos do Frontend - JunquiNet Portal Imobiliário
 *
 * Índice
 *  1. Variáveis CSS
 *  2. Base & Reset
 *  3. Links
 *  4. Ícones (Lucide SVG + fallback Bootstrap Icons)
 *  5. Botões
 *  6. Cards
 *  7. Layout — Topbar
 *  8. Layout — Navbar
 *  9. Layout — Footer
 * 10. Páginas — Home (Banner, Hero, Busca)
 * 11. Páginas — Imóveis
 * 12. Páginas — Contato
 * 13. Componentes — Depoimentos
 
 
/* =========================================================
   1. Variáveis CSS
   ========================================================= */

:root {
  --primary-color: #667eea;
  --secondary-color: #764ba2;
  --success-color: #28a745;
  --info-color: #17a2b8;
  --dark-color: #343a40;
}

/* =========================================================
   2. Base & Reset
   ========================================================= */

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
}

footer {
  margin-top: auto;
}

/* =========================================================
   3. Links
   ========================================================= */

a {
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  opacity: 0.8;
}

/* =========================================================
   4. Ícones (Lucide SVG + fallback Bootstrap Icons)
   ========================================================= */

svg.lucide,
i[data-lucide],
svg[data-lucide] {
  width: 0.9em;
  height: 0.9em;
  vertical-align: -0.125em;
  display: inline-block;
  color: inherit;
}

.bi {
  font-size: 0.9em;
  vertical-align: -0.125em;
}

/* Ajustes específicos para topbar e navbar */
.topbar a i,
.topbar a svg {
  font-size: 1.15rem;
  width: 1.15em;
  height: 1.15em;
}

/* Ícones das redes sociais (direita da topbar) — ligeiramente maiores */
.topbar .topbar-social a i,
.topbar .topbar-social a svg {
  font-size: 1.15rem;
  width: 1.15em;
  height: 1.15em;
}

.navbar .lucide,
.navbar i[data-lucide],
.navbar .bi {
  margin-right: 0.4rem;
}

/* =========================================================
   5. Botões
   ========================================================= */

/* Base: sem sobrescrever classes de tamanho do Bootstrap */
.btn:not(.btn-sm):not(.btn-lg) {
  border-radius: 5px;
  padding: 10px 20px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.btn:not(.btn-sm):not(.btn-lg):hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Botões seguindo tema */
.btn-theme {
  background: var(--theme-primary);
  border-color: var(--theme-primary);
  color: #fff;
}

.btn-theme:hover,
.btn-theme:focus {
  background: var(--theme-primary-dark);
  border-color: var(--theme-primary-dark);
  color: #fff;
}

.btn-theme-outline {
  color: var(--theme-primary);
  border-color: var(--theme-primary);
  background: transparent;
}

.btn-theme-outline:hover,
.btn-theme-outline:focus {
  background: var(--theme-primary);
  border-color: var(--theme-primary);
  color: #fff;
}

/* =========================================================
   6. Cards
   ========================================================= */

.card {
  border: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.3s ease;
}

.card:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Card de Imóvel */
.card-imovel {
  transition:
    transform 0.3s,
    box-shadow 0.3s;
  position: relative;
}

.card-imovel:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15) !important;
}

.card-imovel img {
  height: 200px;
  object-fit: cover;
}

/* Badges de destaque e status compartilham a mesma configuração visual base */
.badge-destaque,
.badge-status-card {
  position: absolute;
  right: 2px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: 6px 10px;
  border-radius: 16px;
  font-weight: 600;
  font-size: .85rem;
  color: inherit;
}

.badge-destaque {
  top: 10px;
  z-index: 10;
}

/* Status badge shown on property cards (placed below destaque badge) */
.badge-status-card {
  top: 37px;
  z-index: 11;
}

/* When there is no destaque badge, status occupies the destaque position */
.badge-status-card--top {
  top: 10px;
}

@media (max-width: 576px) {
  .badge-status-card {
    top: 44px;
    right: 8px;
    padding: 4px 8px;
    font-size: .78rem;
  }
  .badge-status-card--top {
    top: 10px;
  }
}
/* Global imovel badge (used across show and card) */
.imovel-badge {
  display:inline-block;
  padding:1px 8px;
  border-radius:10px;
  font-weight:600;
  margin-right:1px;
  margin-bottom:10px;
}

/* Card de Informações de Contato */
.contact-info-card {
  border: none;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s;
  height: 100%;
}

.contact-info-card:hover {
  transform: translateY(-5px);
}

/* =========================================================
   7. Layout — Topbar
   ========================================================= */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1030;
  background: var(--theme-color);
  color: #ffffff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  font-size: 1.15rem;
  padding: 0.5rem 0;
}

/* Espaçador para compensar a topbar fixa */
.topbar-spacer {
  height: 44px; /* fallback; sobrescrito pela CSS var em main.php */
  /* Compensa padding extra do logo para evitar que este invada a topbar */
  height: calc(var(--topbar-height) + 8px) !important;
}

.topbar a {
  color: rgba(255, 255, 255, 0.95);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: all 0.15s ease;
  font-weight: 400;
}

.topbar a:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.topbar .bi {
  font-size: 1.1rem;
  margin-right: 0.4rem;
}

.topbar-divider {
  display: inline-block;
  width: 1px;
  height: 1.2rem;
  background-color: rgba(0, 0, 0, 0.1);
  margin: 0 1rem;
  vertical-align: middle;
}

.topbar-text {
  margin-left: 0.20rem;
}

/* =========================================================
   8. Layout — Navbar
   ========================================================= */

.navbar-theme {
  background: var(--navbar-bg, #fff) !important;
  box-shadow: none !important;
  border-bottom: 20px solid var(--theme-color);
  position: relative;
  z-index: 1025;
}

.navbar-theme .nav-link {
  color: var(--theme-color) !important;
  font-weight: 600;
  font-size: 1.3rem;
}

.navbar-theme .nav-link:hover,
.navbar-theme .nav-link:focus,
.navbar-theme .nav-link:active {
  color: var(--theme-color) !important;
  background: transparent !important;
  opacity: 0.95;
}

/* Legibilidade do item ativo quando navbar é branca */
.navbar-theme .nav-link.active,
.navbar-theme .nav-link.show {
  color: var(--theme-color) !important;
  background: transparent !important;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.navbar-theme .navbar-brand {
  color: var(--theme-color);
  font-weight: 700;
}

/* Logo wrap: fundo branco independente da cor da navbar */
.navbar-brand .logo-wrap {
  background: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none !important;
  border: none !important;
}

.navbar-brand .logo-wrap img {
  display: block;
  height: auto;
  max-width: none;
  width: auto;
}

/* Ajustes de tema para hamburger e background da navbar */
.navbar-theme .navbar-toggler {
  border: none;
  background: transparent;
}
.navbar-theme .navbar-toggler-icon {
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
}

[data-bs-theme='dark'] .navbar-theme {
  background: var(--theme-primary) !important;
  color: rgba(255,255,255,0.95);
}
[data-bs-theme='dark'] .navbar-theme .navbar-brand,
[data-bs-theme='dark'] .navbar-theme .nav-link {
  color: rgba(255,255,255,0.95) !important;
}
[data-bs-theme='dark'] .navbar-theme .navbar-toggler-icon {
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
}

@media (max-width: 576px) {
  .navbar-brand .logo-wrap {
    padding: 6px 8px;
  }
  .navbar-theme .navbar-brand {
    padding-top: 0.2rem;
    padding-bottom: 0.2rem;
  }
}

/* =========================================================
   9. Layout — Footer
   ========================================================= */

footer {
  margin-top: auto;
}

.footer-theme .text-muted,
.footer-theme .small,
.footer-theme small {
  color: inherit !important;
}

/* Botões de redes sociais no rodapé */
.footer-theme .social-links .btn {
  background: transparent !important;
  border: none !important;
  color: #ffffff !important;
  font-size: 0.95rem !important;
  padding: 0.45rem 0.6rem;
  box-shadow: none !important;
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}

.footer-theme .social-links .btn i {
  font-size: 2.5rem;
  vertical-align: middle;
}

.footer-theme .social-links .btn:hover {
  background: rgba(0, 0, 0, 0.04) !important;
}

/* Classe utilitária btn-outline nas redes sociais */
.footer-theme .social-links .btn.btn-outline {
  background: transparent !important;
  border: none !important;
  color: #ffffff !important;
  font-size: 0.95rem !important;
  padding: 0.45rem 0.6rem;
  box-shadow: none !important;
}

.footer-theme .social-links .btn.btn-outline i {
  font-size: 1.75rem;
  vertical-align: middle;
}

.footer-theme .social-links .btn.btn-outline:hover {
  background: transparent !important;
  border: 1px solid var(--theme-color) !important;
  color: var(--theme-color) !important;
}

/* SVGs e ícones Bootstrap no rodapé */
.footer-theme .social-links .btn svg {
  width: 1.75rem !important;
  height: 1.75rem !important;
  display: inline-block;
  vertical-align: middle;
}

.footer-theme .social-links .btn .bi {
  font-size: 1.75rem !important;
  line-height: 1 !important;
  vertical-align: middle;
}

/* Footer 4 colunas */
.footer-col-heading {
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.footer-slogan {
  font-size: 0.9rem;
  opacity: 0.85;
}

.footer-contacts {
  font-style: normal;
}

.footer-contact-link {
  color: inherit;
  text-decoration: none;
  font-size: 0.9rem;
  opacity: 0.88;
}

.footer-contact-link:hover {
  opacity: 1;
  text-decoration: underline;
  color: inherit;
}

.footer-hours li {
  margin-bottom: 0.25rem;
  opacity: 0.82;
}

/* Redes sociais — grid 1 coluna */
.footer-social-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.4rem;
}

.footer-social-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: inherit;
  text-decoration: none;
  font-size: 0.88rem;
  padding: 0.4rem 0.6rem;
  border-radius: 5px;
  opacity: 0.88;
  transition:
    background 0.15s ease,
    opacity 0.15s ease;
}

.footer-social-item:hover {
  background: rgba(255, 255, 255, 0.1);
  opacity: 1;
  color: inherit;
}

.footer-social-item i {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.footer-social-item svg {
  width: 1.25rem !important;
  height: 1.25rem !important;
  flex-shrink: 0;
}

/* Menu de navegação no rodapé */
.footer-nav-list li {
  margin-bottom: 0.45rem;
}

.footer-nav-list a {
  color: inherit;
  text-decoration: none;
  font-size: 0.9rem;
  opacity: 0.85;
}

.footer-nav-list a::before {
  content: "›";
  margin-right: 0.4rem;
  opacity: 0.55;
}

.footer-nav-list a:hover {
  opacity: 1;
  text-decoration: underline;
  color: inherit;
}

/* Mapa de localização */
.footer-map-wrap iframe {
  border-radius: 6px;
  display: block;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.footer-address {
  font-style: normal;
  opacity: 0.82;
  line-height: 1.55;
}

/* Barra inferior do rodapé */
.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.footer-bottom-link {
  color: inherit;
  text-decoration: none;
  opacity: 0.85;
}

.footer-bottom-link:hover {
  color: inherit;
  text-decoration: underline;
  opacity: 1;
}

.footer-bottom-sep {
  opacity: 0.45;
}

/* Regras de override específicas do tema */

/* Footer logo: limitar a 80% da largura da coluna e comportamento responsivo */
.footer-theme .footer-brand {
  display: block;
}
.footer-theme .footer-brand .logo-wrap {
  display: block;
  width: 100%;
  /* background branco com transparencia de 80% */
  background-color: rgba(255, 255, 255, 0.7);
  padding: 5px;
  border-radius: 5px;
}
.footer-theme .footer-brand .logo-wrap img.footer-logo {
  max-width: 95%;
  width: auto;
  height: auto;
  display: block;
}

/* Garantir que o footer-logo não seja esticado por estilos inline */
.footer-theme .footer-brand .logo-wrap img.footer-logo {
  max-height: none !important;
}

/* =========================================================
   10. Páginas — Home (Banner, Hero, Busca)
   ========================================================= */

.hero-section {
  background: linear-gradient(
    135deg,
    var(--theme-primary) 0%,
    var(--theme-primary-dark) 100%
  );
  min-height: var(--banner-height);
  display: flex;
  align-items: center;
}

.search-box {
  background: #ffffff;
  padding: 1rem;
  border-radius: 0.75rem;
}

/* Banner full-view: ocupa a largura da viewport sem causar overflow */
.banner-carousel.full-view {
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  width: 100vw;
  max-width: 100vw;
  box-sizing: border-box;
  padding: 0;
  overflow: hidden;
  transition:
    box-shadow 180ms,
    margin 150ms;
}

.banner-carousel.full-view .banner-img {
  width: 100% !important;
  height: 650px;
  object-fit: cover;
  object-position: center center;
  max-width: none !important;
  display: block;
}

/* Evitar overflow com scrollbar em elementos internos */
.banner-carousel.full-view .carousel,
.banner-carousel.full-view .carousel-inner,
.banner-carousel.full-view .carousel-item {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
}

.banner-carousel.container-view {
  margin-top: 5px;
  margin-bottom: 5px;
  transition:
    box-shadow 180ms,
    margin 150ms;
}

.banner-carousel.container-view .banner-img {
  width: 100%;
  height: auto;
  max-height: 650px;
  object-fit: cover;
  object-position: center center;
  display: block;
  /* Reserva espaço antes da imagem carregar — evita CLS */
  aspect-ratio: 1920 / 650;
}

/* Sombra para o slide */
.banner-carousel.full-view,
.banner-carousel.container-view.banner-img {
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

/* Caption do carrossel */
.banner-carousel .carousel-caption {
  padding: calc(1rem * 0.7) !important;
}

.banner-carousel .carousel-caption h3,
.banner-carousel .carousel-caption p {
  margin-bottom: 0.2rem;
  color: #fff !important;
}

[data-bs-theme="dark"] .banner-carousel .carousel-caption,
[data-bs-theme="dark"] .banner-carousel .carousel-caption h3,
[data-bs-theme="dark"] .banner-carousel .carousel-caption p {
  color: #fff !important;
}

.h3Caption {
  font-size: 1.25rem !important;
  line-height: 0.85 !important;
  margin-top: 0 !important;
  margin-bottom: 0.15rem !important;
}

/* =========================================================
   11. Páginas — Imóveis
   ========================================================= */

.page-hero {
  background: linear-gradient(
    135deg,
    var(--theme-primary) 0%,
    var(--theme-primary-dark) 100%
  );
  color: var(--banner-text-color);
  padding: 40px 0 50px;
  margin-bottom: 30px;
}

.page-hero .lead {
  color: rgba(255, 255, 255, 0.95);
}

.preco {
  font-size: 1.5rem;
  font-weight: 700;
  color: #e74c3c;
}

/* =========================================================
   12. Páginas — Contato
   ========================================================= */

.contact-hero {
  background: linear-gradient(
    135deg,
    var(--theme-primary) 0%,
    var(--theme-primary-dark) 100%
  );
  color: var(--banner-text-color);
  padding: 40px 0 50px;
  margin-bottom: 50px;
}

.contact-icon {
  width: 60px;
  height: 60px;
  background: var(--theme-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--banner-text-color);
  margin: 0 auto 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.contact-form {
  background: var(--bs-body-bg, #ffffff);
  padding: 40px;
  border-radius: 10px;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
}

.map-container {
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
}

/* =========================================================
   13. Componentes — Depoimentos
   ========================================================= */

/* Barra sutil de carregamento à esquerda do card */
.testimonial-card {
  position: relative;
  overflow: hidden;
}

.testimonial-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(
    180deg,
    var(--testimonial-bar-color-start, var(--primary-color)),
    var(--testimonial-bar-color-end, var(--primary-color))
  );
  transform-origin: top;
  transform: scaleY(0);
  transition: transform 0.35s linear;
  z-index: 6;
}

/* Animação durante carregamento (duração sincronizada com JS — ANIM_MS) */
.testimonial-card.loading::before {
  animation: loading-bar 4s linear forwards;
}

.testimonial-card.loaded::before {
  transform: scaleY(1);
}

@keyframes loading-bar {
  0% {
    transform: scaleY(0);
  }
  80% {
    transform: scaleY(0.95);
  }
  100% {
    transform: scaleY(1);
  }
}

/* =========================================================
   14. Componentes — Voltar ao Topo
   ========================================================= */

.back-to-top-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1%;
  position: relative;
  z-index: 10;
}

.back-to-top-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1.4rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-decoration: none;
  background: var(--theme-color);
  color: #fff;
  border: 3px solid #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background 0.15s ease;
}

.back-to-top-btn:hover,
.back-to-top-btn:focus {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
  background: var(--theme-color);
  color: #fff;
  text-decoration: none;
}

.back-to-top-btn i,
.back-to-top-btn svg {
  font-size: 1rem;
  width: 1rem;
  height: 1rem;
}

/* =========================================================
   15. Media Queries
   ========================================================= */

/* Seções abaixo da dobra: content-visibility evita render/layout
   delas enquanto o browser ainda está pintando o LCP (banner/hero).
   O browser pulará layout e paint até o usuário rolar até elas. */
.hero-section ~ section {
  content-visibility: auto;
  contain-intrinsic-size: 0 800px; /* fallback de altura p/ barra de rolagem */
}

/* Tablet estreito (768–991px) */
@media (min-width: 768px) and (max-width: 991.98px) {
  .navbar-theme .nav-link {
    font-size: 0.95rem;
    padding-left: 0.35rem;
    padding-right: 0.35rem;
  }
}

/* Mobile (≤768px) */
@media (max-width: 768px) {
  .hero {
    padding: 60px 0 !important;
  }

  .hero h1 {
    font-size: 2rem !important;
  }

  .topbar {
    font-size: 0.8rem;
    padding: 0.4rem 0;
  }

  /* Removida a ocultação do texto para exibir telefone/redes no mobile */
  .topbar-divider {
    margin: 0 0.5rem;
  }

  /* Banner: reduz de 650px para 260px no mobile — melhora LCP e CLS */
  .banner-carousel.full-view .banner-img {
    height: 260px;
  }
  .banner-carousel.container-view .banner-img {
    max-height: 260px;
    aspect-ratio: 16 / 9;
  }
}

/* Mobile (≤767.98px) */
@media (max-width: 767.98px) {
  .footer-social-grid {
    grid-template-columns: 1fr;
  }

  .footer-bottom .d-flex {
    flex-direction: column;
    align-items: flex-start !important;
  }
}

/* Telas muito pequenas (≤420px) */
@media (max-width: 420px) {
  .testimonial-card::before {
    width: 3px;
  }
}
