/* Monly — javna pretraga: filteri lijevo, mapa gore, oglasi desno. */
.search-layout { display: grid; grid-template-columns: 248px minmax(0, 1fr); gap: 44px; margin-top: 22px; align-items: start; }

/* ---------- filteri ---------- */
.filters { position: sticky; top: 84px; display: grid; gap: 22px; }
.deal-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.deal-tabs button { height: 32px; border: 0; background: #fff; font-size: 12px; font-weight: 600; color: var(--text); }
.deal-tabs button + button { border-left: 1px solid var(--line); }
.deal-tabs button.is-on { background: var(--soft); border-color: #c3c5ca; color: var(--ink); font-weight: 600; }
.fset { margin: 0; padding: 0; border: 0; display: grid; gap: 9px; }
.fset legend { padding: 0; margin-bottom: 4px; font-size: 11.5px; font-weight: 600; color: var(--ink); }
.check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text); cursor: pointer; }
.check input { width: 14px; height: 14px; accent-color: var(--ink); margin: 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.two label { display: grid; gap: 4px; min-width: 0; }
.two span { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.two input {
  width: 100%; height: 34px; padding: 0 9px; border: 1px solid var(--line); border-radius: var(--r);
  background: #fff; font: inherit; font-size: 12.5px; color: var(--text); font-variant-numeric: tabular-nums;
}
.two input:focus { outline: 2px solid var(--ink); outline-offset: 1px; }
.reset { justify-self: start; min-height: 32px; padding: 6px 0; border: 0; background: none; font-size: 11.5px; font-weight: 600; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.reset:hover { color: var(--ink); }
.reset.inline { display: inline; margin-left: 6px; }

/* ---------- mapa ---------- */
.results { min-width: 0; }
.map-strip { position: relative; }
.search-map { position: relative; height: 236px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--soft); }
.search-map.is-empty { display: grid; place-items: center; padding: 20px; font-size: 12px; color: var(--muted); text-align: center; }
.map-btn {
  position: absolute; left: 12px; top: 12px; height: 30px; padding: 0 12px; border-radius: var(--r);
  border: 1px solid var(--ink); background: var(--ink); color: #fff; font-size: 11.5px; font-weight: 600;
  z-index: 2;
}
.map-btn:hover { opacity: .88; }

/* oznaka i bubanj (pop-up) na mapi — zaobljen oblik, ne kocka */
.map-pin {
  display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border: 0; border-radius: 999px;
  background: var(--ink); color: #fff; font-size: 11px; font-weight: 600; letter-spacing: .01em;
  white-space: nowrap; font-variant-numeric: tabular-nums; cursor: pointer;
}
.map-pin:hover { background: #23262b; }
/* Bubanj na mapi je mali providan list, ne bijeli pravougaonik preko mape. */
.map-popup .maplibregl-popup-content {
  padding: 6px; border-radius: 13px; border: 1px solid rgba(255, 255, 255, .7);
  background: rgba(255, 255, 255, .88);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: 0 8px 22px rgba(12, 13, 15, .16);
}
.map-popup .maplibregl-popup-tip { border-top-color: rgba(255, 255, 255, .88); }
.map-popup.maplibregl-popup-anchor-top .maplibregl-popup-tip { border-bottom-color: rgba(255, 255, 255, .88); }
.map-popup.maplibregl-popup-anchor-bottom .maplibregl-popup-tip { border-top-color: rgba(255, 255, 255, .88); }
.map-popup.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: rgba(255, 255, 255, .88); }
.map-popup.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: rgba(255, 255, 255, .88); }
.map-popup .maplibregl-popup-close-button { right: 4px; top: 2px; width: 20px; height: 20px; font-size: 15px; color: var(--muted); background: none; }
.pop { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 8px; align-items: center; }
.pop-img { display: block; width: 56px; height: 44px; border-radius: 8px; overflow: hidden; background: var(--soft); }
.pop-img img { width: 100%; height: 100%; object-fit: cover; }
.pop-body { display: grid; gap: 1px; min-width: 0; }
.pop-deal { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.pop b { font-size: 13px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.pop small { font-size: 10.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- traka rezultata ---------- */
.results-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin: 18px 0 16px; }
.count { font-size: 12px; color: var(--muted); }
.bar-right { display: flex; align-items: center; gap: 14px; }
.sort { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.sort select { height: 30px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; font: inherit; font-size: 12px; color: var(--ink); }
/* Mreža / Lista — dvije ikone bez teksta: isto na telefonu i na računaru,
   pa se ne pojavljuje riječ koja na uskom ekranu visi sama na kraju reda. */
.dir-switch { display: inline-flex; gap: 4px; align-items: center; }
.dir-switch button {
  appearance: none; width: 34px; height: 30px; padding: 0; display: inline-grid; place-items: center;
  border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 8px;
  cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.dir-switch button svg { display: block; }
.dir-switch button:hover { color: var(--ink); border-color: #cfd1d4; }
.dir-switch button.is-on { background: var(--soft); border-color: #c3c5ca; color: var(--ink); }

/* ---------- oglasi ---------- */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 30px 16px; }
.lcard-body { min-width: 0; }
.lcard-unit { margin-top: 2px; font-size: 11px; color: var(--muted); }
.grid.is-list { grid-template-columns: 1fr; gap: 14px; }
/* Slika i tekst počinju u istom redu — ranije je slika bila vertikalno centrirana,
   pa je cijena znala iskočiti iznad nje kad je opis duži. */
.lcard.is-list { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 14px; align-items: start; }
.lcard.is-list .lcard-img { aspect-ratio: 4 / 3; }
.lcard.is-list .lcard-row { margin-top: 0; }

@media (max-width: 1080px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-layout { grid-template-columns: 220px minmax(0, 1fr); gap: 28px; }
}

@media (max-width: 960px) {
  .search-layout { grid-template-columns: 1fr; gap: 22px; }
  .filters { position: static; order: 1; }
  .results { order: 2; }
}

@media (max-width: 720px) {
  /* „Kocke“ moraju ostati mreža i na telefonu — dvije kolone, ne naslagana lista. */
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.is-list { grid-template-columns: 1fr; }
  .lcard.is-list { grid-template-columns: 120px minmax(0, 1fr); }
}
/* Telefon: zone dodira najmanje 36 px — filteri, prebacivanje prikaza, sortiranje. */
@media (max-width: 720px) {
  .deal-tabs button { height: 40px; font-size: 12.5px; }
  .fset { gap: 10px; }
  .check { min-height: 36px; font-size: 13px; }
  .check input { width: 18px; height: 18px; }
  .two input { height: 40px; font-size: 13px; }
  .sort select { height: 36px; font-size: 12.5px; }
  .dir-switch button { width: 38px; height: 36px; }
  .dir-switch button svg { width: 16px; height: 16px; }
  .map-popup .maplibregl-popup-close-button { width: 32px; height: 32px; font-size: 20px; right: 2px; top: 0; }
}

/* ---------- Telefon: mapa, rezultati pa filteri ---------- */
@media (max-width: 720px) {
  body { font-size: 13px; }
  .search-layout { gap: 18px; margin-top: 16px; }
  .search-map { height: 200px; }
  .map-btn { top: 8px; left: 8px; height: 36px; padding: 0 12px; font-size: 12px; }
  .filters { gap: 18px; }
  .fset legend { font-size: 11px; }
  .results-bar { margin: 14px 0 12px; }
  /* Sortiranje i prebacivanje prikaza ne smiju preliti širinu na uskom telefonu. */
  .bar-right { gap: 8px 10px; flex-wrap: wrap; justify-content: flex-end; }
  .count { font-size: 11.5px; }
  .grid:not(.is-list) { gap: 20px 12px; }
  .lcard-row b { font-size: 14px; }
  .lcard-title { line-height: 1.35; }
}

/* Telefon: filteri su sklopljeni u jedno dugme — prvi oglas je odmah vidljiv. */
.filters-toggle { display: none; }
@media (max-width: 960px) {
  .filters-toggle {
    order: 0; display: flex; align-items: center; gap: 10px; width: 100%; height: 46px; padding: 0 14px;
    border: 1px solid var(--line); border-radius: var(--r); background: #fff; color: var(--ink);
    font: inherit; font-size: 13px; font-weight: 600; text-align: left; cursor: pointer;
  }
  .filters-toggle[aria-expanded="true"] { background: var(--soft); }
  .filters-toggle.has-on { border-color: var(--ink); }
  .filters-toggle b {
    margin-left: auto; display: inline-flex; align-items: center; justify-content: center;
    min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
    background: var(--ink); color: #fff; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
  }
  .filters-toggle .filters-arrow { font-size: 12px; color: var(--muted); transition: transform .15s; }
  .filters-toggle[aria-expanded="true"] .filters-arrow { transform: rotate(180deg); }
  .filters { display: none; order: 1; }
  .filters.is-open { display: grid; }
  .results { order: 2; }
}

/* Telefon: poruka prazne mape ide ispod dugmeta (detalji dugmeta su niže). */
@media (max-width: 640px) {
  .search-map.is-empty { padding-top: 54px; }
}

/* ---------- Telefon: zone dodira najmanje 36 px za radnje u kartici ---------- */
@media (max-width: 720px) {
  .lcard .btn, .lcard .mini-btn, .lcard button { min-height: 36px; display: inline-flex; align-items: center; }
}

/* Telefon: oznake na mapi i kontrole zumiranja imaju punu zonu dodira. */
@media (max-width: 720px) {
  .map-pin { min-height: 36px; min-width: 36px; display: inline-flex; align-items: center; justify-content: center; }
  .maplibregl-ctrl-group button { width: 36px !important; height: 36px !important; }
}

/* v14 — čipovi vrste i legenda oznaka na mapi */
.map-types { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; overflow-x: auto; scrollbar-width: none; }
.map-types::-webkit-scrollbar { display: none; }
.map-types button { flex: none; height: 30px; padding: 0 11px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.94); color: var(--muted); font-size: 11px; font-weight: 600; cursor: pointer; }
.map-types button.is-on { border-color: #c3c5ca; background: var(--soft); color: var(--ink); }
.map-legend-box { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 8px; font-size: 10.5px; color: var(--muted); pointer-events: none; }
.map-legend-box span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.map-legend-box i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink); }
.map-legend-box i.is-rent { background: #0058ff; }
.map-legend-box i.is-quote { background: #fff; border: 1px solid var(--muted); }
.map-pin.is-rent { background: #0058ff; }
.map-pin.is-rent:hover { background: #0b46c8; }
.map-pin.is-quote { background: #fff; color: var(--ink); border: 1px solid var(--line); }
@media (max-width: 720px) {
  .map-types button { height: 36px; font-size: 12px; }
  .map-legend-box { font-size: 10px; gap: 8px; justify-content: flex-start; }
}

/* v17 — „Sačuvaj pretragu“: imenovanje filtera bez napuštanja rezultata. */
.save-search-wrap { position: relative; }
.save-search-btn { min-height: 32px; padding: 6px 11px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; color: var(--ink); font: inherit; font-size: 12px; cursor: pointer; }
.save-search-btn:hover { border-color: var(--ink); }
.save-search-btn[aria-expanded="true"] { border-color: var(--ink); background: var(--soft); }
.save-search { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 300px; max-width: min(84vw, 320px); padding: 12px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; display: flex; flex-direction: column; gap: 8px; }
.save-search[hidden] { display: none; }
.save-search label { font-size: 11px; color: var(--muted); }
.save-search input { height: 34px; }
.save-search-row { display: flex; gap: 6px; }
.save-search-row .btn { padding: 6px 10px; font-size: 12px; }
.save-search-msg { margin: 0; font-size: 11.5px; line-height: 1.5; color: var(--text); }
.save-search-msg.is-error { color: #8a1c1c; }
@media (max-width: 720px) {
  .save-search-btn { min-height: 36px; }
  .save-search-row .btn { min-height: 36px; }
}

/* v18 — Poređenje oglasa: dugme na kartici, traka na dnu i tabela. */
.lcard-actions { display: flex; justify-content: flex-end; margin-top: 8px; }
.lcard-cmp {
  appearance: none; min-height: 32px; padding: 6px 10px; border: 1px solid var(--line);
  border-radius: var(--r); background: #fff; color: var(--text);
  font: inherit; font-size: 11.5px; font-weight: 500; cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.lcard-cmp:hover { border-color: var(--ink); color: var(--ink); }
.lcard-cmp.is-on { background: var(--soft); border-color: #c3c5ca; color: var(--ink); }

.cmp-tray { position: sticky; bottom: 0; z-index: 40; background: #fff; border-top: 1px solid var(--ink); }
.cmp-tray[hidden] { display: none; }
.cmp-tray-in { display: flex; align-items: center; gap: 8px; padding-top: 9px; padding-bottom: 9px; flex-wrap: wrap; }
.cmp-label { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.cmp-slots { display: flex; gap: 6px; flex-wrap: wrap; }
.cmp-slot { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: var(--r); padding: 4px 5px 4px 8px; background: #fff; }
.cmp-slot-txt { display: grid; gap: 1px; line-height: 1.2; }
.cmp-slot-txt b { font-size: 12px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.cmp-slot-txt span { font-size: 10px; color: var(--muted); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-slot button { width: 28px; height: 28px; border: 0; background: none; color: var(--muted); font-size: 15px; line-height: 1; cursor: pointer; }
.cmp-slot button:hover { color: var(--ink); }
.cmp-open {
  margin-left: auto; min-height: 36px; padding: 0 14px; border: 1px solid var(--ink); border-radius: var(--r);
  background: var(--ink); color: #fff; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
.cmp-open:hover { opacity: .88; }
.cmp-clear { min-height: 36px; padding: 0 6px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 11.5px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.cmp-clear:hover { color: var(--ink); }

.cmp-dialog {
  width: min(980px, 94vw); max-height: 86vh; padding: 0; border: 1px solid var(--line);
  border-radius: var(--r); background: #fff; color: var(--text); overflow: hidden;
}
.cmp-dialog::backdrop { background: rgba(12, 13, 15, .48); }
.cmp-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.cmp-dialog-head h2 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.01em; color: var(--ink); }
.cmp-close { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; color: var(--ink); font-size: 18px; line-height: 1; cursor: pointer; }
.cmp-close:hover { border-color: var(--ink); }
.cmp-table-wrap { max-height: calc(86vh - 63px); overflow: auto; padding: 4px 16px 16px; }
.cmp-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.cmp-table th, .cmp-table td { text-align: left; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.cmp-table thead th { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--ink); }
.cmp-table thead th a { display: block; font-size: 12.5px; letter-spacing: 0; text-transform: none; color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.cmp-table thead th a:hover { text-decoration: underline; text-underline-offset: 3px; }
.cmp-table thead th small { display: block; font-size: 10.5px; font-weight: 400; color: var(--muted); letter-spacing: 0; text-transform: none; margin-top: 2px; }
.cmp-table tbody th { font-weight: 400; color: var(--muted); font-size: 11.5px; width: 150px; }
.cmp-table td { color: var(--text); font-variant-numeric: tabular-nums; }
.cmp-table td.is-best { color: var(--ink); font-weight: 600; }
.cmp-best { display: inline-block; margin-left: 7px; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; border: 1px solid var(--line); border-radius: 2px; padding: 2px 4px; color: var(--muted); font-weight: 500; vertical-align: 1px; }
.cmp-empty { margin: 18px 0; font-size: 12.5px; color: var(--muted); }

@media (max-width: 720px) {
  .lcard-cmp { min-height: 36px; font-size: 12px; }
  .cmp-tray-in { gap: 6px; }
  .cmp-open { margin-left: 0; flex: 1 1 120px; min-height: 40px; }
  .cmp-clear { min-height: 40px; }
  .cmp-dialog { width: 96vw; }
  .cmp-table { min-width: 580px; }
  .cmp-table tbody th { width: 116px; }
}

/* Legenda markera i „Lociraj me“ na mapi. */
.map-legend-box { position: absolute; left: 10px; bottom: 44px; z-index: 3; display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; background: rgba(255,255,255,.94); border: 1px solid var(--line); border-radius: 4px; font-size: 10.5px; color: var(--text); pointer-events: none; }
.map-legend-box span { display: flex; align-items: center; gap: 6px; }
.map-legend-box i { width: 7px; height: 7px; border-radius: 50%; border: 1px solid var(--ink); background: var(--ink); }
.map-legend-box i.is-rent { background: #fff; }
.map-legend-box i.is-quote { background: #fff; border-style: dashed; }
.map-tools { position: absolute; right: 10px; top: 10px; z-index: 3; display: grid; gap: 5px; }
.map-locate { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--ink); font-size: 15px; line-height: 1; cursor: pointer; }
.map-locate:hover { border-color: var(--ink); }
.map-locate[disabled] { opacity: .5; cursor: default; }
.map-locate-note { position: absolute; right: 0; top: 100%; margin: 5px 0 0; width: 182px; padding: 7px 9px; background: #fff; border: 1px solid var(--line); border-radius: 4px; font-size: 11px; line-height: 1.35; color: var(--text); text-align: left; }
@media (max-width: 520px) {
  .map-legend-box { left: 8px; bottom: 36px; padding: 6px 8px; font-size: 10px; gap: 3px; }
  .map-tools { right: 8px; top: 8px; bottom: auto; }
  .map-locate { width: 36px; height: 36px; }
}

/* Telefon: mapa bez prekrivača — legenda se sklanja (boju oznake objašnjava
   bubanj koji se otvara klikom), dugme ostaje gore lijevo, oznake su uže. */
@media (max-width: 640px) {
  .search-map { height: 240px; }
  .map-legend-box { display: none; }
  .map-btn { top: 8px; bottom: auto; left: 8px; height: 34px; padding: 0 11px; font-size: 11.5px; }
  .map-pin { font-size: 10.5px; padding: 0 9px; }
  .map-tools { top: 8px; right: 8px; }
}

/* Najuži telefoni: dvije kolone ostaju, samo sa manjim razmakom. */
@media (max-width: 360px) {
  .grid:not(.is-list) { gap: 18px 8px; }
}
