/* ── Search bar ───────────────────────────────────────────── */
#fresh-makelaars .block-search .search-filter {
  display: flex;
  align-items: center;
  gap: 8px;
}

#fresh-makelaars .block-search .search-input {
  position: relative;
  flex: 1;
}

#fresh-makelaars .block-search .search-input input {
  width: 100%;
  height: 46px;
  padding: 0 16px;
  border: 1px solid var(--fm2-border, #dde1e7);
  border-radius: var(--fm2-radius, 8px);
  font-size: 15px;
  color: var(--fm2-text, #1a1f2e);
  background: #fff;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
  box-sizing: border-box;
}

#fresh-makelaars .block-search .search-input input:focus {
  border-color: var(--fm2-blue, #1a5e8a);
  box-shadow: 0 0 0 3px rgba(26, 94, 138, 0.12);
}

#fresh-makelaars .block-search .search-input input::placeholder {
  color: var(--fm2-text-muted, #6b7280);
}

/* Search submit button */
#fresh-makelaars .block-search .search-filter .button {
  flex-shrink: 0;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  background: var(--fm2-blue, #1a5e8a);
  color: #fff !important;
  border: none;
  border-radius: var(--fm2-radius, 8px);
  cursor: pointer;
  transition: background 150ms ease;
  box-shadow: none;
}

#fresh-makelaars .block-search .search-filter .button:hover {
  background: var(--fm2-blue-dark, #154d73);
  box-shadow: none;
}

/* Filters trigger button */
#fresh-makelaars .block-search .search-filter .btn-filters-open {
  flex-shrink: 0;
  height: 46px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 18px;
  background: #fff;
  color: var(--fm2-text, #1a1f2e);
  border: 1px solid var(--fm2-border, #dde1e7);
  border-radius: var(--fm2-radius, 8px);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
}

#fresh-makelaars .block-search .search-filter .btn-filters-open:hover {
  border-color: var(--fm2-blue, #1a5e8a);
  background: #f5f9fc;
}

/* ── Overlay ──────────────────────────────────────────────── */
#fresh-makelaars .sidebar-filters-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
  z-index: 9998;
}

#fresh-makelaars .sidebar-filters-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* ── Sidebar panel ────────────────────────────────────────── */
#fresh-makelaars .sidebar-filters {
  position: fixed;
  top: 0;
  left: 0;
  width: min(400px, 92vw);
  /* 100vh measures the viewport with the mobile browser's address bar hidden,
     so on iOS Safari and Chrome Android the panel is taller than what is
     actually on screen. The flex footer then sits below the fold, and because
     the body is locked while the panel is open there is no way to scroll down
     to it: the apply button is simply unreachable until the address bar
     collapses. 100dvh follows the visible viewport instead.

     100vh stays as the fallback for browsers without dvh (Safari < 15.4). */
  height: 100vh;
  height: 100dvh;
  background: #fff;
  transform: translateX(-100%);
  transition: transform 220ms ease;
  z-index: 9999;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
}

#fresh-makelaars .sidebar-filters.is-open {
  transform: translateX(0);
}

#fresh-makelaars .sidebar-filters-inner {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  /* Breathing room under the last filter group, so it does not end flush
     against the footer bar. */
  padding-bottom: 24px;
}

/* Header */
#fresh-makelaars .sidebar-filters-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--fm2-border, #dde1e7);
  flex-shrink: 0;
}

#fresh-makelaars .sidebar-filters-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--fm2-text, #1a1f2e);
}

#fresh-makelaars .sidebar-filters-header .btn-filters-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none !important;
  border: 1px solid var(--fm2-border, #dde1e7) !important;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  color: var(--fm2-text-muted, #6b7280) !important;
  cursor: pointer;
  padding: 0;
  box-shadow: none !important;
  transition: border-color 150ms ease, color 150ms ease;
}

#fresh-makelaars .sidebar-filters-header .btn-filters-close:hover {
  border-color: var(--fm2-text, #1a1f2e) !important;
  color: var(--fm2-text, #1a1f2e) !important;
  background: none !important;
}

/* Scrollable filter area */
#fresh-makelaars .sidebar-filters-inner > .filter,
#fresh-makelaars .sidebar-filters-inner > .filter-group-soort,
#fresh-makelaars .sidebar-filters-inner > .filter-group-prijs,
#fresh-makelaars .sidebar-filters-inner > .filter-group-plaats,
#fresh-makelaars .sidebar-filters-inner > .filter-group-oppervlakte {
  padding: 20px 24px;
  border-bottom: 1px solid var(--fm2-border, #dde1e7);
}

#fresh-makelaars .sidebar-filters .filter {
  padding: 20px 24px;
  border-bottom: 1px solid var(--fm2-border, #dde1e7);
}

/* Filter title */
#fresh-makelaars .sidebar-filters .filter-title {
  display: block;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fm2-text-muted, #6b7280);
  margin-bottom: 14px;
}

/* Checkboxes */
#fresh-makelaars .sidebar-filters .filter-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#fresh-makelaars .sidebar-filters .filter-group-kamers .filter-checkboxes,
#fresh-makelaars .sidebar-filters .filter-group-slaapkamers .filter-checkboxes,
#fresh-makelaars .sidebar-filters .filter-group-badkamers .filter-checkboxes,
#fresh-makelaars .sidebar-filters .filter-group-energielabel .filter-checkboxes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 12px;
}

#fresh-makelaars .sidebar-filters .filter-checkboxes label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  color: var(--fm2-text, #1a1f2e);
  cursor: pointer;
  text-transform: capitalize;
}

#fresh-makelaars .sidebar-filters .filter-checkboxes input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--fm2-blue, #1a5e8a);
  cursor: pointer;
  flex-shrink: 0;
}

/* Range slider */
#fresh-makelaars .range-slider {
  margin-top: 4px;
}

#fresh-makelaars .sidebar-filters .noUi-target {
  height: 4px;
  background: var(--fm2-border, #dde1e7);
  border: none;
  box-shadow: none;
  border-radius: 2px;
}

#fresh-makelaars .sidebar-filters .noUi-connect {
  background: var(--fm2-blue, #1a5e8a);
}

#fresh-makelaars .sidebar-filters .noUi-handle {
  width: 16px !important;
  height: 16px !important;
  top: -6px !important;
  right: -8px !important;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  border: 2px solid var(--fm2-blue, #1a5e8a);
  background: #fff;
  cursor: pointer;
}

#fresh-makelaars .sidebar-filters .noUi-handle::before,
#fresh-makelaars .sidebar-filters .noUi-handle::after {
  display: none;
}

#fresh-makelaars .range-slider-labels {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--fm2-text, #1a1f2e);
}

/* Footer */
#fresh-makelaars .sidebar-filters-footer {
  padding: 16px 24px;
  /* env() clears the iOS home indicator, which otherwise sits over the button.
     Resolves to 0px on every other device. */
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--fm2-border, #dde1e7);
  flex-shrink: 0;
}

#fresh-makelaars .sidebar-filters-footer .button-apply-filters {
  width: 100%;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--fm2-blue, #1a5e8a);
  color: #fff !important;
  border: none;
  border-radius: var(--fm2-radius, 8px);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 150ms ease;
  text-decoration: none;
  box-shadow: none;
}

#fresh-makelaars .sidebar-filters-footer .button-apply-filters:hover {
  background: var(--fm2-blue-dark, #154d73);
  color: #fff !important;
  box-shadow: none;
}

/* Body lock */
body.filters-open {
  overflow: hidden;
}

/* ── Active filter pills ──────────────────────────────────── */
#fresh-makelaars .block-search .active-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

#fresh-makelaars .block-search .active-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid #dde1e7;
  border-radius: 999px;
  background: #f1f3f5;
  color: #1a1f2e;
  font-size: 13px;
  line-height: 1.4;
  text-decoration: none;
  transition: background .2s ease, border-color .2s ease;
}

#fresh-makelaars .block-search .active-filter-pill:hover,
#fresh-makelaars .block-search .active-filter-pill:focus-visible {
  background: #1a1f2e;
  border-color: #1a1f2e;
  color: #fff;
}

#fresh-makelaars .block-search .active-filter-pill-remove {
  font-size: 15px;
  line-height: 1;
  opacity: .6;
}

#fresh-makelaars .block-search .active-filter-pill:hover .active-filter-pill-remove,
#fresh-makelaars .block-search .active-filter-pill:focus-visible .active-filter-pill-remove {
  opacity: 1;
}

#fresh-makelaars .block-search .active-filter-clear {
  font-size: 13px;
  color: #6b7280;
  text-decoration: underline;
}

#fresh-makelaars .block-search .active-filter-clear:hover,
#fresh-makelaars .block-search .active-filter-clear:focus-visible {
  color: #1a1f2e;
}

/* Visually hidden, still read by screen readers. */
#fresh-makelaars .block-search .screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Van/Tot range selects (commercial property) ──────────────
   Replaces the noUiSlider pair. Two columns so "Van" and "Tot" read as one
   control; they stack under 360px, where a 2-up select is narrower than its
   own longest option ("€ 1.250.000"). */
#fresh-makelaars .filter-range-selects {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 359px) {
  #fresh-makelaars .filter-range-selects {
    grid-template-columns: minmax(0, 1fr);
  }
}

#fresh-makelaars .filter-range-select {
  min-width: 0;
}

#fresh-makelaars .filter-range-select-label {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--fm2-text-muted, #6b7280);
}

#fresh-makelaars .filter-range-select-input {
  /* width:100% with min-width:0 above is what keeps a long option from
     stretching the column past its share of the grid. */
  width: 100%;
  min-width: 0;
  height: 42px;
  /* Tight padding and 14px on purpose: the closed select has to fit its longest
     option ("Geen maximum") beside the arrow the browser draws, and a native
     select clips rather than ellipsises when it does not. 15px clipped it to
     "Geen maximur" in a 340px sidebar. */
  padding: 0 6px;
  font-size: 14px;
  color: var(--fm2-text, #1a1f2e);
  background: #fff;
  border: 1px solid var(--fm2-border, #dde1e7);
  border-radius: var(--fm2-radius, 8px);
  cursor: pointer;
}

#fresh-makelaars .filter-range-select-input:focus {
  outline: 2px solid var(--fm2-blue, #1a5e8a);
  outline-offset: 1px;
}
