/* Budha ADT — Sticky Call button */

.budha-adt-call-btn {
    position: fixed;
    bottom: var(--budha-cb-bottom, 22px);
    z-index: 2147483550;            /* above most theme stuff, below age-gate (which is 600) */
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: var(--budha-cb-bg, #7cc04a);
    color: var(--budha-cb-fg, #0b0b0b) !important;
    font-family: var(--budha-font, -apple-system, "Segoe UI", Roboto, sans-serif);
    font-weight: 600;
    font-size: 15px;
    line-height: 1;
    text-decoration: none !important;
    border-radius: var(--budha-radius-pill, 9999px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
    transition: transform 160ms cubic-bezier(.2, .8, .2, 1),
                box-shadow 160ms cubic-bezier(.2, .8, .2, 1),
                filter    160ms cubic-bezier(.2, .8, .2, 1);
}
.budha-adt-call-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
    filter: brightness(1.05);
}
.budha-adt-call-btn:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.6);
    outline-offset: 3px;
}

.budha-adt-call-btn__icon { flex: 0 0 auto; }

.budha-adt-call-btn__label {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.1;
}
.budha-adt-call-btn__lead {
    font-size: 11px;
    font-weight: 500;
    opacity: 0.78;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.budha-adt-call-btn__num {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

/* Position variants */
.budha-adt-call-btn--bottom-right  { right: var(--budha-cb-side, 22px); left: auto; }
.budha-adt-call-btn--bottom-left   { left:  var(--budha-cb-side, 22px); right: auto; }
.budha-adt-call-btn--bottom-center { left: 50%; transform: translateX(-50%); right: auto; }
.budha-adt-call-btn--bottom-center:hover { transform: translateX(-50%) translateY(-2px); }

/* ---------------------------------------------------------------
 * Coexist with Glozin's scroll-to-top button.
 *
 * Read directly from glozin/style.css (verified):
 *   .gz-button-go-top {
 *       --gz-button-width:  50px;
 *       --gz-button-height: 50px;
 *       bottom: calc( var(--gz-navigation-bar-height, 20px) + 10px );
 *       inset-inline-end: 30px;   (via Bootstrap `.end-30`)
 *   }
 *   .glozin-atc-sticky-height-open .gz-button-go-top {
 *       bottom: calc( var(--gz-atc-sticky-height) + 10px );
 *   }
 *
 * Therefore the go-top's TOP edge sits at:
 *   normal page    : (--gz-navigation-bar-height|20) + 10 + 50 = nav + 60
 *   sticky-ATC open: --gz-atc-sticky-height + 10 + 50 = atc + 60
 *
 * Add a 16px breathing gap → call-button `bottom` = top-edge + 16px.
 *
 * `max(...)` keeps the admin-saved offset_bottom if it's larger than
 * the auto-computed clearance (so a manual 200px override still wins).
 *
 * Three layers of detection: PHP body class, :has(#gotop), :has(.gz-button-go-top).
 * ------------------------------------------------------------- */
body.budha-adt-has-gotop .budha-adt-call-btn--bottom-right,
body:has(#gotop) .budha-adt-call-btn--bottom-right,
body:has(.gz-button-go-top) .budha-adt-call-btn--bottom-right {
    bottom: max(
        var(--budha-cb-bottom, 22px),
        calc(var(--gz-navigation-bar-height, 20px) + 76px)
    );
}

/* Sticky add-to-cart bar shifts the go-top to `--gz-atc-sticky-height + 10px`,
   so the call button has to track that anchor instead of the nav-bar one. */
body.glozin-atc-sticky-height-open.budha-adt-has-gotop .budha-adt-call-btn--bottom-right,
body.glozin-atc-sticky-height-open:has(#gotop) .budha-adt-call-btn--bottom-right,
body.glozin-atc-sticky-height-open:has(.gz-button-go-top) .budha-adt-call-btn--bottom-right {
    bottom: max(
        var(--budha-cb-bottom, 22px),
        calc(var(--gz-atc-sticky-height, 0px) + 76px)
    );
}

/* Sticky-ATC + mobile nav bar — Glozin stacks them:
   `.glozin-atc-sticky-height-open.mobile-has-navigation-bar .gz-button-go-top {
       bottom: calc(var(--gz-navigation-bar-height) + var(--gz-atc-sticky-height) + 10px);
    }`
   so we mirror the addition. */
@media (max-width: 599px) {
    body.glozin-atc-sticky-height-open.mobile-has-navigation-bar.budha-adt-has-gotop .budha-adt-call-btn--bottom-right,
    body.glozin-atc-sticky-height-open.mobile-has-navigation-bar:has(#gotop) .budha-adt-call-btn--bottom-right,
    body.glozin-atc-sticky-height-open.mobile-has-navigation-bar:has(.gz-button-go-top) .budha-adt-call-btn--bottom-right {
        bottom: max(
            var(--budha-cb-bottom, 22px),
            calc(var(--gz-navigation-bar-height, 50px) + var(--gz-atc-sticky-height, 0px) + 76px)
        );
    }
}

/* Bottom-left and bottom-centre share no corner with the go-top — leave alone. */

/* Pulse on first paint to draw the eye */
@keyframes budha-cb-pulse {
    0%, 100% { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22), 0 0 0 0 rgba(124, 192, 74, 0.55); }
    50%      { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22), 0 0 0 14px rgba(124, 192, 74, 0); }
}
.budha-adt-call-btn { animation: budha-cb-pulse 2.4s ease-out 1.2s 2; }

/* ---------- Responsive ---------- */

/* Hide on a given breakpoint */
@media (max-width: 599px) {
    .budha-adt-call-btn--hide-mobile { display: none !important; }
}
@media (min-width: 600px) {
    .budha-adt-call-btn--hide-desktop { display: none !important; }
}

/* Compact icon-only button on mobile (smaller phones especially) */
@media (max-width: 599px) {
    .budha-adt-call-btn--compact-mobile {
        gap: 0;
        width: 56px;
        height: 56px;
        padding: 0;
        border-radius: 50%;
        justify-content: center;
    }
    .budha-adt-call-btn--compact-mobile .budha-adt-call-btn__label {
        position: absolute;
        width: 1px; height: 1px; padding: 0; margin: -1px;
        overflow: hidden; clip: rect(0,0,0,0); border: 0;
    }
    .budha-adt-call-btn--compact-mobile .budha-adt-call-btn__icon {
        width: 24px; height: 24px;
    }
}

/* Tablet: keep label but tighten */
@media (min-width: 600px) and (max-width: 900px) {
    .budha-adt-call-btn { padding: 12px 16px; }
    .budha-adt-call-btn__lead { display: none; }
    .budha-adt-call-btn__num  { font-size: 14px; }
}

/* Avoid clashing with WP admin bar when previewing as admin */
.admin-bar .budha-adt-call-btn { /* no change needed; bottom-anchored */ }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .budha-adt-call-btn { animation: none !important; transition: none !important; }
}

/* ---------------------------------------------------------------
 * Hide the call button while ANY off-canvas drawer is open
 * (cart panel, mobile menu, account panel, filter sidebar).
 * Glozin's scripts.js adds `body.offcanvas-opened` on open
 * and removes it on close. Also covers panel-specific classes
 * like `cart-panel-opened`, `mobile-menu-panel-opened` etc.
 * ------------------------------------------------------------- */
body.offcanvas-opened .budha-adt-call-btn,
body.cart-panel-opened .budha-adt-call-btn,
body.account-panel-opened .budha-adt-call-btn,
body.mobile-menu-panel-opened .budha-adt-call-btn,
body.filter-sidebar-panel-opened .budha-adt-call-btn {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(.95);
    transition: opacity 200ms cubic-bezier(.2, .8, .2, 1),
                transform 200ms cubic-bezier(.2, .8, .2, 1);
}
/* Bottom-centre needs the X-translate preserved while hiding */
body.offcanvas-opened .budha-adt-call-btn--bottom-center,
body.cart-panel-opened .budha-adt-call-btn--bottom-center {
    transform: translateX(-50%) translateY(20px) scale(.95);
}
