/* ============================================================
   filters.css
   Airbnb-style filter bar, popovers and modal for the
   Landing Search UX demo. Paired with filters.js.
   Depends on the CSS custom properties declared in styles.css
   (--landing-blue, --accent, --accent-soft, --line, --ink,
    --ink-soft, --radius). Fallbacks are inlined so this file
   also renders standalone.
   ============================================================ */

/* ---------- filter bar ---------- */

#filterBar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  min-width: 0;
}

.fb-scroll {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  padding: 2px 2px 4px;
}
.fb-scroll::-webkit-scrollbar { display: none; }

.fb-pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 15px;
  border: 1px solid var(--line, #e5e7ee);
  border-radius: 999px;
  background: #fff;
  color: var(--ink, #1c2030);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background .15s, color .15s;
}
.fb-pill:hover {
  border-color: #c8ccdd;
  box-shadow: 0 1px 3px rgba(21, 25, 45, .10);
}
.fb-pill.is-active {
  background: var(--landing-blue, #15192D);
  border-color: var(--landing-blue, #15192D);
  color: #fff;
}
.fb-pill.is-active:hover { background: #232a4d; border-color: #232a4d; }
.fb-pill:focus-visible,
.fb-clear:focus-visible {
  outline: 2px solid var(--accent, #3557F0);
  outline-offset: 2px;
}

.fb-caret {
  width: 9px;
  height: 9px;
  flex: none;
  opacity: .55;
  transition: transform .18s;
}
.fb-pill[aria-expanded="true"] .fb-caret { transform: rotate(180deg); }
.fb-pill.is-active .fb-caret { opacity: .9; }

.fb-ico { width: 15px; height: 15px; flex: none; }

.fb-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--landing-blue, #15192D);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}
.fb-pill.is-active .fb-badge {
  background: #fff;
  color: var(--landing-blue, #15192D);
}
.fb-badge[hidden] { display: none; }

.fb-clear {
  flex: 0 0 auto;
  border: none;
  background: none;
  padding: 6px 2px;
  color: var(--ink-soft, #5b6172);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}
.fb-clear:hover { color: var(--ink, #1c2030); }
.fb-clear[hidden] { display: none; }

/* ---------- popover ---------- */

.fpop {
  position: fixed;
  z-index: 2000;
  width: 342px;
  max-width: calc(100vw - 24px);
  background: #fff;
  border: 1px solid var(--line, #e5e7ee);
  border-radius: var(--radius, 14px);
  box-shadow: 0 2px 6px rgba(21, 25, 45, .12), 0 14px 40px rgba(21, 25, 45, .18);
  padding: 16px 18px 18px;
}

.fpop-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -.01em;
}
.fpop-sub {
  font-size: 12px;
  color: var(--ink-soft, #5b6172);
  margin-top: 2px;
}
.fpop-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line, #e5e7ee);
}

/* ---------- price control (histogram + dual range) ---------- */

.fprice { margin-top: 14px; }

.fhist {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 58px;
  padding: 0 11px;
}
.fhist-bar {
  flex: 1 1 0;
  min-height: 3px;
  border-radius: 2px 2px 0 0;
  background: #dfe2ee;
  transition: background .12s;
}
.fhist-bar.is-in { background: var(--accent, #3557F0); }

.frange {
  position: relative;
  height: 28px;
  margin-top: -1px;
}
.frange-track,
.frange-fill {
  position: absolute;
  top: 12px;
  height: 4px;
  border-radius: 2px;
  pointer-events: none;
}
.frange-track { left: 11px; right: 11px; background: var(--line, #e5e7ee); }
.frange-fill { background: var(--accent, #3557F0); }

.frange input[type="range"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 28px;
  margin: 0;
  padding: 0;
  background: transparent;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
}
.frange input[type="range"]::-webkit-slider-runnable-track {
  height: 28px;
  background: transparent;
  border: none;
}
.frange input[type="range"]::-moz-range-track {
  height: 28px;
  background: transparent;
  border: none;
}
.frange input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  pointer-events: auto;
  width: 22px;
  height: 22px;
  margin-top: 3px;
  border-radius: 50%;
  border: 1px solid var(--line, #e5e7ee);
  background: #fff;
  box-shadow: 0 1px 4px rgba(21, 25, 45, .28);
  cursor: grab;
}
.frange input[type="range"]::-moz-range-thumb {
  pointer-events: auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--line, #e5e7ee);
  background: #fff;
  box-shadow: 0 1px 4px rgba(21, 25, 45, .28);
  cursor: grab;
}
.frange input[type="range"]:focus { outline: none; }
.frange input[type="range"]:focus-visible::-webkit-slider-thumb {
  outline: 2px solid var(--accent, #3557F0);
  outline-offset: 2px;
}
.frange input[type="range"]:focus-visible::-moz-range-thumb {
  outline: 2px solid var(--accent, #3557F0);
  outline-offset: 2px;
}

.fnum-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}
.fnum {
  flex: 1 1 0;
  min-width: 0;
  border: 1px solid var(--line, #e5e7ee);
  border-radius: 10px;
  padding: 7px 11px 8px;
  background: #fff;
}
.fnum:focus-within { border-color: var(--accent, #3557F0); }
.fnum span {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft, #5b6172);
}
.fnum input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink, #1c2030);
}
.fnum-dash {
  flex: none;
  width: 10px;
  height: 1px;
  background: var(--line, #e5e7ee);
}

/* ---------- segmented choices and toggle chips ---------- */

.fseg {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.fseg-btn {
  border: 1px solid var(--line, #e5e7ee);
  border-radius: 999px;
  background: #fff;
  padding: 8px 16px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink, #1c2030);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.fseg-btn:hover { border-color: #c8ccdd; }
.fseg-btn[aria-checked="true"] {
  background: var(--landing-blue, #15192D);
  border-color: var(--landing-blue, #15192D);
  color: #fff;
}
.fseg-btn:focus-visible,
.famen-chip:focus-visible {
  outline: 2px solid var(--accent, #3557F0);
  outline-offset: 2px;
}

.famen {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 12px;
}
.famen-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line, #e5e7ee);
  border-radius: 999px;
  background: #fff;
  padding: 9px 15px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink, #1c2030);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.famen-chip:hover { border-color: #c8ccdd; }
.famen-chip[aria-pressed="true"] {
  background: var(--accent-soft, #E8EDFE);
  border-color: var(--accent, #3557F0);
  color: var(--accent, #3557F0);
}
.famen-check { width: 13px; height: 13px; flex: none; opacity: 0; }
.famen-chip[aria-pressed="true"] .famen-check { opacity: 1; }

/* ---------- modal ---------- */

.fm-overlay {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(21, 25, 45, .48);
}

.fm-modal {
  display: flex;
  flex-direction: column;
  width: min(620px, 100%);
  max-height: min(86vh, 780px);
  background: #fff;
  border-radius: var(--radius, 14px);
  box-shadow: 0 10px 44px rgba(21, 25, 45, .34);
  overflow: hidden;
}

.fm-head {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line, #e5e7ee);
}
.fm-title { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.fm-x {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--ink, #1c2030);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.fm-x:hover { background: #f3f4f8; }
.fm-x:focus-visible { outline: 2px solid var(--accent, #3557F0); outline-offset: 1px; }

.fm-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 24px;
}

.fm-sec { padding: 22px 0; border-bottom: 1px solid var(--line, #e5e7ee); }
.fm-sec:last-child { border-bottom: none; }
.fm-sec-title { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.fm-sec-sub { font-size: 12px; color: var(--ink-soft, #5b6172); margin-top: 3px; }

.fm-foot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--line, #e5e7ee);
  background: #fff;
}
.fm-clear {
  border: none;
  background: none;
  padding: 8px 2px;
  color: var(--ink, #1c2030);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}
.fm-clear:hover { color: var(--accent, #3557F0); }
.fm-apply {
  border: none;
  border-radius: 10px;
  padding: 12px 20px;
  background: var(--landing-blue, #15192D);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.fm-apply:hover { background: #232a4d; }
.fm-apply:disabled { opacity: .55; cursor: default; }
.fm-clear:focus-visible,
.fm-apply:focus-visible { outline: 2px solid var(--accent, #3557F0); outline-offset: 2px; }

/* ---------- narrow screens ---------- */

@media (max-width: 620px) {
  .fm-overlay { padding: 0; align-items: stretch; }
  .fm-modal {
    width: 100%;
    max-height: 100%;
    height: 100%;
    border-radius: 0;
  }
  .fm-body { padding: 0 18px; }
  .fpop { width: calc(100vw - 24px); }
}

@media (prefers-reduced-motion: reduce) {
  .fb-pill, .fb-caret, .fhist-bar, .fseg-btn, .famen-chip { transition: none; }
}
