/* ============================================================
   Stage Zero Livechat - SCOPED OVERRIDES ONLY
   Purpose: style 1Stream/Odoo live chat WITHOUT impacting site UI
   Scope: targets the 1Stream livechat iframe + nearby launcher only
   ============================================================ */

/* Brand tokens */
:root {
  --sz-blue: #00144B;
  --sz-blue-700: #001A70;
  --sz-white: #FFFFFF;
  --sz-grey-50: #F7F8FB;
  --sz-grey-100: #EEF1F6;
  --sz-shadow: 0 14px 40px rgba(0, 20, 75, 0.25);
  --sz-radius-lg: 18px;

  --sz-launcher-size: 56px;
  --sz-offset: 14px;

  /* Hosted icon (recommended) */
  --sz-launcher-icon: url("/assets/img/stagezero-livechat-launcher.png");
}

/* ------------------------------------------------------------
   1) Chat iframe (SAFE: only matches 1Stream livechat iframe)
   ------------------------------------------------------------ */
iframe[src^="https://stagezero.1stream.co.za/im_livechat"] {
  position: fixed !important;
  right: var(--sz-offset) !important;
  bottom: calc(var(--sz-offset) + var(--sz-launcher-size) + 12px) !important;

  width: min(380px, calc(100vw - (var(--sz-offset) * 2))) !important;
  height: min(640px, calc(100vh - 140px)) !important;

  border: 0 !important;
  border-radius: var(--sz-radius-lg) !important;
  box-shadow: var(--sz-shadow) !important;
  overflow: hidden !important;
  z-index: 2147483647 !important;
}

/* ------------------------------------------------------------
   2) Launcher button (SCOPED)
   We avoid global selectors and only style known Odoo livechat
   elements if present. If 1Stream uses different IDs/classes,
   update these 2-3 selectors (not the whole website).
   ------------------------------------------------------------ */
.o_livechat_button,
.o_livechat_button_container button,
button.o_livechat_button {
  position: fixed !important;
  right: var(--sz-offset) !important;
  bottom: var(--sz-offset) !important;

  width: var(--sz-launcher-size) !important;
  height: var(--sz-launcher-size) !important;
  border-radius: 16px !important;

  background-color: var(--sz-blue) !important;
  background-image: var(--sz-launcher-icon) !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: 78% !important;

  border: 0 !important;
  box-shadow: var(--sz-shadow) !important;
  z-index: 2147483646 !important;

  cursor: pointer !important;
}

/* Hide default icon/text INSIDE the launcher ONLY (scoped) */
.o_livechat_button svg,
.o_livechat_button i,
.o_livechat_button span {
  display: none !important;
}

/* Hover/focus states for launcher only */
.o_livechat_button:hover,
.o_livechat_button_container button:hover,
button.o_livechat_button:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 18px 50px rgba(0, 20, 75, 0.32) !important;
}

.o_livechat_button:focus-visible,
.o_livechat_button_container button:focus-visible,
button.o_livechat_button:focus-visible {
  outline: 3px solid rgba(0, 20, 75, 0.35) !important;
  outline-offset: 3px !important;
}

/* ------------------------------------------------------------
   3) Mobile sizing (iframe only)
   ------------------------------------------------------------ */
@media (max-width: 420px) {
  iframe[src^="https://stagezero.1stream.co.za/im_livechat"] {
    width: calc(100vw - (var(--sz-offset) * 2)) !important;
    height: calc(100vh - 170px) !important;
  }
  :root {
    --sz-launcher-size: 52px;
    --sz-offset: 12px;
  }
}