/* -------------------- Colors & Variables -------------------- */
:root {
    --cart-primary: #000080;
    /* Navy Blue */
    --cart-bg-light: #f9f9f9;
    --cart-border: #eeeeee;
    --cart-text-main: #000000;
    --cart-text-muted: #666666;
    --cart-white: #ffffff;
}

/* -------------------- Overlay -------------------- */
#cart-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    z-index: 9000;
    pointer-events: none;
    transition: background 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

#cart-drawer-overlay.is-open {
    background: rgba(0, 0, 0, 0.55);
    pointer-events: all;
}

/* -------------------- Drawer Panel -------------------- */
#cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 100vw;
    height: 100dvh;
    background: #fff;
    z-index: 9100;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
    pointer-events: none;
}

@media (min-width: 1024px) {
    #cart-drawer {
        width: 1000px;
        box-shadow: -8px 0 40px rgba(0, 0, 0, 0.12);
    }
}

#cart-drawer-overlay.is-open #cart-drawer {
    transform: translateX(0);
    pointer-events: all;
}

/* -------------------- Unified Container (Layout Logic) -------------------- */
.cart-drawer-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    /* Fallback for very small screens */
}

@media (min-width: 1024px) {
    .cart-drawer-container {
        display: grid;
        grid-template-columns: 320px 1fr;
        grid-template-rows: auto auto 1fr auto;
        overflow: hidden;
        /* Desktop uses internal scrolls */
    }
}

/* -------------------- Header -------------------- */
.cart-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 15px;
    border-bottom: 1px solid #eee;
    background: #fff;
}

@media (min-width: 1024px) {
    .cart-drawer-header {
        grid-column: 2;
        padding: 30px 40px 10px;
        border-bottom: none;
    }
}

.cart-drawer-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

@media (min-width: 1024px) {
    .cart-drawer-title {
        font-size: 38px;
    }
}

.cart-header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.cart-continue-link {
    font-size: 14px;
    font-weight: 500;
    text-decoration: underline;
    cursor: pointer;
}

@media (min-width: 1024px) {
    .cart-continue-link {
        font-size: 16px;
    }
}

.cart-drawer-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (min-width: 1024px) {
    .cart-drawer-close {
        width: 44px;
        height: 44px;
        border: 1px solid #eee;
        border-radius: 4px;
        font-size: 20px;
    }
}

/* -------------------- Banner -------------------- */
.cart-banner {
    padding: 10px 15px;
}

@media (min-width: 1024px) {
    .cart-banner {
        grid-column: 2;
        padding: 0 40px 15px;
    }
}

.cart-banner-inner {
    width: 100%;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    aspect-ratio: 3.2;
    /* Matches both mobile (292/91.25) and desktop (604/188.75) */
}

.cart-banner-inner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease-in-out;
}

.cart-banner-inner:hover img {
    transform: scale(1.05);
    /* Added subtle hover scale as per screenshot classes */
}

/* -------------------- Body & Scrolling -------------------- */
#cart-drawer-body {
    flex: 0 0 auto;
    /* Natural growth on mobile */
    padding: 10px 15px;
}

@media (min-width: 1024px) {
    #cart-drawer-body {
        grid-column: 2;
        flex: 1;
        /* Fills middle on desktop */
        overflow-y: auto;
        padding: 0 40px;
    }
}

.cart-item {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}

@media (min-width: 1024px) {
    .cart-item {
        grid-template-columns: 100px 1fr auto 100px;
        gap: 30px;
        padding: 25px 0;
    }
}

.cart-item-image {
    width: 80px;
    height: 80px;
    background: #f7f7f7;
    border-radius: 4px;
}

@media (min-width: 1024px) {
    .cart-item-image {
        width: 100px;
        height: 100px;
    }
}

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

.cart-item-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cart-item-title {
    font-size: 15px;
    font-weight: 700;
    margin: 0;
}

@media (min-width: 1024px) {
    .cart-item-title {
        font-size: 18px;
    }
}

.cart-item-meta {
    font-size: 13px;
    color: #666;
}

.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 5px;
}

.cart-item-qty {
    display: flex;
    border: 1px solid #ccc;
    height: 28px;
    border-radius: 2px;
}

.qty-ctrl {
    width: 24px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-display {
    width: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    border-left: 1px solid #ccc;
    border-right: 1px solid #ccc;
}

.cart-item-remove {
    font-size: 12px;
    text-decoration: underline;
    color: #666;
    background: none;
    border: none;
    cursor: pointer;
}

.cart-item-price {
    font-size: 15px;
    font-weight: 700;
}

@media (min-width: 1024px) {
    .cart-item-price {
        font-size: 18px;
        text-align: right;
    }
}

/* -------------------- Sidebar (Must Haves) -------------------- */
.cart-sidebar {
    background: #fff;
    padding: 20px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

@media (min-width: 1024px) {
    .cart-sidebar {
        grid-column: 1;
        grid-row: 1 / span 4;
        border-top: none;
        border-bottom: none;
        border-right: 1px solid #eee;
        display: flex;
        flex-direction: column;
        height: 100%;
        overflow-y: auto;
        padding: 0;
    }
}

.cart-sidebar-header {
    padding: 0 15px 15px;
}

@media (min-width: 1024px) {
    .cart-sidebar-header {
        padding: 30px 25px;
    }
}

.cart-sidebar-title {
    font-size: 14px;
    font-weight: 700;
    margin: 0;
}

.cart-sidebar-content {
    display: flex;
    overflow-x: auto;
    gap: 15px;
    padding: 0 15px;
    scrollbar-width: none;
}

.cart-sidebar-content::-webkit-scrollbar {
    display: none;
}

@media (min-width: 1024px) {
    .cart-sidebar-content {
        flex-direction: column;
        overflow-x: visible;
        overflow-y: visible;
        padding: 0 25px 30px;
        gap: 30px;
    }
}

.sidebar-product {
    flex: 0 0 150px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

@media (min-width: 1024px) {
    .sidebar-product {
        flex: none;
    }
}

.sidebar-product-img {
    width: 100%;
    aspect-ratio: 1;
    background: #f7f7f7;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.sidebar-product-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.sidebar-product-info {
    position: relative;
    padding-right: 35px;
}

.sidebar-product-name {
    font-size: 12px;
    font-weight: 700;
    margin: 0 0 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sidebar-product-price {
    font-size: 12px;
    font-weight: 600;
}

.sidebar-qty-select {
    font-size: 11px;
    padding: 2px;
    border: 1px solid #ddd;
    margin-top: 5px;
}

.btn-sidebar-add {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 28px;
    height: 28px;
    background: #fff;
    border: 1px solid #000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 2px;
}

/* -------------------- Footer -------------------- */
#cart-drawer-footer {
    padding: 20px 15px;
    background: #fff;
}

@media (min-width: 1024px) {
    #cart-drawer-footer {
        grid-column: 2;
        padding: 30px 40px 40px;
        border-top: 1px solid #eee;
    }
}

.cart-footer-top {
    margin-bottom: 20px;
}

.cart-total-display {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.cart-total-label {
    font-size: 20px;
    font-weight: 700;
}

.cart-total-value {
    font-size: 24px;
    font-weight: 700;
}

@media (min-width: 1024px) {

    .cart-total-label,
    .cart-total-value {
        font-size: 38px;
    }
}

.btn-cart-checkout {
    display: block;
    width: 100%;
    background: var(--cart-primary);
    color: #fff;
    padding: 16px;
    font-size: 18px;
    font-weight: 700;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-transform: uppercase;
}

.payment-methods {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 15px;
}

@media (min-width: 1024px) {
    .payment-methods {
        justify-content: flex-start;
    }
}

.payment-methods img {
    height: 16px;
    object-fit: contain;
}
/* -------------------- Stock Limit & Toast Feedback -------------------- */
.qty-ctrl.plus.limit-reached {
    cursor: not-allowed !important;
    opacity: 0.3 !important;
    pointer-events: none;
}

#cart-error-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #333;
    color: #fff;
    padding: 12px 24px;
    border-radius: 4px;
    z-index: 10001;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
    transform: translateY(-20px);
    pointer-events: none;
}

#cart-error-toast.show {
    opacity: 1;
    transform: translateY(0);
}
