/* Filter dropdown shared by index.html and charts.html. Loads after
   css/common.css and before the page's own stylesheet. */

/* The filter form packs a lot in, so labels and controls run smaller here. */
.filters label { font-size: var(--fs-xs); margin: 0 0 5px; }
.filters input, .filters select { padding: 7px 11px; font-size: 13.5px; }
.filters select { background-position: right 11px center; padding-right: 32px; }

/* --- Compact filter controls in the page header ---------------------------
   A button that names the active filters opens a dropdown holding the full
   filter form. Charts adds a second, icon-only button for chart visibility. */
.head-actions { position: relative; display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
/* The dropdown anchors to .head-actions, so it lines up with the page edge. */
.head-tools { display: flex; gap: var(--s-2); }
.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  max-width: 340px;
  padding: 0 10px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  font-family: inherit;
  font-size: 13px;
  font-weight: 550;
  color: var(--ink);
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}
.tool-btn:hover, .tool-btn[aria-expanded="true"] { border-color: var(--ink-faint); background: var(--panel-sunk); }
.tool-btn > svg:first-child { width: 16px; height: 16px; flex-shrink: 0; color: var(--ink-soft); }
.tool-btn.icon-only { padding: 0 8px; }
.filter-summary { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.chev { display: inline-flex; color: var(--ink-faint); transition: transform .15s ease; }
.chev svg { width: 10px; height: 10px; }
.chev.open { transform: rotate(180deg); }

.dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 15;
  width: min(560px, calc(100vw - 2 * var(--gutter)));
  padding: var(--s-4) var(--s-5);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
}
.dropdown-title { font-size: var(--fs); font-weight: 650; margin-bottom: var(--s-3); }
.filter-note { color: var(--ink-faint); }
.filter-note:not(:empty)::before { content: "· "; }

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--s-3);
}
.filter-actions {
  display: flex;
  gap: var(--s-2);
  align-items: flex-end;
  flex-wrap: wrap;
  margin-top: var(--s-4);
}
.dropdown .filter-actions { justify-content: flex-end; }
button.apply, button.reset {
  padding: 7px var(--s-4);
  border-radius: var(--r);
  font-size: 13.5px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
}
button.apply { background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); }
button.apply:hover { background: var(--accent-hover); }
button.reset { background: var(--panel); border: 1px solid var(--line-strong); color: var(--ink); font-weight: 550; }
button.reset:hover { border-color: var(--ink-faint); background: var(--panel-sunk); }
button.reset:disabled { opacity: .6; cursor: default; }
@media (max-width: 640px) {
  .head-actions { width: 100%; }
  .head-actions .search-row { order: -1; flex-basis: 100%; }
}
