/* Floating WhatsApp button and popup. From the Cierre design.
   Rebuilt off WhatsApp's own green/Segoe UI, onto the WAAGS palette and Outfit —
   this was the last component still carrying the old WhatsApp brand look. */

.wa-fab {
  position: fixed;
  bottom: 22px;
  right: 22px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--color-forest);
  border: 1px solid rgb(224 222 44 / 0.35);
  color: var(--color-lime);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 999;
  box-shadow: 0 14px 34px -12px rgb(0 0 0 / 0.55);
  transition: background-color 0.2s ease, transform 0.2s ease, bottom 0.3s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.wa-fab:hover { background: var(--color-forest-hover); transform: scale(1.05); }
.wa-fab svg { width: 26px; height: 26px; }

/* Appears with a small scale-in once the visitor scrolls past the hero
   (see js/whatsapp.js) instead of just sitting there from the first paint.
   Gated behind .js-wa-fab so without JS/IntersectionObserver support the
   button just stays visible the whole time, same as before. */
.js-wa-fab .wa-fab {
  opacity: 0;
  transform: scale(0.5);
  pointer-events: none;
  transition: background-color 0.2s ease, transform 0.3s cubic-bezier(0.2, 0.8, 0.3, 1), opacity 0.3s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.js-wa-fab .wa-fab.is-visible {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}
.js-wa-fab .wa-fab.is-visible:hover { transform: scale(1.05); }

.wa-popup {
  position: fixed;
  bottom: 94px;
  right: 22px;
  width: 320px;
  max-width: calc(100vw - 32px);
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 22px 50px -18px rgb(32 54 39 / 0.5);
  z-index: 999;
  font-family: var(--font-sans);
  /* Anchored to the fab button below-right of it, so it visibly grows out
     of the button instead of fading in place. */
  transform-origin: bottom right;
  transform: scale(0.9);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.wa-popup.open {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
  .js-wa-fab .wa-fab { transition: background-color 0.2s ease; }
  .wa-popup { transition: opacity 0.2s ease; }
}

.wa-popup-header {
  background: var(--color-forest-deep);
  color: var(--color-white);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.wa-popup-avatar {
  display: block;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgb(157 196 213 / 0.4);
}
.wa-popup-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }

.wa-popup-header-text { flex: 1; min-width: 0; }
.wa-popup-header-text strong {
  display: block;
  font-size: 1.0625rem;
  font-weight: var(--fw-semibold);
}
.wa-popup-header-text span {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  line-height: 1.3;
  color: rgb(255 255 255 / 0.82);
  margin-top: 3px;
}
.wa-popup-status-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--color-sky);
}

.wa-popup-close {
  width: 44px;
  height: 44px;
  flex: none;
  margin: -10px -10px 0 0;
  border: none;
  background: transparent;
  color: rgb(255 255 255 / 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.wa-popup-close:hover { color: var(--color-white); }
.wa-popup-close svg { width: 18px; height: 18px; }

.wa-popup-body {
  padding: 18px 16px 16px;
}
.wa-bubble {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px 16px 16px 6px;
  padding: 14px 16px;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--color-text);
}
.wa-bubble-sender {
  font-size: 0.75rem;
  color: var(--color-muted);
}

.wa-popup-footer {
  padding: 0 16px 18px;
}
.wa-popup-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 52px;
  background: var(--color-lime);
  color: var(--color-forest);
  border-radius: var(--radius-pill);
  font-size: 1.0625rem;
  font-weight: var(--fw-semibold);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.wa-popup-cta:hover { background: var(--color-lime-hover); }

@media (max-width: 600px) {
  .wa-popup { right: 16px; bottom: 90px; }
  .wa-fab { right: 16px; bottom: 18px; }
}

/* On phones the floating button would sit over the chat send button while
   typing. Needs to win over .is-visible's higher specificity explicitly. */
@media (max-width: 899px) {
  .chat-typing .wa-fab,
  .chat-typing .wa-fab.is-visible {
    opacity: 0;
    pointer-events: none;
  }
}

