/* kcg/product-filters + kcg/product-toolbar (design C listing). */
/* sticks just under the menu bar like the article side column (--kcg-sticky-top, theme.css; the admin bar included); a list
   taller than the window scrolls on its own so its last filters stay reachable */
.kcg-filters { position: sticky; top: var(--kcg-sticky-top); box-sizing: border-box; max-height: calc(100vh - var(--kcg-sticky-top) - var(--wp--preset--spacing--40)); overflow-y: auto; background: var(--wp--preset--color--surface); border: 1px solid var(--wp--preset--color--line); border-radius: var(--wp--preset--border-radius--medium); padding: var(--wp--preset--spacing--40) var(--wp--preset--spacing--50); }
.kcg-filters svg { width: 16px; height: 16px; fill: currentColor; flex: none; }
.kcg-filters__toggle { display: none; }
.kcg-fgroup { margin: 0; padding: var(--wp--preset--spacing--30) 0; border: 0; border-bottom: 1px solid var(--wp--preset--color--line); }
.kcg-fgroup h3, .kcg-fgroup legend { display: flex; align-items: center; gap: var(--wp--preset--spacing--20); margin: 0 0 var(--wp--preset--spacing--20); padding: 0; font-size: var(--wp--preset--font-size--small); font-weight: 700; /* = theme.json heading weight: a legend does not inherit it */ text-transform: uppercase; letter-spacing: .05em; color: var(--wp--preset--color--ink-2); }
/* a legend sits in the fieldset border, so the group padding would land under it: move that space above the heading,
   which then has the same space above and below as the h3 group */
fieldset.kcg-fgroup { padding-top: 0; }
fieldset.kcg-fgroup > legend { padding-top: var(--wp--preset--spacing--30); line-height: 1.25; /* = theme.json heading line height, which the h3 gets and a legend does not */ }
.kcg-flist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.kcg-flist a { display: flex; justify-content: space-between; gap: var(--wp--preset--spacing--20); padding: var(--wp--preset--spacing--20); border-radius: var(--wp--preset--border-radius--small); font-size: var(--wp--preset--font-size--small); color: var(--wp--preset--color--ink); text-decoration: none !important; }
.kcg-flist a:hover { background: var(--wp--preset--color--paper); }
.kcg-flist a[aria-current="page"] { background: var(--wp--preset--color--brand-soft); color: var(--wp--preset--color--brand-ink); font-weight: 600; }
.kcg-flist small, .kcg-check small { margin-left: auto; color: var(--wp--preset--color--ink-2); }
.kcg-check { display: flex; align-items: center; gap: var(--wp--preset--spacing--20); min-height: 36px; font-size: var(--wp--preset--font-size--small); cursor: pointer; }
/* filter tick boxes and radios: a small box with a tick drawn inside (two borders, sharp at any size; the icon set's tick is
   a hairline meant for 24px), radios the same with a dot */
.kcg-check input { appearance: none; -webkit-appearance: none; display: grid; place-items: center; flex: none; box-sizing: border-box; width: var(--kcg-check); height: var(--kcg-check); margin: 0; border: 1.5px solid var(--wp--preset--color--ink-2); border-radius: 3px; background: var(--wp--preset--color--surface); color: var(--wp--preset--color--on-brand); cursor: pointer; transition: background-color .15s var(--wp--custom--ease), border-color .15s var(--wp--custom--ease); } /* ds-ok: box border and corner at this small size */
.kcg-check input::before { content: ""; box-sizing: border-box; width: 4px; height: 8px; margin-top: -2px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg) scale(0); transition: transform .15s var(--wp--custom--ease); } /* ds-ok: tick drawn to the box size */
.kcg-check input:checked { border-color: var(--wp--preset--color--brand); background: var(--wp--preset--color--brand); }
.kcg-check input:checked::before { transform: rotate(45deg) scale(1); }
.kcg-check input[type="radio"] { border-radius: 50%; }
.kcg-check input[type="radio"]::before { width: 6px; height: 6px; margin: 0; border: 0; border-radius: 50%; background: currentColor; transform: scale(0); } /* ds-ok: radio dot */
.kcg-check input[type="radio"]:checked::before { transform: scale(1); }
.kcg-check:hover input:not(:checked) { border-color: var(--wp--preset--color--brand); }
.kcg-check input:focus-visible { outline: 2px solid var(--wp--preset--color--brand); outline-offset: 2px; }
/* the product list while a filter or page loads in place (catalog.js) */
.kcg-catm { transition: opacity .2s var(--wp--custom--ease); }
.kcg-catm.is-loading { opacity: .45; pointer-events: none; }
.kcg-filters__reset { display: flex; align-items: center; justify-content: center; gap: var(--wp--preset--spacing--20); box-sizing: border-box; min-height: var(--wp--custom--control-height); margin-top: var(--wp--preset--spacing--30); border: 1px solid var(--wp--preset--color--brand-line); border-radius: var(--wp--preset--border-radius--small); font-size: var(--wp--preset--font-size--small); font-weight: 600; text-decoration: none !important; }
/* the filter box scrolls on its own (long lists): "Bỏ lọc" stays at its bottom; the surface-coloured ring hides the list
   scrolling under it */
.kcg-filters__reset { position: sticky; bottom: 0; z-index: 1; background: var(--wp--preset--color--surface); box-shadow: 0 0 0 var(--wp--preset--spacing--40) var(--wp--preset--color--surface); } /* ring = the box padding: nothing peeks below it */

.kcg-toolbar { display: flex; justify-content: space-between; align-items: center; gap: var(--wp--preset--spacing--30); flex-wrap: wrap; padding: var(--wp--preset--spacing--20) var(--wp--preset--spacing--20) var(--wp--preset--spacing--20) var(--wp--preset--spacing--40); background: var(--wp--preset--color--surface); border: 1px solid var(--wp--preset--color--line); border-radius: var(--wp--preset--border-radius--medium); font-size: var(--wp--preset--font-size--small); }
.kcg-toolbar form { display: flex; align-items: center; gap: var(--wp--preset--spacing--20); margin: 0; }
.kcg-toolbar select { min-height: var(--wp--custom--control-height-sm); padding: 0 var(--wp--preset--spacing--30); border: 1px solid var(--wp--preset--color--line); border-radius: var(--wp--preset--border-radius--small); background: var(--wp--preset--color--surface); color: var(--wp--preset--color--ink); font-family: inherit; font-weight: 500; font-size: var(--wp--preset--font-size--small); line-height: 1; cursor: pointer; }

.kcg-filters__close { display: none; }
/* Tablets and phones: "Bộ lọc" is a vertical tab pinned to the left edge of the window, so it follows the visitor down the
   list; it opens the filters as a panel sliding in from the left over a dimmed page (catalog.js), like the menu panel
   slides in from the right. */
@media (max-width: 900px) {
	.kcg-filters { position: static; max-height: none; overflow: visible; padding: 0; border: 0; background: none; }
	.kcg-filters__toggle { position: fixed; left: 0; top: 50%; z-index: var(--wp--custom--z--header); display: flex; align-items: center; gap: var(--wp--preset--spacing--20); box-sizing: border-box; min-width: var(--wp--custom--control-height); padding: var(--wp--preset--spacing--40) 0; border: 1px solid var(--wp--preset--color--brand); border-left: 0; border-radius: 0 var(--wp--preset--border-radius--medium) var(--wp--preset--border-radius--medium) 0; background: var(--wp--preset--color--brand); color: var(--wp--preset--color--on-brand); font: inherit; font-size: var(--wp--preset--font-size--small); font-weight: 600; writing-mode: vertical-lr; transform: translateY(-50%); box-shadow: var(--wp--preset--shadow--float); cursor: pointer; }
	.kcg-filters__toggle svg { width: 18px; height: 18px; fill: currentColor; } /* ds-ok: icon size */
	.kcg-filters::before { content: ""; position: fixed; inset: 0; z-index: calc(var(--wp--custom--z--drawer) - 1); background: color-mix(in srgb, var(--wp--preset--color--deep) 55%, transparent); opacity: 0; visibility: hidden; transition: opacity .3s var(--wp--custom--ease), visibility 0s .3s; } /* the dimmed page: a click on it closes */
	.kcg-filters.is-open::before { opacity: 1; visibility: visible; transition: opacity .3s var(--wp--custom--ease); }
	.kcg-filters__form { position: fixed; top: var(--kcg-adminbar-h); bottom: 0; left: 0; z-index: var(--wp--custom--z--drawer); display: block; box-sizing: border-box; width: min(var(--kcg-panel-w), calc(100% - var(--kcg-panel-gap))); margin: 0; padding: var(--wp--preset--spacing--40) var(--wp--preset--spacing--50); overflow-y: auto; overscroll-behavior: contain; background: var(--wp--preset--color--surface); box-shadow: var(--wp--preset--shadow--float); transform: translateX(-100%); visibility: hidden; transition: transform .3s var(--wp--custom--ease), visibility 0s .3s; }
	.kcg-filters.is-open .kcg-filters__form { transform: none; visibility: visible; transition: transform .3s var(--wp--custom--ease); }
	.kcg-filters__close { display: flex; align-items: center; gap: var(--wp--preset--spacing--10); margin: 0 0 var(--wp--preset--spacing--20) auto; padding: var(--wp--preset--spacing--20) 0; border: 0; background: none; color: var(--wp--preset--color--ink); font: inherit; font-size: var(--wp--preset--font-size--small); font-weight: 600; cursor: pointer; }
	.kcg-filters__close svg { width: 20px; height: 20px; fill: currentColor; } /* ds-ok: icon size */
	.kcg-filters-open body { overflow: hidden; } /* the list behind the panel does not scroll */
}
@media (max-width: 900px) and (prefers-reduced-motion: reduce) {
	.kcg-filters__form, .kcg-filters::before { transition: none !important; }
}
