/* ==========================================================================
   OSSA — advanced search bar (js/search-bar.js)
   .osb            light variant (listing pages)
   .osb--glass     frosted variant over the homepage hero video
   .osb--up        panels open above the bar (hero sits at the bottom of the video)
   Breakpoints follow the site: 0–809 / 810–1199 / 1200+
   ========================================================================== */

.osb {
  --osb-line: rgba(67, 63, 56, 0.12);
  --osb-h: 84px;
  position: relative;
  font-family: var(--f-ui);
  color: var(--c-dark);
  text-align: left;
}

/* ---------- bar ---------- */
.osb-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.9fr) auto auto;
  min-height: var(--osb-h);
  background: var(--c-white);
  border: 1px solid var(--osb-line);
  box-shadow: 0 10px 30px rgba(67, 63, 56, 0.06);
}
.osb-seg {
  position: relative;
  display: flex; flex-direction: column; justify-content: center; gap: 6px;
  min-width: 0;
  padding: 16px 44px 16px 22px;
  text-align: left;
  border-right: 1px solid var(--osb-line);
  transition: background 0.2s ease;
}
.osb-seg::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: var(--c-orange);
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.3s ease;
}
.osb-seg:hover { background: var(--c-beige-15); }
.osb-seg.is-open { background: var(--c-bg); }
.osb-seg.is-open::after, .osb-seg--where:focus-within::after { transform: scaleX(1); }
.osb-lbl {
  font-size: 10.5px; line-height: 1; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--c-grey);
}
.osb-val {
  font-family: var(--f-body); font-size: 15px; line-height: 20px;
  color: var(--c-text-70);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.osb-seg.is-set .osb-val { color: var(--c-dark); }
.osb-seg > svg {
  position: absolute; right: 18px; top: 50%;
  width: 16px; height: 16px; margin-top: -8px;
  color: var(--c-grey);
  transition: transform 0.25s ease;
}
.osb-seg.is-open > svg { transform: rotate(180deg); color: var(--c-orange); }

/* location / agent: a real input inside the segment */
.osb-seg--where { padding-right: 18px; cursor: text; }
.osb-whererow { display: flex; align-items: center; gap: 8px; }
.osb-where {
  flex: 1; min-width: 0;
  border: 0; outline: 0; background: none; padding: 0;
  font-family: var(--f-body); font-size: 15px; line-height: 20px; color: var(--c-dark);
}
.osb-where::placeholder { color: var(--c-text-70); }
.osb.has-where .osb-bar .osb-where { color: var(--c-orange); }
.osb-wclear { width: 22px; height: 22px; flex: none; color: var(--c-grey); border-radius: 50%; display: grid; place-items: center; }
.osb-wclear:hover { color: var(--c-orange); background: var(--c-bg); }
.osb-wclear svg { width: 14px; height: 14px; }
.osb-wclear[hidden] { display: none; }

/* "more options" — icon-led square cell */
.osb-seg--more {
  align-items: center; justify-content: center; gap: 8px;
  padding: 14px 22px; min-width: 112px;
}
.osb-moreic { position: relative; display: inline-flex; }
.osb-moreic svg { width: 22px; height: 22px; color: var(--c-dark); }
.osb-seg--more.is-open .osb-moreic svg { color: var(--c-orange); }
.osb-badge {
  position: absolute; top: -6px; right: -10px;
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--c-orange); color: var(--c-white);
  font: 600 10px/17px var(--f-ui); text-align: center;
}
.osb-badge[hidden] { display: none; }

/* search button */
.osb-go {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-width: 84px; padding: 0 26px;
  background: var(--c-dark); color: var(--c-white);
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  transition: background 0.25s ease;
}
.osb-go svg { width: 22px; height: 22px; transition: transform 0.25s ease; }
.osb-go:hover { background: var(--c-orange); }
.osb-go:hover svg { transform: scale(1.1); }

/* ---------- panels ---------- */
.osb-panel {
  position: absolute; left: 0; top: calc(100% + 10px); z-index: 45;
  background: var(--c-white);
  border: 1px solid var(--osb-line);
  box-shadow: 0 28px 60px rgba(67, 63, 56, 0.18);
  padding: 22px;
  color: var(--c-dark);
  animation: osb-in 0.22s ease both;
}
.osb-panel[hidden] { display: none; }
.osb--up .osb-panel { top: auto; bottom: calc(100% + 10px); animation-name: osb-in-up; }
@keyframes osb-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes osb-in-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.osb-panel--more { right: 0; padding: 28px 30px 24px; }
.osb-ph { display: none; }
.osb-h {
  font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--c-grey); margin-bottom: 12px;
}
.osb-scrim { display: none; }

/* property type tiles */
.osb-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.osb-tile {
  position: relative;
  display: flex; flex-direction: column; align-items: flex-start; gap: 14px;
  padding: 18px 16px 14px;
  border: 1px solid var(--c-border);
  font-size: 13px; letter-spacing: 0.04em; color: var(--c-dark);
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.osb-tile > svg { width: 28px; height: 28px; color: var(--c-text-70); transition: color 0.2s ease; }
.osb-tile:hover { border-color: var(--c-beige); background: var(--c-beige-15); }
.osb-tile i {
  position: absolute; top: 10px; right: 10px;
  width: 18px; height: 18px; border-radius: 50%;
  border: 1px solid var(--c-beige);
  display: grid; place-items: center;
}
.osb-tile i svg { width: 11px; height: 11px; color: var(--c-white); opacity: 0; }
.osb-tile[aria-pressed="true"] { border-color: var(--c-orange); background: rgba(237, 106, 20, 0.05); }
.osb-tile[aria-pressed="true"] > svg { color: var(--c-orange); }
.osb-tile[aria-pressed="true"] i { background: var(--c-orange); border-color: var(--c-orange); }
.osb-tile[aria-pressed="true"] i svg { opacity: 1; }

/* transaction / market pills */
.osb-tx + .osb-tx { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--c-border); }
.osb-seglist { display: flex; flex-wrap: wrap; gap: 8px; }
.osb-pill {
  display: inline-flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 18px 0 14px;
  border: 1px solid var(--c-border); border-radius: var(--radius-pill);
  font-size: 13px; color: var(--c-dark);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.osb-pill i { width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--c-beige); transition: inherit; }
.osb-pill:hover { border-color: var(--c-beige); }
.osb-pill[aria-pressed="true"] { background: var(--c-dark); border-color: var(--c-dark); color: var(--c-white); }
.osb-pill[aria-pressed="true"] i { border: 4px solid var(--c-orange); background: var(--c-white); }

/* location / agent results */
.osb-panel--where { padding: 8px 0; }
.osb-where--m { display: none; }
.osb-results { max-height: 360px; overflow-y: auto; overscroll-behavior: contain; }
.osb-gh {
  position: sticky; top: 0; z-index: 1;
  padding: 12px 20px 8px;
  background: var(--c-white);
  font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--c-grey);
}
.osb-opt {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 9px 20px;
  text-align: left;
  transition: background 0.15s ease;
}
.osb-opt:hover, .osb-opt.is-hl { background: var(--c-bg); }
.osb-opt > svg { width: 18px; height: 18px; flex: none; color: var(--c-beige); }
.osb-opt:hover > svg, .osb-opt.is-hl > svg { color: var(--c-orange); }
.osb-opt span { display: flex; flex-direction: column; min-width: 0; }
.osb-opt b { font: 400 14px/20px var(--f-body); color: var(--c-dark); }
.osb-opt small { font-size: 11.5px; line-height: 16px; color: var(--c-grey); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.osb-opt mark { background: none; color: var(--c-orange); }
.osb-none { padding: 18px 20px; font-size: 13px; color: var(--c-grey); }

/* more options */
.osb-more { display: grid; grid-template-columns: repeat(2, minmax(220px, 300px)) minmax(0, 1fr); gap: 0 32px; align-items: start; }
.osb-extra { padding-left: 32px; border-left: 1px solid var(--c-border); display: flex; flex-direction: column; }
.osb-rh { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.osb-rh .osb-h { margin-bottom: 0; }
.osb-cur { display: inline-flex; border: 1px solid var(--c-border); border-radius: var(--radius-pill); padding: 2px; }
.osb-cur button {
  padding: 4px 10px; border-radius: var(--radius-pill);
  font-size: 10.5px; letter-spacing: 0.08em; color: var(--c-grey);
}
.osb-cur button:hover { color: var(--c-dark); }
.osb-cur button[aria-pressed="true"] { background: var(--c-dark); color: var(--c-white); }
.osb-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.osb-sel { position: relative; display: block; }
.osb-sel select {
  width: 100%; height: 44px; padding: 0 34px 0 14px;
  appearance: none; -webkit-appearance: none;
  border: 1px solid var(--c-border); border-radius: 0; background: var(--c-white);
  font-family: var(--f-body); font-size: 13px; color: var(--c-dark);
  cursor: pointer; outline: none;
}
.osb-sel select:focus { border-color: var(--c-orange); }
.osb-sel svg { position: absolute; right: 12px; top: 50%; width: 14px; height: 14px; margin-top: -7px; color: var(--c-grey); pointer-events: none; }
.osb-toggles { display: flex; flex-direction: column; gap: 12px; }
.osb-check { display: flex; align-items: center; gap: 12px; cursor: pointer; font-family: var(--f-body); font-size: 13px; color: var(--c-dark); }
.osb-check input { position: absolute; opacity: 0; pointer-events: none; }
.osb-check i {
  width: 18px; height: 18px; flex: none;
  border: 1px solid var(--c-beige);
  display: grid; place-items: center;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.osb-check i svg { width: 12px; height: 12px; color: var(--c-white); opacity: 0; }
.osb-check input:checked + i { background: var(--c-orange); border-color: var(--c-orange); }
.osb-check input:checked + i svg { opacity: 1; }
.osb-check input:focus-visible + i { outline: 2px solid var(--c-orange-60); outline-offset: 2px; }
.osb-kw {
  margin-top: 18px; height: 44px; padding: 0 14px;
  border: 1px solid var(--c-border); border-radius: 0; outline: 0; background: var(--c-white);
  font-family: var(--f-body); font-size: 13px; color: var(--c-dark);
}
.osb-kw:focus { border-color: var(--c-orange); }
.osb-kw::placeholder { color: var(--c-grey); }
.osb-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 22px;
  margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--c-border);
}
.osb-clear { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--c-grey); }
.osb-clear svg { width: 14px; height: 14px; }
.osb-clear:hover { color: var(--c-dark); }
.osb-apply {
  display: inline-flex; align-items: center; gap: 10px;
  height: 44px; padding: 0 26px;
  border-radius: var(--radius-pill);
  background: var(--c-orange); color: var(--c-white);
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  transition: background 0.25s ease;
}
.osb-apply svg { width: 16px; height: 16px; }
.osb-apply:hover { background: var(--c-dark); }

/* ---------- glass variant (homepage hero) ---------- */
.osb--glass { --osb-line: rgba(255, 255, 255, 0.4); color: var(--c-white); }
.osb--glass .osb-bar {
  background: rgba(203, 196, 188, 0.16);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: none;
}
.osb--glass .osb-seg:hover { background: rgba(255, 255, 255, 0.1); }
.osb--glass .osb-seg.is-open { background: rgba(255, 255, 255, 0.18); }
.osb--glass .osb-lbl { color: rgba(255, 255, 255, 0.75); }
.osb--glass .osb-val, .osb--glass .osb-bar .osb-where::placeholder { color: rgba(255, 255, 255, 0.85); }
.osb--glass .osb-seg.is-set .osb-val, .osb--glass .osb-bar .osb-where { color: var(--c-white); }
.osb--glass.has-where .osb-bar .osb-where { color: var(--c-white); }
.osb--glass .osb-seg > svg, .osb--glass .osb-moreic svg, .osb--glass .osb-wclear { color: var(--c-white); }
.osb--glass .osb-wclear:hover { background: rgba(255, 255, 255, 0.15); color: var(--c-white); }
.osb--glass .osb-go { background: var(--c-white); color: var(--c-dark); }
.osb--glass .osb-go:hover { background: var(--c-orange); color: var(--c-white); }

/* hero placement: wider than the old 800px link box */
.hero .hero-search--osb { width: 1120px; bottom: 190px; }

/* converted price under a card price while searching in EUR / USD */
.pc-price-fx { display: block; margin-top: 3px; font-family: var(--f-ui); font-size: 12px; line-height: 1.2; letter-spacing: 0.02em; color: var(--c-grey); }

/* listing pages */
.listing .osb { margin-top: 10px; z-index: 5; }

/* ---------- tablet ---------- */
@media (max-width: 1199px) {
  .osb-seg { padding: 14px 38px 14px 16px; }
  .osb-seg > svg { right: 12px; }
  .osb-seg--more { padding: 12px 14px; min-width: 92px; }
  .osb-go { padding: 0 22px; min-width: 72px; }
  .osb-go span { display: none; }
  .osb-more { grid-template-columns: 1fr 1fr; gap: 20px 28px; }
  .osb-extra { grid-column: 1 / -1; padding: 20px 0 0; border-left: 0; border-top: 1px solid var(--c-border); }
}

/* ---------- mobile: stacked bar, panels become bottom sheets ---------- */
@media (max-width: 809px) {
  .osb { --osb-h: auto; }
  .osb-bar { grid-template-columns: 1fr 1fr; }
  .osb-seg { padding: 14px 36px 14px 16px; border-bottom: 1px solid var(--osb-line); }
  .osb-seg[data-seg="tx"] { border-right: 0; }
  .osb-seg--where { grid-column: 1 / -1; border-right: 0; padding-right: 16px; }
  .osb-seg--more { flex-direction: row; justify-content: flex-start; padding: 14px 16px; border-bottom: 0; }
  .osb-go { padding: 14px 16px; }
  .osb-go span { display: inline; }
  .osb-val, .osb-where { font-size: 14px; }

  html.osb-lock, html.osb-lock body { overflow: hidden; }
  .osb-scrim { display: block; position: fixed; inset: 0; z-index: 1000; background: rgba(30, 28, 25, 0.45); animation: osb-fade 0.2s ease both; }
  .osb-scrim[hidden] { display: none; }
  @keyframes osb-fade { from { opacity: 0; } to { opacity: 1; } }
  .osb .osb-panel, .osb--up .osb-panel {
    position: fixed; left: 0 !important; right: 0; top: auto; bottom: 0; z-index: 1001;
    width: auto !important; max-height: 86vh; max-height: 86dvh; overflow-y: auto;
    padding: 0 20px calc(20px + env(safe-area-inset-bottom));
    border: 0; border-radius: 18px 18px 0 0;
    animation: osb-sheet 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  }
  @keyframes osb-sheet { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
  .osb-ph {
    position: sticky; top: 0; z-index: 2;
    display: flex; align-items: center; justify-content: space-between;
    margin: 0 -20px 16px; padding: 18px 20px 14px;
    background: var(--c-white); border-bottom: 1px solid var(--c-border);
    font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--c-dark);
  }
  .osb-close { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--c-bg); }
  .osb-close svg { width: 16px; height: 16px; }

  .osb-panel--where { display: flex; flex-direction: column; height: 86vh; height: 86dvh; padding-bottom: 0; }
  .osb-panel--where[hidden] { display: none; }
  .osb .osb-where--m, .osb--glass .osb-where--m { color: var(--c-dark); -webkit-text-fill-color: var(--c-dark); background: var(--c-white); }
  .osb .osb-where--m::placeholder { color: var(--c-grey); -webkit-text-fill-color: var(--c-grey); }
  .osb-where--m {
    display: block; flex: none;
    height: 46px; margin-bottom: 6px; padding: 0 14px;
    border: 1px solid var(--c-border); outline: 0; border-radius: 0;
    font-family: var(--f-body); font-size: 16px; color: var(--c-dark);
  }
  .osb-where--m:focus { border-color: var(--c-orange); }
  .osb-results { flex: 1; max-height: none; margin: 0 -20px; }

  .osb-more { grid-template-columns: 1fr; gap: 0; }
  .osb-kw { margin-top: 16px; font-size: 16px; }
  .osb-range { padding-bottom: 20px; }
  .osb-range + .osb-range { margin-top: 0; padding-top: 20px; border-top: 1px solid var(--c-border); }
  .osb-extra { margin-top: 0; padding-top: 20px; border-top: 1px solid var(--c-border); }
  .osb-toggles { gap: 14px; }
  .osb-check { font-size: 14px; }
  .osb-foot { position: sticky; bottom: calc(-20px - env(safe-area-inset-bottom)); margin: 20px -20px 0; padding: 14px 20px; background: var(--c-white); justify-content: space-between; }
  .osb-apply { flex: 1; justify-content: center; max-width: 220px; }
  .osb-sel select { font-size: 16px; }

  /* the hero box is centred with a transform, which would trap the fixed sheets */
  .hero .hero-search--osb { left: var(--gutter); right: var(--gutter); width: auto; max-width: none; transform: none; bottom: 30%; }
  .listing .osb { order: 2; margin-top: 40px; }
  .listing--plain .osb, .listing--loc .osb { margin-top: 23px; }
}

@media (prefers-reduced-motion: reduce) {
  .osb-panel, .osb-scrim { animation: none !important; }
  .osb-seg::after { transition: none; }
}
