/* Mobile WhatsApp floating button — chatbot-style FAB with typing teaser (mobile only) */

.mobile-whatsapp-float {
    position: fixed;
    bottom: max(24px, env(safe-area-inset-bottom, 0px));
    right: max(16px, env(safe-area-inset-right, 0px));
    z-index: 9998;
    pointer-events: none;
}

.mobile-whatsapp-float__btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: row;
    gap: 0;
    width: 56px;
    height: 56px;
    border-radius: 28px;
    background: #25D366;
    color: #fff;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(37, 211, 102, 0.45);
    transition: width 1.4s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.6s ease,
                transform 0.2s ease,
                padding 1.4s cubic-bezier(0.4, 0, 0.2, 1),
                justify-content 0s linear 1.4s;
    pointer-events: auto;
    overflow: hidden;
    padding: 0;
    white-space: nowrap;
}

.mobile-whatsapp-float__btn.is-expanded {
    width: min(calc(100vw - 32px), 280px);
    padding-left: 6px;
    padding-right: 16px;
    justify-content: flex-start;
    transition: width 1.4s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.6s ease,
                transform 0.2s ease,
                padding 1.4s cubic-bezier(0.4, 0, 0.2, 1),
                justify-content 0s;
    box-shadow: 0 6px 28px rgba(37, 211, 102, 0.55);
}

.mobile-whatsapp-float__btn:hover,
.mobile-whatsapp-float__btn:focus {
    color: #fff;
    transform: scale(1.04);
    box-shadow: 0 6px 24px rgba(37, 211, 102, 0.6);
}

.mobile-whatsapp-float__btn:active {
    transform: scale(0.97);
}

.mobile-whatsapp-float__icon {
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
}

.mobile-whatsapp-float__btn.is-expanded .mobile-whatsapp-float__icon {
    width: 44px;
    height: 44px;
}

.mobile-whatsapp-float__icon i {
    display: block;
    font-size: 28px;
    line-height: 1;
    text-align: center;
}

.mobile-whatsapp-float__text {
    position: absolute;
    left: 56px;
    right: 0;
    z-index: 2;
    min-width: 0;
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0.01em;
    transition: max-width 1.4s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.8s ease 0.35s;
    pointer-events: none;
}

.mobile-whatsapp-float__btn.is-expanded .mobile-whatsapp-float__text {
    position: relative;
    left: auto;
    right: auto;
    flex: 1;
    max-width: 220px;
    opacity: 1;
    margin-left: 4px;
    pointer-events: auto;
}

.mobile-whatsapp-float__typed {
    display: inline;
}

.mobile-whatsapp-float__cursor {
    display: inline-block;
    width: 2px;
    margin-left: 1px;
    opacity: 0;
    animation: none;
}

.mobile-whatsapp-float__btn.is-typing .mobile-whatsapp-float__cursor,
.mobile-whatsapp-float__btn.is-holding .mobile-whatsapp-float__cursor {
    opacity: 1;
    animation: mobile-whatsapp-blink 0.8s step-end infinite;
}

.mobile-whatsapp-float__pulse {
    position: absolute;
    inset: 0;
    border-radius: 28px;
    background: #25D366;
    z-index: 1;
    animation: mobile-whatsapp-pulse 2.5s ease-out infinite;
}

.mobile-whatsapp-float__btn.is-expanded .mobile-whatsapp-float__pulse {
    animation: none;
    opacity: 0;
}

@keyframes mobile-whatsapp-pulse {
    0% {
        transform: scale(1);
        opacity: 0.55;
    }
    70% {
        transform: scale(1.35);
        opacity: 0;
    }
    100% {
        transform: scale(1.35);
        opacity: 0;
    }
}

@keyframes mobile-whatsapp-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Keep back-to-top above the WhatsApp button when both are visible */
body.has-mobile-whatsapp-float .progress-wrap.active-progress {
    bottom: 90px;
}

@media (min-width: 992px) {
    .mobile-whatsapp-float {
        display: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mobile-whatsapp-float__btn,
    .mobile-whatsapp-float__text,
    .mobile-whatsapp-float__pulse {
        transition: none;
        animation: none;
    }

    .mobile-whatsapp-float__btn.is-expanded {
        width: min(calc(100vw - 32px), 280px);
        padding-left: 6px;
        padding-right: 16px;
    }

    .mobile-whatsapp-float__btn.is-expanded .mobile-whatsapp-float__text {
        max-width: 220px;
        opacity: 1;
    }

    .mobile-whatsapp-float__cursor {
        display: none;
    }
}
