/* Mattana — shared filter + sort UI (bộ lọc / sắp xếp).
   Single source of truth: edit here and every page linking this file updates.
   Pages: Collection All Page, Collection Page, collection-choice. */
.filterbar { position: relative; }
.fb-count[hidden], .chiprow[hidden] { display: none; }
.fb-count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; background: var(--ink-900); color: #fff; border-radius: 999px; font-size: 10px; letter-spacing: 0; }
.fb-sort { position: relative; }
.sort-cur { font-weight: 600; color: var(--ink-500); text-transform: none; letter-spacing: .02em; }
/* sort dropdown */
.sortmenu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 120; min-width: 236px; background: #fff; border: 1px solid var(--border-subtle); box-shadow: 0 18px 40px rgba(0,0,0,.14); padding: 6px 0; display: none; text-transform: none; letter-spacing: 0; }
.sortmenu.open { display: block; }
.sm-head { display: none; }
.sm-opt { display: block; width: 100%; text-align: left; padding: 12px 18px; background: none; border: none; cursor: pointer; font-family: var(--font-sans); font-size: 14px; font-weight: 500; color: var(--ink-700); }
.sm-opt:hover { background: var(--ink-50); color: var(--ink-900); }
.sm-opt.on { font-weight: 700; color: var(--ink-900); }
/* applied chips */
.chiprow { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 0 0; }
.chiprow .ch { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px 0 12px; border: 1px solid var(--border-subtle); background: #fff; font-size: 12.5px; color: var(--ink-800); cursor: default; }
.chiprow .ch button { background: none; border: none; cursor: pointer; color: var(--ink-500); display: flex; padding: 2px; }
.chiprow .ch button:hover { color: var(--ink-900); }
.chiprow .ch-clear { height: 32px; padding: 0 12px; background: none; border: none; cursor: pointer; font-family: var(--font-sans); font-size: 12.5px; font-weight: 600; color: var(--ink-900); text-decoration: underline; text-underline-offset: 3px; }
/* filter drawer */
.fl-backdrop { position: fixed; inset: 0; z-index: 250; background: rgba(19,17,16,.42); opacity: 0; visibility: hidden; transition: opacity .3s var(--ease-standard); }
.fl-backdrop.open { opacity: 1; visibility: visible; }
.fl { position: fixed; top: 0; left: 0; height: 100%; width: 92%; max-width: 460px; background: var(--white); z-index: 251; transform: translateX(-100%); transition: transform .34s var(--ease-standard); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.fl.open { transform: translateX(0); }
.fl-head { display: flex; align-items: center; gap: 14px; padding: 22px 28px; border-bottom: 1px solid var(--border-subtle); flex-shrink: 0; }
.fl-head h2 { margin: 0; font-size: 20px; font-weight: 800; color: var(--ink-900); }
.fl-head .cnt { font-size: 13px; color: var(--ink-600); }
.fl-x { margin-left: auto; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; background: none; border: none; cursor: pointer; color: var(--ink-900); }
.fl-x:hover { background: var(--ink-50); }
.fl-body { flex: 1; overflow-y: auto; padding: 4px 28px 24px; }
.fl-sec { border-bottom: 1px solid var(--border-subtle); padding: 22px 0; }
.fl-sec:last-child { border-bottom: none; }
.fl-sechead { display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.fl-sechead h3 { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-900); }
.fl-sechead svg { color: var(--ink-600); transition: transform .2s var(--ease-standard); }
.fl-sec.closed .fl-opts { display: none; }
.fl-sec.closed .fl-sechead svg { transform: rotate(-90deg); }
.fl-opts { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }
.fl-opt { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; background: #fff; border: 1px solid var(--border-subtle); cursor: pointer; font-size: 14px; color: var(--ink-800); user-select: none; }
.fl-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.fl-opt:hover { border-color: var(--ink-400); }
.fl-opt.sel { border-color: var(--ink-900); background: var(--ink-900); color: #fff; }
.fl-opt .sw { width: 15px; height: 15px; border-radius: 2px; border: 1px solid rgba(0,0,0,.18); flex: none; }
.fl-opts.cols { flex-direction: column; gap: 4px; }
.fl-opts.cols .fl-opt { width: 100%; border: none; border-bottom: 1px solid var(--border-subtle); justify-content: space-between; padding: 0; min-height: 44px; }
.fl-opts.cols .fl-opt.sel { background: none; color: var(--ink-900); font-weight: 700; }
.fl-opts.cols .fl-opt .tick { opacity: 0; color: var(--ink-900); }
.fl-opts.cols .fl-opt.sel .tick { opacity: 1; }
.fl-foot { flex-shrink: 0; display: flex; gap: 12px; padding: 16px 28px 26px; border-top: 1px solid var(--border-subtle); }
.fl-reset { flex: 0 0 auto; height: 54px; padding: 0 20px; background: #fff; border: 1px solid var(--ink-900); cursor: pointer; font-family: var(--font-sans); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-900); }
.fl-reset:hover { background: var(--ink-50); }
.fl-apply { flex: 1; height: 54px; background: var(--ink-900); color: #fff; border: none; cursor: pointer; font-family: var(--font-sans); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.fl-apply:hover { opacity: .86; }
@media (max-width: 640px) {
  .filterbar { height: 46px; gap: 22px; font-size: 11px; position: sticky; top: 56px; z-index: 90; background: rgba(255,255,255,.97); backdrop-filter: blur(8px); margin: 0 -16px; padding: 0 16px; }
  .filterbar .view { display: none; }
  .sort-cur { display: none; }
  .sortmenu { position: fixed; left: 0; right: 0; bottom: 0; top: auto; min-width: 0; padding: 0 0 8px; border: none; border-radius: 0; box-shadow: 0 -14px 40px rgba(0,0,0,.22); transform: translateY(100%); transition: transform .3s var(--ease-standard); display: block; visibility: hidden; }
  .sortmenu.open { transform: none; visibility: visible; }
  .sm-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 10px; font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-900); border-bottom: 1px solid var(--border-subtle); }
  .sm-x { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; background: none; border: none; color: var(--ink-700); cursor: pointer; }
  .sm-opt { padding: 15px 18px; font-size: 15px; }
  .fl-head, .fl-body, .fl-foot { padding-left: 18px; padding-right: 18px; }
  .fl-foot { padding-bottom: 22px; }
  .chiprow { padding-top: 12px; }
}
