/* =====================================================================
 * components/whatsapp-float.css — floating Zalo button (every page).
 * Bottom-right, Zalo-blue background, white Zalo wordmark. Subtle pulse every 4s
 * (disabled under prefers-reduced-motion). No hex literals.
 * ===================================================================== */

.wa-float {
    position: fixed;
    bottom: var(--space-5);
    right: var(--space-5);
    width: 3.5rem;
    height: 3.5rem;
    z-index: var(--z-fixed);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-white);
    color: var(--color-zalo);
    border: 2px solid var(--color-zalo);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-md);
    transition: background-color var(--transition-base),
                transform var(--transition-base),
                box-shadow var(--transition-base);
    /* The pulse animation runs on a pseudo-element so the button
     * itself remains crisp for hover/focus interactions. */
}

.wa-float:hover {
    background-color: var(--color-white);
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
    color: var(--color-text-inverse);
}

.wa-float:focus-visible {
    outline: 2px solid var(--color-zalo);
    outline-offset: 4px;
}

.wa-float svg {
    width: 2.25rem;
    height: 2.25rem;
}

/* Pulse halo. Renders behind the button via z-index:-1. */
.wa-float::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: var(--radius-pill);
    /* Ring only: the button is white now, a filled halo would paint over it. */
    background-color: transparent;
    border: 2px solid var(--color-zalo);
    z-index: -1;
    animation: wa-pulse 4s ease-out infinite;
}

@keyframes wa-pulse {
    0%   { transform: scale(1);   opacity: 0.55; }
    70%  { transform: scale(1.6); opacity: 0; }
    100% { transform: scale(1.6); opacity: 0; }
}

/* Reduced motion / explicit opt-out (.no-pulse set by app.js). */
@media (prefers-reduced-motion: reduce) {
    .wa-float::before { animation: none; }
}

.wa-float.no-pulse::before { animation: none; }

/* Tooltip (visible on hover/focus on desktop only) */
.wa-float__tooltip {
    position: absolute;
    right: calc(100% + var(--space-3));
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--color-ink);
    color: var(--color-text-inverse);
    font-size: var(--fs-sm);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
}

@media (min-width: 1024px) {
    .wa-float:hover .wa-float__tooltip,
    .wa-float:focus-visible .wa-float__tooltip {
        opacity: 1;
    }
}

/* Official Zalo logo (client-supplied) inside the white button. */
.wa-float__logo {
    width: 2.5rem;
    height: 2.5rem;
    display: block;
}
