/* ==========================================================================
   Floating WhatsApp button + chat teaser
   ========================================================================== */

.waf {
    --waf-green: #25d366;
    --waf-green-dark: #128c4b;
    position: fixed;
    inset-inline-start: 18px;
    bottom: max(18px, env(safe-area-inset-bottom));
    z-index: 9999998;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    pointer-events: none;
}

.waf > * {
    pointer-events: auto;
}

/* ---------- main button ---------- */

.waf__btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px;
    padding-inline-end: 18px;
    border-radius: 999px;
    color: #fff !important;
    text-decoration: none !important;
    background: linear-gradient(135deg, #2fe07a 0%, var(--waf-green) 45%, var(--waf-green-dark) 100%);
    box-shadow: 0 12px 28px -8px rgba(18, 140, 75, 0.65), 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    animation: waf-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.8s both;
}

.waf__btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 34px -8px rgba(18, 140, 75, 0.75), 0 2px 6px rgba(0, 0, 0, 0.15);
}

.waf__btn:active {
    transform: scale(0.97);
}

.waf__icon {
    position: relative;
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 29px;
    color: var(--waf-green-dark);
    background: #fff;
}

/* attention ring */
.waf__icon::before,
.waf__icon::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.85);
    animation: waf-ring 2.6s ease-out infinite;
}

.waf__icon::after {
    animation-delay: 1.3s;
}

.waf__badge {
    position: absolute;
    top: -3px;
    inset-inline-end: -3px;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    color: #fff;
    background: #ff3b30;
    border: 2px solid #fff;
    font-family: system-ui, sans-serif;
}

.waf--seen .waf__badge {
    display: none;
}

.waf__label {
    display: flex;
    flex-direction: column;
    gap: 3px;
    line-height: 1.15;
    white-space: nowrap;
}

.waf__label strong {
    font-size: 15px;
    font-weight: 800;
}

.waf__label small {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 600;
    opacity: 0.92;
}

.waf__label small::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #d9ffe8;
    box-shadow: 0 0 0 3px rgba(217, 255, 232, 0.3);
}

/* ---------- teaser bubble ---------- */

.waf__teaser {
    /* floats above the button, so showing it never moves the button (no layout shift) */
    position: absolute;
    bottom: calc(100% + 12px);
    inset-inline-start: 0;
    width: min(300px, calc(100vw - 36px));
    border-radius: 18px;
    border-end-start-radius: 6px;
    background: #fff;
    box-shadow: 0 20px 45px -12px rgba(33, 12, 51, 0.35), 0 2px 8px rgba(0, 0, 0, 0.08);
    opacity: 0;
    transform: translateY(12px) scale(0.96);
    transform-origin: bottom left;
    transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

[dir="rtl"] .waf__teaser {
    transform-origin: bottom right;
}

.waf__teaser.is-visible {
    opacity: 1;
    transform: none;
}

.waf__teaser-body {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    padding-inline-end: 34px;
    color: #2a1140 !important;
    text-decoration: none !important;
}

.waf__avatar {
    position: relative;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #4a1f6e, #2a1140);
}

.waf__avatar img {
    width: 24px;
    height: auto;
}

.waf__online {
    position: absolute;
    bottom: 1px;
    inset-inline-end: 1px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--waf-green);
    border: 2px solid #fff;
}

.waf__msg {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 14px;
    line-height: 1.5;
}

.waf__msg strong {
    font-size: 14.5px;
    font-weight: 800;
    color: #421f61;
}

.waf__msg span {
    color: #4b3d57;
}

.waf__msg em {
    margin-top: 4px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    align-self: flex-start;
    padding: 7px 14px;
    border-radius: 999px;
    font-style: normal;
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    background: var(--waf-green);
}

.waf__msg em i {
    font-size: 16px;
}

.waf__teaser-close {
    position: absolute;
    top: 8px;
    inset-inline-end: 8px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 13px;
    color: #7d6f88;
    background: #f3eef6;
    border: 0;
    cursor: pointer;
    z-index: 1;
}

.waf__teaser-close:hover {
    color: #2a1140;
    background: #e8def0;
}

/* ---------- phones: compact button ---------- */

@media (max-width: 575px) {
    .waf {
        inset-inline-start: 14px;
        bottom: max(14px, env(safe-area-inset-bottom));
    }

    .waf__btn {
        padding-inline-end: 14px;
        gap: 8px;
    }

    .waf__icon {
        width: 46px;
        height: 46px;
        font-size: 27px;
    }

    .waf__label strong {
        font-size: 14px;
    }

    .waf__label small {
        font-size: 10.5px;
    }
}

/* hide while the drawer menu is open */
html.dw-lock .waf {
    display: none;
}

@keyframes waf-ring {
    0% { transform: scale(0.9); opacity: 0.9; }
    80%, 100% { transform: scale(1.45); opacity: 0; }
}

@keyframes waf-in {
    from { opacity: 0; transform: translateY(20px) scale(0.9); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .waf__icon::before,
    .waf__icon::after,
    .waf__btn {
        animation: none;
    }
}
