.buybar { display: none; }

@media (max-width: 767px) {
    .buybar[data-on="1"] {
        visibility: visible;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1000;
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
        max-width: 100vw;
        height: calc(64px + env(safe-area-inset-bottom, 0px));
        margin: 0;
        padding: 0 12px env(safe-area-inset-bottom, 0px) 6px;
        box-sizing: border-box;
        background: rgba(255, 255, 255, .94);
        -webkit-backdrop-filter: saturate(180%) blur(16px);
        backdrop-filter: saturate(180%) blur(16px);
        border-top: 1px solid #e5e5ea;
        transform: none;
    }
    body:has(.buybar[data-on="1"]) { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
    body:has(.buybar[data-on="1"]) #traditional-add-to-cart > div:first-of-type { display: none !important; }
    body:has(.buybar[data-on="1"]) .product-display :is(.quantity-cart-wrapper, .quantity-alert-container, .external-buy-btn, .whatsapp-buy-btn) { display: none !important; }
    body:has(.buybar[data-on="1"]) :is(#scroll-to-top, .fixed.bottom-6) { bottom: calc(80px + env(safe-area-inset-bottom, 0px)) !important; }

    :where(.buybar) button {
        box-sizing: border-box;
        margin: 0;
        font: inherit;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    .buybar__cart {
        flex: 0 0 60px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        height: 48px;
        padding: 0;
        border: 0;
        border-radius: 12px;
        background: transparent;
        color: #6e6e73;
        font-size: 10.5px;
        font-weight: 500;
    }
    .buybar__cart i { font-size: 19px; color: #3a3a3c; }
    .buybar__cart:active { background: #f2f2f7; }

    .buybar__buy {
        flex: 1 1 0;
        min-width: 0;
        max-width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        height: 46px;
        padding: 0 12px;
        border: 1px solid #d1d1d6;
        border-radius: 12px;
        background: #f9f9fb;
        color: #1c1c1e;
        font-size: 15px;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        transition: background .12s ease;
    }
    .buybar__buy i { font-size: 14px; color: #3a3a3c; }
    .buybar__buy:active { background: #ececf0; }
    .buybar :disabled { opacity: .45; cursor: not-allowed; }
}

.buysheet {
    visibility: visible;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 560px;
    max-height: 88dvh;
    margin: auto auto 0;
    padding: 0;
    border: 0;
    border-radius: 22px 22px 0 0;
    background: #fff;
    color: #1c1c1e;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, .16);
    overflow: hidden;
    flex-direction: column;
}
.buysheet[open] { display: flex; animation: buysheet-in .28s cubic-bezier(.2, .8, .2, 1); }
.buysheet::backdrop { background: rgba(0, 0, 0, .4); animation: buysheet-fade .2s ease-out; }

.buysheet__head {
    position: relative;
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 24px 56px 16px 16px;
    border-bottom: .5px solid rgba(0, 0, 0, .1);
}
.buysheet__head::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 50%;
    width: 36px;
    height: 5px;
    margin-left: -18px;
    border-radius: 5px;
    background: rgba(0, 0, 0, .15);
}
.buysheet__thumb {
    flex: none;
    width: 64px;
    height: 64px;
    border-radius: 14px;
    background: #f2f2f7;
    object-fit: cover;
}
.buysheet__thumb[src=""] { visibility: hidden; }
.buysheet__info { min-width: 0; }
.buysheet__name {
    margin: 0;
    font-size: 15px;
    font-weight: 650;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.buysheet__hint {
    margin: 3px 0 0;
    font-size: 13px;
    color: #8e8e93;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.buysheet__hint.is-alert { color: #d70015; font-weight: 600; }
.buysheet__close {
    position: absolute;
    top: 18px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: #f2f2f7;
    color: #636366;
    font-size: 14px;
    cursor: pointer;
}

.buysheet__body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 16px 16px 4px;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.buysheet__body > * { margin-bottom: 16px !important; }
.buysheet__body > :empty { display: none; }
.buysheet__body.is-empty { padding: 0; }
.buysheet__body.is-empty > * { margin: 16px !important; }

.buysheet__qty {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-top: .5px solid rgba(0, 0, 0, .1);
    font-size: 15px;
    font-weight: 600;
}
.buysheet__stepper {
    display: inline-flex;
    align-items: center;
    padding: 2px;
    border-radius: 10px;
    background: #f2f2f7;
}
.buysheet__stepper button {
    width: 36px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #1c1c1e;
    font-size: 18px;
    cursor: pointer;
}
.buysheet__stepper button:active { background: #fff; }
.buysheet__stepper output {
    min-width: 40px;
    text-align: center;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.buysheet__foot { padding: 8px 16px calc(14px + env(safe-area-inset-bottom, 0px)); }
.buysheet__confirm {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    height: 50px;
    border: 1px solid #d1d1d6;
    border-radius: 12px;
    background: #f9f9fb;
    color: #1c1c1e;
    font: inherit;
    font-size: 16px;
    font-weight: 650;
    cursor: pointer;
    transition: transform .12s ease, opacity .12s ease;
}
.buysheet__confirm i { color: #3a3a3c; }
.buysheet__confirm:active { background: #ececf0; }
.buysheet__confirm:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.buysheet__body h3 { font-family: inherit !important; font-size: 15px !important; font-weight: 600 !important; color: #1c1c1e !important; }
.buysheet__body h3 .fa-palette { display: none; }
.buysheet__body .text-luxe-gold { color: #6e6e73 !important; }
.buysheet__body .variation-color-option { border-radius: 10px; box-shadow: none !important; }
.buysheet__body .variation-color-option:not([style*="opacity"]) { border-color: #d1d1d6 !important; }
.buysheet__body .variation-color-option.ring-4 { --tw-ring-color: #1c1c1e !important; box-shadow: 0 0 0 2px #1c1c1e !important; transform: none !important; }
.buysheet__body .checkmark { background: #1c1c1e !important; }
.buysheet__body .variation-select { border-color: #d1d1d6 !important; }

:is(.buybar, .buysheet) button:focus { outline: none; box-shadow: none; }
:is(.buybar, .buysheet) button:focus-visible { outline: 2px solid #8e8e93; outline-offset: 2px; }

@keyframes buysheet-in { from { transform: translateY(100%); } to { transform: none; } }
@keyframes buysheet-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
    .buysheet[open], .buysheet::backdrop { animation: none; }
}
