/* V0.2.1 · Source Preview and two-level Library filters */

.filter-bar {
  position: sticky;
  z-index: 15;
  top: 70px;
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 46px;
  padding: 5px 24px 13px;
  background: rgba(248,248,246,.97);
}

.role-filter-group,
.facet-filter-group {
  display: flex;
  align-items: center;
  min-width: 0;
}

.filter-group-label {
  margin-right: 7px;
  color: #aaa9a5;
  font-size: 9px;
  letter-spacing: .04em;
}

.filter-row {
  position: static;
  display: inline-flex;
  gap: 1px;
  padding: 2px;
  border-radius: 8px;
  background: #ececea;
}

.filter-row button {
  padding: 5px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #777774;
  font-size: 11px;
}

.filter-row button:hover { background: rgba(255,255,255,.52); }
.filter-row button.active {
  background: #fff;
  color: #1f1f1e;
  font-weight: 580;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}

.filter-group-divider {
  width: 1px;
  height: 17px;
  background: #dfdfdc;
}

.facet-filter-group {
  position: relative;
  flex: 1;
  overflow: visible;
}

.quick-facet-row {
  display: flex;
  align-items: center;
  gap: 1px;
  min-width: 0;
}

.quick-facet-row button,
.more-facet-button {
  padding: 5px 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #777774;
  font-size: 10px;
  white-space: nowrap;
}

.quick-facet-row button:hover,
.more-facet-button:hover { background: rgba(0,0,0,.04); color: #373735; }
.quick-facet-row button.active {
  background: #e5e5e2;
  color: #222;
  font-weight: 560;
}

.more-facet-wrap { position: relative; margin-left: 2px; }
.more-facet-button span { margin-left: 2px; color: #aaa; font-size: 9px; }
.more-facet-button.has-active { color: #252523; font-weight: 560; }
.more-facet-button.has-active:after {
  content: attr(data-count);
  display: inline-grid;
  place-items: center;
  min-width: 15px;
  height: 15px;
  margin-left: 4px;
  border-radius: 8px;
  background: #353533;
  color: #fff;
  font-size: 8px;
}

.facet-filter-popover {
  top: 31px;
  right: 0;
  width: 360px;
  max-height: min(510px, calc(100vh - 150px));
  overflow-y: auto;
  padding: 12px;
}

.facet-filter-popover > header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 2px 2px 10px;
  border-bottom: 1px solid var(--line);
}

.facet-filter-popover header div { display: grid; gap: 3px; }
.facet-filter-popover header b { font-size: 11px; }
.facet-filter-popover header span { color: var(--muted); font-size: 9px; }
.facet-filter-popover header button {
  padding: 4px 6px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #777;
  font-size: 9px;
}

.facet-filter-section { padding: 11px 2px 5px; }
.facet-filter-section + .facet-filter-section { border-top: 1px solid #efefed; }
.facet-filter-section > span {
  display: block;
  margin-bottom: 7px;
  color: #9b9b97;
  font-size: 9px;
}
.facet-filter-options { display: flex; flex-wrap: wrap; gap: 5px; }
.facet-filter-options button {
  padding: 5px 7px;
  border: 0;
  border-radius: 5px;
  background: #f0f0ee;
  color: #62625f;
  font-size: 9px;
}
.facet-filter-options button:hover { background: #e7e7e4; }
.facet-filter-options button.active { background: #30302f; color: #fff; }
.facet-filter-empty { padding: 22px 3px 14px; color: #999; font-size: 10px; }

.identity-important .card-badge { letter-spacing: .03em; }
.source-note strong { display: block; margin-bottom: 3px; color: #555; font-size: 10px; }

@media (max-width: 1180px) {
  .filter-bar { padding-inline: 18px; gap: 9px; }
  .filter-group-label { display: none; }
  .quick-facet-row button:nth-child(n+6) { display: none; }
}
