/* ===== FLOATING BUTTONS + WHATSAPP BOT ===== */
:root {
    --fab-green: #25d366;
    --fab-green-dark: #128c7e;
    --fab-teal: #075e54;
    --fab-blue: #2b8fd8;
    --fab-blue-dark: #1c6fb0;
    --fab-gap: 18px;
}

/* ----- Base button ----- */
.fab {
    position: fixed;
    bottom: calc(var(--fab-gap) + env(safe-area-inset-bottom, 0px));
    z-index: 1040;
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    height: 58px;
    min-width: 58px;
    padding: 0 1.1rem 0 0;
    border: 0;
    border-radius: 50px;
    color: #fff;
    font: 700 .95rem/1 inherit;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(0, 0, 0, .25);
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

.fab i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 58px;
    height: 58px;
    font-size: 1.6rem;
}

.fab:hover,
.fab:focus-visible {
    color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, .3);
    outline: none;
}

.fab:focus-visible {
    box-shadow: 0 0 0 4px rgba(255, 255, 255, .9), 0 0 0 7px var(--fab-blue);
}

/* ----- Call (left) ----- */
.fab-call {
    left: var(--fab-gap);
    background: linear-gradient(135deg, var(--fab-blue), var(--fab-blue-dark));
}

.fab-call i {
    animation: fab-ring 2.6s ease-in-out infinite;
    transform-origin: 50% 50%;
}

.fab-call::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 2px solid var(--fab-blue);
    animation: fab-pulse 2.2s ease-out infinite;
    pointer-events: none;
}

/* ----- WhatsApp (right) ----- */
.wa-widget {
    position: fixed;
    right: var(--fab-gap);
    bottom: 0;
    z-index: 1040;
}

.fab-wa {
    right: var(--fab-gap);
    background: linear-gradient(135deg, var(--fab-green), var(--fab-green-dark));
    flex-direction: row-reverse;
    padding: 0 0 0 1.1rem;
}

.fab-wa::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 2px solid var(--fab-green);
    animation: fab-pulse 2.2s .6s ease-out infinite;
    pointer-events: none;
}

.wa-badge {
    position: absolute;
    top: -4px;
    left: -4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #e3242b;
    border: 2px solid #fff;
    color: #fff;
    font-size: .72rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fab-wa[aria-expanded="true"] .wa-badge,
.wa-badge.is-hidden {
    display: none;
}

/* Label pills (desktop only) */
.fab-label {
    white-space: nowrap;
}

@media (max-width: 575.98px) {
    .fab {
        padding: 0;
        border-radius: 50%;
        width: 54px;
        height: 54px;
        min-width: 54px;
    }

    .fab i {
        width: 54px;
        height: 54px;
        font-size: 1.5rem;
    }

    .fab-label {
        display: none;
    }
}

/* ----- Nudge bubble ----- */
.wa-nudge {
    position: fixed;
    right: var(--fab-gap);
    bottom: calc(var(--fab-gap) + 58px + 14px + env(safe-area-inset-bottom, 0px));
    max-width: 230px;
    padding: .7rem 1rem;
    background: #fff;
    color: #1c1c1c;
    font-size: .9rem;
    font-weight: 600;
    border-radius: 16px 16px 4px 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
    animation: wa-pop .35s ease both;
}

.wa-nudge[hidden] {
    display: none;
}

/* ----- Chat panel ----- */
.wa-panel {
    position: fixed;
    right: var(--fab-gap);
    bottom: calc(var(--fab-gap) + 58px + 14px + env(safe-area-inset-bottom, 0px));
    width: 350px;
    max-width: calc(100vw - 2 * var(--fab-gap));
    height: 480px;
    max-height: calc(100vh - 130px);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .3);
    transform-origin: bottom right;
    animation: wa-pop .3s ease both;
}

.wa-panel[hidden] {
    display: none;
}

.wa-head {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .9rem 1rem;
    background: linear-gradient(135deg, var(--fab-teal), var(--fab-green-dark));
    color: #fff;
}

.wa-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #fff;
    color: #e3242b;
    font-size: 1.3rem;
}

.wa-head-text {
    flex: 1;
    min-width: 0;
    line-height: 1.25;
}

.wa-head-text strong {
    display: block;
    font-size: 1rem;
}

.wa-head-text small {
    display: flex;
    align-items: center;
    gap: .4rem;
    opacity: .9;
    font-size: .8rem;
}

.wa-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #7CFC9B;
    box-shadow: 0 0 0 3px rgba(124, 252, 155, .3);
}

.wa-close {
    border: 0;
    background: rgba(255, 255, 255, .15);
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    transition: background .2s;
}

.wa-close:hover,
.wa-close:focus-visible {
    background: rgba(255, 255, 255, .3);
    outline: none;
}

/* Messages area */
.wa-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem .9rem;
    display: flex;
    flex-direction: column;
    gap: .55rem;
    background:
        radial-gradient(rgba(18, 140, 126, .08) 1.5px, transparent 2px) 0 0/20px 20px,
        #efeae2;
    scroll-behavior: smooth;
}

.wa-msg {
    max-width: 85%;
    padding: .6rem .85rem;
    font-size: .92rem;
    line-height: 1.5;
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
    animation: wa-pop .25s ease both;
    word-wrap: break-word;
}

.wa-msg--bot {
    align-self: flex-start;
    background: #fff;
    color: #1c1c1c;
    border-top-left-radius: 4px;
}

.wa-msg--user {
    align-self: flex-end;
    background: #d9fdd3;
    color: #1c1c1c;
    border-top-right-radius: 4px;
}

/* Typing dots */
.wa-typing {
    align-self: flex-start;
    display: inline-flex;
    gap: 4px;
    padding: .75rem .9rem;
    background: #fff;
    border-radius: 14px;
    border-top-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}

.wa-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #9aa5b1;
    animation: wa-bounce 1.2s infinite ease-in-out;
}

.wa-typing span:nth-child(2) {
    animation-delay: .15s;
}

.wa-typing span:nth-child(3) {
    animation-delay: .3s;
}

/* Quick replies */
.wa-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    margin-top: .15rem;
    animation: wa-pop .25s ease both;
}

.wa-chip {
    border: 2px solid var(--fab-green-dark);
    background: #fff;
    color: var(--fab-green-dark);
    padding: .4rem .8rem;
    border-radius: 50px;
    font: 600 .85rem/1.2 inherit;
    cursor: pointer;
    transition: background .2s, color .2s, transform .2s;
}

.wa-chip:hover,
.wa-chip:focus-visible {
    background: var(--fab-green-dark);
    color: #fff;
    transform: translateY(-1px);
    outline: none;
}

/* "Continue on WhatsApp" button inside chat */
.wa-cta {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem 1rem;
    border-radius: 50px;
    background: var(--fab-green);
    color: #fff;
    font-weight: 700;
    font-size: .9rem;
    text-decoration: none;
    box-shadow: 0 4px 0 var(--fab-green-dark);
    animation: wa-pop .25s ease both;
}

.wa-cta:hover,
.wa-cta:focus-visible {
    color: #fff;
    transform: translateY(-1px);
    outline: none;
}

/* Input row */
.wa-form {
    display: flex;
    gap: .5rem;
    padding: .65rem;
    background: #f0f2f5;
    border-top: 1px solid #e1e5ea;
}

.wa-input {
    flex: 1;
    min-width: 0;
    border: 0;
    border-radius: 50px;
    padding: .65rem 1rem;
    font: inherit;
    font-size: .92rem;
    background: #fff;
}

.wa-input:focus {
    outline: 2px solid var(--fab-green);
}

.wa-send {
    flex: none;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: var(--fab-green-dark);
    color: #fff;
    cursor: pointer;
    transition: background .2s, transform .2s;
}

.wa-send:hover,
.wa-send:focus-visible {
    background: var(--fab-teal);
    transform: scale(1.06);
    outline: none;
}

/* On small phones the panel uses almost the full width */
@media (max-width: 575.98px) {
    .wa-panel {
        right: 10px;
        left: 10px;
        width: auto;
        max-width: none;
        height: min(480px, calc(100vh - 120px));
        bottom: calc(var(--fab-gap) + 54px + 12px + env(safe-area-inset-bottom, 0px));
    }

    .wa-nudge {
        bottom: calc(var(--fab-gap) + 54px + 12px + env(safe-area-inset-bottom, 0px));
    }
}

/* ----- Animations ----- */
@keyframes fab-pulse {
    0% {
        transform: scale(1);
        opacity: .7;
    }

    100% {
        transform: scale(1.35, 1.6);
        opacity: 0;
    }
}

@keyframes fab-ring {

    0%,
    60%,
    100% {
        transform: rotate(0);
    }

    65% {
        transform: rotate(-18deg);
    }

    75% {
        transform: rotate(16deg);
    }

    85% {
        transform: rotate(-12deg);
    }

    92% {
        transform: rotate(8deg);
    }
}

@keyframes wa-pop {
    from {
        opacity: 0;
        transform: translateY(8px) scale(.96);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes wa-bounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: .5;
    }

    30% {
        transform: translateY(-5px);
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {

    .fab-call i,
    .fab-call::before,
    .fab-wa::before,
    .wa-msg,
    .wa-panel,
    .wa-nudge,
    .wa-chips,
    .wa-cta,
    .wa-typing span {
        animation: none;
    }

    .fab,
    .wa-chip,
    .wa-send {
        transition: none;
    }

    .wa-body {
        scroll-behavior: auto;
    }
}