/* ============================================
   Floating WhatsApp Chat Button
   ============================================ */

/*
 * Sits in the bottom-right corner, stacked above the AI chatbot toggle
 * (.floating-widgets in base.css) so the two never overlap.
 * Desktop: chatbot toggle is 30px bottom + 60px tall, plus a 16px gap = 106px.
 * Mobile:  chatbot toggle is 20px bottom + 50px tall, plus a 12px gap = 82px.
 * Pages without a bottom bar/widget can set --wa-bottom-offset back to 24px / 16px.
 *
 * z-index 1020 keeps it above page content but below the navbar/mobile
 * menu (1030), Bootstrap modals (1055), and the chatbot panel/overlays.
 */
:root {
    --wa-size: 56px;
    --wa-edge: 24px;
    --wa-bottom-offset: 106px;
}

.whatsapp-float {
    position: fixed;
    right: calc(var(--wa-edge) + env(safe-area-inset-right, 0px));
    bottom: calc(var(--wa-bottom-offset) + env(safe-area-inset-bottom, 0px));
    z-index: 1020;
    display: inline-flex;
    align-items: center;
    height: var(--wa-size);
    min-width: var(--wa-size);
    padding: 0 16px;
    border-radius: calc(var(--wa-size) / 2);
    background: #25D366;
    color: #ffffff;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    -webkit-tap-highlight-color: transparent;
}

.whatsapp-float:hover,
.whatsapp-float:focus-visible {
    color: #ffffff;
    text-decoration: none;
    transform: translateY(-3px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.whatsapp-float:focus-visible {
    outline: 3px solid rgba(37, 211, 102, 0.45);
    outline-offset: 3px;
}

.whatsapp-float:active {
    transform: translateY(-1px);
}

.whatsapp-float i {
    flex-shrink: 0;
    width: 24px;
    font-size: 28px;
    line-height: 1;
    text-align: center;
}

/* Label is collapsed by default; only expands on hover-capable desktops */
.whatsapp-float-label {
    display: inline-block;
    max-width: 0;
    margin-left: 0;
    overflow: hidden;
    white-space: nowrap;
    opacity: 0;
    font-size: 15px;
    font-weight: 600;
    transition: max-width 0.3s ease, margin-left 0.3s ease, opacity 0.2s ease;
}

@media (hover: hover) and (pointer: fine) and (min-width: 769px) {
    .whatsapp-float:hover .whatsapp-float-label,
    .whatsapp-float:focus-visible .whatsapp-float-label {
        max-width: 140px;
        margin-left: 10px;
        opacity: 1;
    }
}

/* Mobile / tablet: round icon only, 16px from the edge */
@media (max-width: 768px) {
    :root {
        --wa-edge: 16px;
        --wa-bottom-offset: 82px;
    }

    .whatsapp-float-label {
        display: none;
    }
}

/* Very small phones */
@media (max-width: 360px) {
    :root {
        --wa-size: 52px;
    }

    .whatsapp-float {
        padding: 0 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .whatsapp-float,
    .whatsapp-float-label {
        transition: none;
    }

    .whatsapp-float:hover,
    .whatsapp-float:focus-visible {
        transform: none;
    }
}

@media print {
    .whatsapp-float {
        display: none !important;
    }
}
