/**
 * ASR WhatsApp Button.
 * Physical left/right on purpose: the side is a setting, not a reading direction.
 * 999.98px = Blocksy's tablet/desktop edge (same as the other ASR plugins).
 */

.asrwa {
  --asrwa-size: 56px;
  --asrwa-edge: 20px;
  --asrwa-lift: 20px;
  position: fixed;
  z-index: 9989; /* under ASR Mobile Bar (9990) and every drawer */
  bottom: calc(var(--asrwa-lift) + env(safe-area-inset-bottom, 0px));
}
.asrwa--left {
  left: var(--asrwa-edge);
}
.asrwa--right {
  right: var(--asrwa-edge);
}
.asrwa[hidden],
.asrwa__bubble[hidden] {
  display: none !important;
}

/* Button */
.asrwa .asrwa__btn {
  position: relative;
  display: grid;
  place-items: center;
  inline-size: var(--asrwa-size);
  block-size: var(--asrwa-size);
  border-radius: 50%;
  background: #25d366;
  color: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
  text-decoration: none;
  transition:
    transform 0.2s ease,
    background-color 0.2s ease;
}
.asrwa .asrwa__btn:hover,
.asrwa .asrwa__btn:focus-visible {
  background: #1ebe5b;
  color: #fff;
  transform: scale(1.06);
}
.asrwa .asrwa__btn:focus-visible {
  outline: 3px solid rgba(37, 211, 102, 0.45);
  outline-offset: 3px;
}
.asrwa__btn svg {
  inline-size: 30px;
  block-size: 30px;
}

/* Soft pulse ring behind the button */
.asrwa__btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 50%;
  background: #25d366;
  animation: asrwa-pulse 2.4s ease-out infinite;
}
@keyframes asrwa-pulse {
  0% {
    transform: scale(1);
    opacity: 0.5;
  }
  70%,
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

/* Greeting bubble, above the button */
.asrwa__bubble {
  position: absolute;
  bottom: calc(100% + 14px);
  inline-size: max-content;
  max-inline-size: min(260px, calc(100vw - 2 * var(--asrwa-edge)));
  padding: 12px 16px;
  padding-inline-end: 34px;
  border-radius: 14px;
  background: #fff;
  color: #1a1a1a;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  opacity: 0;
  translate: 0 8px;
  transition:
    opacity 0.25s ease,
    translate 0.25s ease;
}
.asrwa__bubble.is-in {
  opacity: 1;
  translate: none;
}
.asrwa--left .asrwa__bubble {
  left: 0;
}
.asrwa--right .asrwa__bubble {
  right: 0;
}
.asrwa__bubble::after {
  content: "";
  position: absolute;
  top: 100%;
  border: 8px solid transparent;
  border-top-color: #fff;
}
.asrwa--left .asrwa__bubble::after {
  left: 20px;
}
.asrwa--right .asrwa__bubble::after {
  right: 20px;
}
.asrwa .asrwa__say {
  color: inherit;
  text-decoration: none;
}
.asrwa .asrwa__say:hover {
  color: #128c4b;
}
/* Blocksy's global button style is reset on purpose. */
.asrwa button.asrwa__x {
  position: absolute;
  top: 6px;
  inset-inline-end: 8px;
  inline-size: auto !important;
  min-inline-size: 0 !important;
  min-block-size: 0 !important;
  margin: 0;
  padding: 0 4px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: none !important;
  box-shadow: none !important;
  color: #8a8f98 !important;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.asrwa button.asrwa__x:hover {
  color: #1a1a1a !important;
}

@media (min-width: 1000px) {
  .asrwa--no-d {
    display: none !important;
  }
}
@media (max-width: 999.98px) {
  .asrwa {
    --asrwa-size: 52px;
    --asrwa-edge: 16px;
    --asrwa-lift: 16px;
  }
  .asrwa--no-m {
    display: none !important;
  }
  body.asrmb-on .asrwa {
    --asrwa-lift: calc(var(--asrmb-h, 62px) + 14px);
  }
  .asrwa__btn svg {
    inline-size: 28px;
    block-size: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .asrwa__btn::before {
    display: none;
    animation: none;
  }
  .asrwa .asrwa__btn,
  .asrwa__bubble {
    transition: none;
  }
}
@media print {
  .asrwa {
    display: none !important;
  }
}
