/* ---------------------------------------------------------------------------
   floating-actions.css
   Pins the floating action buttons on one baseline in the bottom-right corner:
       [ live chat ]  [ WhatsApp ]  [ back to top ]
   Each element is positioned independently (fixed + inset) rather than by
   wrapping them in a flex container, because the chat bubble is injected by a
   third-party script as a direct child of <body>.
   --------------------------------------------------------------------------- */

:root {
  /* Distance of the whole group from the viewport edge. */
  --fab-edge: 24px;
  /* Diameter of the live chat bubble (56px is the widget's own size). */
  --fab-size: 56px;
  --fab-gap: 12px;
}

/* --- 1. WhatsApp (direct chat) -------------------------------------------- */
a.whatsapp-button {
  position: fixed;
  right: var(--fab-edge);
  bottom: var(--fab-edge);
  z-index: 2147480000;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--fab-size);
  height: var(--fab-size);
  border-radius: 50%;
  background: #25d366;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .28);
  transition: transform .18s ease, box-shadow .18s ease;
}

a.whatsapp-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, .34);
}

/* The button is a green disc with a white glyph; the icon is a monochrome SVG so
   it stays crisp at any size and inherits no background artefacts. */
a.whatsapp-button img {
  width: 28px;
  height: 28px;
  filter: brightness(0) invert(1);
}

/* --- 2. Live chat bubble (third-party widget) ----------------------------- */
/* The widget ships left-anchored, which put it in the bottom-left corner. It is
   moved to the same baseline as the WhatsApp button and sits one slot to its
   right. !important is required because the rule lives in a vendored sheet. */
#anything-llm-embed-chat-button-container {
  right: calc(var(--fab-edge) + var(--fab-size) + var(--fab-gap)) !important;
  left: auto !important;
  bottom: var(--fab-edge) !important;
  margin: 0 !important;
  z-index: 2147480000 !important;
}

/* --- 3. Back to top ------------------------------------------------------- */
.go_top {
  position: fixed;
  right: calc(var(--fab-edge) + (var(--fab-size) + var(--fab-gap)) * 2);
  bottom: var(--fab-edge);
  width: var(--fab-size);
  height: var(--fab-size);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .18);
  cursor: pointer;
  z-index: 2147480000;
  transition: transform .18s ease, opacity .2s ease;
}

.go_top:hover {
  bottom: var(--fab-edge);   /* keep the baseline; the legacy rule lifted it */
  transform: translateY(-2px);
}

.go_top img {
  width: 24px;
  height: 24px;
}

/* When a modal is open its backdrop sits above the FABs, but the buttons use a
   very high z-index for their own stacking context. Hide them outright so they
   cannot cover the modal content (the PDF viewer especially). */
body.modal-open .whatsapp-button,
body.modal-open .go_top,
body.modal-open #anything-llm-embed-chat-button-container {
  visibility: hidden;
  pointer-events: none;
}

/* --- Small screens -------------------------------------------------------- */
@media (max-width: 767px) {
  :root {
    --fab-edge: 16px;
    --fab-size: 52px;
    --fab-gap: 10px;
  }

  /* The group would cross the left edge on narrow phones: drop "back to top",
     which is a convenience rather than a primary action. */
  .go_top {
    display: none;
  }
}
