:root {
  --whatsapp-green: #25d366;
  --whatsapp-green-dark: #128c7e;
}

.whatsapp-float {
  position: fixed;
  right: max(24px, env(safe-area-inset-right, 0px));
  bottom: max(24px, calc(env(safe-area-inset-bottom, 0px) + 20px));
  z-index: 89;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  pointer-events: none;
}

.whatsapp-float__link {
  display: grid;
  width: 60px;
  height: 60px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  box-shadow:
    0 12px 30px rgba(18, 140, 126, 0.3),
    0 4px 12px rgba(7, 7, 7, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.34);
  pointer-events: auto;
  animation: whatsapp-float-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.35s backwards;
  transition:
    transform 0.22s ease,
    filter 0.22s ease;
}

.whatsapp-float__link img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.12));
}

.whatsapp-float__link picture {
  display: block;
  width: 100%;
  height: 100%;
}

.whatsapp-float__link:hover {
  color: #fff;
  filter: saturate(1.05) brightness(1.03);
  transform: translateY(-3px) scale(1.04);
  box-shadow:
    0 18px 38px rgba(18, 140, 126, 0.38),
    0 7px 18px rgba(7, 7, 7, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.whatsapp-float__link:active {
  transform: translateY(-1px) scale(0.98);
}

.whatsapp-float__link:focus-visible,
.whatsapp-float__close:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
  box-shadow: 0 0 0 6px rgba(37, 211, 102, 0.38);
}

.whatsapp-float__bubble {
  position: relative;
  width: min(320px, calc(100vw - 32px));
  padding: 15px 44px 15px 17px;
  border: 1px solid rgba(184, 124, 106, 0.2);
  border-radius: 16px 16px 4px 16px;
  background: rgba(255, 253, 251, 0.97);
  color: #211b19;
  box-shadow:
    0 18px 48px rgba(43, 30, 25, 0.14),
    0 4px 14px rgba(43, 30, 25, 0.08);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) scale(0.97);
  transform-origin: bottom right;
  visibility: hidden;
  transition:
    opacity 0.25s ease,
    transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s linear 0.3s;
}

.whatsapp-float__bubble::after {
  content: '';
  position: absolute;
  right: 20px;
  bottom: -7px;
  width: 14px;
  height: 14px;
  border-right: 1px solid rgba(184, 124, 106, 0.2);
  border-bottom: 1px solid rgba(184, 124, 106, 0.2);
  background: #fffdfb;
  transform: rotate(45deg);
}

.whatsapp-float__bubble.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  visibility: visible;
  transition-delay: 0s;
}

.whatsapp-float__bubble p {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 650;
  line-height: 1.5;
}

.whatsapp-float__bubble strong {
  color: var(--whatsapp-green-dark);
  font-weight: 800;
}

.whatsapp-float__close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #756b67;
  font: inherit;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  transition: none;
}

.whatsapp-float__close:hover {
  background: rgba(184, 124, 106, 0.1);
  color: #211b19;
}

body.modal-open .whatsapp-float {
  display: none;
}

@keyframes whatsapp-float-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 720px) {
  .whatsapp-float {
    right: max(16px, env(safe-area-inset-right, 0px));
    bottom: calc(104px + env(safe-area-inset-bottom, 0px));
    gap: 10px;
  }

  .whatsapp-float__link {
    width: 56px;
    height: 56px;
  }

  .whatsapp-float__link img {
    width: 100%;
    height: 100%;
  }

  .whatsapp-float__bubble {
    width: min(292px, calc(100vw - 32px));
    padding: 13px 42px 13px 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .whatsapp-float__link {
    animation: none;
    transition: none;
  }

  .whatsapp-float__bubble {
    transition: none;
  }
}

@media print {
  .whatsapp-float {
    display: none !important;
  }
}
