/*
 * Mapa do entorno do empreendimento (seção Localização).
 * Adaptado do mapa do projeto "Minha Casa" (Sistema Principia). Arquivo estático,
 * fora do build Vite, carregado só nas páginas que têm mapa-entorno/<slug>.json.
 */
.mapa-entorno {
    --me-bordo: #9d1836;
    --me-ink: #202020;
    --me-ink-soft: #515151;
    --me-line: rgba(32, 32, 32, 0.12);
    display: flex;
    flex-direction: column;
    width: 100%;
    border: 1px solid var(--me-line);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.mapa-entorno__toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 14px;
    background: #fbfaf7;
    border-bottom: 1px solid var(--me-line);
}

.mapa-entorno__mapa {
    width: 100%;
    height: 560px;
    background: #eae6dd;
}

.mapa-entorno .me-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: none;
    font-family: "DM Sans", sans-serif;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1.5px solid var(--me-line);
    background: #fff;
    color: var(--me-ink);
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    transition: background .2s, border-color .2s, color .2s;
}
.mapa-entorno .me-chip .sw { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--sw, var(--me-ink-soft)); }
.mapa-entorno .me-chip.active { background: var(--sw, var(--me-bordo)); border-color: var(--sw, var(--me-bordo)); color: #fff; }
.mapa-entorno .me-chip.active .sw { background: rgba(255, 255, 255, .85); }
.mapa-entorno .me-chip:focus-visible { outline: 2px solid var(--me-bordo); outline-offset: 2px; }

.mapa-entorno .me-pin-emp {
    width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; border: 3px solid #fff;
    box-shadow: 0 10px 20px -8px rgba(0, 0, 0, .5);
}
.mapa-entorno .me-pin {
    width: 26px; height: 26px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; border: 2px solid #fff;
    box-shadow: 0 6px 14px -6px rgba(0, 0, 0, .45);
}

.mapa-entorno .me-popup b { display: block; font-family: "Inter", sans-serif; font-weight: 700; font-size: 14px; color: var(--me-ink); margin-bottom: 2px; }
.mapa-entorno .me-popup .cat { display: block; font-family: "DM Sans", sans-serif; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--me-ink-soft); margin-top: 2px; }
.mapa-entorno .me-popup .time { display: block; font-family: "DM Sans", sans-serif; font-size: 12px; font-weight: 700; color: var(--me-bordo); margin-top: 3px; }

/* Nome do empreendimento: único rótulo fixo do mapa. */
.mapa-entorno .leaflet-tooltip.me-rotulo-emp {
    background: #fff;
    border: 1.5px solid var(--me-bordo);
    border-radius: 8px;
    box-shadow: 0 8px 18px -10px rgba(32, 32, 32, .45);
    padding: 4px 10px;
    text-align: center;
    white-space: nowrap;
}
.mapa-entorno .leaflet-tooltip.me-rotulo-emp b { display: block; font-family: "Inter", sans-serif; font-weight: 700; font-size: 14px; color: var(--me-ink); }
.mapa-entorno .leaflet-tooltip.me-rotulo-emp span { display: block; font-family: "DM Sans", sans-serif; font-size: 11px; color: var(--me-ink-soft); }
.mapa-entorno .leaflet-tooltip.me-rotulo-emp::before { border-top-color: var(--me-bordo); }

.mapa-entorno .me-legenda {
    background: rgba(255, 255, 255, .95);
    border: 1px solid var(--me-line);
    border-radius: 10px;
    padding: 8px 11px;
    font-family: "DM Sans", sans-serif;
    font-size: 12px;
    color: var(--me-ink);
    box-shadow: 0 12px 26px -14px rgba(32, 32, 32, .4);
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 220px;
}
.mapa-entorno .me-legenda.empty { display: none; }
.mapa-entorno .me-legenda .row { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.mapa-entorno .me-legenda .n { font-weight: 700; color: var(--me-bordo); }

.mapa-entorno .me-dica {
    background: rgba(32, 32, 32, .78);
    color: #fff;
    font-family: "DM Sans", sans-serif;
    font-size: 12px;
    padding: 5px 10px;
    border-radius: 999px;
    pointer-events: none;
    transition: opacity .3s;
}
.mapa-entorno .me-dica.oculta { opacity: 0; }

.mapa-entorno .me-legenda .dica { font-size: 11px; color: var(--me-ink-soft); padding-top: 4px; margin-top: 2px; border-top: 1px solid var(--me-line); white-space: normal; }

/* Versão do quadro abaixo do mapa: só no celular (no computador ele fica sobre o mapa). */
.mapa-entorno .me-legenda--baixo { display: none; }

/* Celular: precisa vir depois das regras base para valer. */
@media (max-width: 768px) {
    /* No celular os filtros rolam de lado em vez de ocupar várias linhas. */
    .mapa-entorno__toolbar {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .mapa-entorno__toolbar::-webkit-scrollbar { display: none; }
    .mapa-entorno__mapa { height: 440px; }
    .mapa-entorno .me-legenda.leaflet-control { display: none; }
    .mapa-entorno .me-legenda.me-legenda--baixo {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px 14px;
        max-width: none;
        border: 0;
        border-top: 1px solid var(--me-line);
        border-radius: 0;
        box-shadow: none;
        padding: 10px 14px;
        background: #fbfaf7;
    }
    .mapa-entorno .me-legenda.me-legenda--baixo.empty { display: none; }
    .mapa-entorno .me-legenda--baixo .dica { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .mapa-entorno * { transition: none !important; }
}
