/* The shared footer loads this sheet only on pages with a support launcher. */
:root {
  --po-chat-size: 52px;
  --po-chat-right: calc(8px + env(safe-area-inset-right, 0px));
  --po-chat-keyboard: 0px;
  --po-chat-bottom: calc(8px + max(env(safe-area-inset-bottom, 0px), var(--po-chat-keyboard)));
  --po-chat-rail: calc(var(--po-chat-right) + var(--po-chat-size) + 8px);
  --po-chat-shelf: calc(var(--po-chat-bottom) + var(--po-chat-size) + 8px);
}

@media screen {
  html:root { box-sizing: border-box; height: 100%; overflow: hidden; padding-right: var(--po-chat-rail); }
  html:root > body {
    position: relative;
    box-sizing: border-box; width: 100%; max-width: 100%; min-height: 0; margin: 0;
    height: 100%; height: calc(100dvh - var(--po-chat-keyboard)); overflow: auto;
  }
  html:root::before {
    content: "";
    position: fixed;
    z-index: -1;
    inset: 0 0 0 auto;
    width: var(--po-chat-rail);
    box-sizing: border-box;
    background: #f8fafc;
    border-left: 1px solid #dce3ea;
    pointer-events: none;
  }
  html:root > body > :where(header, nav, main, article, section, aside, footer, div, form) { flex-shrink: 0; }
}

.po-chat-entry[hidden], #po-site-chat-panel[hidden] { display: none !important; }
.po-chat-entry:not([hidden]), .po-chat-dock {
  position: fixed;
  z-index: 900;
  right: var(--po-chat-right);
  bottom: var(--po-chat-bottom);
  width: var(--po-chat-size);
  height: var(--po-chat-size);
  pointer-events: none;
}
.po-chat-entry > .po-site-chat-link, .po-chat-dock > .po-site-chat-link {
  position: relative;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255,255,255,.65);
  border-radius: 50%;
  background: #245399;
  color: #fff;
  box-shadow: 0 2px 8px #132d493d;
  text-decoration: none;
  pointer-events: auto;
}
.po-site-chat-link:hover, .po-site-chat-link:active { background-color: #193e78; }
.po-site-chat-link:focus-visible { outline: 3px solid #efaf29; outline-offset: 2px; }
.po-site-chat-link > svg { width: 24px; height: 24px; pointer-events: none; }
.po-site-chat-link > span:not(.po-chat-count) {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.po-chat-count:not([hidden]) {
  position: absolute; top: -3px; right: -2px; padding: 2px 5px; border-radius: 12px;
  background: #b52935; color: #fff; font: 700 11px/1.25 system-ui,sans-serif;
}
.po-chat-dock > #po-site-chat-panel {
  position: fixed;
  right: var(--po-chat-right);
  bottom: var(--po-chat-shelf);
  width: min(380px, calc(100% - var(--po-chat-right) - 8px - env(safe-area-inset-left, 0px)));
  height: min(526px, calc(100vh - var(--po-chat-shelf) - 8px));
  height: min(526px, calc(100dvh - var(--po-chat-shelf) - 8px - env(safe-area-inset-top, 0px)));
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid #cdd9e6;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 5px 22px #14253730;
  pointer-events: auto;
}
#po-site-chat-panel iframe { display: block; width: 100%; height: 100%; border: 0; }
#po-site-chat-panel .po-chat-loading {
  position: absolute; z-index: 2; inset: 0; box-sizing: border-box; padding: 20px;
  display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center;
  background: #fff; color: #203958; font: 15px/1.4 system-ui,sans-serif;
}
.po-chat-loading button { padding: 8px 16px; font: inherit; }

/* The same scrollport stays active when the side rail becomes a bottom shelf. */
@media screen and (max-width: 900px) {
  html:root { padding-right: 0; }
  html:root > body {
    height: calc(100% - var(--po-chat-shelf));
    height: calc(100dvh - var(--po-chat-shelf));
  }
  html:root::before {
    inset: auto 0 0;
    width: auto;
    height: var(--po-chat-shelf);
    border-left: 0;
    border-top: 1px solid #dce3ea;
  }
}

@keyframes po-chat-ripple {
  0% { opacity: 0; transform: scale(.96); }
  18% { opacity: .76; }
  86%, 100% { opacity: 0; transform: scale(1.16); }
}
@media screen and (prefers-reduced-motion: no-preference) {
  .po-chat-dock > .po-site-chat-link.po-chat-cue::after {
    content: ""; position: absolute; inset: 0; box-sizing: border-box;
    border: 2px solid #5187d2; border-radius: 50%; pointer-events: none; opacity: 0;
    animation: po-chat-ripple 1.8s cubic-bezier(.20,.52,.36,1) .55s infinite;
  }
}
@media print { .po-chat-dock, .po-chat-entry { display: none !important; } }
