/*
 * Ceres overlays use the 1,000+ stacking range for menus, backdrops, modals,
 * and the basket preview. Keep this light-DOM stacking rule as a defensive
 * fallback for the reviewed Fonio host shape when it honors external z-index.
 * The controller also sets the host's hidden attribute because the current
 * vendor stylesheet uses important :host rules inside the widget's shadow
 * boundary.
 */
html[data-fonio-webchat-active="true"] fonio-webchat-widget-root[data-fonio-webchat-widget-root] {
    z-index: 900 !important;
}

/*
 * The controller sets this plugin-owned lifecycle flag while its vendor
 * lifecycle is active or fenced for reload. This prevents an inactive plugin
 * from hiding another integration's host while retaining the visual fallback
 * for a late vendor mount or same-document route transition.
 */
html[data-fonio-webchat-active="true"][data-fonio-webchat-route-enabled="false"] fonio-webchat-widget-root[data-fonio-webchat-widget-root] {
    display: none !important;
}

/* Keep the HTML hidden state effective if the vendor stylesheet is delayed. */
html[data-fonio-webchat-active="true"] fonio-webchat-widget-root[data-fonio-webchat-widget-root][hidden] {
    display: none !important;
}

/* The controller sets [hidden] for this state; this remains a light-DOM fallback. */
html[data-fonio-webchat-active="true"] body.basket-open fonio-webchat-widget-root[data-fonio-webchat-widget-root] {
    display: none !important;
}

/*
 * Live storefront observation: Trusted Shops renders its floating badge in a
 * light-DOM container whose ID starts with trustbadge-container. Hide only
 * that container while the visible Fonio window is open; removing the
 * plugin-owned marker restores the badge automatically. This is a visual
 * collision workaround, not a consent or privacy gate.
 */
html[data-fonio-webchat-active="true"][data-fonio-webchat-open="true"] div[id^="trustbadge-container"] {
    display: none !important;
}
