/**
 * Cart Drawer - Modern Design v2.2 FINAL
 * Mobile: Fixed 320px width + Sticky footer
 */

/* ═══════════════════════════════════════ */
/* OVERLAY */
/* ═══════════════════════════════════════ */
#cartDrawerOverlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    z-index: 99998;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    cursor: pointer;
}

#cartDrawerOverlay.active {
    opacity: 1;
    visibility: visible;
}

/* ═══════════════════════════════════════ */
/* MAIN DRAWER */
/* ═══════════════════════════════════════ */
#cartDrawer {
    position: fixed;
    top: 0;
    right: -450px;
    width: 100%;
    max-width: 450px;
    height: 100vh;
    background: var(--cd-bg, #ffffff);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.15);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    transition: right 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    font-family: 'Inter', -apple-system, sans-serif;
    overflow: hidden;
}

#cartDrawer.active {
    right: 0;
}

/* Animation variants */
#cartDrawer.animation-slide {
    transition: right 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

#cartDrawer.animation-fade {
    right: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

#cartDrawer.animation-fade.active {
    opacity: 1;
    visibility: visible;
}

#cartDrawer.animation-bounce {
    transition: right 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ═══════════════════════════════════════ */
/* CSS VARIABLES */
/* ═══════════════════════════════════════ */
#cartDrawer {
    --cd-bg: #ffffff;
    --cd-body-bg: #fafafa;
    --cd-title-color: #0a2540;
    --cd-icon-color: #d0011b;
    --cd-close-bg: #f5f5f7;
    --cd-close-color: #666666;
    --cd-item-bg: #ffffff;
    --cd-item-name-color: #0a2540;
    --cd-item-price-color: #d0011b;
    --cd-item-sku-color: #999999;
    --cd-remove-color: #dc3545;
    --cd-subtotal-color: #666666;
    --cd-total-color: #d0011b;
    --cd-viewcart-bg: #f5f5f7;
    --cd-viewcart-color: #0a2540;
    --cd-viewcart-hover-bg: #0a2540;
    --cd-checkout-bg: #d0011b;
    --cd-checkout-color: #ffffff;
    --cd-checkout-hover-bg: #a0011b;
    --cd-border: #e5e7eb;
}

/* ═══════════════════════════════════════ */
/* HEADER */
/* ═══════════════════════════════════════ */
#cartDrawerHeader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 25px;
    background: var(--cd-bg);
    border-bottom: 1px solid var(--cd-border);
    flex-shrink: 0;
}

.cart-drawer-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    font-weight: 700;
    color: var(--cd-title-color);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin: 0;
}

.cart-drawer-title-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(208, 1, 27, 0.1);
    color: var(--cd-icon-color);
    border-radius: 8px;
    position: relative;
}

.cart-drawer-title-icon svg {
    width: 18px;
    height: 18px;
}

.cart-drawer-count-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--cd-remove-color);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(220, 53, 69, 0.3);
    animation: cdBadgePop 0.4s ease;
}

@keyframes cdBadgePop {
    0%   { transform: scale(0); }
    50%  { transform: scale(1.3); }
    100% { transform: scale(1); }
}

#cartDrawerClose {
    background: var(--cd-close-bg);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cd-close-color);
    cursor: pointer;
    transition: all 0.2s;
}

#cartDrawerClose:hover {
    background: var(--cd-remove-color);
    color: #fff;
    transform: rotate(90deg);
}

#cartDrawerClose svg {
    width: 18px;
    height: 18px;
}

/* ═══════════════════════════════════════ */
/* BODY (Scrollable) */
/* ═══════════════════════════════════════ */
#cartDrawerBody {
    flex: 1;
    overflow-y: auto;
    padding: 20px 25px;
    background: var(--cd-body-bg);
    scrollbar-width: thin;
    scrollbar-color: var(--cd-border) transparent;
}

#cartDrawerBody::-webkit-scrollbar {
    width: 6px;
}

#cartDrawerBody::-webkit-scrollbar-track {
    background: transparent;
}

#cartDrawerBody::-webkit-scrollbar-thumb {
    background: var(--cd-border);
    border-radius: 3px;
}

#cartDrawerBody::-webkit-scrollbar-thumb:hover {
    background: #cbd5e1;
}

/* ═══════════════════════════════════════ */
/* LOADING STATE */
/* ═══════════════════════════════════════ */
.cart-drawer-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    color: var(--cd-subtotal-color);
    text-align: center;
    padding: 20px;
}

.cart-drawer-loading::before {
    content: '';
    width: 40px;
    height: 40px;
    border: 3px solid var(--cd-border);
    border-top-color: var(--cd-icon-color);
    border-radius: 50%;
    animation: cdSpin 0.8s linear infinite;
    margin-bottom: 15px;
}

@keyframes cdSpin {
    to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════ */
/* EMPTY STATE */
/* ═══════════════════════════════════════ */
.cart-drawer-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 25px;
    text-align: center;
    animation: cdFadeIn 0.4s ease;
}

@keyframes cdFadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to   { opacity: 1; transform: translateY(0); }
}

.cart-drawer-empty svg {
    width: 80px;
    height: 80px;
    color: #cbd5e1;
    margin-bottom: 20px;
    opacity: 0.8;
}

.cart-drawer-empty h4 {
    font-size: 20px;
    font-weight: 700;
    color: var(--cd-title-color);
    margin: 0 0 10px;
}

.cart-drawer-empty p {
    font-size: 14px;
    color: var(--cd-subtotal-color);
    margin: 0 0 25px;
    line-height: 1.5;
}

.cart-drawer-empty-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 30px;
    background: var(--cd-icon-color);
    color: #fff;
    border-radius: 25px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s;
    box-shadow: 0 5px 15px rgba(208, 1, 27, 0.2);
}

.cart-drawer-empty-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(208, 1, 27, 0.3);
    color: #fff;
    filter: brightness(1.1);
}

/* ═══════════════════════════════════════ */
/* CART ITEMS */
/* ═══════════════════════════════════════ */
.cart-drawer-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    background: var(--cd-item-bg);
    border-radius: 12px;
    margin-bottom: 12px;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
    animation: cdItemIn 0.4s ease;
}

@keyframes cdItemIn {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.cart-drawer-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.cart-drawer-item.removing {
    animation: cdItemOut 0.4s ease forwards;
}

@keyframes cdItemOut {
    to {
        opacity: 0;
        transform: translateX(50px);
        max-height: 0;
        padding: 0 15px;
        margin: 0;
    }
}

/* Item Image */
.cart-drawer-item-image {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    background: #f8fafc;
    border-radius: 10px;
    overflow: hidden;
    padding: 5px;
}

.cart-drawer-item-image a {
    display: block;
    width: 100%;
    height: 100%;
}

.cart-drawer-item-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: transform 0.3s;
}

.cart-drawer-item-image:hover img {
    transform: scale(1.05);
}

/* Item Info */
.cart-drawer-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 25px;
}

.cart-drawer-item-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--cd-item-name-color);
    text-decoration: none;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s;
}

.cart-drawer-item-name:hover {
    color: var(--cd-icon-color);
}

.cart-drawer-item-sku {
    font-size: 11px;
    color: var(--cd-item-sku-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cart-drawer-item-sku strong {
    color: #666;
    font-weight: 600;
}

/* Item Bottom Row */
.cart-drawer-item-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
    gap: 10px;
}

/* Quantity */
.cart-drawer-item-qty {
    display: inline-flex;
    align-items: center;
    background: #f8fafc;
    border: 1px solid var(--cd-border);
    border-radius: 20px;
    overflow: hidden;
    height: 30px;
}

.cart-drawer-item-qty .qty-btn {
    background: transparent;
    border: none;
    width: 28px;
    height: 100%;
    font-size: 16px;
    font-weight: 600;
    color: var(--cd-title-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    user-select: none;
}

.cart-drawer-item-qty .qty-btn:hover {
    background: var(--cd-icon-color);
    color: #fff;
}

.cart-drawer-item-qty .qty-btn:active {
    transform: scale(0.9);
}

.cart-drawer-item-qty .qty-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.cart-drawer-item-qty .qty-input {
    width: 32px;
    height: 100%;
    border: none;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--cd-title-color);
    background: transparent;
    -moz-appearance: textfield;
}

.cart-drawer-item-qty .qty-input:focus {
    outline: none;
}

.cart-drawer-item-qty .qty-input::-webkit-outer-spin-button,
.cart-drawer-item-qty .qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Item Price */
.cart-drawer-item-price {
    font-size: 14px;
    font-weight: 800;
    color: var(--cd-item-price-color);
    text-align: right;
    flex-shrink: 0;
}

.cart-drawer-item-price .woocommerce-Price-currencySymbol {
    font-size: 11px;
    vertical-align: super;
    margin-right: 1px;
}

/* Remove Button */
.cart-drawer-item-remove {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    background: transparent;
    color: #cbd5e1;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    font-weight: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
}

.cart-drawer-item-remove:hover {
    background: var(--cd-remove-color);
    color: #fff;
    transform: rotate(90deg) scale(1.1);
}

/* Item updating state */
.cart-drawer-item.updating {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.cart-drawer-item.updating::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border: 2px solid var(--cd-border);
    border-top-color: var(--cd-icon-color);
    border-radius: 50%;
    animation: cdSpin 0.6s linear infinite;
}

/* ═══════════════════════════════════════ */
/* FOOTER (Fixed at bottom) */
/* ═══════════════════════════════════════ */
#cartDrawerFooter {
    padding: 20px 25px;
    background: var(--cd-bg);
    border-top: 1px solid var(--cd-border);
    flex-shrink: 0;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

#cartDrawerFooter.hidden {
    transform: translateY(100%);
    opacity: 0;
    height: 0;
    padding: 0;
    overflow: hidden;
}

/* Subtotal */
.cart-drawer-subtotal-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 15px;
    margin-bottom: 15px;
    border-bottom: 1px dashed var(--cd-border);
}

.cart-drawer-subtotal-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--cd-subtotal-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#cartDrawerSubtotal {
    font-size: 22px;
    font-weight: 800;
    color: var(--cd-total-color);
    line-height: 1;
}

#cartDrawerSubtotal .woocommerce-Price-currencySymbol {
    font-size: 14px;
    vertical-align: super;
    margin-right: 2px;
}

/* Shipping info */
.cart-drawer-shipping-note {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(208, 1, 27, 0.05);
    border-radius: 8px;
    font-size: 12px;
    color: var(--cd-subtotal-color);
    margin-bottom: 15px;
}

.cart-drawer-shipping-note svg {
    width: 16px;
    height: 16px;
    color: var(--cd-icon-color);
    flex-shrink: 0;
}

.cart-drawer-shipping-note strong {
    color: var(--cd-title-color);
    font-weight: 700;
}

/* Progress Bar (Free Shipping) */
.cart-drawer-progress {
    margin-bottom: 15px;
}

.cart-drawer-progress-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--cd-subtotal-color);
    margin-bottom: 6px;
}

.cart-drawer-progress-info strong {
    color: var(--cd-icon-color);
    font-weight: 700;
}

.cart-drawer-progress-bar {
    height: 6px;
    background: var(--cd-close-bg);
    border-radius: 3px;
    overflow: hidden;
}

.cart-drawer-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--cd-icon-color), #ef4444);
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
}

.cart-drawer-progress-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: cdProgressShine 2s ease-in-out infinite;
}

@keyframes cdProgressShine {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Buttons Group */
.cart-drawer-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cart-drawer-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 50px;
    padding: 0 25px;
    border: none;
    border-radius: 25px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    font-family: inherit;
}

.cart-drawer-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* View Cart Button */
.cart-drawer-btn-viewcart {
    background: var(--cd-viewcart-bg);
    color: var(--cd-viewcart-color);
    border: 2px solid transparent;
}

.cart-drawer-btn-viewcart:hover {
    background: var(--cd-viewcart-hover-bg);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(10, 37, 64, 0.15);
}

/* Checkout Button */
.cart-drawer-btn-checkout {
    background: var(--cd-checkout-bg);
    color: var(--cd-checkout-color);
    box-shadow: 0 5px 15px rgba(208, 1, 27, 0.25);
}

.cart-drawer-btn-checkout::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
    transition: left 0.5s;
}

.cart-drawer-btn-checkout:hover {
    background: var(--cd-checkout-hover-bg);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(208, 1, 27, 0.4);
}

.cart-drawer-btn-checkout:hover::before {
    left: 100%;
}

.cart-drawer-btn-checkout:active {
    transform: translateY(0);
}

/* Continue Shopping Link */
.cart-drawer-continue {
    display: block;
    text-align: center;
    padding: 12px;
    font-size: 12px;
    color: var(--cd-subtotal-color);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.2s;
    margin-top: 5px;
}

.cart-drawer-continue:hover {
    color: var(--cd-icon-color);
    text-decoration: underline;
}

/* Payment Icons */
.cart-drawer-payments {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding-top: 15px;
    margin-top: 15px;
    border-top: 1px dashed var(--cd-border);
}

.cart-drawer-payment-label {
    font-size: 10px;
    color: var(--cd-subtotal-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 4px;
}

.cart-drawer-payment-icon {
    width: 30px;
    height: 20px;
    background: #f5f5f7;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: #666;
}

/* ═══════════════════════════════════════ */
/* TOAST NOTIFICATIONS */
/* ═══════════════════════════════════════ */
.cart-drawer-toast {
    position: fixed;
    top: 30px;
    right: 30px;
    min-width: 280px;
    max-width: 380px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    z-index: 999999;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-left: 4px solid #10b981;
}

.cart-drawer-toast.show {
    transform: translateX(0);
}

.cart-drawer-toast.success { border-left-color: #10b981; }
.cart-drawer-toast.error { border-left-color: #dc2626; }
.cart-drawer-toast.info { border-left-color: #3b82f6; }
.cart-drawer-toast.warning { border-left-color: #f59e0b; }

.cart-drawer-toast-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #d1fae5;
    color: #10b981;
    flex-shrink: 0;
}

.cart-drawer-toast.error .cart-drawer-toast-icon { background: #fee2e2; color: #dc2626; }
.cart-drawer-toast.info .cart-drawer-toast-icon { background: #dbeafe; color: #3b82f6; }
.cart-drawer-toast.warning .cart-drawer-toast-icon { background: #fef3c7; color: #f59e0b; }

.cart-drawer-toast-icon svg {
    width: 20px;
    height: 20px;
}

.cart-drawer-toast-content {
    flex: 1;
    min-width: 0;
}

.cart-drawer-toast-title {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 2px;
    line-height: 1.3;
}

.cart-drawer-toast-message {
    font-size: 12px;
    color: #64748b;
    margin: 0;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cart-drawer-toast-close {
    background: transparent;
    border: none;
    color: #cbd5e1;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    flex-shrink: 0;
}

.cart-drawer-toast-close:hover {
    color: #64748b;
}

.cart-drawer-toast-close svg {
    width: 16px;
    height: 16px;
}

.cart-drawer-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: currentColor;
    opacity: 0.3;
    border-radius: 0 0 12px 12px;
    animation: cdToastProgress 3s linear forwards;
}

@keyframes cdToastProgress {
    from { width: 100%; }
    to   { width: 0%; }
}

.cart-drawer-toast + .cart-drawer-toast {
    margin-top: 10px;
}

/* ═══════════════════════════════════════ */
/* FLYING CART ANIMATION */
/* ═══════════════════════════════════════ */
.cart-drawer-fly {
    position: fixed;
    width: 80px;
    height: 80px;
    background: #fff;
    border: 2px solid var(--cd-icon-color);
    border-radius: 12px;
    padding: 5px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 999998;
    pointer-events: none;
    transition: all 0.8s cubic-bezier(0.55, -0.04, 0.32, 1.79);
}

.cart-drawer-fly img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.cart-drawer-fly.flying {
    width: 20px;
    height: 20px;
    opacity: 0.3;
}

@keyframes cdBump {
    0%, 100% { transform: scale(1); }
    30%      { transform: scale(1.2); }
    60%      { transform: scale(0.95); }
}

.cart-icon-bump {
    animation: cdBump 0.5s ease;
}

/* ═══════════════════════════════════════ */
/* PREVENT BODY SCROLL WHEN OPEN */
/* ═══════════════════════════════════════ */
body.cart-drawer-open {
    overflow: hidden;
}

body.cart-drawer-open .cart-drawer-scroll-lock {
    padding-right: var(--scrollbar-width, 0);
}

/* ═══════════════════════════════════════ */
/* CART BADGE (in header) */
/* ═══════════════════════════════════════ */
.cart-count,
.cart-badge,
.header-cart-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--cd-remove-color, #dc3545);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 10px;
    transition: all 0.3s;
}

.cart-count.updated,
.cart-badge.updated,
.header-cart-count.updated {
    animation: cdBadgePop 0.4s ease;
}

.cart-count.zero,
.cart-badge.zero {
    display: none;
}

/* ═══════════════════════════════════════ */
/* RESPONSIVE - TABLET */
/* ═══════════════════════════════════════ */
@media (max-width: 1024px) {
    #cartDrawer {
        max-width: 420px;
    }
}

/* ═══════════════════════════════════════ */
/* RESPONSIVE - MOBILE (Fixed 320px + Sticky Footer) */
/* ═══════════════════════════════════════ */
@media (max-width: 768px) {
    /* ✅ Drawer container - Fixed 320px */
    #cartDrawer {
        max-width: 320px !important;
        width: 320px !important;
        right: -320px;
        display: flex !important;
        flex-direction: column !important;
        height: 100vh !important;
        max-height: 100vh !important;
    }
    
    /* ✅ Header - fixed at top */
    #cartDrawerHeader {
        padding: 14px 16px;
        flex-shrink: 0 !important;
    }
    
    .cart-drawer-title {
        font-size: 13px;
        gap: 8px;
        letter-spacing: 0.5px;
    }
    
    .cart-drawer-title-icon {
        width: 26px;
        height: 26px;
    }
    
    .cart-drawer-title-icon svg {
        width: 14px;
        height: 14px;
    }
    
    .cart-drawer-count-badge {
        font-size: 9px;
        min-width: 16px;
        height: 16px;
        top: -4px;
        right: -4px;
    }
    
    #cartDrawerClose {
        width: 30px;
        height: 30px;
    }
    
    #cartDrawerClose svg {
        width: 14px;
        height: 14px;
    }
    
    /* ✅ Body - scrollable, takes available space */
    #cartDrawerBody {
        padding: 12px;
        flex: 1 1 auto !important;
        overflow-y: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Cart Items - Compact & Clean */
    .cart-drawer-item {
        padding: 10px;
        gap: 10px;
        margin-bottom: 10px;
        border-radius: 10px;
    }
    
    .cart-drawer-item-image {
        width: 60px;
        height: 60px;
        border-radius: 8px;
        padding: 3px;
    }
    
    .cart-drawer-item-info {
        padding-right: 20px;
        gap: 3px;
    }
    
    .cart-drawer-item-name {
        font-size: 12.5px;
        line-height: 1.35;
        font-weight: 700;
    }
    
    .cart-drawer-item-sku {
        font-size: 9.5px;
        letter-spacing: 0.3px;
    }
    
    .cart-drawer-item-bottom {
        margin-top: 4px;
        gap: 8px;
    }
    
    /* Quantity - smaller */
    .cart-drawer-item-qty {
        height: 26px;
        border-radius: 6px;
    }
    
    .cart-drawer-item-qty .qty-btn {
        width: 22px;
        font-size: 12px;
    }
    
    .cart-drawer-item-qty .qty-input {
        width: 26px;
        font-size: 11px;
    }
    
    /* Price */
    .cart-drawer-item-price {
        font-size: 13px;
        font-weight: 800;
    }
    
    /* Remove button */
    .cart-drawer-item-remove {
        top: 8px;
        right: 8px;
        width: 22px;
        height: 22px;
        font-size: 12px;
    }
    
    /* Empty state */
    .cart-drawer-empty {
        padding: 40px 20px;
    }
    
    .cart-drawer-empty svg {
        width: 60px;
        height: 60px;
    }
    
    .cart-drawer-empty h4 {
        font-size: 17px;
    }
    
    .cart-drawer-empty p {
        font-size: 13px;
    }
    
    /* ✅ FOOTER - STICKY at bottom (ALWAYS VISIBLE) */
    #cartDrawerFooter {
        padding: 14px 16px !important;
        flex-shrink: 0 !important;
        position: sticky !important;
        bottom: 0 !important;
        background: #fff !important;
        z-index: 10 !important;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1) !important;
        border-top: 1px solid var(--cd-border) !important;
    }
    
    .cart-drawer-subtotal-wrapper {
        padding-bottom: 10px !important;
        margin-bottom: 10px !important;
    }
    
    .cart-drawer-subtotal-label {
        font-size: 12px;
    }
    
    #cartDrawerSubtotal {
        font-size: 20px;
    }
    
    .cart-drawer-shipping-note {
        font-size: 11px;
        padding: 8px 10px;
        margin-bottom: 10px !important;
    }
    
    /* ✅ Buttons - ALWAYS VISIBLE */
    .cart-drawer-buttons {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
    }
    
    .cart-drawer-btn {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
        height: 44px !important;
        min-height: 44px !important;
        font-size: 11.5px !important;
        padding: 0 20px !important;
        letter-spacing: 0.8px !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    .cart-drawer-btn svg {
        width: 16px;
        height: 16px;
    }
    
    /* Toast - fullwidth on mobile */
    .cart-drawer-toast {
        top: 15px;
        left: 15px;
        right: 15px;
        min-width: 0;
        max-width: 100%;
        transform: translateY(-120%);
    }
    
    .cart-drawer-toast.show {
        transform: translateY(0);
    }
    
    /* Fly animation - smaller */
    .cart-drawer-fly {
        width: 60px;
        height: 60px;
    }
}

/* ═══════════════════════════════════════ */
/* SMALL MOBILE (< 480px) - Fixed 300px */
/* ═══════════════════════════════════════ */
@media (max-width: 480px) {
    #cartDrawer {
        max-width: 300px !important;
        width: 300px !important;
        right: -300px;
    }
    
    #cartDrawerHeader {
        padding: 12px 14px;
    }
    
    .cart-drawer-title {
        font-size: 12px;
    }
    
    #cartDrawerBody {
        padding: 10px;
    }
    
    .cart-drawer-item {
        padding: 10px;
        gap: 10px;
    }
    
    .cart-drawer-item-image {
        width: 55px;
        height: 55px;
    }
    
    .cart-drawer-item-name {
        font-size: 12px;
    }
    
    /* Keep bottom row inline */
    .cart-drawer-item-bottom {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 6px;
    }
    
    .cart-drawer-item-price {
        text-align: right;
        font-size: 12.5px;
    }
    
    .cart-drawer-item-qty {
        height: 24px;
    }
    
    .cart-drawer-item-qty .qty-btn {
        width: 20px;
        font-size: 11px;
    }
    
    .cart-drawer-item-qty .qty-input {
        width: 24px;
        font-size: 10.5px;
    }
    
    /* ✅ Compact Footer */
    #cartDrawerFooter {
        padding: 12px 14px !important;
    }
    
    .cart-drawer-shipping-note {
        font-size: 10px !important;
        padding: 6px 8px !important;
        margin-bottom: 8px !important;
    }
    
    .cart-drawer-subtotal-wrapper {
        margin-bottom: 8px !important;
        padding-bottom: 8px !important;
    }
    
    #cartDrawerSubtotal {
        font-size: 17px !important;
    }
    
    /* Compact buttons */
    .cart-drawer-buttons {
        gap: 8px !important;
    }
    
    .cart-drawer-btn {
        height: 40px !important;
        min-height: 40px !important;
        font-size: 11px !important;
        padding: 0 16px !important;
        letter-spacing: 0.5px !important;
    }
    
    /* Toast icon smaller */
    .cart-drawer-toast-icon {
        width: 32px;
        height: 32px;
    }
    
    .cart-drawer-toast-title {
        font-size: 12px;
    }
    
    .cart-drawer-toast-message {
        font-size: 11px;
    }
}

/* ═══════════════════════════════════════ */
/* LANDSCAPE MOBILE */
/* ═══════════════════════════════════════ */
@media (max-width: 812px) and (orientation: landscape) {
    #cartDrawerHeader {
        padding: 10px 20px;
    }
    
    #cartDrawerBody {
        padding: 10px 20px;
    }
    
    .cart-drawer-item {
        padding: 10px;
    }
    
    .cart-drawer-item-image {
        width: 55px;
        height: 55px;
    }
    
    #cartDrawerFooter {
        padding: 10px 20px !important;
    }
    
    .cart-drawer-shipping-note {
        display: none;
    }
}

/* ═══════════════════════════════════════ */
/* ADMIN BAR ADJUSTMENT */
/* ═══════════════════════════════════════ */
.admin-bar #cartDrawer {
    top: 32px;
    height: calc(100vh - 32px);
}

@media (max-width: 782px) {
    .admin-bar #cartDrawer {
        top: 46px;
        height: calc(100vh - 46px) !important;
        max-height: calc(100vh - 46px) !important;
    }
}

/* ═══════════════════════════════════════ */
/* ACCESSIBILITY */
/* ═══════════════════════════════════════ */
#cartDrawerClose:focus-visible,
.cart-drawer-btn:focus-visible,
.cart-drawer-item-qty .qty-btn:focus-visible,
.cart-drawer-item-qty .qty-input:focus-visible,
.cart-drawer-item-remove:focus-visible,
.cart-drawer-toast-close:focus-visible {
    outline: 3px solid var(--cd-icon-color);
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    #cartDrawer,
    #cartDrawerOverlay,
    .cart-drawer-item,
    .cart-drawer-toast,
    .cart-drawer-fly {
        transition: none !important;
        animation: none !important;
    }
    
    .cart-drawer-progress-fill::after {
        animation: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    #cartDrawer {
        border-left: 3px solid var(--cd-icon-color);
    }
    
    .cart-drawer-item {
        border: 1px solid var(--cd-border);
    }
    
    .cart-drawer-btn {
        border: 2px solid currentColor;
    }
}

/* ═══════════════════════════════════════ */
/* PRINT (Hide) */
/* ═══════════════════════════════════════ */
@media print {
    #cartDrawer,
    #cartDrawerOverlay,
    .cart-drawer-toast,
    .cart-drawer-fly {
        display: none !important;
    }
}

/* ═══════════════════════════════════════ */
/* SPECIAL STATES */
/* ═══════════════════════════════════════ */

/* Cart drawer while checking out */
#cartDrawer.checking-out {
    pointer-events: none;
    opacity: 0.7;
}

#cartDrawer.checking-out .cart-drawer-btn-checkout::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: cdSpin 0.8s linear infinite;
    margin-left: 8px;
}

/* Highlight new item */
.cart-drawer-item.new-item {
    animation: cdNewItem 1s ease;
}

@keyframes cdNewItem {
    0%   { background: rgba(208, 1, 27, 0.15); transform: scale(1.02); }
    100% { background: var(--cd-item-bg); transform: scale(1); }
}

/* Coupon field */
.cart-drawer-coupon {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.cart-drawer-coupon input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--cd-border);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
}

.cart-drawer-coupon input:focus {
    outline: none;
    border-color: var(--cd-icon-color);
}

.cart-drawer-coupon button {
    padding: 10px 20px;
    background: var(--cd-title-color);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
}

.cart-drawer-coupon button:hover {
    background: var(--cd-icon-color);
    transform: translateY(-1px);
}