/* Natterer UI trim — hide LibreChat elements that have no config toggle.
 * Injected into index.html via the librechat derivation override.
 * LibreChat ships high-specificity utility classes, so use !important.
 * Selectors are anchored on stable ids / structural relationships (not
 * localized aria-labels/titles) so they survive the German UI.
 */

/* --- Composer buttons (stable ids) ------------------------------------ */

/* Attach / file-upload (also removed by fileConfig.disabled; belt-and-suspenders). */
#attach-file-menu-button {
  display: none !important;
}

/* Tools/MCP container (holds only the sliders "tools" button and the "MCP
 * Servers" badge). All MCP servers are force-enabled in code
 * (0001-force-all-mcp-servers-on.patch), so neither control is needed —
 * hide the whole row. Anchored on the stable #tools-dropdown-button child. */
div:has(> #tools-dropdown-button) {
  display: none !important;
}

/* Microphone / speech-to-text button. */
#audio-recorder {
  display: none !important;
}

/* --- Header model-spec selector --------------------------------------
 * Single enforced spec → the "Natterer" dropdown is pointless. Its trigger
 * button has only a localized aria-label, but it uniquely carries our branding
 * <img>, so anchor on that and hide the selector's wrapper.
 * NB: :has() must NOT be nested inside :has() (invalid CSS), so use a single
 * :has() with a descendant: "div whose direct-child button contains the img".
 */
div:has(> button img[src*="/branding/icon.png"]) {
  display: none !important;
}

/* Header export/share button (stable id). */
#export-menu-button {
  display: none !important;
}

/* --- Account (avatar) menu --------------------------------------------
 * Hide "My Files" and "Settings", keep "Log out". ("Help & FAQ" is removed
 * via HELP_AND_FAQ_URL=/.) The menu-item ids are React-random, so anchor on
 * the icons: My Files uses lucide-file-text; the Settings gear is the only
 * item whose icon has no lucide-* class.
 */
.account-settings-popover [role="menuitem"]:has(svg.lucide-file-text),
.account-settings-popover [role="menuitem"]:has(svg:not([class*="lucide"])) {
  display: none !important;
}

/* With My Files + Settings hidden, two separators end up adjacent. Drop the one
 * right after the email header; keep the one above Log out. */
.account-settings-popover [role="note"] + [data-slot="dropdown-menu-separator"] {
  display: none !important;
}

/* --- Side-panel view-switcher rail ------------------------------------
 * The vertical icon rail (Chat History / Attach Files / MCP Settings) and the
 * divider directly above it. Anchored on the Chat History icon (lucide), since
 * the buttons' aria-labels are localized.
 */
div:has(> button > svg.lucide-messages-square) {
  display: none !important;
}
div.border-border-light:has(+ div > button > svg.lucide-messages-square) {
  display: none !important;
}

/* --- Per-message Text-to-Speech ("Read aloud") ------------------------
 * The read-aloud button is the only hover-button immediately followed by its
 * <audio> element. Hiding it also stops the TTS autoplay loading "/" (the
 * text/html "Cannot play media" console error).
 */
.hover-button:has(+ audio) {
  display: none !important;
}

