/* FLOATING WHATSAPP BUTTON */
.whatsapp-float {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background-color: #25D366;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    cursor: pointer;
    z-index: 9999;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
}

/* A few pulses to draw the eye, then it stays still: a ripple grows out of
   the button and fades. Transform and opacity only, so it runs on the
   compositor (an animated box-shadow repainted the page every frame). It
   hangs off the icon because the button's own ::before/::after are the
   tooltip; z-index -1 keeps it under the icon, inside the button. */
.whatsapp-float i::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: 50%;
    background: rgba(37, 211, 102, 0.5);
    opacity: 0;
    pointer-events: none;
    animation: whatsappPulse 2s ease-out 3;
}

/* Scrolling down: slid out of the way (js/common.js toggles this) */
.whatsapp-float.is-tucked {
    transform: translateY(calc(100% + 32px));
    opacity: 0;
    pointer-events: none;
}

.whatsapp-float:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.6);
    background-color: #128C7E;
}

.whatsapp-float:active {
    transform: scale(0.95);
}

/* WhatsApp icon */
.whatsapp-float i {
    color: #fff;
    line-height: 1;
}

@keyframes whatsappPulse {
    from {
        transform: scale(1);
        opacity: 0.6;
    }
    to {
        transform: scale(1.7);
        opacity: 0;
    }
}

/* Tooltip on hover */
.whatsapp-float::before {
    content: 'Chat with us!';
    position: absolute;
    right: 70px;
    background-color: #fff;
    color: #333;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.whatsapp-float::after {
    content: '';
    position: absolute;
    right: 60px;
    border: 6px solid transparent;
    border-left-color: #fff;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.whatsapp-float:hover::before,
.whatsapp-float:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .whatsapp-float {
        width: 48px;
        height: 48px;
        font-size: 24px;
        bottom: calc(14px + env(safe-area-inset-bottom, 0px));
        right: 14px;
    }
    
    /* Hide tooltip on mobile */
    .whatsapp-float::before,
    .whatsapp-float::after {
        display: none;
    }
}

/* Accessibility - reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .whatsapp-float {
        transition: none;
    }

    .whatsapp-float i::after {
        animation: none;
    }
    
    .whatsapp-float:hover {
        transform: none;
    }
}
