/* ============================================================
   MAPA INTERATIVO — busca de unidade, ponto azul e rota
   (aparece só quando o lightbox está com o mapa oficial)
   ============================================================ */
.mapa-busca, .mapa-msg, .mapa-card, .mapa-overlay{ display:none; }
#lightbox.modo-mapa .mapa-busca{ display:flex; }
#lightbox.modo-mapa .mapa-overlay{ display:block; }
#lightbox.modo-mapa .mapa-msg:not([hidden]){ display:block; }
#lightbox.modo-mapa .mapa-card:not([hidden]){ display:block; }
#lightbox.modo-mapa #lb-cap{ display:none; }
#lightbox.modo-mapa #lb-close{ z-index:5; background:rgba(10,14,10,.72); box-shadow:0 8px 24px rgba(0,0,0,.35); }
#lightbox.modo-mapa #lb-close:hover{ background:var(--green); }

.mi{ width:18px; height:18px; flex:none; }

/* ---- camada SVG sobre a imagem (mesmo transform) ---- */
.mapa-overlay{
  position:absolute; left:0; top:0; z-index:1; overflow:visible; pointer-events:none;
  transform-origin:center center;
  transition:transform .18s cubic-bezier(.22,.61,.36,1);
}
.mapa-overlay.dragging{ transition:none; will-change:transform; }

/* ---- barra de busca ---- */
.mapa-busca{
  position:absolute; z-index:4; top:22px; left:50%; transform:translateX(-50%);
  width:min(540px, calc(100vw - 200px)); gap:6px; padding:6px;
  align-items:stretch; border-radius:999px;
  background:var(--surface); border:1px solid var(--line);
  box-shadow:0 16px 44px rgba(0,0,0,.38);
  transition:box-shadow .2s;
}
.mapa-busca:focus-within{ box-shadow:0 0 0 3px rgba(141,198,63,.55), 0 16px 44px rgba(0,0,0,.38); }
.mapa-busca.erro{ animation:mbTreme .42s; }
@keyframes mbTreme{
  20%,60%{ transform:translateX(calc(-50% - 7px)); }
  40%,80%{ transform:translateX(calc(-50% + 7px)); }
}
.mb-campo{
  flex:1; min-width:0; display:flex; align-items:center; gap:9px;
  padding:0 4px 0 14px; color:var(--muted); cursor:text;
}
.mb-campo input{
  flex:1; min-width:0; border:0; outline:0; background:transparent; color:var(--text);
  font:700 1.02rem/1 var(--font-head); letter-spacing:.04em; padding:12px 0;
}
.mb-campo input::placeholder{ color:var(--muted); font-weight:500; letter-spacing:0; }
.mb-limpar{
  width:30px; height:30px; flex:none; border:0; border-radius:50%; cursor:pointer;
  display:grid; place-items:center; background:var(--surface-2); color:var(--muted);
}
.mb-limpar[hidden]{ display:none; }
.mb-limpar .mi{ width:15px; height:15px; }
.mb-buscar{
  border:0; border-radius:999px; padding:0 22px; cursor:pointer;
  background:var(--grad); color:#fff; font:700 .95rem var(--font-head); letter-spacing:.01em;
  transition:filter .2s, transform .2s;
}
.mb-buscar:hover{ filter:brightness(1.06); }
.mb-buscar:active{ transform:scale(.97); }
.mb-eu{
  width:44px; flex:none; border:0; border-radius:50%; cursor:pointer;
  display:grid; place-items:center; background:var(--surface-2); color:#1a73e8;
  transition:background .2s, color .2s;
}
.mb-eu .mi{ width:20px; height:20px; }
.mb-eu.ativo{ background:#1a73e8; color:#fff; }

/* ---- aviso curto abaixo da busca ---- */
.mapa-msg{
  position:absolute; z-index:4; top:86px; left:50%; transform:translateX(-50%);
  width:max-content; max-width:min(540px, calc(100vw - 24px));
  padding:9px 16px; border-radius:14px; text-align:center;
  background:rgba(10,14,10,.82); color:#fff; backdrop-filter:blur(6px);
  font:600 .87rem/1.4 var(--font-body);
  animation:mcEntra .22s ease-out;
}
.mapa-msg.erro{ background:rgba(196,48,43,.95); }

/* ---- cartão do resultado ---- */
.mapa-card{
  position:absolute; z-index:4; left:22px; bottom:22px;
  width:min(380px, calc(100vw - 24px)); max-height:min(62svh, 540px); overflow:auto;
  overscroll-behavior:contain; padding:16px 16px 14px;
  border-radius:20px; background:var(--surface); color:var(--text);
  border:1px solid var(--line); box-shadow:0 22px 60px rgba(0,0,0,.45);
  animation:mcEntra .26s ease-out;
}
@keyframes mcEntra{ from{ opacity:0; translate:0 10px; } }
.mc-fechar{
  position:absolute; top:10px; right:10px; width:32px; height:32px; border:0; border-radius:50%;
  display:grid; place-items:center; cursor:pointer; background:var(--surface-2); color:var(--muted);
}
.mc-fechar .mi{ width:16px; height:16px; }
.mc-topo{ display:flex; align-items:center; gap:12px; padding-right:34px; }
.mc-ico{
  width:44px; height:44px; flex:none; border-radius:14px; display:grid; place-items:center;
  background:var(--grad); color:#fff;
}
.mc-ico .mi{ width:22px; height:22px; }
.mc-tit{ display:flex; flex-direction:column; gap:2px; min-width:0; }
.mc-titulo{ font:800 1.08rem/1.2 var(--font-head); color:var(--ink); }
.mc-sub{ color:var(--muted); font-size:.84rem; line-height:1.35; }
.mc-rota{
  margin-top:13px; padding-top:12px; border-top:1px solid var(--line);
  display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap;
}
.mc-rota[hidden]{ display:none; }
.mc-dist{ display:flex; align-items:center; gap:8px; font-size:.92rem; color:var(--text); }
.mc-dist .mi{ color:#1a73e8; }
.mc-dist b{ font-family:var(--font-head); color:var(--ink); }
.mc-toggle{
  display:inline-flex; align-items:center; gap:4px; border:0; cursor:pointer;
  padding:7px 12px; border-radius:999px; background:var(--surface-2); color:var(--text);
  font:700 .8rem var(--font-head);
}
.mc-toggle .mi{ width:15px; height:15px; transition:transform .2s; }
.mc-toggle.aberto .mi{ transform:rotate(180deg); }
.mc-passos{ list-style:none; margin:12px 0 0; padding:0; display:grid; gap:9px; counter-reset:passo; }
.mc-passos[hidden]{ display:none; }
.mc-passos li{ display:flex; align-items:flex-start; gap:10px; font-size:.88rem; line-height:1.4; }
.mc-passos li .mi{
  width:28px; height:28px; padding:5px; border-radius:9px; flex:none;
  background:rgba(26,115,232,.12); color:#1a73e8;
}
.mc-passos li:last-child .mi{ background:rgba(46,158,63,.14); color:var(--green); }
.mc-passos b{ color:var(--ink); }
.mc-nota{
  margin:12px 0 0; padding:10px 12px; border-radius:12px; background:var(--surface-2);
  color:var(--muted); font-size:.84rem; line-height:1.45;
}
.mc-nota[hidden]{ display:none; }
.mc-nota b{ color:var(--ink); }

.mc-acoes{ display:flex; gap:8px; margin-top:12px; }
.mc-acoes[hidden]{ display:none; }
.mc-local, .mc-iniciar{
  flex:1; min-width:0; padding:13px 12px; border-radius:14px; cursor:pointer;
  display:flex; align-items:center; justify-content:center; gap:8px;
  font:800 .95rem var(--font-head); letter-spacing:.01em; transition:transform .15s, filter .2s;
}
.mc-local{ border:1.5px solid var(--line); background:var(--surface-2); color:var(--text); }
.mc-iniciar{ border:0; background:#1a73e8; color:#fff; box-shadow:0 8px 22px rgba(26,115,232,.35); }
.mc-iniciar[hidden]{ display:none; }
.mc-local:active, .mc-iniciar:active{ transform:scale(.97); }
.mc-local .mi, .mc-iniciar .mi{ width:18px; height:18px; }

/* "Ver o local": cartão enxuto para sobrar mapa para arrastar */
.mapa-card.compacto{ padding:12px 12px 10px; }
.mapa-card.compacto .mc-sub{ display:none; }
.mapa-card.compacto .mc-ico{ width:36px; height:36px; border-radius:11px; }
.mapa-card.compacto .mc-ico .mi{ width:19px; height:19px; }
.mapa-card.compacto .mc-acoes{ margin-top:10px; }
.mapa-card.compacto .mc-local, .mapa-card.compacto .mc-iniciar{ padding:10px 10px; font-size:.9rem; }

/* ---- navegação ("Iniciar viagem") ---- */
.mapa-nav-topo, .mapa-nav-base, .mapa-recentrar{ display:none; }
#lightbox.navegando .mapa-busca, #lightbox.navegando .mapa-card, #lightbox.navegando #lb-close{ display:none !important; }
#lightbox.navegando .mapa-nav-topo:not([hidden]){ display:flex; }
#lightbox.navegando .mapa-nav-base:not([hidden]){ display:flex; }
#lightbox.navegando .mapa-recentrar:not([hidden]){ display:flex; }
.mapa-nav-topo{
  position:absolute; z-index:6; top:12px; left:10px; right:10px; align-items:center; gap:14px;
  padding:14px 16px; border-radius:18px; background:#0f6b3a; color:#fff;
  box-shadow:0 14px 36px rgba(0,0,0,.4); animation:mcEntra .25s ease-out;
}
.mapa-nav-topo.chegou{ background:#1a73e8; }
.nt-ico .mi{ width:42px; height:42px; stroke-width:2.4; }
.nt-txt{ display:flex; flex-direction:column; gap:2px; min-width:0; }
.nt-dist{ font:800 1.55rem/1.1 var(--font-head); }
.nt-acao{ font:600 .98rem/1.3 var(--font-body); opacity:.95; }
.mapa-nav-base{
  position:absolute; z-index:6; left:10px; right:10px; bottom:10px; align-items:center; gap:10px;
  padding:12px 12px 12px 18px; border-radius:18px; background:var(--surface); color:var(--text);
  border:1px solid var(--line); box-shadow:0 14px 36px rgba(0,0,0,.4);
}
.nb-info{ flex:1; min-width:0; display:flex; flex-direction:column; }
.nb-tempo{ font:800 1.3rem/1.15 var(--font-head); color:#0f6b3a; }
html[data-theme="dark"] .nb-tempo{ color:var(--lime); }
.nb-resto{ color:var(--muted); font-size:.86rem; }
.nb-voz{
  width:46px; height:46px; flex:none; border:0; border-radius:50%; cursor:pointer;
  display:grid; place-items:center; background:var(--surface-2); color:var(--text);
}
.nb-voz.mudo{ color:var(--muted); }
.nb-voz .mi{ width:21px; height:21px; }
.nb-sair{
  border:0; border-radius:999px; padding:13px 20px; cursor:pointer;
  background:#d93025; color:#fff; font:800 .95rem var(--font-head);
}
.mapa-recentrar{
  position:absolute; z-index:6; left:50%; bottom:92px; transform:translateX(-50%);
  align-items:center; gap:8px; padding:11px 18px; border:0; border-radius:999px; cursor:pointer;
  background:var(--surface); color:#1a73e8; font:800 .9rem var(--font-head);
  box-shadow:0 10px 28px rgba(0,0,0,.35);
}
.mapa-recentrar .mi{ width:17px; height:17px; }

/* ---- elementos desenhados no mapa ---- */
.mo-grupo rect{ fill:rgba(141,198,63,.28); stroke:#8dc63f; }
.mo-eu-seta{ fill:#1a73e8; stroke:#fff; stroke-width:2; stroke-linejoin:round; }
.mo-predio-ret{ fill:rgba(141,198,63,.2); stroke:#8dc63f; }
.mo-predio-glow{ fill:none; stroke:#8dc63f; animation:moBrilho 1.6s ease-in-out infinite; }
@keyframes moBrilho{ 0%,100%{ stroke-opacity:.12; } 50%{ stroke-opacity:.65; } }
.mo-rota-casca{ fill:none; stroke:#fff; stroke-linecap:round; stroke-linejoin:round; }
.mo-rota-linha{ fill:none; stroke:#1a73e8; stroke-linecap:round; stroke-linejoin:round; }
.mo-tracejado{ fill:none; stroke:#1a73e8; stroke-linecap:round; stroke-linejoin:round; }
.mo-precisao{ fill:rgba(26,115,232,.13); stroke:rgba(26,115,232,.45); }
.mo-eu-ponto{ fill:#1a73e8; stroke:#fff; stroke-width:3; }
.mo-eu-pulso, .mo-pin-pulso{
  transform-box:fill-box; transform-origin:center; animation:moPulso 2s ease-out infinite;
}
.mo-eu-pulso{ fill:#1a73e8; }
.mo-pin-pulso{ fill:#2e9e3f; }
@keyframes moPulso{ from{ transform:scale(1); opacity:.5; } to{ transform:scale(3.2); opacity:0; } }
.mo-pin{ fill:#2e9e3f; stroke:#fff; stroke-width:2.5; }
.mo-pin-furo{ fill:#fff; }
.mo-rotulo rect{ fill:#14240c; stroke:#8dc63f; stroke-width:1.5; }
.mo-rotulo text{ fill:#fff; font:800 12.5px var(--font-head); letter-spacing:.02em; }

@media (prefers-reduced-motion: reduce){
  .mo-predio-glow, .mo-eu-pulso, .mo-pin-pulso, .mapa-busca.erro, .mapa-card, .mapa-msg{ animation:none; }
}

/* ---- celular ---- */
@media (max-width:720px){
  #lightbox.modo-mapa #lb-close{ top:12px; right:10px; width:46px; height:46px; }
  .mapa-busca{ top:12px; left:10px; right:64px; width:auto; transform:none; padding:5px; }
  .mapa-busca.erro{ animation-name:mbTremeM; }
  .mb-campo{ padding-left:11px; gap:7px; }
  .mb-campo > .mi{ display:none; }
  .mb-campo input{ font-size:16px; padding:10px 0; }   /* 16px evita o zoom automático do iOS */
  .mb-buscar{ padding:0 14px; font-size:.9rem; }
  .mapa-msg{ top:72px; }
  .mapa-card{ left:10px; right:10px; bottom:10px; width:auto; max-height:46svh; padding:14px 14px 12px; }
  .mc-ico{ width:40px; height:40px; border-radius:12px; }
}
@keyframes mbTremeM{ 20%,60%{ transform:translateX(-6px); } 40%,80%{ transform:translateX(6px); } }

/* ---- pedido de localização (celular) ---- */
.mapa-gps{ display:none; }
#lightbox.modo-mapa .mapa-gps:not([hidden]){
  display:grid; place-items:center; position:absolute; inset:0; z-index:8; padding:16px;
  background:rgba(10,14,10,.55); backdrop-filter:blur(3px);
}
.mg-caixa{
  width:min(360px, 100%); max-height:calc(100svh - 32px); overflow:auto;
  display:flex; flex-direction:column; align-items:center; gap:10px; text-align:center;
  padding:24px 20px 18px; border-radius:22px; background:var(--surface); color:var(--text);
  border:1px solid var(--line); box-shadow:0 24px 60px rgba(0,0,0,.5); animation:mcEntra .25s ease-out;
}
.mg-ico{
  width:60px; height:60px; border-radius:50%; display:grid; place-items:center;
  background:rgba(26,115,232,.14); color:#1a73e8;
}
.mg-ico .mi{ width:30px; height:30px; }
.mapa-gps[data-tipo="negado"] .mg-ico, .mapa-gps[data-tipo="indisponivel"] .mg-ico,
.mapa-gps[data-tipo="semSuporte"] .mg-ico{ background:rgba(217,48,37,.12); color:#d93025; }
.mapa-gps[data-tipo="aguardando"] .mg-ico .mi{ animation:mgPulsa 1.2s ease-in-out infinite; }
@keyframes mgPulsa{ 50%{ transform:scale(.8); opacity:.6; } }
.mg-tit{ font:800 1.2rem/1.2 var(--font-head); color:var(--ink); }
.mg-txt{ margin:0; font-size:.92rem; line-height:1.5; color:var(--muted); }
.mg-txt b{ color:var(--ink); }
.mg-passos{ margin:2px 0 4px; padding-left:20px; text-align:left; display:grid; gap:8px; font-size:.86rem; line-height:1.45; }
.mg-passos[hidden]{ display:none; }
.mg-passos b{ color:var(--ink); }
.mg-sim{
  width:100%; margin-top:6px; padding:14px 16px; border:0; border-radius:14px; cursor:pointer;
  display:flex; align-items:center; justify-content:center; gap:9px;
  background:#1a73e8; color:#fff; font:800 1rem var(--font-head);
  box-shadow:0 8px 22px rgba(26,115,232,.35);
}
.mg-sim .mi{ width:19px; height:19px; }
.mg-nao{
  width:100%; padding:11px; border:0; border-radius:12px; cursor:pointer;
  background:transparent; color:var(--muted); font:700 .92rem var(--font-head);
}
@media (prefers-reduced-motion: reduce){
  .mg-caixa, .mapa-gps[data-tipo="aguardando"] .mg-ico .mi{ animation:none; }
}

/* ---- gestos: o mapa cuida do toque (nada de zoom/rolagem da página) ---- */
#lightbox.modo-mapa, #lightbox.modo-mapa #lb-img{ touch-action:none; overscroll-behavior:none; }
#lightbox.modo-mapa #lb-img{ cursor:grab; -webkit-user-select:none; user-select:none; }
#lightbox.modo-mapa #lb-img.dragging{ cursor:grabbing; }
#lightbox.modo-mapa .mapa-card, #lightbox.modo-mapa .mg-caixa{ touch-action:pan-y; }
#lightbox.modo-mapa .mapa-busca{ position:fixed; }   /* busca sempre fixa no topo */

/* ---- aviso fixo: fora do condomínio ---- */
.mapa-fora{ display:none; }
#lightbox.modo-mapa .mapa-fora:not([hidden]){
  display:flex; align-items:center; gap:10px;
  position:fixed; z-index:4; top:86px; left:50%; transform:translateX(-50%);
  width:max-content; max-width:calc(100vw - 24px); padding:10px 16px 10px 12px; border-radius:16px;
  background:var(--surface); color:var(--text); border:1px solid var(--line);
  box-shadow:0 12px 32px rgba(0,0,0,.35); animation:mcEntra .25s ease-out;
}
.mapa-fora .mi{ width:22px; height:22px; color:#d93025; }
.mapa-fora span{ display:flex; flex-direction:column; line-height:1.3; }
.mapa-fora b{ font:800 .92rem var(--font-head); color:var(--ink); }
.mapa-fora small{ font-size:.8rem; color:var(--muted); }
#lightbox.fora-do-mapa .mapa-msg{ top:146px; }
#lightbox.navegando .mapa-fora{ display:none !important; }
@media (max-width:720px){
  #lightbox.modo-mapa .mapa-fora:not([hidden]){ top:72px; }
  #lightbox.fora-do-mapa .mapa-msg{ top:132px; }
}
