:root {
  --verde-acento: #009739;
  --verde-escuro: #006b2d;
  --vermelho: #ce1126;
  --dourado: #d4a017;
  --azul: #002776;
  --amarelo: #fedd00;
  --texto: #1a1a1a;
  --texto-secundario: #4a4a4a;
  --texto-discreto: #8c8782;
  --fundo-carta: #ffffff;
  --fundo-primario: #faf9f5;
  --fundo-secundario: #f0ede5;
  --borda: #e0ddd5;
  --rodape-fundo: #f5f2e9;
}

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

html,
body {
  height: 100%;
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
  color: var(--texto);
}

#aplicativo {
  display: flex;
  height: 100vh;
}

#painel {
  width: 400px;
  min-width: 400px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--fundo-carta);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.04);
  z-index: 1000;
}

#cabecalho-painel {
  background: linear-gradient(
    to bottom,
    var(--verde-escuro),
    var(--verde-acento)
  );
  padding: 28px 28px 24px;
  display: flex;
  gap: 12px;
}

.titulo-linha {
  display: flex;
  flex-direction: column;
  align-items: start;
  gap: 12px;
}

.icone-berimbau {
  flex-shrink: 0;
}

#cabecalho-painel h1 {
  font-family: "Anton", sans-serif;
  font-size: 26px;
  font-weight: 400;
  letter-spacing: 0.5px;
  color: #fff;
}

.subtitulo {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.67);
}

.faixa-bandeira {
  display: flex;
  height: 4px;
  border-radius: 2px;
  overflow: hidden;
}

.faixa-bandeira span:nth-child(1) {
  background: var(--verde-acento);
}
.faixa-bandeira span:nth-child(2) {
  background: var(--amarelo);
}
.faixa-bandeira span:nth-child(3) {
  background: var(--azul);
}
.faixa-bandeira span:nth-child(4) {
  background: #fff;
}
.faixa-bandeira span:nth-child(5) {
  background: var(--vermelho);
}
.faixa-bandeira span:nth-child(6) {
  background: #1a1a1a;
}

.faixa-bandeira span {
  flex: 1;
}

#cabecalho-movel {
  display: none;
}

#container-busca {
  padding: 16px 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#campo-busca {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--fundo-secundario);
  border-radius: 10px;
  padding: 0 14px;
  height: 44px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

#campo-busca svg {
  color: var(--texto-discreto);
  flex-shrink: 0;
}

#campo-busca input {
  border: none;
  background: none;
  outline: none;
  font-family: inherit;
  font-size: 13px;
  color: var(--texto);
  width: 100%;
}

#campo-busca input::placeholder {
  color: var(--texto-discreto);
}

#abas-filtro {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

#abas-filtro::-webkit-scrollbar {
  display: none;
}

#abas-filtro .aba {
  border: none;
  background: var(--fundo-secundario);
  color: var(--texto-secundario);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 0 16px;
  height: 32px;
  border-radius: 16px;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.15s,
    color 0.15s;
}

#abas-filtro .aba.ativa {
  background: var(--verde-acento);
  color: #fff;
  font-weight: 600;
}

#abas-filtro .aba:hover:not(.ativa) {
  background: #e5e2da;
}

#lista-locais {
  flex: 1;
  overflow-y: auto;
  padding: 8px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#contagem-resultados {
  font-size: 12px;
  font-weight: 500;
  color: var(--texto-discreto);
  margin-bottom: 2px;
}

.cartao {
  background: var(--fundo-carta);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  cursor: pointer;
  transition: box-shadow 0.15s;
}

.cartao:hover {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.cartao-cabecalho {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cartao-ponto {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cartao-grupo {
  font-size: 14px;
  font-weight: 600;
}

.cartao-detalhe {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cartao-detalhe svg {
  color: var(--texto-discreto);
  flex-shrink: 0;
}

.cartao-detalhe .texto-responsavel {
  font-size: 13px;
  color: var(--texto-secundario);
}

.cartao-detalhe .texto-endereco {
  font-size: 12px;
  color: var(--texto-discreto);
}

.cartao-detalhe .texto-telefone {
  font-size: 12px;
  color: var(--texto-discreto);
}

.cartao-horario {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 153, 57, 0.05);
  border-radius: 6px;
  padding: 6px 10px;
}

.cartao-horario svg {
  color: var(--verde-acento);
  flex-shrink: 0;
}

.cartao-horario span {
  font-size: 12px;
  color: var(--verde-acento);
}

#rodape-painel {
  padding: 10px 20px;
  background: var(--rodape-fundo);
  text-align: center;
  font-size: 10px;
  color: var(--texto-discreto);
}

#area-mapa {
  flex: 1;
  position: relative;
  min-width: 0;
}

#mapa {
  height: 100%;
  width: 100%;
}

.leaflet-control-zoom {
  border: none !important;
  border-radius: 8px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07) !important;
  overflow: hidden;
}

.leaflet-control-zoom a {
  width: 36px !important;
  height: 36px !important;
  line-height: 36px !important;
  font-size: 18px !important;
  color: var(--texto) !important;
  background: var(--fundo-carta) !important;
  border-bottom: 1px solid var(--borda) !important;
}

.leaflet-control-zoom a:last-child {
  border-bottom: none !important;
}

.leaflet-control-zoom a:hover {
  background: var(--fundo-secundario) !important;
}

.leaflet-popup-content-wrapper {
  border-radius: 12px !important;
  padding: 0 !important;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12) !important;
}

.leaflet-popup-content {
  margin: 0 !important;
  min-width: 240px;
}

.leaflet-popup-tip {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
}

.leaflet-popup-close-button {
  color: rgba(255, 255, 255, 0.8) !important;
  font-size: 20px !important;
  top: 8px !important;
  right: 10px !important;
  z-index: 1;
}

.popup-cabecalho {
  background: linear-gradient(
    to bottom,
    var(--verde-escuro),
    var(--verde-acento)
  );
  padding: 14px 16px 10px;
}

.popup-cabecalho h3 {
  font-family: "Anton", sans-serif;
  font-size: 16px;
  font-weight: 400;
  color: #fff;
  margin: 0;
}

.popup-corpo {
  padding: 12px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.popup-linha {
  display: flex;
  align-items: center;
  gap: 6px;
}

.popup-linha svg {
  color: var(--texto-discreto);
  flex-shrink: 0;
}

.popup-linha .texto-nome {
  font-size: 12px;
  color: var(--texto);
}

.popup-linha .texto-endereco {
  font-size: 11px;
  color: var(--texto-secundario);
}

.popup-linha .texto-telefone {
  font-size: 11px;
  color: var(--texto-secundario);
}

.popup-horario {
  background: rgba(0, 153, 57, 0.05);
  border-radius: 6px;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--verde-acento);
  line-height: 1.5;
}

.popup-faixa {
  display: flex;
  height: 4px;
}

.popup-faixa span:nth-child(1) {
  background: var(--amarelo);
}
.popup-faixa span:nth-child(2) {
  background: var(--verde-acento);
}
.popup-faixa span:nth-child(3) {
  background: var(--vermelho);
}

.popup-faixa span {
  flex: 1;
}

.marcador-personalizado {
  background: none !important;
  border: none !important;
}

#busca-movel {
  display: none;
}

#carregando {
  position: fixed;
  inset: 0;
  background: rgba(250, 249, 245, 0.92);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s;
}

#carregando.escondido {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  border: 4px solid var(--borda);
  border-top: 4px solid var(--verde-acento);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: girar 0.8s linear infinite;
}

@keyframes girar {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 768px) {
  #aplicativo {
    flex-direction: column;
  }

  #painel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    min-width: unset;
    height: auto;
    max-height: 55vh;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
    transform: translateY(0);
    transition: transform 0.3s ease;
    z-index: 1001;
  }

  #painel.fechado {
    transform: translateY(100%);
  }

  #cabecalho-painel {
    display: none;
  }

  #cabecalho-movel {
    display: flex;
    flex-direction: column;
    padding: 12px 16px 0;
  }

  .cabecalho-movel-conteudo {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 12px;
  }

  .cabecalho-movel-conteudo h2 {
    flex: 1;
    font-family: "Anton", sans-serif;
    font-size: 20px;
    font-weight: 400;
    color: var(--texto);
  }

  .btn-fechar-painel {
    border: none;
    background: none;
    color: var(--texto-secundario);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
  }

  .selo-contagem {
    background: var(--verde-acento);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 0 10px;
    height: 24px;
    line-height: 24px;
    border-radius: 12px;
  }

  #campo-busca {
    display: none;
  }

  #container-busca {
    padding: 0 20px 12px;
  }

  #lista-locais {
    padding: 0 20px 16px;
  }

  #rodape-painel {
    display: none;
  }

  #area-mapa {
    width: 100%;
    height: 100vh;
  }

  #busca-movel {
    display: flex;
    align-items: center;
    gap: 10px;
    position: absolute;
    top: 10px;
    left: 16px;
    right: 16px;
    background: var(--fundo-carta);
    border-radius: 24px;
    padding: 0 14px;
    height: 48px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    z-index: 1000;
  }

  #busca-movel svg:first-child {
    color: var(--texto-discreto);
    flex-shrink: 0;
  }

  #busca-movel input {
    border: none;
    background: none;
    outline: none;
    font-family: inherit;
    font-size: 14px;
    color: var(--texto);
    flex: 1;
    min-width: 0;
  }

  #busca-movel input::placeholder {
    color: var(--texto-discreto);
  }

  #btn-abrir-painel {
    border: none;
    background: none;
    color: var(--texto-secundario);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
  }

  .leaflet-control-zoom {
    margin-right: 16px !important;
    margin-top: 70px !important;
  }
}
