/* SatTrack filter panel (D-044, roadmap 3.12 step 3): the panel's look and its fold to a strip on desktop. Built on
   assets/03_tokens.css: no colour values here, only tokens (tests/app/test_design_tokens.py checks). The live count,
   segmented controls, type switches, "More filters" rows and chips are roadmap 3.3a/3.3b's.
   Replaces custom.css (Bootstrap 4 era, cyan accents). */

/* ---- The card ----------------------------------------------------------------------------------------------- */
.st-panel { border-radius: var(--st-r); }
.st-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--st-2);
  padding: var(--st-2) var(--st-2) var(--st-2) var(--st-4);
  border-bottom: 1px solid var(--st-line);
  /* "Filters" and its fold button stay in view while the panel scrolls (owner, 28 Nov 2026), on the page and in the
     full-screen drawer, like the selection card's top */
  position: sticky; top: var(--st-bar-h); z-index: 2; background: var(--st-panel);   /* below the page's top bar */
  border-radius: var(--st-r) var(--st-r) 0 0;
}
.st-panel-title { margin: 0; font-size: var(--st-fs-lg); font-weight: 600; }
.st-panel-btn {
  --bs-btn-padding-x: 6px;
  --bs-btn-padding-y: 4px;
  color: var(--st-muted);
  font-size: 18px;
  line-height: 1;
  align-items: center;
}
.st-panel-btn:hover, .st-panel-btn:focus-visible { color: var(--st-fg); }
.st-panel .card-body { padding: var(--st-4); display: grid; gap: var(--st-4); }
.st-panel .card-body > div > .mb-3, .st-panel .card-body > div > .mb-2:last-child { margin-bottom: 0 !important; }

/* Section labels: small uppercase, muted; the (i) icon opens the tooltip */
.st-lbl {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: var(--st-fs-xs);
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--st-muted);
}
.st-lbl .st-icon { font-size: 13px; cursor: pointer; }
.st-lbl .st-icon:hover { color: var(--st-fg); }

/* Filters always shown on desktop; shown or hidden by the chevron on phones */
@media (min-width: 768px) {
  #filter-collapse { display: block !important; height: auto !important; }
}
@media (max-width: 767.98px) {
  #filter-collapse:not(.show) { display: none; }
}

/* ---- Folded to a strip (desktop; tracker-row gets st-panel-folded from callback_filters.toggle_panel_strip) --- */
@media (min-width: 768px) {
  .st-tracker-row > .st-panel-col { transition: flex-basis 120ms ease, max-width 120ms ease; }
  .st-tracker-row.st-panel-folded > .st-panel-col { flex: 0 0 52px; max-width: 52px; }
  .st-panel-folded .st-panel { height: 100%; margin-bottom: 0 !important; }   /* as tall as the views' card */
  .st-panel-folded #filter-collapse { display: none !important; }
  .st-panel-folded .st-panel-head { flex-direction: column; justify-content: flex-start; gap: var(--st-3);
    padding: var(--st-2) 0; border-bottom: 0; }
  .st-panel-folded .st-panel-title { order: 2; writing-mode: vertical-rl; transform: rotate(180deg);
    font-size: var(--st-fs-sm); color: var(--st-muted); }
}

/* ---- Dash 4 controls inside the panel ------------------------------------------------------------------------ */
.dash-checklist { --Dash-Fill-Primary-Hover: transparent; --Dash-Fill-Primary-Active: transparent; }
.dash-checklist .dash-options-list-option-text { color: var(--st-fg) !important; font-weight: 400 !important; }
.dash-checklist .dash-options-list-option { margin-bottom: 0 !important; padding-top: 0 !important; padding-bottom: 0 !important; }

/* ---- Launch year range slider -------------------------------------------------------------------------------- */
.custom-range-slider { margin: var(--st-3) 0 !important; }
.custom-range-slider .dash-slider-mark, .custom-range-slider .dash-slider-dot { display: none !important; }
.custom-range-slider .dash-slider-root.has-marks { padding: 6px 0 !important; }   /* hidden marks still reserve 28 px */
#launchyear-filter-slider { padding: 10px 0 !important; }
.custom-range-slider .dash-slider-track { background-color: var(--st-line) !important; height: 4px !important; }
.custom-range-slider .dash-slider-range { background-color: var(--st-accent) !important; }
.custom-range-slider .dash-slider-thumb {
  border: 2px solid var(--st-accent) !important;
  background-color: var(--st-fg) !important;
  width: 20px !important;
  height: 20px !important;
  box-shadow: none !important;
}
.custom-range-slider .dash-slider-thumb:focus, .custom-range-slider .dash-slider-thumb:active {
  box-shadow: 0 0 0 5px var(--st-accent-soft) !important;
  outline: none !important;
}
.custom-range-slider .dash-slider-tooltip {
  background-color: var(--st-raised) !important;
  color: var(--st-fg) !important;
  font-weight: 600 !important;
  font-size: var(--st-fs-xs) !important;
  padding: 4px 10px !important;
  border-radius: var(--st-r) !important;
  border: 1px solid var(--st-control) !important;
  box-shadow: none !important;
}
@media (max-width: 767.98px) {
  .custom-range-slider .dash-slider-thumb { width: 24px !important; height: 24px !important; }
}
@media (prefers-reduced-motion: reduce) {
  .st-tracker-row > .st-panel-col { transition: none; }
}

/* Search and "More filters" dropdowns */
.st-adv-dropdown { font-size: var(--st-fs-sm); margin-bottom: var(--st-3); }
.st-tip-body { text-align: left; }

/* ---- Object types (roadmap 3.3a): switches with the data colour, the total, the junk switch and the note ---------- */
.st-type-list .dash-options-list-option-text { width: 100%; }
.st-type-option { display: flex; align-items: center; gap: var(--st-2); width: 100%; }
.st-type-name { flex: 1 1 auto; }
.st-type-total { color: var(--st-muted); font-size: var(--st-fs-sm); font-variant-numeric: tabular-nums; }
.st-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.st-swatch-active { background: var(--st-active); }
.st-swatch-inactive { background: var(--st-inactive); }
/* The globe's colour key under the status buttons (owner, 27 Nov 2026) */
.st-status-key { display: flex; gap: var(--st-3); margin-top: var(--st-2); color: var(--st-muted); font-size: var(--st-fs-xs); }
.st-key-item { display: inline-flex; align-items: center; gap: var(--st-1); }
.st-junk-switch { margin: var(--st-2) 0 var(--st-1); font-weight: 600; }
.st-junk-switch .form-check-input:checked { background-color: var(--st-accent); border-color: var(--st-accent); }
.st-type-note { margin: 0; color: var(--st-muted); font-size: var(--st-fs-xs); line-height: 1.4; }
.st-type-match { color: var(--st-fg); font-weight: 600; }
.st-type-hint { margin: var(--st-1) 0 0; color: var(--st-warn); font-size: var(--st-fs-xs); line-height: 1.4; }

/* ---- Live match count (roadmap 3.3b) ---------------------------------------------------------------------------- */
.st-count { display: flex; align-items: baseline; justify-content: space-between; gap: var(--st-2); }
.st-count-n { font-size: var(--st-fs-2xl); font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.st-count-of { color: var(--st-muted); font-size: var(--st-fs-sm); font-variant-numeric: tabular-nums; }

/* ---- Segmented controls (roadmap 3.3b): status picks one, orbit any combination. Dash 4 renders a label per option
   with the class "selected" when on; the input stays in the label (keyboard and screen readers) but is hidden. ---- */
.st-seg { display: flex; border: 1px solid var(--st-control); border-radius: var(--st-r); overflow: hidden; }
.st-seg .dash-options-list-option {
  /* min-width 0 + nowrap: a label never wraps and never makes the control taller (D-067: "Very high" wrapped and the
     pill grew to 53 px); equal widths from flex-basis 0 */
  flex: 1 1 0;
  min-width: 0;
  white-space: nowrap;
  justify-content: center;
  margin: 0 !important;
  padding: 6px var(--st-1) !important;
  border-left: 1px solid var(--st-control);
  background: transparent;
  cursor: pointer;
  text-align: center;
}
.st-seg .dash-options-list-option:first-child { border-left: 0; }
/* Labels of different lengths (the orbit control, D-067): each button as wide as its label needs, the rest shared */
.st-seg-fit .dash-options-list-option { flex: 1 1 auto; }
.st-seg .dash-options-list-option-wrapper {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.st-seg .dash-options-list-option-text { color: var(--st-muted) !important; font-size: var(--st-fs-sm); }
.st-seg .dash-options-list-option:hover { background: var(--st-hover); }
.st-seg .dash-options-list-option.selected { background: var(--st-accent); }
.st-seg .dash-options-list-option.selected .dash-options-list-option-text { color: var(--st-on-accent) !important; font-weight: 600 !important; }
.st-seg .dash-options-list-option:has(input:focus-visible) { outline: 2px solid var(--st-accent-hi); outline-offset: -2px; }

/* ---- "More filters" rows (roadmap 3.3b): native <details>; the row shows its value ------------------------------- */
.st-more .st-row { border-top: 1px solid var(--st-line); }
.st-more .st-row:last-child { border-bottom: 1px solid var(--st-line); }
.st-row-head {
  display: flex; align-items: center; gap: var(--st-2);
  padding: var(--st-2) 0; cursor: pointer; list-style: none; font-size: var(--st-fs-sm);
}
.st-row-head::-webkit-details-marker { display: none; }
.st-row-head:focus-visible { outline: 2px solid var(--st-accent-hi); outline-offset: 2px; border-radius: var(--st-r); }
.st-row-name { flex: 1 1 auto; color: var(--st-fg); }
.st-row-value { color: var(--st-muted); max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-row-chevron { color: var(--st-muted); transition: transform 120ms ease; }
.st-row[open] .st-row-chevron { transform: rotate(180deg); }
.st-row-body { padding: 0 0 var(--st-3); }
.st-row-body .st-adv-dropdown { margin-bottom: 0; }
.st-row-note { margin: var(--st-1) 0 0; color: var(--st-muted); font-size: var(--st-fs-xs); line-height: 1.4; }
.st-system-primary { margin: var(--st-2) 0 0; font-size: var(--st-fs-sm); }

/* ---- Active-filter chips and Clear all (roadmap 3.3b) ------------------------------------------------------------ */
.st-chips-head { display: flex; align-items: center; justify-content: space-between; }
.st-chips-head .st-lbl { margin-bottom: 6px; }
.st-clear-all {
  border: 0; background: none; padding: 0 0 6px; color: var(--st-accent-hi); font-size: var(--st-fs-xs); cursor: pointer;
}
.st-clear-all:hover { text-decoration: underline; }
.st-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.st-chip {
  display: inline-flex; align-items: center; gap: var(--st-1);
  padding: 2px 10px; border: 1px solid var(--st-control); border-radius: var(--st-r-pill);
  color: var(--st-fg); font-size: var(--st-fs-xs); line-height: 1.6;
}
.st-chip[hidden] { display: none; }
.st-chip-x {
  border: 0; background: none; padding: 0 0 0 2px; margin-right: -4px;
  color: var(--st-muted); font-size: var(--st-fs-sm); line-height: 1; cursor: pointer;
}
.st-chip-x:hover, .st-chip-x:focus-visible { color: var(--st-fg); }
.st-clear-all:focus-visible, .st-chip-x:focus-visible { outline: 2px solid var(--st-accent-hi); outline-offset: 2px; }

/* Plotly 3D tab: the tip and the Clear orbits button (moved from the panel in 3.3b) */
.st-3d-foot { display: flex; align-items: center; justify-content: center; gap: var(--st-3); flex-wrap: wrap; }

@media (prefers-reduced-motion: reduce) {
  .st-row-chevron { transition: none; }
}

/* Type switches (roadmap 3.3b, the D-044 mock-up): the checklist's checkboxes drawn as switches on the right of each
   row. Still real checkboxes, so the keyboard, screen readers and the tests see the same control. */
.st-type-list .dash-options-list-option { display: flex !important; align-items: center; gap: var(--st-2); width: 100%;
  padding: 3px 0 !important; }
.st-type-list .dash-options-list-option-wrapper { order: 2; display: flex; }
.st-type-list .dash-options-list-option-text { flex: 1 1 auto; }
.st-type-list input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; margin: 0;
  width: 34px; height: 20px; border-radius: var(--st-r-pill); cursor: pointer;
  border: 1px solid var(--st-control);
  background: var(--st-raised) radial-gradient(circle, var(--st-muted) 0 6px, transparent 6.5px) no-repeat left 1px center / 18px 18px;
  transition: background-position 120ms ease;
}
.st-type-list input[type="checkbox"]:checked {
  border-color: var(--st-accent);
  background: var(--st-accent) radial-gradient(circle, var(--st-on-accent) 0 6px, transparent 6.5px) no-repeat right 1px center / 18px 18px;
}
.st-type-list input[type="checkbox"]:focus-visible { outline: 2px solid var(--st-accent-hi); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .st-type-list input[type="checkbox"] { transition: none; } }
.st-seg .dash-options-list-option.selected + .dash-options-list-option.selected { border-left-color: var(--st-panel); }

/* Long values (an owner like "Arab Satellite Communications Organization") never widen the panel: grid items may
   shrink, and chip and row text is cut with an ellipsis (the full text is in the control itself). */
.st-panel .card-body > * { min-width: 0; }
.st-row-head, .st-row-body, .st-chips, .st-more { min-width: 0; }
.st-chip { max-width: 100%; }
.st-chip > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-row-body .dash-dropdown { max-width: 100%; }
/* The open list is as wide as its dropdown, not the longest option (Dash 4 defaults to fit-content), so it never
   hangs past the panel; long names wrap onto more lines, the tick box staying on the first. Every dcc.Dropdown in the
   app is in this panel, and the list is portalled to <body>, so the rule is global. */
.dash-dropdown-content { width: var(--radix-popover-trigger-width) !important; max-width: var(--radix-popover-trigger-width) !important; }
.dash-dropdown-content .dash-options-list-option { align-items: flex-start; }
/* The tick box (or radio) sits in a slot one text line tall and is centred in it, so it lines up with the first
   line of the option however many lines the name takes. The line's middle is below the letters' middle (the line
   keeps room for descenders), so the box is lifted 0.05em to centre on the capitals: measured against the drawn
   "A" at 100-200% zoom it is then within half a pixel (it was 0.4-0.7px low). */
.dash-dropdown-content .dash-options-list-option-wrapper { display: flex; align-items: center; height: 1lh;
  line-height: inherit; flex: 0 0 auto; }
.dash-dropdown-content .dash-options-list-option-checkbox { margin-top: 0; margin-bottom: 0; transform: translateY(-0.05em); }
.dash-dropdown-content .dash-options-list-option-text { white-space: normal !important; overflow-wrap: anywhere; min-width: 0; }
/* Dash sticks the search box 8px below the list's top, so scrolled options showed through that strip: fill it. */
.dash-dropdown-content .dash-dropdown-search-container { box-shadow: 0 -8px 0 8px var(--Dash-Fill-Inverse-Strong); z-index: 1; }

/* Launch year row (3.3b): the track is inset so the round thumbs stay inside the row, with the end years (1958 and
   this year) under it; the dragged value shows in the bubble and the row's summary. */
.st-year-track { padding: 0 11px; }
.st-year-track .custom-range-slider { margin: var(--st-1) 0 0 !important; }
.st-year-track #launchyear-filter-slider { padding: 10px 0 2px !important; }
.st-year-ends { display: flex; justify-content: space-between; margin: 0 -11px; color: var(--st-muted);
  font-size: var(--st-fs-xs); font-variant-numeric: tabular-nums; }

/* Satellite search (D-052; assets/07_search.js): a box over a list you can scroll, stations and newest launches first */
.st-search-box { display: flex; gap: var(--st-1); }
.st-search-input { font-size: var(--st-fs-sm); flex: 1 1 auto; min-width: 0; }
.st-search-toggle { flex: 0 0 auto; width: 36px; border: 1px solid var(--st-line); border-radius: var(--st-r);
  background: var(--st-raised); color: var(--st-muted); }
.st-search-toggle::before { content: "▾"; }
.st-search.is-open .st-search-toggle::before { content: "▴"; }
.st-search-toggle:hover, .st-search-toggle:focus-visible { color: var(--st-fg); background: var(--st-hover); }
/* Collapsed until the box or the toggle is used (owner, 27 Nov 2026) */
.st-search:not(.is-open) .st-search-list, .st-search:not(.is-open) .st-search-status,
.st-search:not(.is-open) .st-search-jump { display: none; }
/* Browsing in groups (roadmap 3.4, option A): jump links above the list, headings in it */
.st-search-jump { display: flex; flex-wrap: wrap; gap: var(--st-1); margin-top: var(--st-2); }
.st-search-jump[hidden] { display: none; }
.st-search-jump-link, .st-search-top {
  min-height: 28px; padding: 2px var(--st-2); border: 1px solid var(--st-line); border-radius: 6px;
  background: var(--st-control); color: var(--st-fg); font-size: var(--st-fs-xs); font-variant-numeric: tabular-nums;
}
.st-search-jump-link:hover, .st-search-top:hover { background: var(--st-hover); }
.st-search-top { width: 100%; margin-bottom: var(--st-1); color: var(--st-accent-hi); }
.st-search-heading {
  position: sticky; top: 0; z-index: 1; padding: var(--st-1) var(--st-2); background: var(--st-panel);
  font-size: var(--st-fs-xs); color: var(--st-muted); text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 1px solid var(--st-line);
}
.st-search-list { margin-top: var(--st-2); max-height: 240px; overflow-y: auto; border: 1px solid var(--st-line);
  border-radius: var(--st-r); background: var(--st-raised); overscroll-behavior: contain; }
.st-search-row { display: flex; flex-direction: column; align-items: flex-start; width: 100%; padding: 6px 10px;
  border: 0; border-bottom: 1px solid var(--st-line); background: transparent; color: var(--st-fg); text-align: left; }
.st-search-row:last-child { border-bottom: 0; }
.st-search-row:hover, .st-search-row:focus-visible { background: var(--st-hover); outline: none; }
.st-search-row.is-picked { background: var(--st-accent-soft); }
.st-search-row.is-picked .st-search-name::after { content: " ✓"; color: var(--st-accent-hi); }
.st-search-name { font-size: var(--st-fs-sm); line-height: 1.3; }
.st-search-meta { font-size: var(--st-fs-xs); color: var(--st-muted); }
/* Typed search past what the filters show (roadmap 3.4, option 3) */
.st-search-divider {
  padding: var(--st-2) var(--st-2) var(--st-1); border-top: 1px solid var(--st-line);
  font-size: var(--st-fs-xs); color: var(--st-muted); text-transform: uppercase; letter-spacing: 0.04em;
}
.st-search-divider ~ .st-search-row .st-search-name { color: var(--st-muted); }
.st-search-status { margin-top: var(--st-1); min-height: 1.2em; color: var(--st-muted); font-size: var(--st-fs-xs); }

/* Globe loading bar (D-052; viz_globe.py, filled by static/viewer/viewer.js). In the page's stylesheet, not the
   viewer's, so it is styled before any script runs. */
.sattrack-loading {
  position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 10px; color: var(--st-muted); font-size: var(--st-fs-sm); pointer-events: none;
  transition: opacity 300ms ease;
}
.sattrack-loading.is-done { opacity: 0; visibility: hidden; transition: opacity 300ms ease, visibility 0s 300ms; }
.sattrack-loading-bars { display: flex; gap: 6px; }
.sattrack-loading-bar { width: 36px; height: 6px; border-radius: 3px; background: var(--st-line); }
.sattrack-loading-bar.is-done { background: var(--st-accent); }
.sattrack-loading-bar:not(.is-done) { animation: sattrack-pulse 1.2s ease-in-out infinite; }
.sattrack-loading-bar.is-done + .sattrack-loading-bar:not(.is-done), .sattrack-loading-bar:first-child:not(.is-done) {
  background: var(--st-accent-soft);
}
@keyframes sattrack-pulse { 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { .sattrack-loading-bar { animation: none !important; } }
