.floating-whatsapp {
    position: fixed;
    left: clamp(0.875rem, 2vw, 1.5rem);
    bottom: calc(1rem + env(safe-area-inset-bottom));
    z-index: 30;
    display: inline-flex;
    width: 3.25rem;
    height: 3.25rem;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: #25d366;
    color: #fff;
    isolation: isolate;
    box-shadow: 0 14px 32px rgba(18, 140, 126, 0.28), 0 4px 10px rgba(28, 25, 23, 0.14);
    animation: floating-whatsapp-heartbeat 2.8s ease-in-out infinite;
    transition: background-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.floating-whatsapp::before {
    position: absolute;
    inset: -0.45rem;
    z-index: -1;
    border-radius: inherit;
    background: rgba(37, 211, 102, 0.22);
    content: '';
    animation: floating-whatsapp-pulse 2.8s ease-out infinite;
}

.floating-whatsapp__icon {
    display: block;
    width: 1.75rem;
    height: 1.75rem;
    flex: none;
}

.floating-whatsapp__tooltip {
    position: absolute;
    left: 100%;
    bottom: 50%;
    margin-left: 0.75rem;
    width: max-content;
    max-width: min(15rem, calc(100vw - 5.5rem));
    transform: translate(-0.25rem, 50%);
    border-radius: 0.5rem;
    background: #1c1917;
    padding: 0.5rem 0.75rem;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease, transform 180ms ease;
    white-space: nowrap;
}

.floating-whatsapp:hover {
    background: #1ebe5d;
    box-shadow: 0 18px 38px rgba(18, 140, 126, 0.34), 0 6px 14px rgba(28, 25, 23, 0.16);
    transform: scale(1.06);
    animation: none;
}

.floating-whatsapp:hover::before {
    animation-duration: 4s;
}

.floating-whatsapp:hover .floating-whatsapp__tooltip,
.floating-whatsapp:focus-visible .floating-whatsapp__tooltip {
    opacity: 1;
    transform: translate(0, 50%);
}

.floating-whatsapp:focus-visible {
    outline: 3px solid rgba(37, 211, 102, 0.45);
    outline-offset: 4px;
    transform: scale(1.06);
    animation: none;
}

@keyframes floating-whatsapp-heartbeat {
    0%,
    100% {
        transform: scale(1);
    }

    45% {
        transform: scale(1.045);
    }

    60% {
        transform: scale(1);
    }

    75% {
        transform: scale(1.03);
    }
}

@keyframes floating-whatsapp-pulse {
    0% {
        opacity: 0.55;
        transform: scale(0.9);
    }

    70%,
    100% {
        opacity: 0;
        transform: scale(1.35);
    }
}

@media (min-width: 48rem) {
    .floating-whatsapp {
        width: 3.75rem;
        height: 3.75rem;
        bottom: calc(1.5rem + env(safe-area-inset-bottom));
    }

    .floating-whatsapp__icon {
        width: 2rem;
        height: 2rem;
    }
}

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

    .floating-whatsapp {
        transition: background-color 180ms ease, box-shadow 180ms ease;
    }
}
