/* Gated on the .has-vio-agent class that the injector adds to <html>
   once the feature flag resolves enabled — keeps the layout change in
   lock-step with the actual launcher insertion. */

/* In-field "ask AI" pill: a flex sibling of the theme's search form, both in
   the drop-down search panel's row and in the menu drawer's header. */
.has-vio-agent [data-search-panel] vio-search-launch,
.has-vio-agent [data-panels-menu] vio-search-launch {
  flex-shrink: 0;
}

@media (max-width: 550px) {
  /* On smaller devices this takes up too much of the search bar */
  .has-vio-agent [data-search-panel] vio-search-launch,
  .has-vio-agent [data-panels-menu] vio-search-launch {
    display: none;
  }
}

/* Empty-state CTAs: below the theme's own "no results" message, in the
   predictive drop-downs and on the search page. Block-level so it takes its
   own line under the message, but only as wide as the pill — a full-width box
   would swallow clicks either side of it. */
.has-vio-agent [data-search-results] vio-launch-button,
.has-vio-agent [data-drawer-search-results] vio-launch-button,
.has-vio-agent [data-search-empty] vio-launch-button {
  display: flex;
  width: max-content;
  margin-top: 1.5rem;
}

/* Hide Brando's Shopify chat launchers — the legacy Inbox launcher
   (`#shopify-chat`) and Shopify's newer agent (`shopify-agent`) — while
   something of ours occupies the bottom-right corner: the launch bar (only
   below 1756px, where it reaches the corner) or the open/minimised drawer
   (any width). */
@media (max-width: 1755px) {
  .vio-has-agent-launcher #shopify-chat,
  .vio-has-agent-launcher shopify-agent {
    display: none !important;
  }
}

.has-vio-agent:has(vio-agent-drawer:not([visibility='closed'])) #shopify-chat,
.has-vio-agent:has(vio-agent-drawer:not([visibility='closed'])) shopify-agent {
  display: none !important;
}

/* Lift Klaviyo's bottom-left "10% off" teaser clear of the launcher bar
   (z-index below the drawer), only below 1756px where the bar reaches the
   corner. The lift is gated on `.vio-has-agent-launcher` — the embed reflects
   it onto <html> only while the launch bar is present — so dismissing the
   launcher drops the teaser straight back to its default position. It also
   drops back on the bar's reflected `hidden` attribute when the drawer
   opens/minimises. While lifted, hide the teaser during Klaviyo's slide-in
   entrance (`:has([style*="klaviyo-slidein"])`, their inline marker) and fade
   it in after, so its off-screen-parked entrance isn't dragged onto the bar.
   Class is hashed — match the `kl-teaser-` prefix. The z-index stays gated on
   .has-vio-agent since the drawer can still open from the header button after
   the launcher is dismissed. */
.has-vio-agent [class*="kl-teaser-"] {
  z-index: 40 !important;
}

@media (max-width: 1755px) {
  .vio-has-agent-launcher [class*="kl-teaser-"] {
    bottom: 110px !important;
    transition: opacity 0.2s ease !important;
  }

  .vio-has-agent-launcher:has(vio-launch-bar[hidden]) [class*="kl-teaser-"] {
    bottom: 0 !important;
  }

  .vio-has-agent-launcher [class*="kl-teaser-"]:has([style*="klaviyo-slidein"]) {
    opacity: 0 !important;
  }
}
