/*
 * saxliko.ge maps (Leaflet + OpenStreetMap): the Add / Edit pin picker, the listing page's map +
 * nearby places, the results page's map search. Leaflet's own CSS comes from the CDN with it.
 */

/* ---------- Pins (divIcon: pure SVG, no image files) ---------- */
.sx-pin { color: #1F5EFF; filter: drop-shadow(0 4px 6px rgba(14, 26, 43, .35)); }
.sx-pin svg { display: block; width: 32px; height: 42px; }
.sx-pin--vip { color: #D99A1E; }
.sx-poi { display: grid !important; place-items: center; width: 28px !important; height: 28px !important; border: 2px solid #fff; border-radius: 50%; color: #fff; font-size: 13px; box-shadow: 0 2px 6px rgba(14, 26, 43, .35); }
.sx-poi svg { width: 15px; height: 15px; }
.sx-poi--metro { background: #E5484D; }
.sx-poi--school { background: #1F5EFF; }
.sx-poi--kindergarten { background: #EC4899; }
.sx-poi--supermarket { background: #F79009; }
.sx-poi--pharmacy { background: #12B76A; }
.sx-poi--park { background: #3F9142; }

/* ---------- Add / Edit: the pin picker ---------- */
.mapfield { margin-top: 18px; }
.mapfield__label { margin: 0 0 8px; font-size: .9rem; font-weight: 700; color: var(--c-ink, #0E1A2B); }
.mapfield__label .field__optional { display: block; margin-top: 2px; font-size: .78rem; font-weight: 500; color: var(--c-muted, #66768D); }
.mapfield__map { height: 340px; border: 1px solid var(--c-line, #E2E8F0); border-radius: 14px; background: #EEF2F6; overflow: hidden; touch-action: pan-y; }
.mapfield__map.leaflet-container { cursor: crosshair; }
.mapfield__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 8px; }
.mapfield__status { flex: 1 1 220px; margin: 0; font-size: .82rem; color: var(--c-muted, #66768D); }
.mapfield__btn { min-height: 38px; padding: 0 14px; border: 1px solid var(--c-line, #E2E8F0); border-radius: 999px; background: #fff; color: var(--c-ink, #0E1A2B); font: inherit; font-size: .84rem; font-weight: 600; cursor: pointer; }
.mapfield__btn--clear { color: #D92D20; }
@media (max-width: 560px) { .mapfield__map { height: 280px; } }

/* ---------- Listing page: the map + nearby places ---------- */
.lmap { position: relative; height: 340px; border-radius: 16px; overflow: hidden; background: #EEF2F6; }
.lmap__map { position: absolute; inset: 0; }
.lmap__veil { position: absolute; inset: 0; z-index: 500; display: grid; place-items: end center; padding: 14px; border: 0; background: linear-gradient(180deg, transparent 60%, rgba(14, 26, 43, .28)); color: #fff; font: inherit; cursor: pointer; }
.lmap__veil span { padding: 8px 14px; border-radius: 999px; background: rgba(14, 26, 43, .78); font-size: .84rem; font-weight: 700; }
.lmap__veil[hidden] { display: none; }
.lmap__expand { position: absolute; top: 10px; right: 10px; z-index: 600; display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 12px; background: #fff; color: #0E1A2B; box-shadow: 0 2px 8px rgba(14, 26, 43, .25); cursor: pointer; }
.lmap__expand svg { width: 20px; height: 20px; }
.lmap--full { position: fixed; inset: 0; z-index: 1000; height: auto; border-radius: 0; }
.lmap__fallback { position: absolute; inset: 0; display: grid; place-items: center; gap: 6px; padding: 16px; color: #66768D; font-size: .9rem; text-align: center; }
.lmap__fallback a { font-weight: 700; }
.lmap__fallback[hidden] { display: none; }
body.has-full-map { overflow: hidden; }
@media (max-width: 560px) { .lmap { height: 260px; } }

.nearby { margin-top: 18px; }
.nearby__title { margin: 0 0 4px; font-size: 1.02rem; color: var(--c-ink, #0E1A2B); }
.nearby__sub { margin: 0 0 12px; font-size: .8rem; color: var(--c-muted, #66768D); }
.nearby__groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 12px; }
.nearby__group { padding: 12px 14px; border-radius: 14px; background: var(--c-bg, #F5F7FA); }
.nearby__group h4 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: .88rem; color: var(--c-ink, #0E1A2B); }
.nearby__group h4 .sx-poi { position: static; margin: 0 !important; width: 24px !important; height: 24px !important; border-width: 0; box-shadow: none; }
.nearby__group ul { margin: 0; padding: 0; list-style: none; }
.nearby__group li { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 3px 0; font-size: .86rem; }
.nearby__poi { min-width: 0; padding: 0; border: 0; background: none; color: var(--c-text, #2B3A4F); font: inherit; text-align: left; cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.nearby__poi:hover { color: var(--c-primary, #1F5EFF); text-decoration: underline; }
.nearby__group li span { flex: none; font-weight: 700; color: var(--c-ink, #0E1A2B); font-variant-numeric: tabular-nums; }
.nearby__state { margin: 0; padding: 14px; border-radius: 14px; background: var(--c-bg, #F5F7FA); color: var(--c-muted, #66768D); font-size: .88rem; }
.nearby__state button { margin-left: 8px; padding: 4px 12px; border: 1px solid var(--c-line, #E2E8F0); border-radius: 999px; background: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.nearby__skeleton { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 12px; }
.nearby__skeleton i { height: 96px; border-radius: 14px; background: linear-gradient(90deg, #EEF2F6, #F7F9FC, #EEF2F6); background-size: 200% 100%; animation: sx-shimmer 1.2s linear infinite; }
@keyframes sx-shimmer { to { background-position: -200% 0; } }

/* ---------- Results page: the map search ---------- */
.maptoggle { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 700; display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 20px; border: 0; border-radius: 999px; background: #0E1A2B; color: #fff; font: inherit; font-size: .92rem; font-weight: 800; transform: translateX(-50%); box-shadow: 0 12px 30px -10px rgba(14, 26, 43, .6); cursor: pointer; }
.maptoggle:hover { background: #1C3566; }
/* The phone filter sheet is open (results.js locks the page): its own buttons are at the bottom */
html.is-locked .maptoggle { display: none; }
.maptoggle svg { width: 18px; height: 18px; }
.mapview { position: relative; margin: 16px 0 24px; }
.mapview[hidden] { display: none; }
.mapview__map { height: calc(100dvh - 210px); min-height: 420px; border-radius: 18px; overflow: hidden; background: #EEF2F6; box-shadow: 0 1px 2px rgba(14, 26, 43, .05), 0 8px 24px -12px rgba(14, 26, 43, .16); }
.mapview__status { position: absolute; top: 12px; left: 50%; z-index: 600; max-width: calc(100% - 120px); margin: 0; padding: 7px 14px; border-radius: 999px; background: #fff; color: #0E1A2B; font-size: .82rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transform: translateX(-50%); box-shadow: 0 4px 14px -6px rgba(14, 26, 43, .4); }
.mapview__status:empty { display: none; }
.is-map .results-grid, .is-map .more, .is-map .market, .is-map .empty, .is-map .related { display: none !important; }
#results-root.is-map { min-height: 0; padding-bottom: 0; }
@media (max-width: 720px) { .mapview { margin: 10px -16px 0; } .mapview__map { height: calc(100dvh - 170px); border-radius: 0; } }

/* Price pins + clusters */
/* Leaflet places the marker element with its own transform: the pill moves inside it */
.mpin { width: 0 !important; height: 0 !important; overflow: visible; white-space: nowrap; }
.mpin span { position: absolute; left: 0; bottom: 4px; display: block; padding: 5px 10px; border-radius: 999px; background: #fff; color: #0E1A2B; font: 800 12.5px/1 "Noto Sans Georgian", system-ui, sans-serif; box-shadow: 0 3px 10px -2px rgba(14, 26, 43, .35); border: 1px solid rgba(14, 26, 43, .08); transform: translateX(-50%); transition: transform .12s, background-color .12s; }
.mpin--vip span { background: linear-gradient(135deg, #F6D365, #E9A93B); color: #3B2A06; }
.mpin:hover span, .mpin.is-active span { background: #0E1A2B; color: #fff; transform: translateX(-50%) scale(1.06); }
.marker-cluster.sx-cluster { background: rgba(31, 94, 255, .22); }
.marker-cluster.sx-cluster div { background: #1F5EFF; color: #fff; font: 800 13px/30px "Noto Sans Georgian", system-ui, sans-serif; }
.marker-cluster.sx-cluster--big div { background: #0E1A2B; }

/* The popup's mini card */
.sxpop .leaflet-popup-content-wrapper { padding: 0; border-radius: 16px; overflow: hidden; }
.sxpop .leaflet-popup-content { width: 240px !important; margin: 0; font-family: "Noto Sans Georgian", system-ui, sans-serif; }
.sxpop__img { display: block; width: 100%; height: 130px; object-fit: cover; background: linear-gradient(135deg, #EAF0FF, #DDE6F7); }
.sxpop__body { display: grid; gap: 2px; padding: 10px 12px 12px; }
.sxpop__price { font-size: 1.05rem; font-weight: 800; color: #0E1A2B; }
.sxpop__price small { font-size: .74rem; font-weight: 600; color: #66768D; }
.sxpop__title { color: #2B3A4F; font-size: .84rem; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sxpop__link { margin-top: 6px; justify-self: start; padding: 6px 12px; border-radius: 10px; background: #1F5EFF; color: #fff !important; font-size: .82rem; font-weight: 700; text-decoration: none; }
