/* Website chat only: does not change SalesIQ operator or iPhone notification settings. */
#ipc-chat-launcher {
  position: fixed; right: 20px; bottom: 20px; z-index: 99999;
  width: 52px; height: 52px; padding: 0; margin: 0;
  display: flex; align-items: center; justify-content: center;
  box-sizing: border-box; border: 0; border-radius: 50%;
  background: #17457f; color: #fff; cursor: pointer;
  box-shadow: 0 3px 12px rgba(12, 35, 62, .22);
}
#ipc-chat-launcher[hidden] { display: none !important; }
#ipc-chat-launcher:hover { background: #113761; }
#ipc-chat-launcher:focus-visible { outline: 3px solid #f0b14b; outline-offset: 3px; }
#ipc-chat-launcher svg { width: 25px; height: 25px; pointer-events: none; }
#ipc-chat-launcher[aria-busy="true"] { cursor: wait; }

/* Small explanatory label only on hover / keyboard focus. No permanent greeting. */
#ipc-chat-tooltip {
  position: absolute; right: 0; bottom: 100%; padding: 8px 12px;
  border-radius: 7px; background: #173e6c; color: #fff;
  font: 14px/1.4 Arial, sans-serif; white-space: nowrap;
  visibility: hidden; opacity: 0; pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.16);
}
#ipc-chat-launcher:focus-visible:not([data-tooltip-dismissed="true"]) #ipc-chat-tooltip {
  visibility: visible; opacity: 1; pointer-events: auto;
}
@media (hover: hover) {
  #ipc-chat-launcher:hover:not([data-tooltip-dismissed="true"]) #ipc-chat-tooltip {
    visibility: visible; opacity: 1; pointer-events: auto;
  }
}

/* Only our explicit click can reveal the vendor panel.
 * These vendor IDs were observed on the current widget. Check them after a Zoho redesign.
 * Do not crop or scale the iframe: that can hide the composer or make text unreadable.
 */
body[data-ipc-chat-state="pending"] .zls-sptwndw.siqembed,
body[data-ipc-chat-state="hidden"] .zls-sptwndw.siqembed,
body[data-ipc-chat-state="closed"] .zls-sptwndw.siqembed,
body[data-ipc-chat-state="pending"] #siqiframe,
body[data-ipc-chat-state="hidden"] #siqiframe,
body[data-ipc-chat-state="closed"] #siqiframe {
  visibility: hidden !important; pointer-events: none !important;
}
body[data-ipc-chat-state] #zsiq_float,
body[data-ipc-chat-state] #titlediv.zsiq_cnt { display: none !important; }

/* Observed Classic/Medium layout on 30 October 2026:
 * the frame has 5px body padding on each side and 70px for native close controls.
 * A 330x540 frame therefore targets a 320x460 visible panel. Resize its entire
 * responsive layout; never clip or scale the iframe or hide its native controls.
 * Vendor layout assumptions require staging verification before production.
 */
body[data-ipc-chat-state="open"] .zls-sptwndw.siqembed {
  position: fixed !important; right: 20px !important; bottom: 20px !important;
  top: auto !important; left: auto !important;
  width: 330px !important; height: 540px !important;
  max-width: calc(100vw - 40px) !important;
  max-height: calc(var(--ipc-chat-view-height, 100vh) - 40px) !important;
}
body[data-ipc-chat-state="open"] .zls-sptwndw.siqembed #siqcht,
body[data-ipc-chat-state="open"] .zls-sptwndw.siqembed #siqiframe {
  width: 100% !important; height: 100% !important;
  max-width: 100% !important; max-height: 100% !important;
}

@media (max-width: 760px) {
  #ipc-chat-launcher { right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  body.ipcmp-hasbar #ipc-chat-launcher {
    bottom: calc(var(--ipc-chat-toolbar-clearance, 76px) + env(safe-area-inset-bottom, 0px));
  }
  body[data-ipc-chat-state="open"] .zls-sptwndw.siqembed {
    left: 8px !important; right: 8px !important; bottom: auto !important;
    top: calc(var(--ipc-chat-view-top, 0px) + 8px + env(safe-area-inset-top, 0px)) !important;
    width: calc(100vw - 16px) !important;
    height: calc(var(--ipc-chat-view-height, 100vh) - 16px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
    max-width: calc(100vw - 16px) !important;
    max-height: calc(var(--ipc-chat-view-height, 100vh) - 16px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* Mobile web app: keep the guest launcher inside its app surface and above
   the measured Free trial bar. Hide it while navigation/sheets are open. */
body[data-ipc-chat-surface="app"] #ipc-chat-launcher {
  right: var(--ipc-chat-app-right, 12px);
  bottom: var(--ipc-chat-app-clearance, 76px);
}
body[data-ipc-chat-surface="app"]:has(.device.nav-open) #ipc-chat-launcher,
body[data-ipc-chat-surface="app"]:has(.sheet.on) #ipc-chat-launcher {
  display: none !important;
}
@media (min-width: 761px) {
  body[data-ipc-chat-surface="app"][data-ipc-chat-state="open"] .zls-sptwndw.siqembed {
    right: var(--ipc-chat-app-right, 20px) !important;
    bottom: var(--ipc-chat-app-bottom, 20px) !important;
  }
}
