/*
 * WhatsApp Floating Button — runtime values arrive as CSS custom
 * properties via inline style; the stylesheet itself stays cacheable.
 *
 * Two-rule strategy:
 *   1. Base `a.wabtn` carries layout/positioning/display so modifier
 *      classes (--desktop, --mobile, --visible) can override naturally.
 *   2. A chained `a.wabtn:link, :visited, :hover, …` group carries ONLY
 *      color/background/text-decoration to defeat theme link styles
 *      without inflating specificity for layout properties.
 */

a.wabtn {
  position: fixed;
  z-index: 2147483000;
  display: none;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: var(--wabtn-size, 60px);
  height: var(--wabtn-size, 60px);
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: var(--wabtn-radius, 50%);
  box-shadow:
    0 8px 24px rgba(37, 211, 102, 0.35),
    0 2px 6px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px) scale(0.92);
  transition: opacity 280ms ease, transform 280ms cubic-bezier(0.2, 0.9, 0.3, 1.2),
              box-shadow 200ms ease, background-color 200ms ease;
}

/* Defeat theme link styles WITHOUT touching display/layout. */
a.wabtn,
a.wabtn:link,
a.wabtn:visited,
a.wabtn:hover,
a.wabtn:focus,
a.wabtn:active {
  color: var(--wabtn-fg, #FFFFFF);
  background-color: var(--wabtn-bg, #25D366);
  text-decoration: none;
}

a.wabtn--desktop { display: inline-flex; }

@media (max-width: 768px) {
  a.wabtn--desktop { display: none; }
  a.wabtn--mobile { display: inline-flex; }
}

a.wabtn--bottom-right {
  right: var(--wabtn-offset-x, 20px);
  bottom: var(--wabtn-offset-y, 20px);
}
a.wabtn--bottom-left {
  left: var(--wabtn-offset-x, 20px);
  bottom: var(--wabtn-offset-y, 20px);
}

a.wabtn--size-small  { --wabtn-size: 52px; }
a.wabtn--size-medium { --wabtn-size: 62px; }
a.wabtn--size-large  { --wabtn-size: 74px; }

.wabtn__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.wabtn__svg {
  width: 50%;
  height: 50%;
  display: block;
  /* fill is set inline on the element so it cannot be lost to cascade. */
}

.wabtn__label {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  padding: 8px 14px;
  background: #ffffff;
  color: #111111;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14);
  pointer-events: none;
}

a.wabtn--bottom-right .wabtn__label { right: calc(100% + 14px); }
a.wabtn--bottom-left  .wabtn__label { left:  calc(100% + 14px); }

a.wabtn--bottom-right .wabtn__label::after,
a.wabtn--bottom-left  .wabtn__label::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  transform: translateY(-50%);
}
a.wabtn--bottom-right .wabtn__label::after {
  right: -6px;
  border-left: 6px solid #ffffff;
}
a.wabtn--bottom-left .wabtn__label::after {
  left: -6px;
  border-right: 6px solid #ffffff;
}

a.wabtn--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

a.wabtn:hover {
  box-shadow:
    0 12px 28px rgba(37, 211, 102, 0.45),
    0 3px 8px rgba(0, 0, 0, 0.22);
  filter: brightness(1.04);
}

a.wabtn:focus-visible {
  outline: 3px solid var(--wabtn-fg, #FFFFFF);
  outline-offset: 3px;
}

a.wabtn--anim-pulse.wabtn--visible {
  animation: wabtn-pulse 2s ease-in-out infinite;
  will-change: transform;
}
a.wabtn--anim-bounce.wabtn--visible {
  animation: wabtn-bounce 1.6s ease-in-out infinite;
  will-change: transform;
}

@keyframes wabtn-pulse {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(0) scale(1.08); }
}
@keyframes wabtn-bounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-10px) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  a.wabtn { transition: opacity 120ms ease; transform: none; }
  a.wabtn--visible { transform: none; }
  a.wabtn--anim-pulse.wabtn--visible,
  a.wabtn--anim-bounce.wabtn--visible { animation: none; }
}

a.wabtn--no-anim,
a.wabtn--no-anim.wabtn--visible {
  animation: none !important;
  transition: opacity 120ms ease !important;
  transform: none !important;
}
