/* TV category filters — a port of the SalesGuide design system's
 * FilterSidebar composite (components/composites/FilterSidebar.jsx) to plain
 * DOM, wearing Masons' fonts and colours instead of the TimBuild skin.
 *
 * The component's structure is kept intact: collapsible Show/Hide sections, a
 * dual-handle price slider, counted checkbox facets, "+ Show More", a
 * Reset Filters row with removable active-filter chips. Only the token layer
 * is re-pointed — action/accent become Masons blue, the type is the page's own
 * Helvetica stack, and the design system's blocky 6px radius is kept because
 * it already matches the mirror's cards. */

.sg-filters {
  /* The design system's token names, resolved to Masons' palette. Everything
   * below styles against these, so the skin is swappable in one block. */
  --f-surface: #fff;
  --f-on-surface: var(--sg-ink, #333);
  --f-on-surface-muted: var(--sg-muted, #6b6b6b);
  --f-border: var(--sg-line, #e6e6e6);
  --f-border-strong: #c9c9c9;
  --f-action: var(--sg-blue, #0F7EC2);
  --f-accent-text: var(--sg-blue, #0F7EC2);
  --f-radius: 6px;
  --f-radius-sm: 3px;

  background: var(--f-surface);
  border: 1px solid var(--f-border);
  border-radius: var(--f-radius);
  overflow: hidden;
  font-family: "Helvetica", Sans-serif;
  color: var(--f-on-surface);
}

/* The mirror ships a WordPress admin reset that paints EVERY <button> blue on
 * hover and focus. Every control in here is a button, so they each have to
 * hold their own background in all states or they vanish into a blue block. */
.sg-filters button,
.sg-filters button:hover,
.sg-filters button:focus,
.sg-filters button:active {
  background: transparent;
  color: inherit;
  box-shadow: none;
  border-radius: 0;
  font-family: inherit;
}
.sg-filters button:focus-visible { outline: 2px solid var(--f-action); outline-offset: 2px; }

/* ---------- active filters + reset ---------- */
.sg-filters__chips {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--f-border);
}
.sg-filters__chips[hidden] { display: none; }
.sg-filters__reset {
  border: 0; padding: 0; cursor: pointer;
  color: var(--f-accent-text) !important;
  font-size: 13px; line-height: 1;
  text-decoration: underline;
}
.sg-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 4px 3px 9px;
  border: 1px solid var(--f-border-strong);
  border-radius: 999px;
  font-size: 13px; line-height: 1.2;
}
.sg-chip__x {
  border: 0; padding: 0 2px; cursor: pointer;
  color: var(--f-on-surface-muted) !important;
  font-size: 15px; line-height: 1;
}
.sg-chip__x:hover { color: var(--f-on-surface) !important; }

/* ---------- section ---------- */
.sg-fsec { border-bottom: 1px solid var(--f-border); }
.sg-fsec:last-child { border-bottom: 0; }
.sg-fsec__head {
  display: flex; width: 100%; align-items: center; justify-content: space-between;
  gap: 10px; padding: 12px 16px;
  border: 0; cursor: pointer; text-align: left;
}
.sg-fsec__title {
  font-weight: 800; font-size: 14px; line-height: 1;
  text-transform: uppercase; letter-spacing: .02em;
  color: var(--f-on-surface);
}
.sg-fsec__toggle { font-size: 13px; line-height: 1; color: var(--f-accent-text); }
.sg-fsec__body {
  padding: 0 16px 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.sg-fsec__body[hidden] { display: none; }
.sg-fsec__facets { display: flex; flex-direction: column; gap: 8px; }

/* ---------- facet checkbox ---------- */
.sg-facet {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; line-height: 1.2;
}
.sg-facet input { position: absolute; opacity: 0; width: 0; height: 0; }
.sg-facet__box {
  width: 18px; height: 18px; flex: 0 0 18px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--f-surface);
  border: 1px solid var(--f-border-strong);
  border-radius: var(--f-radius-sm);
  color: #fff;
  transition: background .12s cubic-bezier(.2,0,.2,1), border-color .12s;
}
.sg-facet__box svg { width: 12px; height: 12px; display: none; }
.sg-facet input:checked + .sg-facet__box {
  background: var(--f-action); border-color: var(--f-action);
}
.sg-facet input:checked + .sg-facet__box svg { display: block; }
.sg-facet input:focus-visible + .sg-facet__box { outline: 2px solid var(--f-action); outline-offset: 2px; }
.sg-facet__label { font-size: 14px; color: var(--f-on-surface); }
.sg-facet__n {
  font-size: 12px; color: var(--f-on-surface-muted);
  font-variant-numeric: tabular-nums;
}

/* A facet that no remaining product can satisfy. Kept in place rather than
 * hidden, so the shape of the catalogue stays visible as choices narrow. */
.sg-facet.is-empty { cursor: not-allowed; opacity: .38; }
.sg-facet.is-empty .sg-facet__label { text-decoration: line-through; }

.sg-fsec__more {
  align-self: flex-start;
  border: 0; padding: 0; cursor: pointer;
  color: var(--f-accent-text) !important;
  font-size: 13px; line-height: 1;
}

/* ---------- price range ---------- */
.sg-range { display: flex; flex-direction: column; gap: 10px; }
.sg-range__track { position: relative; height: 20px; }
.sg-range__rail, .sg-range__fill {
  position: absolute; top: 8px; height: 4px; border-radius: 999px;
}
.sg-range__rail { left: 0; right: 0; background: var(--f-border); }
.sg-range__fill { background: var(--f-action); }
.sg-range input[type="range"] {
  position: absolute; left: 0; top: 0; width: 100%; height: 20px; margin: 0;
  appearance: none; -webkit-appearance: none;
  background: transparent; pointer-events: none;
}
.sg-range input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; pointer-events: auto;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--f-surface); border: 2px solid var(--f-action);
  box-shadow: 0 1px 2px rgba(4,26,51,.18); cursor: pointer;
}
.sg-range input[type="range"]::-moz-range-thumb {
  pointer-events: auto;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--f-surface); border: 2px solid var(--f-action);
  box-shadow: 0 1px 2px rgba(4,26,51,.18); cursor: pointer;
}
.sg-range input[type="range"]::-moz-range-track { background: transparent; }
.sg-range__vals {
  display: flex; justify-content: space-between;
  font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--f-on-surface);
}

/* ---------- promotion toggle ---------- */
.sg-switch { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.sg-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.sg-switch__track {
  width: 38px; height: 22px; flex: 0 0 38px; padding: 2px;
  border-radius: 999px; background: var(--f-border-strong);
  display: inline-flex;
  transition: background .18s cubic-bezier(.2,0,.2,1);
}
.sg-switch__knob {
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(4,26,51,.18);
  transition: transform .18s cubic-bezier(.2,0,.2,1);
}
.sg-switch input:checked + .sg-switch__track { background: var(--f-action); }
.sg-switch input:checked + .sg-switch__track .sg-switch__knob { transform: translateX(16px); }
.sg-switch input:focus-visible + .sg-switch__track { outline: 2px solid var(--f-action); outline-offset: 2px; }
.sg-switch__label { font-size: 14px; color: var(--f-on-surface-muted); }
.sg-switch input:checked ~ .sg-switch__label { color: var(--f-on-surface); font-weight: 600; }

/* ---------- result count above the grid ---------- */
.sg-filters__count {
  padding: 12px 16px;
  border-bottom: 1px solid var(--f-border);
  font-size: 13px; color: var(--f-on-surface-muted);
}
.sg-filters__count b { color: var(--f-on-surface); font-weight: 700; }

/* ---------- the grid this panel drives ---------- */
.e-loop-item.sg-out { display: none !important; }
.sg-noresults {
  grid-column: 1 / -1;
  padding: 48px 20px; text-align: center;
  color: var(--sg-muted, #6b6b6b);
}
.sg-noresults b { display: block; color: var(--sg-ink, #333); font-size: 17px; margin-bottom: 6px; }

/* ---------- mobile off-canvas host ---------- */
.sg-filters--offcanvas { border: 0; border-radius: 0; }

/* The drawer opens (aria-hidden flips) but its panel rests at the entry
 * animation's off-screen start position and never lands — a pre-existing gap
 * in the mirror, verified against the untouched clone, not something this
 * feature introduced. Scoped to the open state so the closed drawer is
 * unaffected; without it the mobile filter panel can never be seen. */
.elementor-widget-off-canvas .e-off-canvas[aria-hidden="false"] .e-off-canvas__main {
  transform: none !important;
  opacity: 1 !important;
  visibility: visible !important;
}
.elementor-widget-off-canvas .e-off-canvas[aria-hidden="false"] .e-off-canvas__content {
  overflow-y: auto;
}
