/* Bộ lọc sản phẩm v2 — htttek.com (23/11/2026). Dùng biến màu của hp-clean.css. KHÔNG đặt max-width cho chữ. */
.htf, .htf * { box-sizing: border-box; }
.htf { margin: 0 0 12px; }
.htf-preview { margin: 0 0 8px; padding: 8px 12px; background: var(--brand-soft, #eef2ff); border: 1px solid var(--line, #e4e9f2); border-radius: var(--radius, 10px); color: var(--ink, #101828); font-size: 13px; }
.htf-preview a { color: var(--brand, #3157d5); font-weight: 700; }

/* ---- thanh nhóm lọc (desktop) ---- */
.htf-top { background: #fff; border: 1px solid var(--line, #e4e9f2); border-radius: var(--radius, 10px); padding: 10px 12px; }
.htf-sheet-h, .htf-sheet-foot { display: none; }
.htf-groups { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.htf-g { position: relative; }
.htf-g > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; background: #fff; border: 1px solid var(--line, #e4e9f2); border-radius: 999px; color: var(--ink, #101828); font-size: 14px; font-weight: 700; user-select: none; }
.htf-g > summary::-webkit-details-marker { display: none; }
.htf-g > summary::after { content: ""; width: 7px; height: 7px; margin: -3px 0 0 2px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform .15s; }
.htf-g[open] > summary { border-color: var(--brand, #3157d5); box-shadow: 0 0 0 3px var(--brand-soft, #eef2ff); }
.htf-g[open] > summary::after { transform: rotate(-135deg); margin-top: 3px; }
.htf-g > summary:hover { border-color: var(--brand, #3157d5); }
.htf-g:has(.htf-opt.on) > summary { background: var(--brand-soft, #eef2ff); border-color: var(--brand, #3157d5); color: var(--brand-dark, #162c78); }
.htf-n { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px; background: var(--brand, #3157d5); color: #fff; border-radius: 999px; font-size: 12px; font-weight: 800; }
.htf-panel { position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; min-width: 260px; max-height: 360px; overflow: auto; padding: 8px; background: #fff; border: 1px solid var(--line, #e4e9f2); border-radius: var(--radius, 10px); box-shadow: var(--shadow-hover, 0 14px 34px rgba(16, 24, 40, .12)); }
.htf-sec { padding: 4px 0 8px; border-bottom: 1px solid var(--line, #e4e9f2); }
.htf-sec:last-child { border-bottom: 0; }
.htf-sec-t { padding: 6px 8px; color: var(--muted, #667085); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .02em; }

/* ---- lựa chọn ---- */
.htf-opt { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 6px 8px; border-radius: 8px; color: var(--text, #344054); font-size: 14px; text-decoration: none; cursor: pointer; }
a.htf-opt:hover { background: var(--canvas, #f1f4f9); }
.htf-box { flex: 0 0 18px; width: 18px; height: 18px; border: 2px solid #b5bdd0; border-radius: 5px; background: #fff; position: relative; }
.htf-opt.on .htf-box { background: var(--brand, #3157d5); border-color: var(--brand, #3157d5); }
.htf-opt.on .htf-box::after { content: ""; position: absolute; left: 4px; top: 0; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.htf-opt.on { color: var(--ink, #101828); font-weight: 700; }
.htf-t { flex: 1 1 auto; min-width: 0; }
.htf-c { flex: 0 0 auto; color: var(--muted, #667085); font-style: normal; font-size: 12.5px; }
.htf-opt.dis { opacity: .42; cursor: not-allowed; }
.htf-opt:focus-visible, .htf-g > summary:focus-visible, .htf-chip:focus-visible, .htf-sort a:focus-visible, .htf-morebtn:focus-visible { outline: 3px solid var(--brand, #3157d5); outline-offset: 2px; }

/* ---- khoảng giá nhập tay ---- */
.htf-range { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; padding: 10px 8px 4px; border-top: 1px solid var(--line, #e4e9f2); }
.htf-range-l { color: var(--muted, #667085); font-size: 12.5px; }
.htf-range-r { display: flex; align-items: center; gap: 6px; }
.htf-range input[type=number] { flex: 1 1 0; min-width: 0; height: 38px; padding: 0 8px; border: 1px solid var(--line, #e4e9f2); border-radius: 8px; font-size: 14px; }
.htf-range button { height: 38px; padding: 0 12px; border: 0; border-radius: 8px; background: var(--brand, #3157d5); color: #fff; font-weight: 700; cursor: pointer; }

/* ---- thanh trạng thái: số lượng, chip, sắp xếp ---- */
.htf-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 10px; padding: 10px 14px; background: #fff; border: 1px solid var(--line, #e4e9f2); border-radius: var(--radius, 10px); }
.htf-count { color: var(--ink, #101828); font-size: 14px; }
.htf-mbtn { display: none; }
.htf-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; padding: 0; list-style: none; }
.htf-chip { display: inline-flex; align-items: center; gap: 5px; min-height: 30px; padding: 0 10px; background: var(--brand-soft, #eef2ff); border: 1px solid #d3dcfb; border-radius: 999px; color: var(--brand-dark, #162c78); font-size: 13px; text-decoration: none; }
.htf-chip span { color: var(--muted, #667085); }
.htf-chip i { font-style: normal; font-size: 11px; opacity: .7; }
.htf-chip:hover { border-color: var(--brand, #3157d5); }
.htf-clearall { color: var(--danger, #e31b23); font-size: 13px; font-weight: 700; text-decoration: none; }
.htf-sort { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-left: auto; font-size: 13px; }
.htf-sort span { color: var(--muted, #667085); }
.htf-sort a { padding: 5px 10px; border-radius: 999px; color: var(--text, #344054); text-decoration: none; white-space: nowrap; }
.htf-sort a:hover { background: var(--canvas, #f1f4f9); }
.htf-sort a.on { background: var(--ink, #101828); color: #fff; font-weight: 700; }

/* ---- kết quả ---- */
.htf-results { transition: opacity .15s; }
.htf-results.htf-busy { opacity: .5; pointer-events: none; }
.htf-pager { display: flex; justify-content: center; padding: 16px 0 4px; }
.htf-pager:empty { display: none; }
.htf-morebtn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 28px; background: #fff; border: 1px solid var(--brand, #3157d5); border-radius: 999px; color: var(--brand, #3157d5); font-weight: 800; text-decoration: none; }
.htf-morebtn:hover { background: var(--brand, #3157d5); color: #fff; }
.htf-morebtn span { font-weight: 500; }
.htf-empty { padding: 26px 18px; background: #fff; border: 1px solid var(--line, #e4e9f2); border-radius: var(--radius, 10px); color: var(--text, #344054); }
.htf-empty ul { margin: 8px 0 12px 18px; padding: 0; }
.htf-empty li { margin: 6px 0; }
.htf-empty a { color: var(--brand, #3157d5); }

/* ---- mobile: nút Bộ lọc + bottom-sheet (cần JS; không JS thì nhóm xếp dọc) ---- */
@media (max-width: 767px) {
  .htf-panel { position: static; min-width: 0; max-height: none; margin-top: 6px; box-shadow: none; }
  .htf-groups { flex-direction: column; align-items: stretch; }
  .htf-g > summary { justify-content: space-between; border-radius: 10px; }
  .htf-sort { margin-left: 0; width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .htf-status { padding: 10px; }
  html.htf-js .htf-mbtn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 16px; background: var(--ink, #101828); border: 0; border-radius: 999px; color: #fff; font-weight: 800; font-size: 14px; }
  html.htf-js .htf-top { position: fixed; z-index: 1001; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow: auto; padding: 0; border: 0; border-radius: 16px 16px 0 0; transform: translateY(105%); visibility: hidden; transition: transform .25s ease, visibility 0s .25s; box-shadow: 0 -10px 40px rgba(16, 24, 40, .25); }
  html.htf-js .htf.htf-open .htf-top { transform: none; visibility: visible; transition: transform .25s ease; }
  html.htf-js .htf-sheet-h { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 2; padding: 14px 16px; background: #fff; border-bottom: 1px solid var(--line, #e4e9f2); font-size: 16px; }
  html.htf-js .htf-x { width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--canvas, #f1f4f9); font-size: 16px; cursor: pointer; }
  html.htf-js .htf-groups { padding: 10px 12px; }
  html.htf-js .htf-sheet-foot { display: flex; align-items: center; gap: 12px; position: sticky; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line, #e4e9f2); }
  html.htf-js .htf-sheet-foot .htf-clear { color: var(--danger, #e31b23); font-weight: 700; text-decoration: none; }
  html.htf-js .htf-done { flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 46px; background: var(--brand, #3157d5); border-radius: 10px; color: #fff; font-weight: 800; text-decoration: none; }
  .htf-ov { position: fixed; z-index: 1000; inset: 0; background: rgba(16, 24, 40, .5); }
  html.htf-lock { overflow: hidden; }
  html.htf-lock [class*="hp-chat-fab"], html.htf-lock .icon-fixed-right-group, html.htf-lock .hp-side-rail { display: none !important; }
}
@media (min-width: 768px) { .htf-ov { display: none; } }
@media (prefers-reduced-motion: reduce) { .htf-results, html.htf-js .htf-top { transition: none; } }

/* ---- Chip "Chọn theo nhu cầu" (Phase 4, 23/11/2026) ---- */
.htf-needs { display: flex; align-items: center; gap: 8px 14px; margin: 0 0 10px; padding: 10px 12px; background: #fff; border: 1px solid var(--line, #e4e9f2); border-radius: var(--radius, 10px); }
.htf-needs-l { flex: 0 0 auto; color: var(--ink, #101828); font-size: 13px; font-weight: 800; }
.htf-needs-r { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.htf-need { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; background: #fff; border: 1px solid var(--line, #e4e9f2); border-radius: 999px; color: var(--text, #344054); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; cursor: pointer; }
a.htf-need:hover { border-color: var(--brand, #3157d5); background: var(--brand-soft, #eef2ff); }
.htf-need em { font-style: normal; font-size: 12.5px; opacity: .65; }
.htf-need-i { font-style: normal; }
.htf-need.on { background: var(--brand, #3157d5); border-color: var(--brand, #3157d5); color: #fff; }
.htf-need.on em { opacity: .85; }
.htf-need.dis { opacity: .42; cursor: not-allowed; }
.htf-need:focus-visible { outline: 3px solid var(--brand, #3157d5); outline-offset: 2px; }
@media (max-width: 767px) {
  .htf-needs { flex-direction: column; align-items: stretch; gap: 6px; padding: 10px; }
  .htf-needs-r { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .htf-need { flex: 0 0 auto; }
}
