/* ==========================================================================
   OSSA — property listing (/property, categories, rent/sale, locations)
   ========================================================================== */

.listing { padding: 163px var(--gutter) 60px; }
.listing .listing-title { margin-bottom: 10px; }

/* Search box — white card, hairline border, search cell divided off on the right */
.listing-search {
  background: var(--c-white);
  border: 1px solid rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: stretch;
}
.listing-search .ls-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; padding: 16px; }
.listing-search .ls-label { font-family: var(--f-ui); font-size: 16px; line-height: 29px; color: #333; }
.listing-search input {
  width: 100%; height: 46px;
  border: 1px solid rgba(0, 0, 0, 0.25);
  background: var(--c-white);
  padding: 0 16px;
  font-family: var(--f-ui);
  font-size: 14px;
  color: #333;
  outline: none;
}
.listing-search input::placeholder { color: #333; }
.listing-search input:focus { border-color: var(--c-beige); }
.listing-search .ls-btn {
  width: 81px; flex: none;
  display: flex; align-items: center; justify-content: center;
  color: #333;
  border-left: 1px solid rgba(0, 0, 0, 0.25);
  cursor: pointer;
}
.listing-search .ls-btn svg { width: 24px; height: 24px; }
.listing-search .ls-btn:hover { color: var(--c-orange); }

/* Sort + filter rows */
.listing-sort {
  display: flex; justify-content: flex-end; flex-wrap: wrap;
  padding-top: 10px;
  font-family: var(--f-ui); font-size: 14px;
}
.listing-sort .chip {
  padding: 10px 16px; border-radius: 8px;
  font-family: var(--f-body); font-size: 14px; line-height: 19.6px;
  color: rgba(82, 82, 82, 0.7);
}
.listing-count {
  margin-right: auto; align-self: center;
  font-family: var(--f-body); font-size: 14px; line-height: 14px;
  color: rgba(82, 82, 82, 0.7);
}
.listing-filters { padding-top: 17px; display: flex; flex-direction: column; row-gap: 11px; }
.chip .c-abbr { display: inline; }
.filter-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.fr-group { display: flex; align-items: center; gap: 8px; margin-left: 2px; }
.fr-group:first-child { margin-left: 0; }
.filter-row .fr-label { font-family: var(--f-ui); font-size: 11px; line-height: 15.4px; color: #000; margin-right: 2px; }
.filter-row .fr-group .chip { font-family: var(--f-body); }
.filter-row .fr-group[data-dyn] .chip { font-family: var(--f-ui); }
.chip {
  font-family: var(--f-ui); font-size: 14px; line-height: 38px;
  color: #8c8c8c;
  cursor: pointer;
  padding: 0 16px;
  transition: color 0.2s ease;
  background: none; border: none;
}
.chip:hover { color: var(--c-orange); }
.chip.active { color: var(--c-orange); }

/* Pagination */
.listing-pager {
  display: flex; align-items: center; justify-content: space-between;
  padding: 28px 0 19px;
  font-family: var(--f-body); font-size: 16px; line-height: 22.4px; color: #8c8c8c;
}
.listing-pager[hidden] { display: none; }
.listing-pager .lp-nav { display: flex; align-items: center; gap: 10px; }
.listing-pager button {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--f-body); font-size: 14px; line-height: 19.6px; color: #8c8c8c;
}
.listing-pager .lp-prev { padding-right: 16px; }
.listing-pager .lp-next { padding-left: 16px; }
.listing-pager button i { font-style: normal; }
.listing-pager button svg { width: 18px; height: 18px; flex: none; }
.listing-pager button:hover { color: var(--c-orange); }
.listing-pager button[disabled] { pointer-events: none; }

.listing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 44px var(--grid-gap);
}
.listing-empty { padding: 60px 0; text-align: center; color: var(--c-text-70); font-family: var(--f-ui); font-size: 14px; }
@media (max-width: 1199px) and (min-width: 810px) { .listing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 809px) {
  /* the original starts these page titles at y140 (40px under the header) */
  .listing { padding: 140px 20px 60px; display: flex; flex-direction: column; }
  /* original mobile order: title, search, filters, pager, grid — no sort row */
  .listing .listing-title { order: 0; }
  .listing .listing-sort { display: none; }
  .listing .listing-search { order: 2; margin-top: 50px; }
  .listing .listing-filters { order: 3; padding-top: 18px; row-gap: 16px; }
  .listing .listing-pager { order: 4; }
  .listing .listing-grid { order: 5; }
  .listing .listing-pager ~ .listing-pager { order: 6; }
  /* category / rent / sale and location pages start lower and show the offer
     count above the search box (the sort chips stay hidden) */
  .listing--plain { padding-top: 170px; }
  .listing--loc { padding-top: 180px; }
  .listing--plain.listing--low, .listing--low { padding-top: 190px; }
  .listing--plain .listing-sort, .listing--loc .listing-sort { display: flex; order: 1; margin-top: 3px; }
  .listing--plain .listing-sort .chip, .listing--loc .listing-sort .chip { display: none; }
  .listing--plain .listing-count, .listing--loc .listing-count { display: block; margin-right: auto; }
  .listing--plain .listing-search, .listing--loc .listing-search { margin-top: 23px; }
  /* on location pages the pager sits above the filter block here */
  .listing--loc .listing-pager { order: 3; padding-top: 30px; }
  .listing--loc .listing-filters { order: 4; padding-top: 0; }
  /* the four real category pages leave 40px more above the pager than premium / primary do */
  .listing--plain:not(.listing--low) .listing-pager { padding-top: 68px; }
  /* each filter group stacks with its label centred above the chips */
  .filter-row { flex-direction: column; align-items: stretch; row-gap: 16px; }
  .fr-group { width: 100%; margin-left: 0; flex-wrap: wrap; justify-content: center; row-gap: 6px; }
  .fr-group .fr-label { width: 100%; text-align: center; margin-right: 0; }
  .chip .c-abbr { display: none; }
  /* the original stacks listing cards full-width on mobile (335px at x20),
     same card metrics as the homepage grid. Unscoped: .listing-grid is also
     used by the "Polecane Nieruchomości" block on property pages. */
  .listing-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  /* .listing is a flex column here, so its children must not size to content */
  .listing > * { width: 100%; min-width: 0; }
}

/* bottom pager: mobile only, like the original */
.listing-pager.lp-bottom { display: none; }
@media (max-width: 809px) {
  .listing .listing-pager.lp-bottom { display: flex; order: 6; padding-top: 30px; }
  /* the mobile original lists "Wynajem" before "Sprzedaż" */
  .fr-group [data-filter="badge:Na Wynajem"], .fr-group [data-filter="badge:For Rent"] { order: 1; }
  .fr-group [data-filter="badge:Na Sprzedaż"], .fr-group [data-filter="badge:For Sale"] { order: 2; }
}

/* mobile dropdown for "Typ Transakcji" (the original swaps the chips for a select) */
.fr-select { display: none; }
@media (max-width: 809px) {
  .fr-group--select .chip { display: none; }
  .fr-group--select .fr-select { display: inline-flex; position: relative; margin-top: 12px; }
  .fr-select select {
    appearance: none; -webkit-appearance: none;
    height: 40px; padding: 0 46px 0 10px;
    background: #eadedb; border: 0; border-radius: 0;
    font-family: var(--f-ui); font-size: 14px; color: var(--c-orange);
  }
  .fr-select::after {
    content: ""; position: absolute; right: 16px; top: 50%; width: 7px; height: 7px;
    border-right: 1.5px solid var(--c-orange); border-bottom: 1.5px solid var(--c-orange);
    transform: translateY(-70%) rotate(45deg); pointer-events: none;
  }
}

/* Location suggestions under the search input. The original hangs the panel off
   the input itself — 4px below it, aligned with its edges — and caps it at 220px
   (5.5 of its 40px rows) with a scroll. .ls-main has 16px of padding, so the
   panel insets by that much and pulls up over the padding below the input. */
.listing-search .ls-main { position: relative; }
.ls-suggest {
  position: absolute; left: 16px; right: 16px; top: calc(100% - 12px); z-index: 30;
  max-height: 220px; overflow-y: auto;
  background: var(--c-white);
  border: 1px solid rgba(0, 0, 0, 0.25);
}
.ls-suggest[hidden] { display: none; }
.ls-suggest a {
  display: block; padding: 9.6px 16px;
  font-family: var(--f-ui); font-size: 12px; line-height: 20.8px; color: #333;
}
.ls-suggest a:hover { background: rgba(0, 0, 0, 0.04); }

/* the original's premium, primary, rent and sale pages sit 10px lower */
.listing--low { padding-top: 173px; }

/* the original pulls the filter block 7px up on location pages */
@media (min-width: 810px) {
  .listing--loc .listing-filters { padding-top: 10px; }
  .listing--loc .listing-pager { padding-top: 31px; }
}

/* the count belongs to the category pages on desktop; location pages only show it on mobile */
@media (min-width: 810px) { .listing--loc .listing-count { display: none; } }

/* the original drops the favourite heart on the category / rent / sale pages
   (they carry no "Polubione Oferty" filter either) */
.listing--plain .pc-fav { display: none; }
