/* =====================================================================
   Floating Action Buttons — WhatsApp chat widget (bottom-right) + call
   button (bottom-left). Site-wide: markup lives once in
   includes/footer.php, so every page that includes the shared footer
   gets both. Behavior in assets/js/floating-actions.js.

   z-index sits above the header (100) but below the Apply Now modal /
   gallery lightbox (300, see apply-now.css / gallery.css) — deliberate,
   not an oversight: both of those are full-viewport overlays, so once
   either is open it visually (and for pointer-events purposes) covers
   these buttons automatically. No extra JS needed to "hide" them while
   a modal is open.
   ===================================================================== */

.floating-actions {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 250;
    pointer-events: none;
}

.floating-actions > * {
    pointer-events: auto;
}

/* ---- Shared circular-button base ---------------------------------------- */

.floating-call,
.floating-whatsapp__trigger {
    position: fixed;
    bottom: var(--space-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(11, 35, 68, 0.22);
    transition: transform var(--duration-fast) var(--ease-base),
                box-shadow var(--duration-fast) var(--ease-base);
}

.floating-call:hover,
.floating-whatsapp__trigger:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 32px rgba(11, 35, 68, 0.28);
}

.floating-call:active,
.floating-whatsapp__trigger:active {
    transform: translateY(-1px);
}

/* ---- Call button (bottom-left) — site accent, not WhatsApp/reference
   red: this is Voxa's own call action, not a brand mark, so it follows
   CLAUDE.md §3 tokens like every other primary control on the site. */

.floating-call {
    left: var(--space-xl);
    background-color: var(--color-accent);
    color: var(--color-white);
}

.floating-call__icon {
    width: 1.5rem;
    height: 1.5rem;
}

/* Hover-only tooltip — tel: links already do the right thing on tap
   (open the dialer) on touch devices, so this is scoped to genuine
   hover-capable pointers rather than shown/hidden via JS on touch.
   Opens to the RIGHT of the button (not left) since this button sits
   in the bottom-left corner — anchoring it left would push the tooltip
   off-viewport. */
.floating-call__tooltip {
    position: absolute;
    left: calc(100% + var(--space-sm));
    top: 50%;
    transform: translateY(-50%) translateX(-4px);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    background-color: var(--color-primary);
    color: var(--color-white);
    font-size: var(--fs-small);
    font-weight: var(--fw-medium);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--duration-fast) var(--ease-base),
                transform var(--duration-fast) var(--ease-base),
                visibility var(--duration-fast);
}

@media (hover: hover) and (pointer: fine) {
    .floating-call:hover .floating-call__tooltip,
    .floating-call:focus-visible .floating-call__tooltip {
        opacity: 1;
        visibility: visible;
        transform: translateY(-50%) translateX(0);
    }
}

/* ---- WhatsApp widget (bottom-right) — WhatsApp's own green is
   appropriate brand recognition here, not a site color (CLAUDE.md §3
   governs Voxa's own palette, not third-party brand marks we're
   linking out to). */

.floating-whatsapp {
    position: fixed;
    right: var(--space-xl);
    bottom: var(--space-xl);
}

.floating-whatsapp__trigger {
    position: static;
    background-color: #25D366;
    color: var(--color-white);
}

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

/* ---- Chat-preview popup --------------------------------------------------
   Same "card" language as apply-modal/lightbox (white surface, radius-lg,
   restrained shadow) rather than a WhatsApp-style green bubble — this is
   Voxa's own popup chrome, only the trigger button itself needs to read
   as "WhatsApp". */

.floating-whatsapp__popup {
    position: absolute;
    right: 0;
    bottom: calc(100% + var(--space-md));
    width: min(320px, calc(100vw - 3rem));
    border-radius: var(--radius-lg);
    background-color: var(--color-white);
    box-shadow: 0 24px 48px rgba(11, 35, 68, 0.24);
    overflow: hidden;
    transform-origin: bottom right;
    opacity: 0;
    transform: scale(0.94) translateY(8px);
    transition: opacity var(--duration-fast) var(--ease-base),
                transform var(--duration-fast) var(--ease-base);
}

.floating-whatsapp__popup[hidden] {
    display: none;
}

.floating-whatsapp__popup.is-open {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.floating-whatsapp__popup-header {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-lg);
    background-color: var(--color-primary);
}

.floating-whatsapp__avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.floating-whatsapp__popup-heading {
    flex: 1;
    min-width: 0;
}

.floating-whatsapp__popup-name {
    margin: 0;
    color: var(--color-white);
    font-size: var(--fs-body);
    font-weight: var(--fw-semibold);
}

.floating-whatsapp__popup-status {
    margin: var(--space-2xs) 0 0;
    display: flex;
    align-items: center;
    gap: var(--space-2xs);
    color: rgba(255, 255, 255, 0.75);
    font-size: var(--fs-small);
}

.floating-whatsapp__status-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background-color: #25D366;
    flex-shrink: 0;
}

.floating-whatsapp__popup-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: var(--color-white);
    cursor: pointer;
    transition: background-color var(--duration-fast) var(--ease-base);
}

.floating-whatsapp__popup-close:hover {
    background-color: rgba(255, 255, 255, 0.22);
}

.floating-whatsapp__popup-close svg {
    width: 1rem;
    height: 1rem;
}

.floating-whatsapp__popup-body {
    padding: var(--space-lg);
    background-color: var(--color-bg-light);
}

.floating-whatsapp__message {
    margin: 0;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md) var(--radius-md) var(--radius-md) var(--radius-sm);
    background-color: var(--color-white);
    color: var(--color-text-dark);
    font-size: var(--fs-small);
    line-height: var(--lh-body);
    box-shadow: 0 2px 6px rgba(11, 35, 68, 0.08);
}

.floating-whatsapp__start-chat {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: none;
    background-color: #25D366;
    color: var(--color-white);
    font-family: var(--font-body);
    font-size: var(--fs-small);
    font-weight: var(--fw-semibold);
    cursor: pointer;
    transition: background-color var(--duration-fast) var(--ease-base);
}

.floating-whatsapp__start-chat:hover {
    background-color: #1fb959;
}

.floating-whatsapp__start-chat svg {
    width: 1.1rem;
    height: 1.1rem;
}

/* ---- Responsive ------------------------------------------------------- */

@media (max-width: 640px) {
    .floating-call,
    .floating-whatsapp__trigger {
        width: 3.125rem;
        height: 3.125rem;
        bottom: var(--space-lg);
    }

    .floating-call {
        left: var(--space-md);
    }

    .floating-whatsapp {
        right: var(--space-md);
        bottom: var(--space-lg);
    }

    .floating-call__icon,
    .floating-whatsapp__icon {
        width: 1.375rem;
        height: 1.375rem;
    }

    .floating-whatsapp__popup {
        width: min(300px, calc(100vw - 2rem));
    }
}

@media (prefers-reduced-motion: reduce) {
    .floating-call,
    .floating-whatsapp__trigger,
    .floating-whatsapp__popup,
    .floating-call__tooltip {
        transition: none;
    }
}
