@layer infine.components {
.category-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

/* A filter bar's label for the field after it, "Category:" and the like. */
.filter-label {
  font-weight: 600;
  color: var(--infine-blue);
  white-space: nowrap;
}

/* Wide enough for All and its chevron, and growing with the pills up to where the bar's other contents still fit. */
.category-filter .mantine-MultiSelect-root {
  min-width: 180px;
  max-width: 520px;
}

.category-filter .mantine-MultiSelect-input {
  border: 1px solid var(--infine-blue-light-fade);
  background: var(--infine-blue-bg-tint);
}

/* All is the value of an empty filter rather than a hint, so it is set as the pills' text is. */
.category-filter .mantine-MultiSelect-inputField::placeholder {
  color: var(--infine-blue);
}

.category-filter .mantine-Pill-root {
  background-color: var(--infine-blue-light-fade);
  color: var(--infine-blue);
  font-weight: 700;
}

/* The two-level filter's field, drawn as the flat one's MultiSelect input draws itself,
   opening the tree of checkboxes rather than a list. */
.category-tree__field {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-width: 180px;
  max-width: 520px;
  min-height: 30px;
  padding: 3px 28px 3px 8px;
  border: 1px solid var(--infine-blue-light-fade);
  border-radius: var(--mantine-radius-default);
  background: var(--infine-blue-bg-tint);
  font-size: var(--mantine-font-size-xs);
  cursor: pointer;
}
.category-tree__field .mantine-Pill-root {
  background-color: var(--infine-blue-light-fade);
  color: var(--infine-blue);
  font-weight: 700;
}
.category-tree__all {
  color: var(--infine-blue);
}
.category-tree__caret {
  position: absolute;
  right: 8px;
  display: inline-flex;
  color: var(--mantine-color-gray-6);
}
.category-tree__dropdown {
  width: max-content;
  max-width: calc(100vw - 32px);
  max-height: 360px;
  overflow-y: auto;
  padding: 6px 8px;
}
.category-tree__row {
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 26px;
}
/* The tree draws the whole row as something to click, so the checkbox and its name take the rest of it:
   a click anywhere after the arrow ticks, where it would otherwise land on nothing under a pointer. */
.category-tree__row .mantine-Checkbox-root {
  flex: 1;
}
.category-tree__row .mantine-Checkbox-body,
.category-tree__row .mantine-Checkbox-labelWrapper {
  flex: 1;
}
.category-tree__row .mantine-Checkbox-label {
  display: block;
  cursor: pointer;
}
/* Every row, as wide as it would be shown, holding the dropdown at the widest of them: see category_filter.cljs. */
.category-tree__sizer {
  height: 0;
  overflow: hidden;
  visibility: hidden;
}
.category-tree__chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--infine-blue);
  cursor: pointer;
}
}
