/* ============================================================
   facets.css — Painel de facetas dinâmicas
   ============================================================ */

/* ─── Wrap + aside ────────────────────────────────────────── */
.facets-wrap {
  display: flex;
  flex-direction: column;
  width: 320px;
  min-width: 0;
  flex-shrink: 0;
  container-type: inline-size;
  container-name: facets;
  border-right: 1px solid var(--border);
  overflow: hidden;
  position: relative;
  background: var(--bg-facets);
}

.facets-wrap .section-title {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-sm);
  padding: 0 var(--spacing-md);
  height: var(--header-height);
  font-size: calc(11px * var(--font-scale, 1));
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  position: absolute;
  width: 100%;
  top: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-header);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
}

.facets {
  flex: 1;
  overflow-y: auto;
  padding: 68px calc(var(--spacing-md) - 5px) var(--spacing-md) var(--spacing-md);
  display: flex;
  flex-direction: column;
  width: auto;
  min-width: 0;
  border-right: none;
  background-color: var(--bg-facets);
  scrollbar-gutter:stable;
}

.facets-wrap.facets-hidden { display: none; }

/* ─── Grupos ──────────────────────────────────────────────── */
.fg + .fg { margin-top: var(--spacing-sm); }

.fg {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  flex-shrink: 0;
}

.fg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-sm);
  background: var(--primary-2);
  /* border-bottom: 1px solid var(--border); */
  gap: var(--spacing-sm);
}

.fg-title {
  font-size: calc(11px * var(--font-scale, 1));
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.fg-counts { display: flex; gap: var(--spacing-sm); flex-shrink: 0; }

/* ─── Contadores ──────────────────────────────────────────── */
.facet-cnt {
  font-size: calc(10px * var(--font-scale, 1));
  font-weight: 600;
  padding: 2px 5px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.facet-cnt-p { background: var(--primary-4); color: var(--primary);border:1px solid var(--border); }
.facet-cnt-d { background: #f0fdf4; color: #15803d;border:1px solid #d1fae5; }

/* ─── Items ───────────────────────────────────────────────── */
.fi {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
  cursor: pointer;
}
.fi:last-of-type { border-bottom: none; }
.fi:hover        { background: var(--primary-2); }
.fi.hidden       { display: none; }

.fi input[type="checkbox"] {
  /* Tamanho acompanha o zoom de acessibilidade (--font-scale), senão a caixa
     ficava minúscula ao lado do rótulo ampliado. */
  flex: 0 0 auto;
  width:  calc(13px * var(--font-scale, 1));
  height: calc(13px * var(--font-scale, 1));
  accent-color: var(--primary);
  cursor: pointer;
  margin: 0;
}

.fi-label {
  flex: 1;
  min-width: 0;
  font-size: calc(12px * var(--font-scale, 1));
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fi-label[data-action="facet-name"] {
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
}
.fi-label[data-action="facet-name"]:hover { color: var(--primary); }
.fi-label.name-disabled {
  cursor: default;
  text-decoration: none;
  opacity: 0.6;
  pointer-events: none;
}

.fi-counts { display: flex; gap: 3px; flex-shrink: 0; align-items: center; }

/* ─── "Ver mais" ──────────────────────────────────────────── */
.fg-more {
    display: block;
    width: 100%;
    padding: 6px 12px;
    background: var(--primary-6);
    border: none;
    border-top: 1px solid var(--border);
    font-size: calc(11px * var(--font-scale, 1));
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    height: auto;
    transition: color .1s;
    border-radius: 0 0 var(--radius) var(--radius);
}
.fg-more:hover  { color: var(--primary); background: none; }
.fg-more:active { transform: none; }

/* ─── Search de faceta ────────────────────────────────────── */
.facet-search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

/* ─── Highlight ───────────────────────────────────────────── */
/* Realce âmbar padrão — a versão anterior (véu azul translúcido com
   color-mix + color:inherit) era invisível sobre os chips/badges claros. */
mark.facet-highlight {
  background: #fde68a;
  color: #78350f;
  border-radius: 2px;
  padding: 0 1px;
  font-weight: 600;
}

/* ─── Flash de foco no input ──────────────────────────────── */
@keyframes inputPulse {
  0%   { box-shadow: 0 0 0 0 rgba(0,52,116,.4); }
  70%  { box-shadow: 0 0 0 6px rgba(0,52,116,0); }
  100% { box-shadow: 0 0 0 0 rgba(0,52,116,0); }
}
.query-input--active { animation: inputPulse .4s ease-out; }


/* Distribuição — toggle de Arquivos Únicos */
.dist-arqunico {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-size: calc(12px * var(--font-scale, 1));
  color: var(--text-light);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.dist-arqunico input { accent-color: var(--primary); cursor: pointer; }
.dist-tabs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* Aviso de faceta truncada (lote 29): a lista veio no teto pedido ao Solr, o
   índice pode ter mais valores. Discreto — é informação, não alerta. */
.fg-truncado {
  padding: 2px 10px 6px;
  font-size: calc(10.5px * var(--font-scale, 1));
  color: var(--text-hint, #8a8a8a);
  font-style: italic;
  cursor: help;
}
