/* =================================================================== */
/* --- Full Complete Styles for Slide-Out Side Cart                --- */
/* =================================================================== */

.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.4s ease, visibility 0s 0.4s;
}

.cart-overlay.active {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.4s ease;
}

.side-cart {
    position: fixed;
    top: 0;
    right: 0;
    width: 90%;
    max-width: 420px;
    /* Uses dynamic viewport height to fix mobile browser bar issues */
    height: 100vh;
    height: 100dvh; 
    background-color: #fff;
    z-index: 2000;
    box-shadow: -5px 0 25px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    /* Prevents the whole sidebar from scrolling, only the body will scroll */
    overflow: hidden; 
}

@media (max-width: 480px) {
    .side-cart {
        width: 100%;
        max-width: 100%;
    }
}

.side-cart.active {
    transform: translateX(0);
}

.side-cart__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e9ecef;
    /* Ensures header never shrinks */
    flex-shrink: 0; 
}

.side-cart__header h4 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
}

.side-cart__close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6c757d;
    cursor: pointer;
    padding: 0.5rem;
}

.side-cart__body {
    /* Takes up all available middle space */
    flex-grow: 1; 
    overflow-y: auto;
    padding: 1.5rem;
    /* Smooth scrolling on iOS */
    -webkit-overflow-scrolling: touch; 
}

.side-cart__empty {
    text-align: center;
    padding-top: 4rem;
    color: #6c757d;
}

.side-cart__empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Individual Cart Item Styles */
.cart-item {
    display: flex;
    gap: 1rem;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.cart-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.cart-item__image {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    background-color: #f8f9fa; 
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #f0f0f0;
    border-radius: 4px;
}

.cart-item__image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.cart-item__details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.cart-item__title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    color: #212529;
    text-decoration: none;
}

.cart-item__meta {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
}

.cart-item__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.cart-item__price {
    font-weight: 700;
    color: #212529;
}

.cart-item__remove-btn {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0;
}

.side-cart__footer {
    /* Pins footer to bottom and ensures it doesn't shrink */
    flex-shrink: 0; 
    border-top: 1px solid #e9ecef;
    background: #fff;
    /* Fix for iPhone bottom home bar */
    padding-bottom: env(safe-area-inset-bottom, 20px); 
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.side-cart__subtotal {
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    padding: 0 1.5rem;
}

.side-cart__actions .btn {
    display: block;
    width: 100%;
    text-align: center;
    padding: 0.8rem;
    margin-bottom: 0.5rem;
}

/* Custom Scrollbar for the Body area */
.side-cart__body::-webkit-scrollbar {
    width: 4px;
}
.side-cart__body::-webkit-scrollbar-track {
    background: #f1f1f1;
}
.side-cart__body::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}