/* ===== Cart Drawer ===== */
.cart-drawer-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    z-index: 2000;
    opacity: 0;
    transition: opacity .25s ease;
    touch-action: none;
}

.cart-drawer-overlay.is-open {
    opacity: 1;
}

.cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    width: 100%;
    max-width: 420px;
    height: 100%;
    height: 100dvh;
    max-height: 100dvh;
    background: #fff;
    z-index: 2001;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.12);
    transform: translate3d(100%, 0, 0);
    transition: transform .28s ease;
    overflow: hidden;
    padding-right: env(safe-area-inset-right, 0);
}

.cart-drawer.is-open {
    transform: translate3d(0, 0, 0);
}

.cart-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    padding-top: calc(18px + env(safe-area-inset-top, 0));
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.cart-drawer-header h2 {
    font-size: 1.15rem;
    font-weight: 600;
}

.cart-drawer-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f5f5f5;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-drawer-body {
    flex: 1;
    min-width: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 16px 20px;
    -webkit-overflow-scrolling: touch;
}

.cart-drawer-empty {
    text-align: center;
    padding: 48px 16px;
    color: #666;
}

.cart-drawer-empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    color: #cbd5e1;
}

.cart-drawer-empty-icon svg {
    width: 100%;
    height: 100%;
}

.cart-drawer-shop-link {
    display: inline-block;
    margin-top: 12px;
    color: #2563eb;
    font-weight: 500;
}

.cart-drawer-item {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid #f0f0f0;
    min-width: 0;
}

.cart-drawer-item-image {
    width: 72px;
    height: 90px;
    background: #f8f8f8;
    overflow: hidden;
}

.cart-drawer-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-drawer-item-name {
    font-size: .9rem;
    font-weight: 500;
    line-height: 1.35;
    margin-bottom: 4px;
    overflow-wrap: anywhere;
}

.cart-drawer-item-variant {
    font-size: .78rem;
    color: #666;
    margin-bottom: 8px;
}

.cart-drawer-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.cart-drawer-item-price {
    font-size: .88rem;
    font-weight: 600;
}

.cart-drawer-qty {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.cart-drawer-qty button {
    width: 28px;
    height: 28px;
    background: #fafafa;
    font-size: 1rem;
    line-height: 1;
}

.cart-drawer-qty span {
    min-width: 28px;
    text-align: center;
    font-size: .85rem;
}

.cart-drawer-remove {
    font-size: .75rem;
    color: #c8102e;
    text-decoration: underline;
    margin-top: 6px;
}

.cart-drawer-footer {
    padding: 16px 20px calc(24px + env(safe-area-inset-bottom, 0));
    border-top: 1px solid #eee;
    background: #fff;
    flex-shrink: 0;
    min-width: 0;
}

.cart-drawer-applied-coupon.is-hidden,
.cart-drawer-discount.is-hidden,
.cart-drawer-promo-error.is-hidden,
#cartDrawerPromoFormWrap.is-hidden {
    display: none !important;
}

.cart-drawer-promo {
    margin-bottom: 14px;
}

.cart-drawer-promo-label {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    margin-bottom: 8px;
    color: #555;
}

.cart-drawer-promo-form {
    display: flex;
    gap: 0;
    min-width: 0;
}

.cart-drawer-promo-form input {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-right: none;
    font-family: inherit;
    font-size: .88rem;
    text-transform: uppercase;
}

.cart-drawer-promo-form button {
    padding: 10px 14px;
    background: #111;
    color: #fff;
    font-weight: 500;
    font-size: .88rem;
    white-space: nowrap;
    border: none;
    cursor: pointer;
}

.cart-drawer-promo-form button:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.cart-drawer-applied-coupon {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    padding: 10px 12px;
    font-size: .85rem;
}

.cart-drawer-coupon-remove {
    background: none;
    border: none;
    color: #dc2626;
    font-size: .8rem;
    text-decoration: underline;
    cursor: pointer;
    flex-shrink: 0;
}

.cart-drawer-promo-error {
    margin: 8px 0 0;
    font-size: .8rem;
    color: #dc2626;
}

.cart-drawer-subtotal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: .95rem;
}

.cart-drawer-discount {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    font-size: .85rem;
    color: #16a34a;
}

.cart-drawer-subtotal strong {
    font-size: 1.05rem;
}

.cart-drawer-btn {
    display: block;
    width: 100%;
    text-align: center;
    padding: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

.cart-drawer-btn-primary {
    background: #111;
    color: #fff;
}

.cart-drawer-btn-outline {
    border: 1px solid #111;
    color: #111;
}

body.cart-drawer-open {
    overflow: hidden;
    width: 100%;
    touch-action: none;
}

html.cart-drawer-open {
    overflow: hidden;
}

@media (max-width: 480px) {
    .cart-drawer {
        left: 0;
        right: 0;
        max-width: none;
        width: 100%;
    }
}

.cart-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #111;
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: .88rem;
    z-index: 2100;
    opacity: 0;
    transition: opacity .2s ease, transform .2s ease;
    pointer-events: none;
}

.cart-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.add-to-cart-btn.is-loading {
    opacity: .7;
    pointer-events: none;
}
