/* OE Filter Checkboxes (oe/filter-checkboxes). Matches the old WP Grid
   Builder checkboxes: 20px boxes, label, count on the right, + for sub-terms. */

.oe-block-filter-checkboxes__fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.oe-block-filter-checkboxes .oe-block-filter-checkboxes__list {
  display: flex;
  flex-direction: column;
  gap: var(--oe-spacing-xsmall);
  margin: 0;
  padding: 0;
  list-style: none;
}

.oe-block-filter-checkboxes .oe-block-filter-checkboxes__list--sub {
  margin-top: var(--oe-spacing-xsmall);
  padding-left: var(--oe-spacing-large);
}

.oe-block-filter-checkboxes .oe-block-filter-checkboxes__item {
  margin: 0;
}

.oe-block-filter-checkboxes__item[hidden],
.oe-block-filter-checkboxes__sub[hidden] {
  display: none;
}

.oe-block-filter-checkboxes__row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: start;
  gap: var(--oe-spacing-xsmall);
}

.oe-block-filter-checkboxes__input {
  appearance: none;
  display: grid;
  place-content: center;
  width: 20px;
  height: 20px;
  margin: 0.15em 0 0;
  border: 1px solid var(--oe-color-base);
  border-radius: var(--oe-border-radius-xsmall);
  background-color: transparent;
  cursor: pointer;
}

.oe-block-filter-checkboxes__input::before {
  content: "";
  width: 11px;
  height: 6px;
  margin-top: -3px;
  border-bottom: 2px solid var(--oe-color-primary-4, #fff);
  border-left: 2px solid var(--oe-color-primary-4, #fff);
  transform: rotate(-45deg) scale(0);
  transition: transform 120ms ease-out;
}

.oe-block-filter-checkboxes__input:checked {
  border-color: var(--oe-color-secondary);
  background-color: var(--oe-color-secondary);
}

.oe-block-filter-checkboxes__input:checked::before {
  transform: rotate(-45deg) scale(1);
}

.oe-block-filter-checkboxes__input:focus-visible {
  outline: 2px solid var(--oe-color-primary);
  outline-offset: 2px;
}

.oe-block-filter-checkboxes__label {
  color: var(--oe-color-base);
  line-height: var(--oe-line-height-medium-large);
  cursor: pointer;
}

.oe-block-filter-checkboxes__count {
  color: var(--oe-color-neutral);
  line-height: var(--oe-line-height-medium-large);
}

.oe-block-filter-checkboxes__toggle {
  display: grid;
  place-content: center;
  width: var(--oe-sizing-medium);
  height: var(--oe-sizing-medium);
  margin-top: -2px;
  padding: 0;
  border: 0;
  border-radius: var(--oe-border-radius-xsmall);
  background-color: var(--oe-color-base);
  color: var(--oe-color-primary-4, #fff);
  cursor: pointer;
}

.oe-block-filter-checkboxes__toggle:hover,
.oe-block-filter-checkboxes__toggle:focus {
  background-color: var(--oe-color-secondary);
  color: var(--oe-color-primary-4, #fff);
}

.oe-block-filter-checkboxes__toggle:focus-visible {
  outline: 2px solid var(--oe-color-primary);
  outline-offset: 2px;
}

.oe-block-filter-checkboxes__toggle[aria-expanded="true"] .oe-block-filter-checkboxes__plus-v {
  display: none;
}

/* No matches while other filters are on: greyed out but still usable.
   Neutral grey keeps text contrast above 4.5:1 (opacity would not). */
.oe-block-filter-checkboxes__item.is-empty > .oe-block-filter-checkboxes__row .oe-block-filter-checkboxes__label {
  color: var(--oe-color-neutral);
}

.oe-block-filter-checkboxes__item.is-empty > .oe-block-filter-checkboxes__row .oe-block-filter-checkboxes__input {
  border-color: var(--oe-color-neutral);
}

.oe-block-filter-checkboxes .oe-block-filter-checkboxes__more,
.oe-block-filter-checkboxes .oe-block-filter-checkboxes__more:hover,
.oe-block-filter-checkboxes .oe-block-filter-checkboxes__more:focus {
  border: 0;
  background: transparent;
  margin-top: var(--oe-spacing-small);
  color: var(--oe-color-secondary);
  font-size: var(--oe-font-size-small);
  cursor: pointer;
}
