/*
 * Seletor de cidade da /familias (src/pages/familias.astro, js/cidade-familias.js).
 * Computador: botão "Curitiba - PR" no topo, ao lado do "Pedir cuidadora"; a lista abre como balão.
 * Celular: faixa fina logo abaixo do topo, que some ao rolar; a lista abre embaixo, como folha.
 * Branco, com o roxo da Afeto nos detalhes.
 */
.topo-acoes {
  display: flex;
  align-items: center;
  gap: 12px;
}

.seletor-cidade {
  display: none;
  align-items: center;
  gap: 8px;
  /* 32px de altura para o toque, sem aumentar o topo (a margem negativa devolve 8px). */
  height: 32px;
  margin: -4px 0;
  padding: 0 14px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #fff;
  color: var(--preto-fonte, #1f2937);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition:
    border-color 0.15s ease-out,
    background 0.15s ease-out;
}
.seletor-cidade:hover,
.seletor-cidade[aria-expanded='true'] {
  border-color: var(--lilas, #8b5cf6);
  background: #faf8ff;
}
.seletor-cidade .fa-location-dot {
  color: var(--lilas, #8b5cf6);
}
.seletor-cidade .fa-chevron-down {
  font-size: 11px;
  color: #6b7280;
}

/* Celular: faixa pendurada logo abaixo do topo, na largura toda. Fica fora do fluxo do topo (position
   absolute), então o topo não muda de altura quando ela some ao rolar. */
.faixa-cidade {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin: 0;
  padding: 8px 5%;
  border: 0;
  border-top: 1px solid #f1eefc;
  border-bottom: 1px solid #f1eefc;
  background: #faf8ff;
  color: var(--preto-fonte, #1f2937);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition:
    opacity 0.2s ease-out,
    transform 0.2s ease-out,
    visibility 0s;
}
.faixa-cidade span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.faixa-cidade .fa-location-dot {
  color: var(--lilas, #8b5cf6);
}
.faixa-cidade .faixa-seta {
  font-size: 11px;
  color: #6b7280;
}
/* O topo mantém o mesmo tamanho ao rolar (como nas outras páginas): a regra antiga da página
   (public/css/familias.css) trocava o espaço de 15px por 10px quando a página descia. Só a sombra aparece.
   A faixa da cidade sai da tela ao rolar para baixo e volta ao chegar no topo. */
.topo-familias.scrolled {
  padding: 15px 5%;
}
.topo-familias.scrolled .faixa-cidade {
  opacity: 0;
  transform: translateY(-6px);
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.2s ease-out,
    transform 0.2s ease-out,
    visibility 0s 0.2s;
}

@media (min-width: 900px) {
  .seletor-cidade {
    display: inline-flex;
  }
  .faixa-cidade {
    display: none;
  }
}

/* Lista de cidades e lista de espera. */
.cidade-fundo,
.cidade-pop {
  position: fixed;
}
.cidade-fundo[hidden],
.cidade-pop[hidden],
.cidade-vista[hidden] {
  display: none;
}
.cidade-fundo {
  inset: 0;
  z-index: 1090;
  background: rgba(17, 24, 39, 0.4);
  /* Tocar e arrastar no fundo não rola a página por trás (no lugar de travar o body, que pula no iPhone). */
  touch-action: none;
}
.cidade-pop {
  z-index: 1100;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 20px calc(22px + env(safe-area-inset-bottom, 0px));
  background: #fff;
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.18);
  color: var(--preto-fonte, #1f2937);
}
@media (min-width: 900px) {
  .cidade-fundo {
    background: transparent;
  }
  .cidade-pop {
    left: auto;
    right: max(5%, 16px);
    top: 66px;
    bottom: auto;
    width: 340px;
    max-height: calc(100vh - 100px);
    max-height: calc(100dvh - 100px);
    padding: 16px;
    border: 1px solid #eee;
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(124, 58, 237, 0.18);
  }
}
body.cidade-aberta .btn-wpp {
  display: none !important;
}

.cidade-topo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.cidade-pop h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.3px;
  color: var(--preto-fonte, #1f2937);
}
.cidade-vista > h2 {
  margin: 4px 0 6px;
}
.cidade-fechar,
.cidade-voltar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #6b7280;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}
.cidade-fechar:hover,
.cidade-voltar:hover {
  background: #f5f3ff;
  color: var(--lilas-escuro, #7c3aed);
}

.cidade-itens {
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
}
.cidade-item,
.cidade-outra {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 13px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--preto-fonte, #1f2937);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.cidade-item:hover,
.cidade-outra:hover {
  background: #f5f3ff;
}
.cidade-item.on {
  background: #f5f3ff;
  color: var(--lilas-escuro, #7c3aed);
  font-weight: 800;
}
.cidade-outra {
  margin-top: 6px;
  border-top: 1px solid #f1f1f4;
  border-radius: 0 0 12px 12px;
  color: var(--lilas-escuro, #7c3aed);
  font-weight: 800;
}

.cidade-texto {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
  color: #6b7280;
}
.cidade-erro {
  display: none;
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.4;
}
.cidade-erro.on {
  display: block;
}
.cidade-pop .cidade-campo {
  display: block;
  margin: 0 0 10px;
}
.cidade-pop .cidade-campo span {
  display: block;
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 800;
  color: #6b7280;
}
.cidade-pop .cidade-campo input {
  width: 100%;
  height: 46px;
  margin: 0;
  padding: 0 14px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  transform: none;
  box-shadow: none;
}
.cidade-pop .cidade-campo input:focus {
  border-color: var(--lilas, #8b5cf6);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
  background: #fff;
  transform: none;
}
.cidade-pop .cidade-aceite {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 12px 0 12px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  color: #6b7280;
}
.cidade-pop .cidade-aceite input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  padding: 0;
  accent-color: var(--lilas, #8b5cf6);
  transform: none;
  box-shadow: none;
}
.cidade-pop .cidade-aceite a {
  color: var(--lilas-escuro, #7c3aed);
  text-decoration: underline;
}
.cidade-enviar {
  display: block;
  width: 100%;
  padding: 14px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--lilas, #8b5cf6);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s ease-out;
}
.cidade-enviar:hover {
  background: var(--lilas-escuro, #7c3aed);
}
.cidade-enviar:disabled {
  opacity: 0.7;
  cursor: default;
}
.cidade-ok {
  text-align: center;
}
.cidade-ok-ic {
  display: block;
  margin: 4px 0 10px;
  font-size: 30px;
  color: var(--lilas, #8b5cf6);
}
.cidade-ok .cidade-texto {
  margin-bottom: 16px;
}

/* Menu de 3 listras (no lugar do botão "Pedir cuidadora" do topo). */
.menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  /* Toque de 44px sem aumentar o topo: a margem negativa devolve a altura (e alinha as barras à margem da página). */
  margin: -10px -9px -10px 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--lilas, #8b5cf6);
  cursor: pointer;
  transition: color 0.2s ease-out;
}
.menu-btn:hover,
.menu-btn[aria-expanded='true'] {
  color: var(--lilas-escuro, #7c3aed);
}
.menu-btn:focus-visible {
  outline: 2px solid var(--lilas, #8b5cf6);
  outline-offset: 0;
}
/* Três traços grossos e arredondados, desenhados em CSS, sem círculo em volta. */
.menu-barras,
.menu-barras::before,
.menu-barras::after {
  display: block;
  width: 26px;
  height: 4px;
  border-radius: 4px;
  background: currentColor;
}
.menu-barras {
  position: relative;
}
.menu-barras::before,
.menu-barras::after {
  content: '';
  position: absolute;
  left: 0;
}
.menu-barras::before {
  top: -8px;
}
.menu-barras::after {
  top: 8px;
}
.menu-pedir {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 4px 0 14px;
  padding: 14px 18px;
  border-radius: 999px;
  background: var(--lilas, #8b5cf6);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  text-decoration: none;
  transition: background 0.15s ease-out;
}
.menu-pedir:hover {
  background: var(--lilas-escuro, #7c3aed);
  color: #fff;
}
.menu-subtitulo {
  margin: 0 0 2px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 800;
  color: #9ca3af;
}
.cidade-item.desativado {
  color: #9ca3af;
  cursor: default;
}
.cidade-item.desativado:hover {
  background: transparent;
}
.cidade-item small {
  padding: 2px 8px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #6b7280;
  font-size: 11px;
  font-weight: 800;
}
.cidade-pop a.cidade-outra {
  margin-top: 6px;
}

/* Lista de espera: CEP ou localização no lugar da caixa de cidade. */
.cidade-gps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin: 0 0 6px;
  padding: 11px 14px;
  border: 1px solid #ddd6fe;
  border-radius: 12px;
  background: #faf8ff;
  color: var(--lilas-escuro, #7c3aed);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}
.cidade-gps:hover:not(:disabled) {
  background: #f5f3ff;
  border-color: var(--lilas, #8b5cf6);
}
.cidade-gps:disabled {
  opacity: 0.7;
  cursor: default;
}
.cidade-status {
  min-height: 18px;
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  color: #6b7280;
}
.cidade-status.erro {
  color: #b91c1c;
}
.cidade-local {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f5f3ff;
  color: var(--lilas-escuro, #7c3aed);
  font-size: 14px;
}
.cidade-local[hidden] {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .menu-btn,
  .menu-pedir,
  .seletor-cidade,
  .faixa-cidade,
  .topo-familias.scrolled .faixa-cidade,
  .cidade-enviar {
    transition: none;
  }
}

/* Menu (3 listras): painel lateral que abre pela direita, como nas grandes plataformas. */
.menu-lateral {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1100;
  width: min(86vw, 340px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 20px calc(22px + env(safe-area-inset-bottom, 0px));
  background: #fff;
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.18);
  color: var(--preto-fonte, #1f2937);
  transform: translateX(100%);
  transition: transform 0.25s ease-out;
}
.menu-lateral[hidden] {
  display: none;
}
.menu-lateral.aberto {
  transform: none;
}
.menu-lateral h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.3px;
  color: var(--preto-fonte, #1f2937);
}
.menu-lateral .cidade-topo {
  margin-bottom: 16px;
}
.menu-lateral a.cidade-outra {
  margin-top: 6px;
}
/* Com o menu aberto o fundo escurece (também no computador). */
.cidade-fundo.menu {
  background: rgba(17, 24, 39, 0.45);
}
@media (prefers-reduced-motion: reduce) {
  .menu-lateral {
    transition: none;
  }
}
