/* Fixed cluster: back-to-top (above) + WhatsApp live chat (below), bottom-right */

.site-edge-dock {
    position: fixed;
    z-index: 2000;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    max-width: min(280px, calc(100vw - 32px));
    pointer-events: none;
}

.site-edge-dock > * {
    pointer-events: auto;
}

/* Cart drawer stacks below this dock (z-index); hide FABs while drawer is open */
body.cart-drawer-open .site-edge-dock {
    display: none;
}

[dir="rtl"] .site-edge-dock {
    right: auto;
    left: 16px;
    align-items: flex-start;
}

[dir="rtl"] .footer-live-chat-fab {
    flex-direction: row-reverse;
}

/* Scroll button: cancel theme fixed positioning — lives inside dock */
.site-edge-dock .scroll-to-top-btn {
    position: relative !important;
    right: auto !important;
    left: auto !important;
    bottom: auto !important;
    opacity: 1 !important;
    margin: 0 !important;
    flex-shrink: 0;
}

.site-edge-dock .scroll-to-top-btn:not(.visible) {
    opacity: 0.35 !important;
    pointer-events: none;
}

@media (max-width: 991.98px) {
    .site-edge-dock {
        bottom: calc(var(--mobile-app-nav-height, 56px) + env(safe-area-inset-bottom, 0px) + 8px);
    }

    .site-edge-dock .scroll-to-top-btn {
        bottom: auto !important;
    }
}

/* WhatsApp row: Bangla text + close on the LEFT, icon link on the RIGHT */
.footer-live-chat-fab {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: flex-end;
    gap: 0;
    padding: 0;
    border-radius: 14px;
    background: #25d366 !important;
    color: #fff !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    max-width: 100%;
    transition:
        box-shadow 0.15s ease,
        transform 0.15s ease;
}

.footer-live-chat-fab:hover {
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.45);
}

.footer-live-chat-fab__text-panel {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.35rem;
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.5rem 0.5rem 0.5rem 0.75rem;
}

[dir="rtl"] .footer-live-chat-fab__text-panel {
    padding: 0.5rem 0.75rem 0.5rem 0.5rem;
}

.footer-live-chat-fab__text {
    margin: 0;
    flex: 1;
    min-width: 0;
    font-size: 0.8125rem;
    font-weight: 700;
    line-height: 1.35;
    text-align: start;
    word-break: break-word;
    color: #fff !important;
}

.footer-live-chat-fab__close {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.22);
    color: #fff !important;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.footer-live-chat-fab__close:hover,
.footer-live-chat-fab__close:focus {
    background: rgba(0, 0, 0, 0.15);
    outline: none;
}

.footer-live-chat-fab__close:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 1px;
}

.footer-live-chat-fab__icon-link {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 48px;
    min-height: 100%;
    padding: 0 0.35rem;
    background: rgba(0, 0, 0, 0.12);
    color: #fff !important;
    text-decoration: none !important;
    transition: background-color 0.15s ease;
}

.footer-live-chat-fab__icon-link:hover,
.footer-live-chat-fab__icon-link:focus {
    color: #fff !important;
    background: rgba(0, 0, 0, 0.2);
}

.footer-live-chat-fab__icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.footer-live-chat-fab__icon svg {
    display: block;
    width: 22px;
    height: 22px;
}

/* Text dismissed — icon-only strip */
.footer-live-chat-fab--text-hidden .footer-live-chat-fab__text-panel {
    display: none !important;
}

.footer-live-chat-fab--text-hidden {
    border-radius: 50%;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.footer-live-chat-fab--text-hidden .footer-live-chat-fab__icon-link {
    width: 52px;
    height: 52px;
    min-height: 52px;
    border-radius: 50%;
    padding: 0;
    background: transparent;
}

.footer-live-chat-fab--text-hidden .footer-live-chat-fab__icon-link:hover,
.footer-live-chat-fab--text-hidden .footer-live-chat-fab__icon-link:focus {
    background: rgba(0, 0, 0, 0.1);
}

.footer-live-chat-fab .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 400px) {
    .footer-live-chat-fab__text {
        font-size: 0.75rem;
    }
}

/* Lift dock when cookie strip is visible (uses --cookie-consent-height from cookie-consent script) */
body.has-cookie-bar .site-edge-dock {
    bottom: calc(var(--cookie-consent-height, 0px) + 16px + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 991.98px) {
    body.has-cookie-bar .site-edge-dock {
        bottom: calc(var(--cookie-consent-height, 0px) + var(--mobile-app-nav-height, 56px) + env(safe-area-inset-bottom, 0px) + 8px);
    }
}

/* Back-to-top: comfortable touch target, clear focus */
.site-edge-dock .scroll-to-top-btn {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--theme-primary, #f59e0b) !important;
    color: #fff !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        opacity 0.2s ease;
}

.site-edge-dock .scroll-to-top-btn.visible {
    opacity: 1 !important;
    pointer-events: auto !important;
}

.site-edge-dock .scroll-to-top-btn:hover,
.site-edge-dock .scroll-to-top-btn:focus {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    transform: translateY(-2px);
    outline: none;
}

.site-edge-dock .scroll-to-top-btn:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--theme-primary, #f59e0b) 70%, #fff);
    outline-offset: 2px;
}

.site-edge-dock .scroll-to-top-btn > i {
    font-size: 1.1rem;
    line-height: 1;
}
