/*
 * Filtro "Tipo de imóvel" multi-seleção — skin Belmont (Stitch).
 *
 * As páginas Belmont reconstruídas não carregam styles.css (só Tailwind CDN +
 * <style> inline), então o painel do #61 do master (tipo-imovel.js +
 * painel-multi.js) precisa trazer o próprio CSS: gatilho, painel lista/colunas,
 * bottom sheet do mobile e overlay. Classes iguais às do master (o JS é o
 * mesmo); cores = tokens do tailwind.config das páginas Belmont.
 *
 *   primary #bb0019 · secondary #510003 · on-surface #1b1c1c
 *   on-surface-variant #59413e · outline-variant #e1bfbb
 *   surface-container #f0eded · background #fbf9f8
 */

/* ---- Gatilho (o fundo/altura vêm das classes Tailwind do markup) ---- */
.tipo-imovel-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  cursor: pointer;
}
.tipo-imovel-trigger .localidade-resumo {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tipo-imovel-trigger .localidade-resumo.is-vazio { color: #59413e; }
.tipo-imovel-trigger .localidade-contador {
  flex: none;
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  box-sizing: border-box;
  border-radius: 8px;
  background: #bb0019;
  color: #fff;
  font: 700 10px/16px "Plus Jakarta Sans", sans-serif;
  text-align: center;
}
.tipo-imovel-trigger .localidade-contador[hidden] { display: none; }
.tipo-imovel-trigger .localidade-seta { flex: none; color: #59413e; transition: transform .15s; }
/* Nada dentro do gatilho pode ser mais alto que a linha do texto: o campo tem
   que ficar da altura dos vizinhos (select/input da mesma linha). A seta é
   glifo Material (line-height 1) e o contador tem 16px — cabem no text-xs
   (16px) da home e no text-sm (20px) da busca. */
.tipo-imovel-trigger .localidade-seta.material-symbols-outlined { font-size: 16px; line-height: 1; width: 16px; height: 16px; overflow: hidden; }
.tipo-imovel-trigger[aria-expanded="true"] { box-shadow: 0 0 0 2px rgba(187, 0, 25, .3); }
.tipo-imovel-trigger[aria-expanded="true"] .localidade-seta { transform: rotate(180deg); }
.tipo-imovel-trigger:focus-visible { outline: 2px solid #bb0019; outline-offset: 2px; }

/* ---- Painel (desktop: dropdown ancorado no campo) ---- */
.tipo-imovel-painel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 40;
  width: 360px;
  max-width: 94vw;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #f0eded;
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(27, 28, 28, .28);
  font-family: Inter, sans-serif;
  color: #1b1c1c;
  overflow: hidden;
  text-align: left;
}
.tipo-imovel-painel[hidden] { display: none; }
/* O herói da home é h-screen + overflow-hidden: com o painel aberto ele
   cortaria a lista em tela baixa. Só enquanto aberto o painel pode vazar. */
.hero:has(.tipo-imovel-painel:not([hidden])) { overflow: visible; }
/* Busca: a sidebar é position:sticky = contexto de empilhamento próprio, então
   o z-index do painel não vale fora dela e a foto dos cards (com transform)
   pintava por cima. Com o painel aberto a sidebar sobe (abaixo do header z-50). */
#filter-sidebar-sticky:has(.tipo-imovel-painel:not([hidden])) { z-index: 45; }
.tipo-imovel-painel.painel-multi-direita:not(.localidade-sheet) { left: auto; right: 0; }
.tipo-imovel-painel.tipo-imovel-painel--colunas { width: min(820px, 94vw); }

/* Cabeçalho só no sheet do mobile */
.tipo-imovel-painel .localidade-painel-topo { display: none; }

.tipo-imovel-painel .tipo-imovel-grupos {
  max-height: 380px;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.tipo-imovel-painel--colunas .tipo-imovel-grupos {
  display: grid;
  grid-template-columns: repeat(var(--tipo-cols, 3), minmax(0, 1fr));
  gap: 28px;
  padding: 20px 24px;
  max-height: 420px;
  align-items: start;
}

.tipo-imovel-painel .tipo-imovel-grupo {
  margin: 0;
  padding: 0;
  border: none;
  min-width: 0;
}
.tipo-imovel-painel .tipo-imovel-grupo legend {
  padding: 0;
  width: 100%;
  float: left; /* fora do fluxo do fieldset: sem recorte de borda */
}
.tipo-imovel-painel .tipo-imovel-grupo legend + * { clear: left; }

.tipo-imovel-painel .tipo-imovel-grupo label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 32px;
  font-size: 13px;
  color: #1b1c1c;
  cursor: pointer;
  border-radius: 4px;
}
.tipo-imovel-painel .tipo-imovel-grupo label:hover { color: #bb0019; }
.tipo-imovel-painel .tipo-imovel-grupo .tipo-imovel-grupo-titulo {
  margin-bottom: 4px;
  border-bottom: 1px solid #f0eded;
  border-radius: 0;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #510003;
}
.tipo-imovel-painel .tipo-imovel-grupo .tipo-imovel-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Em colunas a largura é curta: nome longo quebra linha em vez de "…". */
.tipo-imovel-painel--colunas:not(.localidade-sheet) .tipo-imovel-grupo .tipo-imovel-item span { white-space: normal; }
.tipo-imovel-painel--colunas:not(.localidade-sheet) .tipo-imovel-grupo .tipo-imovel-item { align-items: flex-start; padding: 7px 0; min-height: 0; }
.tipo-imovel-painel--colunas:not(.localidade-sheet) .tipo-imovel-grupo .tipo-imovel-item input { margin-top: 1px; }

.tipo-imovel-painel input[type="checkbox"] {
  flex: none;
  width: 16px;
  height: 16px;
  margin: 0;
  border-radius: 2px;
  accent-color: #bb0019;
  /* As páginas carregam o Tailwind com ?plugins=forms: o checkbox marcado é
     pintado com currentColor (azul por padrão) e accent-color não vale. */
  color: #bb0019;
  border-color: #8d706d;
  --tw-ring-color: rgba(187, 0, 25, .3);
  cursor: pointer;
}
.tipo-imovel-painel input[type="checkbox"]:focus { --tw-ring-offset-width: 0; box-shadow: none; }
.tipo-imovel-painel input[type="checkbox"]:focus-visible { outline: 2px solid #bb0019; outline-offset: 2px; }

.tipo-imovel-painel .localidade-vazio { margin: 0; font-size: 13px; color: #59413e; }

/* ---- Rodapé: Limpar / Aplicar (n) ---- */
.tipo-imovel-painel .localidade-rodape {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid #f0eded;
  background: #fbf9f8;
}
.tipo-imovel-painel .localidade-limpar {
  background: none;
  border: none;
  padding: 0;
  height: 36px;
  font: 600 13px Inter, sans-serif;
  color: #59413e;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.tipo-imovel-painel .localidade-limpar:hover { color: #bb0019; }
.tipo-imovel-painel .localidade-aplicar {
  height: 36px;
  padding: 0 22px;
  border: none;
  border-radius: 4px;
  background: linear-gradient(to bottom, #bb0019, #9c0015);
  color: #fff;
  font: 700 12px Inter, sans-serif;
  letter-spacing: .02em;
  cursor: pointer;
}
.tipo-imovel-painel .localidade-aplicar:hover { opacity: .9; }

/* ---- Mobile: bottom sheet (painel-multi.js move o painel p/ o <body>) ---- */
.localidade-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(27, 28, 28, .45);
}
.localidade-overlay[hidden] { display: none; }
body.localidade-sem-scroll { overflow: hidden; }

.tipo-imovel-painel.localidade-sheet {
  position: fixed;
  top: auto;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 71;
  width: 100%;
  max-width: none;
  max-height: 80vh;
  border-radius: 12px 12px 0 0;
}
.tipo-imovel-painel.localidade-sheet .localidade-painel-topo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 8px 20px;
  border-bottom: 1px solid #f0eded;
}
.tipo-imovel-painel.localidade-sheet .localidade-painel-titulo {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: #510003;
}
.tipo-imovel-painel.localidade-sheet .localidade-fechar {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  font-size: 26px;
  line-height: 1;
  color: #1b1c1c;
  cursor: pointer;
}
.tipo-imovel-painel.localidade-sheet .tipo-imovel-grupos {
  display: flex;
  flex: 1;
  max-height: none;
  padding: 8px 20px 16px;
}
.tipo-imovel-painel.localidade-sheet .tipo-imovel-grupo label { min-height: 44px; font-size: 14px; }
.tipo-imovel-painel.localidade-sheet .tipo-imovel-grupo .tipo-imovel-grupo-titulo { font-size: 11px; }
.tipo-imovel-painel.localidade-sheet .localidade-rodape { padding: 12px 20px 20px; }
.tipo-imovel-painel.localidade-sheet .localidade-limpar,
.tipo-imovel-painel.localidade-sheet .localidade-aplicar { height: 44px; }
