.floating-whatsapp {
  position: fixed;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: calc(100vw - 32px);
  margin: 0;
}

.floating-whatsapp-link {
  order: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: calc(100vw - 88px);
  min-height: 52px;
  padding: 8px 16px;
  border: 1px solid rgba(15, 47, 15, 0.24);
  border-radius: 999px;
  background: #2F5C54;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.24);
  font-family: inherit;
  text-decoration: none;
  transition: transform 150ms ease, background-color 150ms ease;
}

.floating-whatsapp-link:hover {
  transform: translateY(-2px);
  background: #2F5C54;
  color: #fff;
}

.floating-whatsapp-toggle {
  order: 2;
  display: grid;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  background: #075e54;
  color: #fff;
  cursor: pointer;
  list-style: none;
  transition: background-color 150ms ease, transform 150ms ease;
}

.floating-whatsapp-toggle::-webkit-details-marker {
  display: none;
}

.floating-whatsapp-toggle:hover {
  transform: translateY(-1px);
  background: #064e46;
}

.floating-whatsapp-link:focus-visible,
.floating-whatsapp-toggle:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.floating-whatsapp-label {
  min-width: 0;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
}

.floating-whatsapp-link .icon {
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  fill: currentColor;
  stroke: none;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.6));
}

.floating-whatsapp-toggle .icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
  stroke: none;
}

.floating-whatsapp-collapsed-icon {
  display: block;
}

.floating-whatsapp-expanded-icon {
  display: none;
}

.floating-whatsapp[open] .floating-whatsapp-collapsed-icon {
  display: none;
}

.floating-whatsapp[open] .floating-whatsapp-expanded-icon {
  display: block;
}

.floating-whatsapp[open] .floating-whatsapp-link {
  animation: whatsapp-attention 1.5s ease-in-out 2;
}

@keyframes whatsapp-attention {
  0%,
  100% {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.24);
  }

  50% {
    box-shadow: 0 0 0 7px rgba(109, 201, 108, 0.32), 0 4px 16px rgba(0, 0, 0, 0.28);
  }
}

@media (max-width: 575px) {
  .floating-whatsapp {
    right: max(12px, env(safe-area-inset-right, 0px));
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
    gap: 6px;
    max-width: calc(100vw - 24px);
  }

  .floating-whatsapp-link {
    gap: 8px;
    max-width: calc(100vw - 70px);
    min-height: 48px;
    padding: 7px 12px;
  }

  .floating-whatsapp-label {
    font-size: 0.875rem;
  }

  .floating-whatsapp-link .icon {
    flex-basis: 22px;
    width: 22px;
    height: 22px;
  }

  .floating-whatsapp-toggle {
    flex-basis: 36px;
    width: 36px;
    height: 36px;
  }

  .floating-whatsapp-toggle .icon {
    width: 18px;
    height: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .floating-whatsapp-link,
  .floating-whatsapp-toggle {
    transition: none;
  }

  .floating-whatsapp[open] .floating-whatsapp-link {
    animation: none;
  }
}
