:root {
    --bnb-accent: var(--sf-primary, #f97316);
    --bnb-bar-height: 76px;
}

/* ── Shared buttons ────────────────────────────────────────────────────── */

.bnb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 12px 22px;
    border: 0;
    border-radius: 12px;
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    min-height: 48px;
    cursor: pointer;
    /* Themes style their own buttons freely; forcing a single line here is what
       keeps both buttons the same height instead of one wrapping to two rows. */
    white-space: nowrap !important;
    word-break: keep-all !important;
    transition: transform .15s ease, opacity .15s ease, box-shadow .15s ease;
}

.bnb-btn > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bnb-btn svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.bnb-btn:hover { transform: translateY(-1px); }
.bnb-btn:active { transform: translateY(0); }

.bnb-btn.is-disabled,
.bnb-btn[disabled] {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
}

.bnb-btn--buy {
    background: var(--bnb-accent);
    color: #fff;
    box-shadow: 0 8px 20px -8px var(--bnb-accent);
}

.bnb-btn--cart {
    background: transparent;
    color: var(--sf-text, #16181d);
    border: 1.5px solid currentColor;
}

.bnb-inline-host {
    display: block;
    margin-top: 10px;
}

.bnb-inline {
    width: 100%;
}

/* ── Sticky bar ────────────────────────────────────────────────────────── */

.bnb-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9990;
    background: var(--sf-surface, #fff);
    color: var(--sf-text, #16181d);
    border-top: 1px solid rgba(0, 0, 0, .08);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, .12);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    transform: translateY(110%);
    transition: transform .3s ease;
}

.bnb-bar.is-visible {
    transform: translateY(0);
}

.bnb-bar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    max-width: 1180px;
    margin: 0 auto;
    padding: 12px 16px;
}

.bnb-bar__info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.bnb-bar__thumb {
    width: 52px;
    height: 52px;
    flex: 0 0 auto;
    border-radius: 10px;
    object-fit: cover;
    background: rgba(0, 0, 0, .05);
}

.bnb-bar__texts {
    min-width: 0;
}

.bnb-bar__title {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 320px;
}

/* Applied by the script when the row runs out of room: the name goes first,
   the thumbnail second, so the price and the buttons are never squeezed. */
.bnb-bar--compact .bnb-bar__title {
    display: none;
}

.bnb-bar--minimal .bnb-bar__thumb {
    display: none;
}

.bnb-bar--minimal .bnb-bar__info:empty,
.bnb-bar--minimal .bnb-bar__texts:empty {
    display: none;
}

.bnb-bar__price {
    margin: 2px 0 0;
    font-size: 16px;
    font-weight: 800;
    color: var(--bnb-accent);
}

.bnb-bar__actions {
    display: flex;
    align-items: stretch;
    gap: 10px;
    flex: 0 0 auto;
}

.bnb-qty {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    border: 1.5px solid rgba(0, 0, 0, .12);
    border-radius: 12px;
    overflow: hidden;
}

.bnb-qty__btn {
    width: 38px;
    height: 42px;
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 19px;
    line-height: 1;
    cursor: pointer;
}

.bnb-qty__btn:hover {
    background: rgba(0, 0, 0, .05);
}

.bnb-qty__value {
    min-width: 30px;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
}

/* Keep the page's own footer reachable above the bar. */
.bnb-has-bar body {
    padding-bottom: calc(var(--bnb-bar-height) + env(safe-area-inset-bottom, 0px));
}

/* ── Phones: stacked, thumb-friendly layout ────────────────────────────── */

@media (max-width: 767px) {
    :root {
        --bnb-bar-height: 132px;
    }

    .bnb-bar__inner {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 10px 12px 12px;
    }

    .bnb-bar__title {
        max-width: none;
        font-size: 13px;
    }

    .bnb-bar__info {
        justify-content: space-between;
    }

    .bnb-bar__thumb {
        width: 40px;
        height: 40px;
    }

    .bnb-bar__texts {
        display: flex;
        flex: 1 1 auto;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }

    .bnb-bar__price {
        margin: 0;
        font-size: 15px;
        white-space: nowrap;
    }

    .bnb-bar__actions {
        display: grid;
        grid-template-columns: auto 1fr 1fr;
        align-items: stretch;
        gap: 8px;
    }

    .bnb-bar__actions:has(.bnb-btn--cart:only-of-type) {
        grid-template-columns: auto 1fr;
    }

    .bnb-btn {
        padding: 13px 12px;
        font-size: 14px;
        width: 100%;
    }

    .bnb-qty__btn {
        width: 34px;
        height: 46px;
    }
}

/* Narrow phones: the labels get the room the icons were taking. */
@media (max-width: 430px) {
    .bnb-bar__actions .bnb-btn svg {
        display: none;
    }

    .bnb-bar__actions .bnb-btn {
        padding: 13px 8px;
        font-size: 13px;
    }

    .bnb-qty__btn {
        width: 30px;
    }

    .bnb-qty__value {
        min-width: 24px;
    }
}

.bnb-no-mobile .bnb-bar {
    display: none;
}

@media (min-width: 768px) {
    .bnb-no-mobile .bnb-bar {
        display: block;
    }

    .bnb-no-desktop .bnb-bar {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bnb-bar,
    .bnb-btn {
        transition: none;
    }
}
