/*
 * Golden Age Media — Sticky Buy Bar v1.1.0
 * Fully scoped; complements (does not replace) the existing theme and Additional CSS.
 */
#gam-sticky-purchase,
#gam-sticky-purchase *,
#gam-sticky-purchase *::before,
#gam-sticky-purchase *::after {
    box-sizing: border-box !important;
}

#gam-sticky-purchase {
    position: fixed !important;
    inset: auto 0 0 0 !important;
    z-index: 9000 !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 10px max(18px, env(safe-area-inset-right))
        calc(10px + env(safe-area-inset-bottom))
        max(18px, env(safe-area-inset-left)) !important;
    background: rgba(255, 252, 247, 0.98) !important;
    border: 0 !important;
    border-top: 1px solid #eadfce !important;
    border-radius: 0 !important;
    box-shadow: 0 -9px 30px rgba(62, 34, 12, 0.12) !important;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    font-family: 'Inter', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif !important;
    transform: translate3d(0, 110%, 0) !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transition: transform 260ms ease, opacity 220ms ease, visibility 260ms ease !important;
}

#gam-sticky-purchase.gam-spb--visible {
    transform: translate3d(0, 0, 0) !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

#gam-sticky-purchase .gam-spb__inner {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(370px, 480px) !important;
    align-items: center !important;
    gap: 28px !important;
    width: 100% !important;
    max-width: 1180px !important;
    margin: 0 auto !important;
    padding: 0 !important;
}

#gam-sticky-purchase .gam-spb__identity {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

#gam-sticky-purchase .gam-spb__cover {
    display: block !important;
    width: 42px !important;
    height: 54px !important;
    flex: 0 0 42px !important;
    object-fit: contain !important;
    background: #fff !important;
    border: 1px solid #eadfce !important;
    border-radius: 5px !important;
    box-shadow: 0 3px 9px rgba(0, 0, 0, 0.07) !important;
}

#gam-sticky-purchase .gam-spb__cover[hidden] {
    display: none !important;
}

#gam-sticky-purchase .gam-spb__details {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    gap: 3px !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
}

#gam-sticky-purchase .gam-spb__eyebrow {
    color: #a85c30 !important;
    font-size: 9px !important;
    font-weight: 800 !important;
    letter-spacing: 0.095em !important;
    line-height: 1.2 !important;
    text-transform: uppercase !important;
}

#gam-sticky-purchase .gam-spb__title {
    display: block !important;
    max-width: 100% !important;
    margin: 0 !important;
    color: #2e251f !important;
    font-size: 14px !important;
    line-height: 1.35 !important;
    font-weight: 750 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

#gam-sticky-purchase .gam-spb__price {
    flex: 0 0 auto !important;
    color: #af460f !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    line-height: 1.25 !important;
    white-space: nowrap !important;
}

#gam-sticky-purchase .gam-spb__price:empty {
    display: none !important;
}

#gam-sticky-purchase .gam-spb__actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    align-items: center !important;
    gap: 10px !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

#gam-sticky-purchase .gam-spb__btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 7px !important;
    appearance: none !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 46px !important;
    height: 46px !important;
    margin: 0 !important;
    padding: 0 9px !important;
    border-radius: 8px !important;
    font-size: 12px !important;
    line-height: 1.2 !important;
    font-weight: 800 !important;
    letter-spacing: 0.015em !important;
    text-decoration: none !important;
    text-transform: uppercase !important;
    text-align: center !important;
    white-space: nowrap !important;
    font-family: inherit !important;
    cursor: pointer !important;
    transition: background 180ms ease, color 180ms ease, box-shadow 180ms ease !important;
}

#gam-sticky-purchase .gam-spb__btn-icon {
    width: 16px !important;
    height: 16px !important;
    flex: 0 0 16px !important;
    stroke: currentColor !important;
}

#gam-sticky-purchase .gam-spb__btn--cart {
    color: #fff !important;
    background: #ed570b !important;
    border: 1px solid #ed570b !important;
    box-shadow: 0 4px 12px rgba(232, 91, 19, 0.16) !important;
}

#gam-sticky-purchase .gam-spb__btn--cart:hover:not(:disabled) {
    background: #ca480b !important;
    border-color: #ca480b !important;
}

#gam-sticky-purchase .gam-spb__btn--buy {
    color: #ce490e !important;
    background: #fff !important;
    border: 1.5px solid #e85b13 !important;
}

#gam-sticky-purchase .gam-spb__btn--buy:hover:not(:disabled) {
    background: #fff0e4 !important;
}

#gam-sticky-purchase .gam-spb__btn:disabled {
    opacity: 0.62 !important;
    cursor: wait !important;
}

#gam-sticky-purchase .gam-spb__btn:focus-visible {
    outline: 3px solid #1d4ed8 !important;
    outline-offset: 2px !important;
}

#gam-sticky-purchase-spacer {
    display: block !important;
    height: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    pointer-events: none !important;
}

#gam-sticky-purchase-spacer.gam-spb-spacer--active {
    height: var(--gam-spb-height, 86px) !important;
}

/* Never cover the product image viewer or the Mayū chat modal. */
body.single-product:has(#gam-lightbox.is-open) #gam-sticky-purchase,
body.gama-chat-modal-open #gam-sticky-purchase {
    transform: translate3d(0, 110%, 0) !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Position only Mayū's launcher above the purchase bar while the bar is active.
   The widget's default position returns as soon as the sticky bar disappears. */
body.gam-spb-bar-visible:not(.gama-chat-modal-open) #gama-widget-container.gama-position-bottom-left,
body.gam-spb-bar-visible:not(.gama-chat-modal-open) #gama-widget-container.gama-position-bottom-right {
    bottom: calc(var(--gam-spb-height, 86px) + 16px) !important;
}

/* Small desktop / tablet: keep both buttons beside a concise title. */
@media (max-width: 900px) and (min-width: 701px) {
    #gam-sticky-purchase .gam-spb__inner {
        grid-template-columns: minmax(0, 1fr) minmax(320px, 45%) !important;
        gap: 14px !important;
    }
    #gam-sticky-purchase .gam-spb__btn {
        font-size: 11px !important;
    }
}

/* Mobile: show the cover + title + price like desktop, with two equal buttons below. */
@media (max-width: 700px) {
    #gam-sticky-purchase {
        padding: 8px max(12px, env(safe-area-inset-right))
            calc(9px + env(safe-area-inset-bottom))
            max(12px, env(safe-area-inset-left)) !important;
    }
    #gam-sticky-purchase .gam-spb__inner {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 8px !important;
        max-width: 540px !important;
    }
    #gam-sticky-purchase .gam-spb__identity {
        gap: 10px !important;
        min-height: 38px !important;
    }
    #gam-sticky-purchase .gam-spb__cover {
        width: 34px !important;
        height: 42px !important;
        flex-basis: 34px !important;
        border-radius: 4px !important;
    }
    #gam-sticky-purchase .gam-spb__details {
        gap: 2px !important;
    }
    #gam-sticky-purchase .gam-spb__eyebrow {
        font-size: 8px !important;
    }
    #gam-sticky-purchase .gam-spb__title {
        font-size: 12px !important;
        font-weight: 750 !important;
    }
    #gam-sticky-purchase .gam-spb__price {
        font-size: 12px !important;
        margin-left: 5px !important;
    }
    #gam-sticky-purchase .gam-spb__actions {
        gap: 9px !important;
    }
    #gam-sticky-purchase .gam-spb__btn {
        height: 44px !important;
        min-height: 44px !important;
        font-size: 12px !important;
        border-radius: 7px !important;
        letter-spacing: 0 !important;
    }
    #gam-sticky-purchase .gam-spb__btn-icon {
        width: 15px !important;
        height: 15px !important;
        flex-basis: 15px !important;
    }
}

/* Extra-narrow phones: prevent overflow at 320px and below. */
@media (max-width: 360px) {
    #gam-sticky-purchase .gam-spb__btn {
        font-size: 11px !important;
        padding: 0 5px !important;
        gap: 4px !important;
    }
    #gam-sticky-purchase .gam-spb__actions {
        gap: 7px !important;
    }
    #gam-sticky-purchase .gam-spb__title {
        font-size: 11px !important;
    }
    #gam-sticky-purchase .gam-spb__price {
        font-size: 11px !important;
    }
}

/* Compact layout in landscape with little viewport height. */
@media (max-height: 420px) and (orientation: landscape) {
    #gam-sticky-purchase .gam-spb__cover,
    #gam-sticky-purchase .gam-spb__eyebrow {
        display: none !important;
    }
    #gam-sticky-purchase .gam-spb__btn {
        height: 40px !important;
        min-height: 40px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    #gam-sticky-purchase,
    #gam-sticky-purchase .gam-spb__btn {
        transition: none !important;
    }
}
