.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* -- Cart Slider Base -- */
.cart-slider {
    position: fixed;
    top: 0;
    right: 0;
    width: 800px;
    max-width: 90%;
    height: 100vh;
    background-color: #ffffff;
    z-index: 2000;
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    display: flex;
    flex-direction: column;
}

.cart-slider.open {
    transform: translateX(0);
}

/* -- Cart Header -- */
.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    border-bottom: 1px solid #e2e8f0;
}

.cart-title {
    font-family: 'Poppins', sans-serif;
    font-size: 24px;
    font-weight: 600;
    color: #1a202c;
}

.cart-close-btn {
    background: none;
    border: none;
    font-size: 32px;
    color: #4a5568;
    cursor: pointer;
    line-height: 1;
}

/* -- Cart Body Layout -- */
.cart-body {
    display: flex;
    flex-grow: 1;
    overflow: hidden;
    /* Prevent body from scrolling */
}

/* -- Cart Items (Left, Scrollable) -- */
.cart-items-container {
    flex: 3;
    /* Takes more space */
    padding: 24px 32px;
    overflow-y: auto;
    /* This makes only this part scrollable */
    border-right: 1px solid #e2e8f0;
}

/* Enhanced Cart Item Styling */
.cart-item {
    display: flex;
    padding: 24px;
    margin-bottom: 20px;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.cart-item:hover {
    border-color: #cbd5e0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.cart-item-img {
    width: 120px;
    height: 120px;
    background-color: #f8fafc;
    border-radius: 12px;
    margin-right: 20px;
    overflow: hidden;
    position: relative;
    border: 1px solid #e2e8f0;
}

.cart-item-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.cart-item:hover .cart-item-img img {
    transform: scale(1.05);
}

.cart-item-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding-right: 16px;
}

.item-name {
    font-size: 18px;
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.item-meta {
    font-size: 14px;
    color: #718096;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.item-meta::before {
    content: "•";
    color: #cbd5e0;
    font-weight: bold;
}

.item-price {
    font-size: 20px;
    font-weight: 700;
    color: #2d3748;
    margin-top: auto;
}

.cart-item-actions {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-end;
    min-width: 120px;
}

.delete-item-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
}

.delete-item-btn:hover {
    background-color: #fed7d7;
}

.delete-item-btn svg {
    width: 20px;
    height: 20px;
    color: #e53e3e;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.delete-item-btn:hover svg {
    opacity: 1;
}

.quantity-selector {
    display: flex;
    align-items: center;
    background-color: #f7fafc;
    border-radius: 12px;
    padding: 6px;
    border: 1px solid #e2e8f0;
    margin-top: 16px;
}

.quantity-btn {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    color: #4a5568;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.quantity-btn:hover {
    background-color: #f7fafc;
    border-color: #cbd5e0;
    color: #2d3748;
}

.quantity-btn:active {
    transform: scale(0.95);
}

.quantity-num {
    padding: 0 16px;
    font-weight: 600;
    color: #2d3748;
    min-width: 24px;
    text-align: center;
    font-size: 16px;
}

/* Mobile responsiveness improvements */
@media (max-width: 480px) {
    .cart-item {
        padding: 16px;
        align-items: flex-start;
    }

    .cart-item-img {
        width: 80px;
        height: 80px;
        margin-right: 12px;
    }

    .item-name {
        font-size: 16px;
    }

    .item-price {
        font-size: 18px;
    }

    .cart-item-actions {
        min-width: auto;
    }

    .quantity-selector {
        margin-top: 8px;
        padding: 4px;
    }

    .quantity-btn {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }

    .quantity-num {
        padding: 0 12px;
        font-size: 14px;
    }
}

/* -- Order Summary (Right, Fixed) -- */
.order-summary {
    flex: 2;
    /* Takes less space */
    padding: 24px 32px;
    background-color: #f8fafc;
    display: flex;
    flex-direction: column;
}

.summary-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 24px;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    font-size: 16px;
    color: #4a5568;
}

.summary-line span:last-child {
    font-weight: 600;
    color: #1a202c;
}

.discount-amount {
    color: #e53e3e !important;
}

.summary-total {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 2px solid #e2e8f0;
    font-size: 20px;
    font-weight: 700;
}

.checkout-btn {
    background-color: #1a202c;
    color: #ffffff;
    border: none;
    padding: 18px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 30px;
    /* Pushes the button to the bottom */
    transition: background-color 0.2s ease;
}

.checkout-btn:hover {
    background-color: #000000;
}

.checkout-btn .arrow {
    margin-left: 8px;
    transition: transform 0.2s ease;
}

.checkout-btn:hover .arrow {
    transform: translateX(4px);
}

a {
    text-decoration-line: none;
}

.cart-item-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    flex-grow: 1;
    gap: 20px; /* Adjust gap as needed */
}

@media (max-width: 480px) {

    /* Make the slider full-width on mobile */
    .cart-slider {
        max-width: 100%;
        width: 100%;
    }

    /* Change to a single-column layout */
    .cart-body {
        flex-direction: column;
    }

    /* Remove the border between columns */
    .cart-items-container {
        border-right: none;
        padding: 16px;
    }

    /* Adjust cart item for new layout */
    .cart-item {
        position: relative;
        /* Needed for absolute positioning of the delete button */
        align-items: flex-start;
        padding: 16px;
    }

    .cart-item-img {
        width: 80px;
        height: 100px;
    }

    /* Position delete icon in the corner */
    .cart-item-actions {
        /* This container is no longer needed for layout, but we target its children */
        display: contents;
        /* Makes the container "disappear" so its children can be positioned freely */
    }

    .delete-item-btn {
        position: absolute;
        top: 16px;
        right: 16px;
    }

    /* Move quantity selector below the price */
    .quantity-selector {
        margin-top: 12px;
    }

    /* Style the order summary section */
    .order-summary {
        background-color: #ffffff;
        /* Give it a solid background */
        border-top: 1px solid #e2e8f0;
        padding: 24px 16px;
    }

    .checkout-btn {
        margin-top: 24px;
    }

    /* Add styles for the promo code section from the image */
    /* NOTE: You will need to add the HTML for this section back into your order-summary div */
    .promo-code-form {
        display: flex;
        gap: 8px;
        margin-top: 24px;
    }

    .promo-input-wrapper {
        position: relative;
        flex-grow: 1;
    }

    .promo-input-wrapper svg {
        position: absolute;
        left: 12px;
        top: 50%;
        transform: translateY(-50%);
        color: #9ca3af;
        width: 20px;
    }

    .promo-input {
        width: 100%;
        padding: 14px 14px 14px 40px;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        background-color: #f8fafc;
        font-size: 14px;
    }

    .promo-apply-btn {
        background-color: #1a202c;
        color: #ffffff;
        border: none;
        padding: 0 24px;
        border-radius: 12px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
    }
}


@media (max-width: 480px) {

    /* Make the slider full-width on mobile */
    .cart-slider {
        max-width: 100%;
        width: 100%;
    }

    /* Change to a single-column layout */
    .cart-body {
        flex-direction: column;
        overflow-y: auto; /* Make the entire body scrollable */
    }

    /* Remove the border between columns */
    .cart-items-container {
        border-right: none;
        padding: 16px;
        overflow-y: visible; /* Remove individual scroll */
        flex: none; /* Don't grow/shrink */
        min-height: 200px; /* Ensure minimum height for empty cart message */
    }
    
    /* Center the empty cart message */
    .cart-items-container > p {
        padding: 60px 20px !important;
        text-align: center;
        color: #718096;
        font-size: 16px;
    }
}

