/* Flowize overrides for marimo.flowize.xyz (jyqi.19 / jyqi.25).
 *
 * Marimo's WASM bundle ships a full AI-provider settings dialog with a
 * Radix Accordion of providers (OpenAI, Anthropic, Google, Ollama, GitHub,
 * OpenRouter, Weights & Biases, OpenCode Go, Azure, AWS Bedrock,
 * OpenAI-Compatible Legacy, Custom Providers). In Flowize the AI surface
 * is routed through aiservice via nginx (see nginx.conf), so per-provider
 * api_key/base_url configuration is inert. We hide it to avoid user
 * confusion.
 *
 * Selector strategy (verified via webwright probe 2026-06-28):
 *   - The accordion item is <div data-orientation="vertical">...<img alt="..."></div>
 *     where alt is one of: openai, anthropic, google, ollama, github,
 *     openrouter, wandb, opencode-go, azure, bedrock.
 *   - The api_key/base_url inputs use stable testids: ai-<provider>-api-key-input,
 *     ai-base-url-input, custom-provider-<n>-*. These remain hidden as a
 *     defense-in-depth layer even after the accordion is hidden.
 *
 * Fragility: Marimo upstream rename/restructure → some selectors stop matching.
 * Mitigation: visual regression baselines under docs/visual-baselines/.
 */

/* Hide each provider's Radix Accordion item (the row a user clicks to expand). */
[data-orientation="vertical"]:has(> h3 img[alt="openai"]),
[data-orientation="vertical"]:has(> h3 img[alt="anthropic"]),
[data-orientation="vertical"]:has(> h3 img[alt="google"]),
[data-orientation="vertical"]:has(> h3 img[alt="ollama"]),
[data-orientation="vertical"]:has(> h3 img[alt="github"]),
[data-orientation="vertical"]:has(> h3 img[alt="openrouter"]),
[data-orientation="vertical"]:has(> h3 img[alt="wandb"]),
[data-orientation="vertical"]:has(> h3 img[alt="opencode-go"]),
[data-orientation="vertical"]:has(> h3 img[alt="azure"]),
[data-orientation="vertical"]:has(> h3 img[alt="bedrock"]) {
    display: none !important;
}

/* "OpenAI-Compatible (Legacy)" uses a Lucide bot icon, not <img alt>.
 * Pattern: it's the AccordionItem (data-orientation=vertical, class contains
 * "border-b") that doesn't contain an <img>. Hide all AccordionItems within
 * the AI Providers tabpanel that lack a recognised provider <img alt>. */
[role="tabpanel"][id$="content-ai-providers"] [data-orientation="vertical"].border-b:not(:has(img)) {
    display: none !important;
}

/* "Custom Providers" section (heading + helper text + Add Provider button)
 * is wrapped in <div class="flex flex-col gap-4 pb-4"> immediately after the
 * accordion list. Target by class combo + that it contains an Add Provider
 * button with the lucide-plus icon. */
[role="tabpanel"][id$="content-ai-providers"] div.flex.flex-col.gap-4.pb-4:has(svg.lucide-plus) {
    display: none !important;
}

/* Helper text at top: "Add your API keys below or to marimo.toml..." */
[role="tabpanel"][id$="content-ai-providers"] > div > p.text-sm.text-muted-secondary:has(kbd) {
    display: none !important;
}

/* Defence-in-depth: even if a provider accordion sneaks through, its actual
 * input fields stay hidden. Stable testids per the bundle source. */
[data-testid$="-api-key-input"],
[data-testid$="-base-url-input"],
[data-testid^="custom-provider-"],
input[name^="ai.open_ai."],
input[name^="ai.anthropic."],
input[name^="ai.google."],
input[name^="ai.ollama."],
input[name^="ai.github."],
input[name^="ai.openrouter."],
input[name^="ai.wandb."],
input[name^="ai.opencode_go."],
input[name^="ai.azure."],
input[name^="ai.bedrock."],
input[name^="ai.open_ai_compatible."],
input[name^="ai.custom_providers."] {
    display: none !important;
}

