/* =====================================================================
   Página do mapa — logo no canto superior esquerdo, linha lateral até o
   rodapé (trilho) e barra superior de ferramentas formando um "L".
   ===================================================================== */
html, body { height: 100%; overflow: hidden; }

.app {
  height: 100vh; height: 100dvh;
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  grid-template-rows: 76px minmax(0, 1fr) auto;
  grid-template-areas: "trilho ferramentas" "trilho mapa" "rodape rodape";
}
.rodape-logos { grid-area: rodape; z-index: 1100; }

/* ---------- trilho (coluna lateral) ---------- */
.trilho {
  grid-area: trilho; position: relative; z-index: 1050;
  background: #fff; display: flex; flex-direction: column; min-height: 0;
}
.trilho::after { /* linha lateral: desce da barra superior até o rodapé, sem cruzar as outras listras */
  content: ""; position: absolute; top: calc(76px + var(--listra-esp)); bottom: var(--listra-esp);
  right: calc(-1 * var(--listra-esp)); width: var(--listra-esp); background: var(--listra-vertical); z-index: 2;
}
.trilho__logo { display: block; padding: 18px 26px 10px; flex: none; }
.trilho__logo img { display: block; width: 100%; height: auto; max-height: 290px; object-fit: contain; }
.trilho__corpo { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 4px 0 0; }
.trilho__resumo { padding: 6px 22px 10px; display: flex; align-items: baseline; gap: 8px; }
.trilho__resumo strong { font-family: var(--fonte-titulo); font-size: 2rem; font-weight: 800; color: var(--terracota); line-height: 1; }
.trilho__resumo span { font-size: .85rem; color: var(--tinta-2); line-height: 1.2; }
.trilho__fechar { display: none; }

.legenda { list-style: none; margin: 0; padding: 0 14px 10px; display: flex; flex-direction: column; gap: 2px; }
.legenda button {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 0; background: none;
  border-radius: 8px; cursor: pointer; text-align: left; font-size: .9rem;
}
.legenda button:hover { background: var(--suave); }
.legenda button[aria-pressed="true"] { background: var(--ouro-logo); font-weight: 700; }
.legenda .ponto { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(0,0,0,.08); }
.legenda .nome { flex: 1; }
.legenda .n { font-variant-numeric: tabular-nums; color: var(--tinta-2); font-weight: 700; }
.legenda button.apagado { opacity: .45; }

.aviso-busca {
  margin: 0 14px 8px; padding: 10px 12px; border-radius: 6px; background: var(--suave); border-left: 3px solid var(--ouro-logo); font-size: .85rem; color: var(--tinta-2);
  display: flex; gap: 8px; align-items: flex-start;
}
.aviso-busca strong { color: var(--tinta); }
.aviso-busca button { margin-left: auto; border: 0; background: none; cursor: pointer; color: var(--terracota); font-weight: 700; }

.lista-igs {
  list-style: none; margin: 0; padding: 6px 10px 16px; overflow-y: auto; flex: 1; min-height: 0;
  border-top: 1px solid var(--linha);
  scrollbar-width: thin; scrollbar-color: var(--linha) transparent;
}
.lista-igs button {
  width: 100%; display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: center;
  padding: 8px; border: 0; background: none; border-radius: 10px; cursor: pointer; text-align: left;
}
.lista-igs button:hover { background: var(--suave); }
.lista-igs button.ativo { background: var(--ouro-logo); }
.lista-igs button.ativo .sub { color: var(--tinta); }
.lista-igs .marca { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; overflow: hidden; background: #fff; border: 1px solid var(--linha); }
.lista-igs .marca img { width: 100%; height: 100%; object-fit: contain; }
.lista-igs .marca i { width: 12px; height: 12px; border-radius: 50%; display: block; }
.lista-igs .titulo { font-weight: 700; font-size: .88rem; line-height: 1.25; display: block; color: var(--tinta); }
.lista-igs .sub { font-size: .76rem; color: var(--tinta-2); display: block; line-height: 1.3; margin-top: 1px; }
.lista-igs .sem-local { font-size: .7rem; color: var(--terracota); font-weight: 700; }
.lista-igs .vazio { padding: 18px 10px; color: var(--tinta-2); font-size: .88rem; text-align: center; }

/* ---------- barra de ferramentas ---------- */
.ferramentas {
  grid-area: ferramentas; position: relative; z-index: 1040;
  display: flex; align-items: center; gap: 14px; padding: 0 18px 0 24px;
  background: #fff;
}
.ferramentas::after { content: ""; position: absolute; left: 0; right: 0; bottom: calc(-1 * var(--listra-esp)); height: var(--listra-esp); background: var(--listra); }
.ferramentas__logo-movel { display: none; height: 40px; width: auto; }

.busca { position: relative; flex: 1 1 320px; max-width: 440px; min-width: 200px; }
.busca input {
  width: 100%; height: 44px; border-radius: 999px; border: 1.5px solid var(--linha); background: var(--suave);
  padding: 0 40px 0 42px; font-size: .95rem; outline: none; transition: border-color .15s, background .15s, box-shadow .15s;
}
.busca input:focus { border-color: var(--terracota); background: #fff; box-shadow: 0 0 0 4px rgba(184, 80, 27, .12); }
.busca input::-webkit-search-cancel-button { display: none; }
.busca__icone { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--tinta-3); pointer-events: none; }
.busca__limpar { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border-radius: 50%; border: 0; background: var(--linha); cursor: pointer; font-size: 1.1rem; line-height: 1; }
.busca__sugestoes {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: #fff; border-radius: var(--raio);
  box-shadow: var(--sombra-forte); padding: 8px; max-height: min(70vh, 460px); overflow-y: auto; z-index: 1200;
}
.sugestoes__grupo { font-family: var(--fonte-titulo); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; font-size: .7rem; color: var(--tinta-3); padding: 8px 10px 4px; }
.sugestao { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; cursor: pointer; font-size: .92rem; }
.sugestao[aria-selected="true"], .sugestao:hover { background: var(--suave); }
.sugestao .ponto { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.sugestao__produto { color: var(--tinta-2); }
.sugestao small { color: var(--tinta-3); margin-left: auto; white-space: nowrap; }
.sugestao svg { width: 14px; height: 14px; color: var(--tinta-3); flex: none; }
.sugestoes__dica { padding: 8px 10px; font-size: .8rem; color: var(--tinta-3); border-top: 1px solid var(--linha); margin-top: 6px; }

.filtros { display: flex; align-items: flex-end; gap: 10px; }
.filtro { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.filtro span { font-family: var(--fonte-titulo); font-weight: 700; text-transform: uppercase; letter-spacing: .09em; font-size: .66rem; color: var(--tinta-3); padding-left: 12px; }
.filtro select {
  height: 36px; max-width: 170px; border-radius: 999px; border: 1.5px solid var(--linha); background: #fff;
  padding: 0 30px 0 12px; font-size: .86rem; cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='%238A827A' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 14px;
}
.filtro select.ativo { border-color: var(--terracota); background-color: #fff; color: var(--terracota-escuro); font-weight: 700; }
.filtros__limpar { height: 36px; border: 0; background: none; color: var(--terracota); font-weight: 700; cursor: pointer; padding: 0 6px; }
.botao-filtros { display: none; }

.botao-saiba {
  margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 6px; height: 42px; padding: 0 18px;
  border-radius: 999px; background: var(--terracota); color: #fff; text-decoration: none; font-weight: 700;
  font-family: var(--fonte-titulo); letter-spacing: .04em; text-transform: uppercase; font-size: .9rem;
  box-shadow: 0 4px 14px rgba(184, 80, 27, .28); transition: background .15s, transform .1s;
}
.botao-saiba:hover { background: var(--terracota-escuro); }
.botao-saiba svg { width: 16px; height: 16px; }

/* ---------- mapa ---------- */
.area-mapa { grid-area: mapa; position: relative; min-height: 0; overflow: hidden; }
.mapa { position: absolute; inset: 0; background: #EEF0EC; z-index: 0; isolation: isolate; } /* controles do Leaflet ficam abaixo do painel */
.leaflet-container { font-family: var(--fonte-texto); }
.leaflet-control-attribution { font-size: 10px; background: rgba(255,255,255,.75) !important; }
.leaflet-bar { border: 0 !important; box-shadow: var(--sombra) !important; border-radius: 12px !important; overflow: hidden; }
.leaflet-bar a { width: 36px !important; height: 36px !important; line-height: 36px !important; color: var(--tinta) !important; }
/* mapa de fundo discreto: os pins e as áreas é que chamam a atenção */
.tiles-suave { filter: grayscale(.55) saturate(.8) contrast(.95) brightness(1.03); }
.leaflet-control-layers { border: 0 !important; border-radius: 12px !important; box-shadow: var(--sombra) !important; font-family: var(--fonte-texto); font-size: .85rem; }
.leaflet-control-layers-expanded { padding: 10px 14px !important; }
.leaflet-tooltip { border-radius: 8px; border: 0; box-shadow: var(--sombra); font-weight: 600; font-size: .82rem; padding: 5px 10px; }

.pin-ig { background: none; border: 0; }
.pin-ig svg { width: 100%; height: 100%; filter: drop-shadow(0 3px 3px rgba(43,39,35,.35)); transition: transform .18s; transform-origin: 50% 100%; }
.pin-ig:hover svg { transform: scale(1.12); }
.pin-ig.ativo { z-index: 1000 !important; }
.pin-ig.ativo svg { animation: pulo .5s ease-out; }
.pin-img { filter: drop-shadow(0 3px 3px rgba(43,39,35,.35)); }
@keyframes pulo { 0% { transform: translateY(-14px) scale(1.05); } 60% { transform: translateY(0) scale(1); } 80% { transform: translateY(-3px); } 100% { transform: none; } }

.cluster-ig { background: none; }
.cluster-ig span {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: var(--terracota); color: #fff; font-family: var(--fonte-titulo); font-weight: 800; font-size: 1rem;
  border: 3px solid #fff; box-shadow: 0 0 0 4px rgba(184, 80, 27, .25), var(--sombra);
}
.marco-municipio { border-radius: 50%; background: rgba(79, 145, 189, .18); border: 2px solid var(--azul); animation: marco 1.8s ease-out infinite; }
@keyframes marco { 0% { box-shadow: 0 0 0 0 rgba(79,145,189,.45); } 100% { box-shadow: 0 0 0 22px rgba(79,145,189,0); } }

.controles-mapa { position: absolute; top: 16px; right: 16px; z-index: 700; display: flex; flex-direction: column; gap: 8px; }
.controle {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px 0 11px; border-radius: 999px;
  border: 0; background: #fff; box-shadow: var(--sombra); cursor: pointer; font-weight: 700; font-size: .82rem; color: var(--tinta-2);
}
.controle svg { width: 18px; height: 18px; }
.controle.ativo { color: var(--terracota); }
.controle--lista { display: none; }

/* ---------- painel lateral da IG ---------- */
.painel-ig {
  position: absolute; z-index: 800; top: 0; bottom: 0; left: 0; width: min(430px, 100%);
  background: #fff; box-shadow: var(--sombra-forte); overflow-y: auto; overscroll-behavior: contain;
  transform: translateX(-104%); transition: transform .32s cubic-bezier(.2, .8, .2, 1);
  padding: 0 26px 28px;
}
.painel-ig.aberto { transform: none; }
.painel-ig__barra {
  position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center;
  margin: 0 -26px 14px; padding: 14px 18px 10px 26px; background: linear-gradient(#fff 75%, rgba(255,255,255,0));
}
.painel-ig__barra span { font-family: var(--fonte-titulo); font-weight: 700; text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; color: var(--terracota); }
.painel-ig__fechar { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--suave); cursor: pointer; font-size: 1.3rem; line-height: 1; }
.painel-ig__fechar:hover { background: var(--linha); }
.painel-ig__vizinhas { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--linha); display: flex; flex-wrap: wrap; gap: 6px; }
.painel-ig__vizinhas > span { width: 100%; font-family: var(--fonte-titulo); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: .74rem; color: var(--tinta-3); }
.painel-ig__vizinhas .chip { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.painel-ig__vizinhas .chip:hover { border-color: var(--terracota); color: var(--terracota); }
.painel-ig__vizinhas .chip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ---------- responsivo ---------- */
@media (max-height: 760px) and (min-width: 901px) {
  .trilho__logo img { max-height: 190px; }
}

@media (max-width: 1240px) {
  .botao-filtros {
    display: inline-flex; align-items: center; gap: 6px; height: 42px; padding: 0 14px; border-radius: 999px;
    border: 1.5px solid var(--linha); background: #fff; cursor: pointer; font-weight: 700; font-size: .88rem; flex: none;
  }
  .botao-filtros svg { width: 18px; height: 18px; }
  .botao-filtros__n { background: var(--terracota); color: #fff; border-radius: 999px; font-size: .72rem; padding: 0 7px; }
  .filtros {
    display: none; position: absolute; top: calc(100% + 10px); right: 18px; width: min(340px, calc(100vw - 36px));
    flex-direction: column; align-items: stretch; gap: 12px; padding: 16px; background: #fff; border-radius: var(--raio);
    box-shadow: var(--sombra-forte); z-index: 1200;
  }
  .filtros.aberto { display: flex; }
  .filtro select { max-width: none; width: 100%; height: 40px; }
  .filtros__limpar { align-self: flex-end; }
}

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; grid-template-areas: "ferramentas" "mapa" "rodape"; }
  .ferramentas { flex-wrap: wrap; padding: 10px 12px 12px; gap: 10px; }
  .ferramentas__logo-movel { display: block; height: 34px; }
  .busca { order: 3; flex: 1 1 100%; max-width: none; }
  .botao-filtros { margin-left: auto; height: 38px; }
  .botao-saiba { margin-left: 0; height: 38px; padding: 0 12px; font-size: .8rem; }
  .trilho {
    position: fixed; top: 0; bottom: 0; left: 0; width: min(340px, 88vw); z-index: 1300; box-shadow: var(--sombra-forte);
    transform: translateX(-105%); transition: transform .3s;
  }
  .trilho.aberto { transform: none; }
  .trilho__logo img { max-height: 150px; }
  .trilho__fechar { display: block; position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--suave); font-size: 1.3rem; cursor: pointer; z-index: 3; }
  .controle--lista { display: inline-flex; }
  .controle span { display: none; }
  .controle--lista span { display: inline; }
  .controle { padding: 0 11px; }
  .painel-ig {
    top: auto; right: 0; width: 100%; max-height: 78%; border-radius: 20px 20px 0 0;
    transform: translateY(104%);
  }
  .painel-ig.aberto { transform: none; }
  .painel-ig__barra { border-radius: 20px 20px 0 0; }
  .painel-ig__barra::before { content: ""; position: absolute; left: 50%; top: 6px; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: var(--linha); }
  .rodape-logos__info { display: none; }
}
