.floating-whatsapp {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: calc(18px + env(safe-area-inset-bottom));
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(145deg, #28d367 0%, #1fae58 100%);
  color: #ffffff;
  display: grid;
  place-items: center;
  text-decoration: none;
  box-shadow:
    0 10px 22px rgba(20, 84, 48, 0.24),
    0 0 0 1px rgba(255, 255, 255, 0.2) inset;
  z-index: 38;
  transform: translateZ(0);
  transition:
    transform var(--interaction-duration-base) var(--interaction-ease),
    box-shadow var(--interaction-duration-base) var(--interaction-ease),
    filter var(--interaction-duration-base) var(--interaction-ease);
  animation: floating-whatsapp-float 3.6s ease-in-out infinite;
  isolation: isolate;
}

.floating-whatsapp__icon {
  width: 28px;
  height: 28px;
}

.floating-whatsapp__halo {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 1px solid rgba(31, 174, 88, 0.32);
  opacity: 0;
  transform: scale(0.92);
  animation: floating-whatsapp-pulse 3.6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes floating-whatsapp-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2px);
  }
}

@keyframes floating-whatsapp-pulse {
  0%,
  56%,
  100% {
    opacity: 0;
    transform: scale(0.92);
  }
  68% {
    opacity: 0.32;
    transform: scale(1);
  }
  82% {
    opacity: 0;
    transform: scale(1.08);
  }
}

@media (hover: hover) and (pointer: fine) {
  .floating-whatsapp:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow:
      0 14px 26px rgba(20, 84, 48, 0.3),
      0 0 0 1px rgba(255, 255, 255, 0.24) inset;
    filter: brightness(1.02);
    animation-play-state: paused;
  }
}

.floating-whatsapp:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 4px rgba(31, 174, 88, 0.18),
    0 14px 26px rgba(20, 84, 48, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.24) inset;
}

.floating-whatsapp:active {
  transform: scale(0.99);
  box-shadow:
    0 8px 18px rgba(20, 84, 48, 0.22),
    0 0 0 1px rgba(255, 255, 255, 0.16) inset;
}

@media (max-width: 767px) {
  .floating-whatsapp {
    right: max(14px, env(safe-area-inset-right));
    bottom: calc(14px + env(safe-area-inset-bottom));
    width: 54px;
    height: 54px;
  }

  .floating-whatsapp__icon {
    width: 26px;
    height: 26px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .floating-whatsapp,
  .floating-whatsapp__halo {
    animation: none;
  }
}
