/* Social Lab chat widget, in H10's look (loaded with the floating contact button).
   The widget script adds #sociallab-widget-container to our page: the chat window (an iframe of
   Social Lab's own page, coloured from Social Lab's "primary colour" setting), a round chat button,
   a label and optionally a WhatsApp button. We hide Social Lab's button and label and show our own
   launcher instead (js/chat-launcher.js), styled like the site's navigation pill: dark glass,
   a yellow circle with a chat bubble, the label in white. It opens and closes the same chat window. */

#sociallab-widget-container > div[role="button"],
#sociallab-widget-container > div:not([role]) { display: none !important; }
#sociallab-widget-container > a { /* WhatsApp button, if switched on in Social Lab */
  background-image: none !important;
  box-shadow: 0 10px 24px -8px rgba(0, 0, 0, 0.45) !important;
}

.chat-launcher {
  position: fixed; z-index: 100005;
  bottom: max(20px, env(safe-area-inset-bottom));
  left: 20px; /* same corner as the chat window (Social Lab setting: left) */
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 5px 20px 5px 5px;
  border: 0; border-radius: 999px;
  background: rgba(22, 24, 28, 0.86);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
          backdrop-filter: blur(18px) saturate(160%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 18px 40px -12px rgba(0, 0, 0, 0.55);
  color: #FFFFFF;
  font: 600 15px/1.2 var(--font, system-ui, sans-serif);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  opacity: 0; translate: 0 12px; pointer-events: none;
  transition: opacity 300ms ease, translate 300ms var(--ease-out, ease), transform 160ms var(--ease-out, ease);
}
:root[dir="rtl"] .chat-launcher { padding: 5px 5px 5px 20px; }
.chat-launcher.is-ready { opacity: 1; translate: 0 0; pointer-events: auto; }
.chat-launcher:active { transform: scale(0.97); }
.chat-launcher:focus-visible { outline: 3px solid var(--h10-yellow, #F2B705); outline-offset: 3px; }

.chat-launcher__icon {
  position: relative;
  display: grid; place-items: center; flex: none;
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--h10-yellow, #F2B705); color: var(--h10-ink, #16181C);
  transition: transform 160ms var(--ease-out, ease);
}
.chat-launcher__icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chat-launcher__icon .is-close { stroke-width: 2.2; }
.chat-launcher__icon .is-close { display: none; }
.chat-launcher.is-open .chat-launcher__icon .is-chat { display: none; }
.chat-launcher.is-open .chat-launcher__icon .is-close { display: block; }

/* soft ring that pulses twice when the launcher appears */
.chat-launcher__icon::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--h10-yellow, #F2B705); opacity: 0;
}
.chat-launcher.is-ready .chat-launcher__icon::after { animation: chat-launcher-ring 1.6s ease-out 0.6s 2; }
@keyframes chat-launcher-ring { from { opacity: 0.8; transform: scale(0.9); } to { opacity: 0; transform: scale(1.35); } }

/* unread replies while the window is closed */
.chat-launcher__dot {
  position: absolute; top: 0; inset-inline-end: 0;
  width: 12px; height: 12px; border-radius: 50%;
  background: #E5484D; box-shadow: 0 0 0 2px #16181C;
  display: none;
}
.chat-launcher.has-unread .chat-launcher__dot { display: block; }

@media (hover: hover) and (pointer: fine) {
  .chat-launcher:hover .chat-launcher__icon { transform: rotate(-12deg) scale(1.06); }
}
@media (prefers-reduced-motion: reduce) {
  .chat-launcher { transition: opacity 200ms ease; translate: none; }
  .chat-launcher.is-ready .chat-launcher__icon::after { animation: none; }
}
/* phones: the chat window opens full screen, so the launcher steps aside while it is open */
@media (max-width: 768px) {
  .chat-launcher { left: 16px; bottom: max(16px, env(safe-area-inset-bottom)); min-height: 48px; font-size: 14px; }
  .chat-launcher__icon { width: 38px; height: 38px; }
  .chat-launcher.is-open { opacity: 0; pointer-events: none; }
}

/* Call / chat menu above the launcher (with a customer service number in the site settings): the
   "contact us" panel of the buttons (app-picker.css), growing up out of the launcher's corner;
   enters in 180ms, leaves faster. */
.contact-menu {
  position: fixed; z-index: 100006;
  left: 20px; bottom: calc(max(20px, env(safe-area-inset-bottom)) + 64px);
  display: grid; gap: 8px;
  width: min(300px, calc(100vw - 40px));
  padding: 8px;
  border-radius: 22px;
  background: rgba(24, 26, 31, 0.97);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), 0 18px 40px -12px rgba(0, 0, 0, 0.6);
  font-family: var(--font, system-ui, sans-serif);
  transform-origin: bottom left;
  opacity: 0; transform: translateY(6px) scale(0.96); visibility: hidden;
  transition: opacity 120ms ease, transform 120ms var(--ease-out, ease), visibility 0s linear 120ms;
}
.contact-menu[data-open] {
  opacity: 1; transform: none; visibility: visible;
  transition: opacity 180ms ease, transform 180ms var(--ease-out, ease), visibility 0s;
}
/* the launcher shows its close icon while the menu is open, like while the chat is open */
.chat-launcher.is-menu .chat-launcher__icon .is-chat { display: none; }
.chat-launcher.is-menu .chat-launcher__icon .is-close { display: block; }
@media (max-width: 768px) {
  .contact-menu { left: 16px; bottom: calc(max(16px, env(safe-area-inset-bottom)) + 58px); width: min(300px, calc(100vw - 32px)); }
  .chat-launcher.is-menu { opacity: 1; pointer-events: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .contact-menu, .contact-menu[data-open] { transform: none; }
}
