/* ════════════════════════════════════════════════════════════════════
   WhatsApp chat button (inc/whatsapp.php, Settings → WhatsApp).

   Same size, corner offsets and animations as the foliumpx-helper
   plugin's widget on the live site, in the brand colours instead of a
   flat teal. CSS only: it fades in after 0.6s, like the plugin did.
   ════════════════════════════════════════════════════════════════════ */

.fpx-wa {
  --fpx-wa-size: 60px;
  --fpx-wa-pad: 17px;
  position: fixed;
  /* Above page content, below the cart drawer, popovers and mobile menu. */
  z-index: 250;
  bottom: calc(13px + var(--fpx-sticky-atc-h, 0px));
  display: flex;
  align-items: center;
  transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: fpx-wa-in 0.4s ease 0.6s both;
}
.fpx-wa--left {
  left: 11px;
}
.fpx-wa--right {
  right: 11px;
  flex-direction: row-reverse;
}

@keyframes fpx-wa-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.fpx-wa__btn {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--fpx-wa-size);
  height: var(--fpx-wa-size);
  padding: var(--fpx-wa-pad);
  border-radius: 50%;
  background: var(--brand-grad, linear-gradient(340deg, #148d9f 30%, #56ccf2 100%));
  box-shadow: 0 6px 18px rgba(20, 141, 159, 0.35);
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.fpx-wa__btn:hover {
  transform: scale(1.06);
  box-shadow: 0 8px 24px rgba(20, 141, 159, 0.45);
}
.fpx-wa__btn:focus-visible {
  outline: 3px solid var(--brand-deep, #148d9f);
  outline-offset: 3px;
}
.fpx-wa__btn svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: #fff;
}

/* ── Pulse rings ─────────────────────────────────────────────────── */
.fpx-wa__rings {
  position: absolute;
  bottom: 0;
  width: var(--fpx-wa-size);
  height: var(--fpx-wa-size);
  pointer-events: none;
}
.fpx-wa--left .fpx-wa__rings { left: 0; }
.fpx-wa--right .fpx-wa__rings { right: 0; }
.fpx-wa__rings span {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--brand-light, #56ccf2);
  opacity: 0;
  animation: fpx-wa-pulse 2.5s ease-out infinite;
}
.fpx-wa__rings span:nth-child(2) {
  animation-delay: 1s;
}
@keyframes fpx-wa-pulse {
  0%   { transform: scale(1);   opacity: 0.45; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* ── Shake: a short wiggle every 5 seconds ───────────────────────── */
.fpx-wa--anim-shake .fpx-wa__btn {
  animation: fpx-wa-shake 5s ease-in-out 3s infinite;
}
@keyframes fpx-wa-shake {
  0%, 12%, 100% { transform: rotate(0); }
  1.8%  { transform: rotate(-10deg); }
  3.6%  { transform: rotate(10deg); }
  5.4%  { transform: rotate(-8deg); }
  7.2%  { transform: rotate(8deg); }
  9%    { transform: rotate(-4deg); }
  10.8% { transform: rotate(4deg); }
}

/* ── Bounce in once ──────────────────────────────────────────────── */
.fpx-wa--anim-bounce {
  animation: none;
}
.fpx-wa--anim-bounce .fpx-wa__btn {
  animation: fpx-wa-bounce 0.65s cubic-bezier(0.36, 0.07, 0.19, 0.97) 0.6s both;
}
@keyframes fpx-wa-bounce {
  0%   { transform: scale(0);    opacity: 0; }
  55%  { transform: scale(1.18); opacity: 1; }
  75%  { transform: scale(0.93); }
  100% { transform: scale(1); }
}

/* ── Hover label (computers only) ────────────────────────────────── */
.fpx-wa__label {
  margin: 0 12px;
  padding: 9px 14px;
  border-radius: 8px;
  background: #0f2a30;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
.fpx-wa--right .fpx-wa__label {
  transform: translateX(6px);
}
.fpx-wa:hover .fpx-wa__label,
.fpx-wa:focus-within .fpx-wa__label {
  opacity: 1;
  transform: none;
}

/* ── Phones and devices setting ──────────────────────────────────── */
@media (max-width: 767px) {
  .fpx-wa {
    --fpx-wa-size: 56px;
    --fpx-wa-pad: 15px;
  }
  .fpx-wa__label,
  .fpx-wa--on-desktop {
    display: none;
  }
}
@media (min-width: 768px) {
  .fpx-wa--on-mobile {
    display: none;
  }
}

/* ── Phones: edge tab (Settings → WhatsApp → Style on phones) ─────────
   A floating 56px circle sat on top of product photos and prices while
   shoppers scrolled. The tab hugs the screen edge instead: icon only,
   no rings, and it slides out with "Chat with us" once when the page
   opens, then tucks away. */
.fpx-wa__tab-label {
  display: none;
}
@media (max-width: 767px) {
  .fpx-wa--mtab {
    bottom: calc(105px + var(--fpx-sticky-atc-h, 0px));
  }
  .fpx-wa--mtab.fpx-wa--left {
    left: 0;
  }
  .fpx-wa--mtab.fpx-wa--right {
    right: 0;
  }
  .fpx-wa--mtab .fpx-wa__rings {
    display: none;
  }
  .fpx-wa--mtab .fpx-wa__btn {
    width: auto;
    height: 44px;
    padding: 0 9px 0 7px;
    gap: 0;
    border-radius: 0 22px 22px 0;
    box-shadow: 0 4px 14px rgba(20, 141, 159, 0.35);
    animation: none;
  }
  .fpx-wa--mtab.fpx-wa--right .fpx-wa__btn {
    flex-direction: row-reverse;
    padding: 0 7px 0 9px;
    border-radius: 22px 0 0 22px;
  }
  .fpx-wa--mtab .fpx-wa__btn:hover {
    transform: none;
  }
  .fpx-wa--mtab .fpx-wa__btn svg {
    width: 22px;
    height: 22px;
    flex: none;
  }
  .fpx-wa--mtab .fpx-wa__tab-label {
    display: inline-block;
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    opacity: 0;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    animation: fpx-wa-peek 5s ease 1.2s both;
  }
  /* Already shown this visit (inc/whatsapp.php): stay tucked. */
  .fpx-wa--peeked .fpx-wa__tab-label {
    animation: none;
  }
}
@keyframes fpx-wa-peek {
  0%   { max-width: 0;     opacity: 0; margin-inline: 0; }
  10%  { max-width: 140px; opacity: 1; margin-inline: 8px 2px; }
  78%  { max-width: 140px; opacity: 1; margin-inline: 8px 2px; }
  100% { max-width: 0;     opacity: 0; margin-inline: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .fpx-wa,
  .fpx-wa__btn,
  .fpx-wa__rings span,
  .fpx-wa__tab-label {
    animation: none !important;
  }
  .fpx-wa__rings {
    display: none;
  }
}

@media print {
  .fpx-wa {
    display: none;
  }
}
