/*
 * Mapa na listama – mapa premium (direktor 8. 11. 2026, besplatna varijanta; mockup scratchpad/mobilni-hero/mapa-v2.png + mapa-popup.png).
 * JS: public/js/mdh-mapa.js · partial: resources/views/user/partials/mapa/mapa.blade.php · podaci: App\Support\MapListing.
 * Podloga OSM smirena filterom SAMO na sloju pločica (pinovi, kartice i atribucija se ne filtriraju).
 * Brend: bronza #996a37 (dugmad, sitan tekst) / #ad7c46 (linije, okviri), tekst #161e2d, šampanj #f8efe3 → #e9d4b8; bez tamnoplave.
 * Telefon/tablet ≤ 991 px: mapa ispod zaglavlja i trake filtera, kartica odozdo. Računar: popup u istom stilu.
 */
.mdh-mapa { font-family: 'Plus Jakarta Sans', sans-serif; background: #f4efe8; -webkit-tap-highlight-color: transparent; }
/* ublaženo (bez smanjenja kontrasta, koje je natpise činilo mekšim); filter je na cijelom sloju – sve pločice isto */
.mdh-mapa.mdh-mapa--osm .leaflet-tile-pane { filter: grayscale(.7) sepia(.14) brightness(1.03) saturate(.9); }
.mdh-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* atribucija OSM ostaje vidljiva (globalni stil skriva .leaflet-control – ovdje samo atribucija) */
.mdh-mapa .leaflet-control-attribution {
    display: block !important; margin: 0 !important; padding: 2px 6px; border-radius: 8px 0 0 0;
    background: rgba(255, 255, 255, .86) !important; color: #4a4f5a; font: 500 12px/1.4 'Plus Jakarta Sans', sans-serif;
}
.mdh-mapa .leaflet-control-attribution a { color: #85592c; text-decoration: underline; }
.mdh-mapa.has-sheet .leaflet-bottom { bottom: var(--mdh-sheet-h, 0px); }

/* ---------- pinovi sa cijenom ---------- */
.mdh-mapa .mdh-pin-wrap { background: none; border: 0; width: 0 !important; height: 0 !important; overflow: visible; }
.mdh-mapa .mdh-pin-wrap:focus { outline: none; }
.mdh-pin {
    position: absolute; left: 0; bottom: 8px; transform: translateX(-50%); transform-origin: 50% 100%;
    display: inline-flex; align-items: center; height: 30px; padding: 0 11px; border-radius: 16px;
    background: #fff; border: 1.5px solid #ad7c46; color: #161e2d; box-shadow: 0 4px 10px rgba(22, 30, 45, .16);
    font: 800 13px/1 'Plus Jakarta Sans', sans-serif; white-space: nowrap; cursor: pointer;
    transition: transform .18s ease, background-color .18s ease, color .18s ease;
}
.mdh-pin::after {   /* repić */
    content: ""; position: absolute; left: 50%; bottom: -6px; width: 10px; height: 10px; margin-left: -5px;
    background: inherit; border-right: 1.5px solid #ad7c46; border-bottom: 1.5px solid #ad7c46; transform: rotate(45deg);
}
.mdh-pin::before { content: ""; position: absolute; inset: -8px -4px -12px; }   /* dodirna zona ≥ 44 px */
.mdh-pin__t { position: relative; }
.mdh-pin.is-closed { height: 24px; padding: 0 9px; background: #f4f1ec; color: #5a6170; border-color: #d9cfc1; box-shadow: none; font-size: 11px; font-weight: 700; letter-spacing: .02em; }   /* prodato/izdato – sivo, ispod aktivnih (direktor 16. 11.) */
.mdh-pin.is-closed::after { border-color: #d9cfc1; }
.mdh-pin.is-sel, .mdh-pin-wrap:focus-visible .mdh-pin { background: #996a37; color: #fff; border-color: #fff; transform: translateX(-50%) scale(1.15); }
.mdh-pin.is-sel::after, .mdh-pin-wrap:focus-visible .mdh-pin::after { border-color: #fff; }
.mdh-pin-wrap:focus-visible .mdh-pin { outline: 2px solid #161e2d; outline-offset: 2px; }
@media (hover: hover) { .mdh-pin:hover { transform: translateX(-50%) scale(1.06); } .mdh-pin.is-sel:hover { transform: translateX(-50%) scale(1.15); } }

/* grupe: bronzani krug 44 px, bijeli broj i obrub (zamjena za zeleno/žuto/narandžasto iz MarkerCluster.Default.css) */
.mdh-mapa .mdh-cl-wrap { background: none !important; border: 0; }
.mdh-cl {
    display: grid; place-items: center; width: 44px; height: 44px; box-sizing: border-box; border-radius: 50%;
    background: #996a37; border: 3px solid #fff; color: #fff; box-shadow: 0 4px 10px rgba(22, 30, 45, .22);
    font: 800 14px/1 'Plus Jakarta Sans', sans-serif; cursor: pointer;
}
.mdh-mapa .mdh-cl-wrap:focus-visible { outline: none; }
.mdh-mapa .mdh-cl-wrap:focus-visible .mdh-cl { outline: 2px solid #161e2d; outline-offset: 2px; }

/* ---------- kontrole na mapi ---------- */
.mdh-mapa__top, .mdh-mapa__side, .mdh-mapa__listbox, .mdh-mapa__toast-box, .mdh-mapa__sheet { position: absolute; z-index: 1000; }
.mdh-mapa__top {
    left: 50%; top: 12px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px;
    max-width: calc(100% - 24px); pointer-events: none;
}
.mdh-mapa__top > * { pointer-events: auto; }
.mdh-mapa__area, .mdh-mapa__chip, .mdh-mapa__loc, .mdh-mapa__list {
    font-family: 'Plus Jakarta Sans', sans-serif; border: 0; background: #fff; box-shadow: 0 6px 16px rgba(22, 30, 45, .14); cursor: pointer;
}
.mdh-mapa__area {
    display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 22px;
    color: #85592c; font-size: 14.5px; font-weight: 700; white-space: nowrap;
}
.mdh-mapa__area[hidden], .mdh-mapa__chip[hidden], .mdh-mapa__toast[hidden], .mdh-mapa__sheet[hidden] { display: none !important; }
.mdh-mapa__chip {
    display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 4px 0 16px; border-radius: 22px; cursor: default;
    color: #161e2d; font-size: 14px; font-weight: 600; white-space: nowrap;
}
.mdh-mapa__chip-x {
    min-height: 44px; padding: 0 12px; border: 0; background: none; color: #85592c; font: 700 14px 'Plus Jakarta Sans', sans-serif;
    text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.mdh-mapa__side { right: 12px; bottom: calc(var(--mdh-sheet-off, 0px) + 84px); }
.mdh-mapa__loc { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; color: #996a37; }
.mdh-mapa__loc.is-busy svg { animation: mdhMapaSpin 1s linear infinite; }
@keyframes mdhMapaSpin { to { transform: rotate(360deg); } }
.mdh-mapa__listbox { left: 50%; bottom: calc(var(--mdh-sheet-off, 0px) + 16px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: none; }
.mdh-mapa__list {
    display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 20px; border-radius: 22px;
    color: #161e2d; font-size: 15px; font-weight: 700;
}
.mdh-mapa__area:focus-visible, .mdh-mapa__loc:focus-visible, .mdh-mapa__list:focus-visible, .mdh-mapa__chip-x:focus-visible,
.mdh-mapa__x:focus-visible, .mdh-mc__fav:focus-visible, .mdh-pc__fav:focus-visible, .mdh-pc__x:focus-visible { outline: 2px solid #161e2d; outline-offset: 2px; }
.mdh-mapa__toast-box { left: 12px; right: 12px; top: 64px; display: flex; justify-content: center; pointer-events: none; }
.mdh-mapa__toast {
    margin: 0; max-width: 340px; padding: 10px 14px; border-radius: 12px; background: #fff; color: #161e2d;
    box-shadow: 0 6px 16px rgba(22, 30, 45, .14); font-size: 14px; font-weight: 600; line-height: 1.4; text-align: center;
}

/* ---------- oznaka Prodaja / Izdavanje (kao na listi) ---------- */
.mdh-deal {
    position: absolute; left: 6px; top: 6px; z-index: 2; padding: 3px 9px; border-radius: 12px;
    font: 700 12px/1.3 'Plus Jakarta Sans', sans-serif; white-space: nowrap;
}
.mdh-deal.is-sale, .mdh-deal.is-nb { background: #996a37; color: #fff; border: 1.5px solid #996a37; }
.mdh-deal.is-rent { background: #fff; color: #85592c; border: 1.5px solid #996a37; }
.mdh-deal.is-closed { background: #161e2d; color: #fff; border: 1.5px solid #161e2d; }   /* Prodato / Izdato – isto kao kartica liste (QA V7) */

/* sličica bez fotografije – „Fotografije uskoro“ (šampanj, kao kartica liste; public/css/mdh-bez-foto.css) */
.mdh-mapa-bf {
    position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    padding: 26px 6px 8px; text-align: center; background: linear-gradient(160deg, #f8efe3 0%, #e9d4b8 100%); color: #85592c;
}
.mdh-mapa-bf::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: #ad7c46; }
.mdh-mapa-bf__ring { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: rgba(255, 255, 255, .7); }
.mdh-mapa-bf__t { font-size: 12px; font-weight: 700; line-height: 1.25; color: #85592c; }

/* ---------- telefon: kartica odozdo ---------- */
.mdh-mapa__sheet {
    left: 0; right: 0; bottom: 0; padding: 8px 0 calc(14px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0;
    background: #fff; box-shadow: 0 -10px 30px rgba(22, 30, 45, .15); transition: transform .22s ease;
}
.mdh-mapa__grab { width: 40px; height: 5px; margin: 0 auto 8px; border-radius: 5px; background: #ddd5ca; }
.mdh-mapa__x {
    position: absolute; right: 8px; top: 2px; width: 44px; height: 44px; border: 0; border-radius: 50%;
    background: none; color: #161e2d; font-size: 18px; line-height: 1; cursor: pointer;
}
.mdh-mapa__row {
    display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 26px 14px 2px; scroll-padding: 0 14px;
    scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
}
.mdh-mapa__row::-webkit-scrollbar { display: none; }
.mdh-mc {
    position: relative; flex: 0 0 calc(100% - 44px); max-width: 360px; display: flex; gap: 12px; padding: 8px; box-sizing: border-box;
    border: 1px solid #efe7dc; border-radius: 18px; background: #fff; scroll-snap-align: start;
}
.mdh-mc:only-child { flex-basis: 100%; max-width: none; }
/* sve kartice u traci iste širine – dug naslov ne širi karticu (QA S10) */
.mdh-mc { min-width: 0; }
.mdh-mc__b { min-width: 0; flex: 1 1 auto; overflow-wrap: anywhere; }
.mdh-mc__img { position: relative; flex: 0 0 108px; width: 108px; height: 108px; border-radius: 14px; overflow: hidden; background: #f1e3cf; }
.mdh-mc__img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.mdh-mc__fav, .mdh-pc__fav {
    position: absolute; z-index: 3; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%;
    background: transparent; color: #fff; cursor: pointer;
}
.mdh-mc__fav { right: 0; bottom: 0; }
.mdh-mc__fav::before, .mdh-pc__fav::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: rgba(22, 30, 45, .45); }
.mdh-mc__fav svg, .mdh-pc__fav svg { position: relative; }
.mdh-mc__fav.active-favourite svg, .mdh-pc__fav.active-favourite svg { fill: #fff; }
.mdh-mc__b { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; justify-content: center; padding-right: 2px; }
.mdh-mc__t {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    color: #161e2d !important; font-size: 15.5px; font-weight: 800; line-height: 1.3; text-decoration: none;
}
.mdh-mc__t::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: 18px; }   /* cijela kartica je link */
.mdh-mc__t:focus-visible { outline: none; }
.mdh-mc__t:focus-visible::after { outline: 2px solid #161e2d; outline-offset: -2px; }
.mdh-mc__s { margin: 3px 0 4px; color: #555b66; font-size: 13px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mdh-mc__p { margin: 0; color: #161e2d; font-size: 18px; line-height: 1.25; }
.mdh-mc__p b { font-weight: 800; }
.mdh-mc__p small { color: #555b66; font-size: 13px; font-weight: 600; }
.mdh-mc__go { margin-top: 3px; color: #85592c; font-size: 13.5px; font-weight: 700; }
.mdh-mc .mdh-deal, .mdh-mc .mdh-mc__fav { z-index: 2; }
.mdh-mc .mdh-mc__fav { z-index: 3; }

/* ---------- računar: popup (mapa-popup.png) ---------- */
.mdh-pop .leaflet-popup-content-wrapper { padding: 0; border-radius: 20px; overflow: hidden; box-shadow: 0 12px 32px rgba(22, 30, 45, .2); }
.mdh-pop .leaflet-popup-content { width: 320px !important; margin: 0; font-family: 'Plus Jakarta Sans', sans-serif; }
.mdh-pop .leaflet-popup-tip { box-shadow: none; }
.mdh-pc { position: relative; }
.mdh-pc__img { position: relative; height: 160px; background: #f1e3cf; overflow: hidden; }
.mdh-pc__img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.mdh-pc__img .mdh-deal { left: 12px; top: auto; bottom: 12px; font-size: 13px; padding: 4px 11px; border-radius: 14px; }
.mdh-pc__code {
    position: absolute; left: 12px; top: 12px; z-index: 2; padding: 4px 10px; border-radius: 12px; background: rgba(255, 255, 255, .94);
    color: #161e2d; font-size: 12.5px; font-weight: 700;
}
.mdh-pc__x {
    position: absolute; right: 6px; top: 6px; z-index: 3; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%;
    background: transparent; color: #fff; font-size: 16px; cursor: pointer;
}
.mdh-pc__x::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: rgba(22, 30, 45, .5); z-index: -1; }
.mdh-pc__fav { right: 6px; bottom: 6px; }
.mdh-pc__b { position: relative; padding: 14px 16px 16px; }
.mdh-pc__t { display: block; color: #161e2d !important; font-size: 17px; font-weight: 800; line-height: 1.3; text-decoration: none; }
.mdh-pc__t::after { content: ""; position: absolute; inset: -160px 0 0 0; z-index: 1; }   /* cijeli popup (osim ✕ i srca) je link */
.mdh-pc__t:focus-visible { outline: 2px solid #161e2d; outline-offset: 2px; }
.mdh-pc__l { display: flex; align-items: center; gap: 6px; margin: 6px 0 0; color: #555b66; font-size: 14px; }
.mdh-pc__l svg { flex: 0 0 auto; color: #996a37; }
.mdh-pc__m { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0 0; color: #5b6170; font-size: 13.5px; font-weight: 600; }
.mdh-pc__f { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.mdh-pc__p { margin: 0; color: #161e2d; font-size: 21px; font-weight: 800; line-height: 1.2; }
.mdh-pc__p small { color: #555b66; font-size: 13px; font-weight: 600; }
.mdh-pc__go {
    flex: 0 0 auto; display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: 12px;
    background: #996a37; color: #fff; font-size: 14px; font-weight: 700;
}
.mdh-pc .mdh-pc__img .mdh-deal, .mdh-pc__code { z-index: 2; }
.mdh-mapa .leaflet-popup-content a { color: inherit; }

/* ---------- telefon / tablet ≤ 991 px: mapa preko liste, ispod zaglavlja i trake filtera ---------- */
@media (max-width: 991.98px) {
    html.mdh-mapa-lock, html.mdh-mapa-lock body { overflow: hidden !important; overscroll-behavior: none; }
    body.mdh-mapa-open #map.mdh-mapa {
        display: block !important; position: fixed !important; top: var(--mdh-map-top, 122px) !important; left: 0 !important; right: 0 !important;
        bottom: 0 !important; width: auto !important; height: auto !important; z-index: 985 !important; border-radius: 0 !important;
    }
    body.mdh-mapa-open #mapOverlay, body.mdh-mapa-open .progress-wrap { display: none !important; }   /* „na vrh“ ne prekriva karticu */
    .mdh-mapa .close-map-btn { display: none !important; }
    .mdh-mapa__listbox { display: block; }
    .mdh-mapa.has-sheet { --mdh-sheet-off: var(--mdh-sheet-h, 0px); }
    .mdh-mapa .leaflet-popup-pane { display: none; }
}
/* C117 (direktor 1. 12. 2026, TELEFON ≤ 767 px): na mapi preko cijelog ekrana donja traka stranice je skrivena (config/mdh_donja_traka.php, data-nt-skriveno), pa je fioka kartice
   na samom dnu: razmak + safe-area (iPhone traka za povratak) – vidi se cijela kartica (slika, naslov, lokacija, cijena). „Lista“ i lociranje stoje iznad fioke
   (visina fioke već sadrži safe-area), a bez fioke iznad donje ivice + safe-area – ne sudaraju se ni sa fiokom ni međusobno. Tablet i računar bez promjene. */
@media (max-width: 767.98px) {
    .mdh-mapa__sheet { padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
    .mdh-mapa__side { bottom: calc(var(--mdh-sheet-off, 0px) + 84px + (1 - var(--mdh-has-sheet, 0)) * env(safe-area-inset-bottom, 0px)); }
    .mdh-mapa__listbox { bottom: calc(var(--mdh-sheet-off, 0px) + 16px + (1 - var(--mdh-has-sheet, 0)) * env(safe-area-inset-bottom, 0px)); }
    .mdh-mapa.has-sheet { --mdh-has-sheet: 1; }
}
@media (min-width: 640px) and (max-width: 991.98px) {
    .mdh-mc { flex-basis: 360px; }
}

/* ---------- računar ≥ 992 px: kontrole ispod zaglavlja i trake filtera (mapa je fiksna od vrha prozora) ---------- */
@media (min-width: 992px) {
    .mdh-mapa__top { top: calc(var(--mdh-map-obst, 80px) + 14px); }   /* ispod zaglavlja i trake filtera (mjeri mdh-mapa.js) */
    .mdh-mapa__toast-box { top: calc(var(--mdh-map-obst, 80px) + 66px); }
    .mdh-mapa__side { bottom: 28px; right: 16px; }
    .mdh-mapa__sheet { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
    .mdh-pin, .mdh-mapa__sheet { transition: none; }
    .mdh-mapa__loc.is-busy svg { animation: none; }
}

/* sličica kartice (108 px) bez fotografije: samo fotoaparat ispod oznake Prodaja/Izdavanje (tekst „Fotografije uskoro“ za čitače ekrana) */
.mdh-mapa-bf--s { padding: 22px 0 0; }
.mdh-mapa-bf--s .mdh-mapa-bf__ring { width: 40px; height: 40px; }

/* Leaflet daje <p> u popup-u margin 17px – u kartici popup-a razmaci su naši */
.mdh-pop .leaflet-popup-content .mdh-pc p { margin: 0; }
.mdh-pop .leaflet-popup-content .mdh-pc .mdh-pc__l { margin-top: 6px; }
.mdh-pop .leaflet-popup-content .mdh-pc .mdh-pc__m { margin-top: 8px; }

/* ---------- „Pretraži ovo područje“ na serveru (bbox, direktor 8. 11. 2026, 16:26) ---------- */
.mdh-mapa__area.is-busy { cursor: progress; opacity: .85; }
.mdh-mapa__area.is-busy svg { animation: mdhMapaSpin 1s linear infinite; }
@media (prefers-reduced-motion: reduce) { .mdh-mapa__area.is-busy svg { animation: none; } }
