/* The chat UI's custom stylesheet -- all of it.
 *
 * Chainlit loads exactly one file, named by `custom_css` in `.chainlit/config.toml` -- there
 * is no conventional filename it picks up on its own, and nothing is served unless that
 * setting points at it. So every rule the app adds lives here, whatever it touches.
 */

/* Hide the element sidebar's own close control, so the header button is the only way to
 * open or close the details panel.
 *
 * Two routes to the same state is how the server's idea of it goes stale -- and while the
 * panel now reports its own state so nothing desyncs, one control is still one control.
 *
 * Scoped rather than global. `#side-view-content` is the sidebar's content container, so
 * `div:has(> #side-view-content)` is the card that wraps it, and the arrow sits in that
 * card's header. Matching the icon class as well means this cannot catch an unrelated
 * button that appears in the same header later.
 *
 * If a Chainlit upgrade renames either hook, the arrow simply comes back -- a returned
 * affordance, not a broken app.
 */
div:has(> #side-view-content) button:has(svg.lucide-arrow-left) {
  display: none !important;
}

/* Spin the icon on a running tool step.
 *
 * `ui/app.py` opens each tool step with `icon="loader-2"`, which Chainlit renders through
 * lucide-react. `Loader2` there is an alias of `LoaderCircle` -- both resolve to the
 * component registered as `loader-circle` -- so the element in the DOM carries
 * `lucide-loader-circle`, and that, not `lucide-loader-2`, is what a selector has to match.
 *
 * Lucide ships the icon as a static arc; the rotation has always been the caller's to add.
 * Without it a step that is working and a step that has hung look exactly alike, which is
 * the one distinction the icon exists to draw -- and tool calls here routinely run for tens
 * of seconds, so that is a real question a reader asks rather than a hypothetical one.
 *
 * `:not(.animate-spin)` leaves anything Chainlit already animates to Chainlit rather than
 * competing with it at equal specificity. The keyframes are declared here instead of
 * borrowing the app bundle's Tailwind `spin`, so this does not rest on a utility class
 * surviving an upgrade. `transform-origin: center` because an SVG's default origin is its
 * top-left corner, which orbits the icon instead of turning it.
 */
@keyframes brfss-tool-step-spin {
  to { transform: rotate(360deg); }
}

svg.lucide-loader-circle:not(.animate-spin) {
  animation: brfss-tool-step-spin 1s linear infinite;
  transform-origin: center;
}

/* Reduced motion gets a slower turn rather than none. Stopping it altogether would restore
 * exactly the static arc this rule exists to fix, leaving those readers with the bug.
 */
@media (prefers-reduced-motion: reduce) {
  svg.lucide-loader-circle:not(.animate-spin) {
    animation-duration: 3s;
  }
}
