/* Faceted Filter Panel */
.rlb-faceted-filter {
  max-width: 320px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 16px;
  background: var(--surface-color);
  font-family: inherit;
}

/* Header */
.rlb-faceted-filter__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-200);
}

.rlb-faceted-filter__title {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-color-strong);
}

/* Clear All Button */
.rlb-faceted-filter__clear {
  background: none;
  border: none;
  color: var(--primary-color);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--border-radius);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.rlb-faceted-filter__clear:hover {
  color: var(--text-color-strong);
  background: var(--surface-muted);
}

.rlb-faceted-filter__clear:focus-visible {
  outline: 2px solid var(--focus-color);
  outline-offset: 2px;
}

/* Live Region */
.rlb-faceted-filter__live-region {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-color);
  padding: 8px 12px;
  background: var(--surface-muted);
  border-radius: var(--border-radius);
  margin-bottom: 16px;
}

/* Filter Groups */
.rlb-faceted-filter__group {
  border: none;
  padding: 0;
  margin: 0 0 8px 0;
  border-bottom: 1px solid var(--gray-200);
}

.rlb-faceted-filter__group:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
}

.rlb-faceted-filter__group-legend {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Toggle Button */
.rlb-faceted-filter__toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 12px 0;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--primary-color);
}

.rlb-faceted-filter__toggle:hover {
  color: var(--text-color-strong);
}

.rlb-faceted-filter__toggle:focus-visible {
  outline: 2px solid var(--focus-color);
  outline-offset: 2px;
  border-radius: var(--border-radius);
}

/* Toggle Icon (chevron) */
.rlb-faceted-filter__toggle-icon {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--text-color-subtle);
  border-bottom: 2px solid var(--text-color-subtle);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.rlb-faceted-filter__toggle[aria-expanded="false"] .rlb-faceted-filter__toggle-icon {
  transform: rotate(-45deg);
}

/* Options Container */
.rlb-faceted-filter__options {
  padding: 0 0 12px 0;
}

.rlb-faceted-filter__options[hidden] {
  display: none;
}

/* Individual Option */
.rlb-faceted-filter__option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-color);
}

.rlb-faceted-filter__option:hover {
  background: var(--background-color);
}

/* Checkbox Styling */
.rlb-faceted-filter__option input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--text-color-faint);
  border-radius: var(--border-radius);
  background: var(--surface-color);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
}

.rlb-faceted-filter__option input[type="checkbox"]:checked {
  background: var(--primary-color);
  border-color: var(--primary-color);
}

.rlb-faceted-filter__option input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 5px;
  width: 5px;
  height: 9px;
  border: solid var(--text-color-inverse);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.rlb-faceted-filter__option input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--focus-color);
  outline-offset: 2px;
}

/* Option Name */
.rlb-faceted-filter__option-name {
  flex: 1;
}

/* Count Badge */
.rlb-faceted-filter__option-count {
  font-size: 0.8125rem;
  color: var(--text-color-subtle);
  font-weight: 500;
  background: var(--surface-muted);
  padding: 1px 6px;
  border-radius: var(--border-radius);
  min-width: 28px;
  text-align: center;
}

/* Focus indicators - 3:1 contrast */
*:focus-visible {
  outline: 2px solid var(--focus-color);
  outline-offset: 2px;
}
