/* Astra scroll-to-top: counter header-grid hide + stack under floating cart (Apple-like FAB) */

#ast-scroll-top .ast-icon.icon-arrow,
#ast-scroll-top .ast-icon.icon-arrow svg,
#ast-scroll-top .ast-arrow-svg {
    visibility: visible !important;
    opacity: 1 !important;
    position: static !important;
    left: auto !important;
    top: auto !important;
    overflow: visible !important;
    margin: 0 !important;
    padding: 0 !important;
}

#ast-scroll-top .ast-icon.icon-arrow {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100% !important;
    height: 100% !important;
}

#ast-scroll-top .ast-icon.icon-arrow svg,
#ast-scroll-top .ast-arrow-svg {
    display: block !important;
    width: 1.1em !important;
    height: 1.1em !important;
    vertical-align: middle;
    transform: rotate(180deg) !important;
    translate: none !important;
}

#ast-scroll-top .ast-arrow-svg path {
    fill: #1d1d1f !important;
}

#ast-scroll-top {
    overflow: hidden !important;
    text-align: center;
    width: 48px !important;
    height: 48px !important;
    min-width: 48px;
    min-height: 48px;
    line-height: 1 !important;
    right: 32px !important;
    left: auto !important;
    z-index: 1040;
    border-radius: 50% !important;
    border: none !important;
    background: rgba(255, 255, 255, 0.92) !important;
    backdrop-filter: saturate(180%) blur(16px);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    box-shadow:
        0 0.5px 0 rgba(0, 0, 0, 0.06),
        0 4px 16px rgba(0, 0, 0, 0.1);
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#ast-scroll-top:active {
    transform: scale(0.96);
    box-shadow:
        0 0.5px 0 rgba(0, 0, 0, 0.06),
        0 2px 8px rgba(0, 0, 0, 0.08);
}

/* 有悬浮车时：回顶贴底，购物车在上（车钮 bottom 72px + 高 60） */
body:has(#floatingCartBtn) #ast-scroll-top {
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}

/* 单色箭头，不用 ::after 避免双箭头 */
#ast-scroll-top::after {
    content: none !important;
    display: none !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) #ast-scroll-top {
    display: none !important;
}

@media (min-width: 922px) {
    body:not(:has(#floatingCartBtn)) #ast-scroll-top {
        bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    }

    body:has(#floatingCartBtn) #ast-scroll-top {
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    }
}