/* 搵樓頁（browse.html）篩選 UI —— 1:1 對 Android PropertyBrowseActivity
 *
 * 每個數值嘅出處（唔靠肉眼估）：
 *   搜尋卡    activity_property_browse.xml:127-178  CardView 44dp、圓角 8dp、
 *             elevation 2dp、左右邊距 16dp、上邊距 12dp；搜尋圖示 18dp；
 *             hint 14sp；清除圖示 44dp（padding 12dp）
 *   篩選列    activity_property_browse.xml:181-283  HorizontalScrollView 45dp、
 *             每粒 36dp 高、padding 12dp、字 12sp、相距 8dp
 *   chip 顏色 照工作站頁 .ws-filter（--brand-blue 底 #EBF2FA、1px 藍框、700 粗字）
 *   AlertDialog  標題 20sp、單選／多選行 48dp 高、文字 14sp、遮罩 rgba(0,0,0,.6)、
 *             白卡圓角 2dp（app AlertDialog 預設 Material 值）
 *   地區三欄  SelectDistrictActivity + activity_select_district.xml:52-112
 *             三欄等闊、每行 48dp、選中橙字 #FF8000 + 灰底 #F5F5F5、
 *             底欄 70dp（「取消所有選項」／「確定」）
 *   空狀態    activity_property_browse.xml:306-334  64dp 圖示 + 14sp 灰字
 */

/* ---------- 搜尋卡（對 searchCard 44dp） ---------- */
.bf-search { padding: 12px 16px 0; background: var(--white); }
.bf-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 4px 0 12px;
  background: var(--white);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .16), 0 0 0 1px var(--divider);
}
.bf-search-box svg.bf-search-ico { width: 18px; height: 18px; flex: none; color: var(--nav-gray); }
.bf-search-box input[type="search"] {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: 14px;
  color: var(--black);
  -webkit-appearance: none;
  appearance: none;
}
.bf-search-box input[type="search"]:focus { outline: none; }
.bf-search-box input[type="search"]::-webkit-search-cancel-button { display: none; }
.bf-search-clear {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 12px;
  border: 0;
  background: none;
  color: var(--nav-gray);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.bf-search-clear[hidden] { display: none; } /* hidden 屬性敵不過 display:inline-flex，要明寫 */

/* ---------- 篩選 chips（一行橫向捲動，跟 hsvFilters 45dp） ---------- */
.bf-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 45px;
  margin-top: 8px;
  padding: 0 12px;
  background: var(--white);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.bf-chips::-webkit-scrollbar { display: none; }
.bf-chip {
  flex: none;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--divider);
  border-radius: 14px;
  background: var(--white);
  font-family: inherit;
  font-size: 12.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  cursor: pointer;
  max-width: 60vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 選中態跟 app `highlightFilterButton`：橙字 #FF8000、底色 #FFF3F3（唔用網站慣用嘅藍） */
.bf-chip[aria-pressed="true"] {
  border-color: var(--brand-orange, #FF8000);
  background: #FFF3F3;
  color: var(--brand-orange, #FF8000);
  font-weight: 700;
}
.bf-chip:focus-visible { outline: 2px solid var(--brand-blue); outline-offset: 1px; }

/* ---------- 結果數量（app 冇此行；只為網站補一個清楚嘅筆數） ---------- */
.bf-count {
  padding: 10px 16px 2px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--page-bg);
}
.bf-count strong { color: var(--text-primary); font-size: 13px; }

/* ---------- 對話框（單選／多選，跟 app AlertDialog） ---------- */
.bf-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  background: rgba(0, 0, 0, .6);
}
.bf-overlay.bf-overlay-sheet { padding: 0; align-items: stretch; }
.bf-dialog {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 340px;
  max-height: 76vh;
  background: var(--white);
  border-radius: 2px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .3);
}
.bf-dialog-h {
  padding: 20px 20px 8px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}
.bf-dialog-body { flex: 1 1 auto; overflow-y: auto; padding-bottom: 12px; overscroll-behavior: contain; }
.bf-dialog-f {
  flex: none;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px;
  border-top: 1px solid var(--divider);
}
.bf-dialog-f button {
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--brand-orange);
  cursor: pointer;
}
.bf-dialog-f button.bf-muted { color: var(--text-secondary); font-weight: 400; }

/* 單選／多選一行（app setSingleChoiceItems／setMultiChoiceItems 48dp 行） */
.bf-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}
.bf-opt:hover { background: #F5F5F5; }
.bf-opt[aria-selected="true"] { color: var(--brand-orange); font-weight: 700; }
.bf-opt .bf-mark {
  flex: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid #9E9E9E;
  background: var(--white);
  position: relative;
}
.bf-opt .bf-mark.round { border-radius: 50%; }
.bf-opt[aria-selected="true"] .bf-mark { border-color: var(--brand-orange); }
.bf-opt[aria-selected="true"] .bf-mark.round::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--brand-orange);
}
.bf-opt[aria-selected="true"] .bf-mark.box::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid var(--brand-orange);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.bf-opt .bf-label { flex: 1 1 auto; min-width: 0; }
.bf-opt .bf-sub { color: var(--text-tertiary); font-size: 12px; font-weight: 400; }

/* 類型：大類（＝app TYPE_FILTER_*）＋可展開嘅小類（app PropertyTypeCatalog 類別樹）
   一行兩個並排掣：左邊揀大類，右邊淨係展開／收起 —— 唔用「button 包 button」。 */
.bf-parent-row { display: flex; align-items: stretch; }
.bf-parent-row .bf-opt.bf-cat { flex: 1 1 auto; min-width: 0; }
.bf-caret-btn {
  flex: none;
  width: 44px;
  border: 0;
  background: none;
  color: var(--text-tertiary);
  font-size: 11px;
  cursor: pointer;
}
.bf-caret-btn:hover { background: #F5F5F5; }
.bf-caret-glyph { display: inline-block; transition: transform .15s ease; }
.bf-caret-btn[aria-expanded="true"] .bf-caret-glyph { transform: rotate(90deg); }
.bf-subopt { padding-left: 52px; min-height: 44px; font-size: 13.5px; }
.bf-subopt[aria-selected="true"] { background: #FFF8F0; }

/* ---------- 地區三欄（SelectDistrictActivity） ---------- */
.bf-sheet {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--app-width);
  height: 100%;
  margin: 0 auto;
  background: var(--white);
}
.bf-sheet-h {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  height: 56px;
  padding: 0 8px;
  background: var(--brand-blue);
}
.bf-sheet-h .bf-sheet-t {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--white);
  pointer-events: none;
}
.bf-sheet-x {
  margin-left: auto;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--white);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.bf-cols { flex: 1 1 auto; display: flex; overflow: hidden; }
.bf-col { flex: 1 1 0; min-width: 0; overflow-y: auto; padding: 4px 0 16px; }
.bf-col + .bf-col { border-left: 1px solid var(--divider); }
.bf-col-item {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 12px 4px;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: 14px;
  color: #333333;
  text-align: center;
  cursor: pointer;
  word-break: break-word;
}
.bf-col-item[aria-selected="true"] {
  color: var(--brand-orange);
  background: #F5F5F5;
  font-weight: 700;
}
.bf-sheet-f {
  flex: none;
  display: flex;
  height: 70px;
  border-top: 1px solid var(--divider);
  background: var(--white);
}
.bf-sheet-f button {
  flex: 1 1 0;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.bf-sheet-f .bf-sheet-clear { color: var(--text-primary); border-right: 1px solid var(--divider); }
.bf-sheet-f .bf-sheet-ok { color: var(--brand-orange); }

/* ---------- 空狀態（llEmptyState：64dp 圖示 + 14sp 灰字） ---------- */
.bf-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 64px 16px 40px;
  color: var(--nav-gray);
}
.bf-empty svg { width: 64px; height: 64px; color: #9E9E9E; }
.bf-empty p { margin: 12px 0 0; font-size: 14px; }

/* 對話框開住時鎖住背景捲動（同 app 模態一樣） */
body.bf-locked { overflow: hidden; }

@media (max-width: 360px) {
  .bf-chip { font-size: 12px; padding: 0 10px; }
  .bf-dialog-h { font-size: 18px; }
}
