/* ═══════════════════════════════════════════════════════════════
   /public/css/imovel.css
   Estilo unificado, responsivo e premium para a página do imóvel
   ═══════════════════════════════════════════════════════════════ */

:root {
  --primary:      #1A56DB;
  --primary-dark: #1240AA;
  --accent:       #F59E0B;
  --bg:           #F8FAFC;
  --card:         #FFFFFF;
  --text:         #0F172A;
  --muted:        #64748B;
  --text-muted:   #64748B;
  --border:       #E2E8F0;
  --success:      #10B981;
  --danger:       #EF4444;
  --warning:      #F59E0B;
  --r:            16px;
  --radius:       16px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Loading ── */
#loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 16px;
}
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Error ── */
#error-view {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 16px;
  padding: 24px;
  text-align: center;
}
.error-icon { font-size: 64px; }
#error-view h2 { font-size: 20px; font-weight: 700; }
#error-view p  { color: var(--text-muted); max-width: 320px; }

/* ── Main view ── */
#main-view { display: none; }

/* ── Header barra ── */
.top-bar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.top-bar-logo { font-size: 18px; font-weight: 800; color: var(--primary); }
.top-bar-sub  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── Status badges ── */
.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.status-disponivel { background: #D1FAE5; color: #065F46; }
.status-reservado  { background: #FEF3C7; color: #92400E; }
.status-vendido    { background: #FEE2E2; color: #991B1B; }

.sbadge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 12px;
}

/* ── Card Base ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 20px;
}
.card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 14px;
}

/* ── Nome e Preço ── */
.imovel-nome {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 4px;
}
h1.imovel-nome {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 4px;
}
.imovel-emp {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 12px;
}
.imovel-preco {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
}
.imovel-preco-sub {
  font-size: 13px;
  color: var(--muted);
}
.preco-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 4px;
}

/* ── Specs Grid ── */
.specs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
}
.spec {
  background: var(--bg);
  border-radius: 10px;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}
.spec-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}
.spec-val {
  font-size: 17px;
  font-weight: 700;
}
.spec-lbl {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

/* ── Localização ── */
.local-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}
.local-row + .local-row {
  margin-top: 6px;
}

/* ── Descrição ── */
.descricao {
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
}
.descricao h1 { font-size: 20px; font-weight: 800; color: var(--text); margin: 16px 0 8px; }
.descricao h2 { font-size: 17px; font-weight: 700; color: var(--text); margin: 14px 0 6px; }
.descricao h3 { font-size: 15px; font-weight: 700; color: var(--text); margin: 12px 0 4px; }
.descricao p  { margin-bottom: 10px; }
.descricao ul, .descricao ol { padding-left: 20px; margin-bottom: 10px; }
.descricao li { margin-bottom: 4px; }
.descricao strong { color: var(--text); }
.descricao a  { color: var(--primary); text-decoration: underline; }

/* ── Planta Baixa & Lazer Imagens ── */
.planta-img {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-bottom: 8px;
  cursor: zoom-in;
  display: block;
}

/* ── Galeria de fotos ── */
.gallery-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: #000;
  border-radius: var(--r) var(--r) 0 0;
}
.gallery-slides {
  display: flex;
  transition: transform 0.4s ease;
  height: 100%;
}
.gallery-slide {
  min-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gallery-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
}
.gallery-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .3s;
}
.gallery-img.active {
  opacity: 1;
}
.gallery-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--card);
}
.gallery-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 20px;
  cursor: pointer;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}
.gallery-dots {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  border: none;
  cursor: pointer;
  transition: background .2s;
  padding: 0;
}
.dot.active {
  background: var(--primary);
}
.gallery-counter {
  position: absolute;
  top: 10px;
  right: 12px;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  display: none;
}

/* ── Consultor card ── */
.consultor-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: var(--r);
  padding: 20px;
  color: #fff;
}
.consultor-card .label {
  font-size: 11px;
  font-weight: 600;
  opacity: .7;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.consultor-card .nome, .consultor-card .cnome {
  font-size: 18px;
  font-weight: 700;
  margin: 4px 0 14px;
}

.btn-wpp {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  background: #25D366;
  color: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  text-decoration: none;
  transition: background 0.2s;
}
.btn-wpp:hover { background: #1ebe5a; }

/* ── CTA visitar e Barra de Interesse ── */
.interesse-bar, #interesse-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px;
  background: var(--card);
  border-top: 1px solid var(--border);
  z-index: 100;
  display: flex;
  justify-content: center;
}
.btn-visitar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 520px;
  padding: 14px 20px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  transition: background 0.2s;
}
.btn-visitar:hover { background: var(--primary-dark); }

/* ── Lightbox ── */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.95);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 95vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 4px;
}
.lb-close, .lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,.15);
  color: #fff;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Modal de Interesse ── */
.modal-overlay, #interesse-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  align-items: flex-end;
  justify-content: center;
}
.modal-overlay.open, #interesse-overlay.open { display: flex; }

.modal-box, #interesse-modal {
  background: var(--card);
  border-radius: 24px 24px 0 0;
  padding: 24px 20px 32px;
  width: 100%;
  max-width: 520px;
  z-index: 201;
}
.modal-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  margin-top: 6px;
}
.modal-btn {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  margin-top: 12px;
}
.modal-ok {
  display: none;
  text-align: center;
  padding: 24px 0 8px;
}

/* ── Footer ── */
.footer, .layout-footer {
  text-align: center;
  font-size: 12px;
  color: #94A3B8;
  padding: 20px;
}

/* ── Print / PDF ── */
.btn-print { display: inline-block; }
#print-cover-wrap { display: none; }
@media print {
  .top-bar, .gallery-dots, .gallery-btn, .gallery-counter,
  .btn-wpp, .footer, .lightbox, #video-section,
  .btn-print, #interesse-bar, .interesse-bar, #desktop-cta { display: none !important; }
  .gallery-wrap { display: none !important; }
  #print-cover-wrap { display: block !important; }
  .card { break-inside: avoid; }
  body { background: white !important; }
  .col-left, .col-right { display: block !important; }
  .content-layout { display: block !important; padding: 8px !important; }
}

/* ════════════════════════════════════════════════
   MOBILE LAYOUT  (< 860px)
   Colunas são transparentes; order controla a pilha
   ════════════════════════════════════════════════ */
.container {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 0 0 110px;
}

.content-layout {
  display: flex;
  flex-direction: column;
}

.col-left, .col-right {
  display: contents;
}

/* Ordem mobile e margens */
.card, .consultor-card {
  margin: 12px 16px 0;
}

#gallery-wrap, .gallery-card {
  order: 1;
  margin: 0 0 12px !important;
  border-radius: 0;
}

#video-section, .video-card {
  order: 2;
  margin: 12px 16px 0 !important;
}

#main-info-card, .main-info-card {
  order: 3;
  margin: 16px 16px 0 !important;
}

#specs-card, .specs-card {
  order: 4;
}

#local-card, .local-card {
  order: 5;
}

#desc-card, .desc-card {
  order: 6;
}

#planta-card, .planta-card {
  order: 7;
}

#lazer-card, .lazer-card {
  order: 8;
}

#consultor-card, .consultor-card {
  order: 9;
}

#desktop-cta {
  display: none;
  order: 10;
}

.layout-footer {
  order: 11;
  margin-top: 12px;
  padding-bottom: 80px;
}

/* ════════════════════════════════════════════════
   DESKTOP LAYOUT  (>= 860px)
   Grid de duas colunas
   ════════════════════════════════════════════════ */
@media (min-width: 860px) {
  .top-bar { padding: 16px 40px; }

  .container {
    max-width: 1200px;
    padding: 24px 24px 100px;
    margin: 0 auto;
  }

  .content-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    grid-template-rows: auto;
    gap: 28px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 0 56px;
    align-items: start;
  }

  /* Colunas reativadas */
  .col-left {
    display: flex;
    flex-direction: column;
    gap: 20px;
    grid-column: 1;
    min-width: 0;
  }
  .col-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
    grid-column: 2;
    position: sticky;
    top: 73px; /* abaixo do top-bar ou header */
    align-self: start;
  }

  /* Reset de margens mobile nos cards */
  .card, .consultor-card,
  #main-info-card,
  #specs-card,
  #local-card,
  #desc-card,
  #planta-card,
  #lazer-card,
  #consultor-card {
    margin: 0 !important;
    order: unset !important;
  }

  /* Galeria desktop */
  #gallery-wrap, .gallery-card {
    height: 400px;
    max-height: none;
    border-radius: var(--r) !important;
    overflow: hidden;
    order: unset !important;
  }

  .gallery-wrap {
    border-radius: var(--r) var(--r) 0 0 !important;
  }

  #video-section, .video-card {
    order: unset !important;
    border-radius: var(--r);
    overflow: hidden;
  }

  /* CTA desktop: visivel */
  #desktop-cta { display: block; order: unset; }

  /* Footer */
  .layout-footer { grid-column: 1 / -1; order: unset; padding-bottom: 0; margin-top: 0; }

  /* Esconde barra flutuante mobile */
  #interesse-bar, .interesse-bar { display: none !important; }

  /* Modais e Overlays centrados no desktop */
  .modal-overlay, #interesse-overlay {
    align-items: center !important;
  }
  .modal-box, #interesse-modal {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    bottom: auto !important;
    right: auto !important;
    transform: translate(-50%, -50%) !important;
    border-radius: 20px !important;
    width: 480px;
    max-width: 90vw;
    margin: 0 auto;
  }

  /* Fonte e espaçamento maiores no desktop */
  .imovel-nome  { font-size: 24px; }
  .imovel-preco { font-size: 30px; }
}
