/* ========================================= */
/* --- THE SHOPPING TOTE CSS (FIXED) --- */
/* ========================================= */

/* 1. The Dark Overlay */
.cart-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(13, 38, 31, 0.6); /* Deep Green Tint */
    backdrop-filter: blur(2px);
    z-index: 4000; /* High Layer */
    opacity: 0; visibility: hidden;
    transition: all 0.4s ease;
}

/* JS adds 'active' to overlay */
.cart-overlay.active { opacity: 1; visibility: visible; }

/* 2. The Drawer (Desktop: Right Side) */
.cart-drawer {
    position: fixed;
    top: 0; right: -100%; /* Hidden off-screen right */
    width: 400px;
    height: 100vh;
    background: #fff;
    z-index: 4100; /* HIGHER than overlay */
    box-shadow: -10px 0 30px rgba(0,0,0,0.1);
    transition: right 0.5s cubic-bezier(0.77, 0, 0.175, 1);
    display: flex; flex-direction: column;
}

/* FIX: Changed from .active to .open to match main.js */
.cart-drawer.open { right: 0; }

/* 3. Header */
.cart-header {
    padding: 25px;
    border-bottom: 1px solid #f0f0f0;
    display: flex; justify-content: space-between; align-items: center;
}
.cart-title { font-family: 'Playfair Display', serif; margin: 0; font-size: 1.2rem; color: #0D261F; }
.cart-count { color: #C5A059; font-weight: bold; }
.cart-close { background: none; border: none; cursor: pointer; padding: 5px; color: #333; transition: transform 0.3s; }
.cart-close:hover { transform: rotate(90deg); color: #C5A059; }

/* 4. Cart Items (Scrollable Body) */
.cart-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 25px;
}

/* Single Item Styling */
.cart-item {
    display: flex; gap: 15px;
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 1px solid #f9f9f9;
    position: relative;
}

.item-img {
    width: 80px; height: 80px;
    background: #f4f4f4;
    border-radius: 6px;
    overflow: hidden;
}
.item-img img { width: 100%; height: 100%; object-fit: cover; }

.item-details { flex-grow: 1; }
.item-name { margin: 0 0 5px 0; font-size: 0.95rem; font-weight: 600; color: #333; }
.item-variant { margin: 0 0 10px 0; font-size: 0.8rem; color: #888; }

.item-controls { display: flex; justify-content: space-between; align-items: center; }
.item-price { font-weight: bold; color: #0D261F; }

/* Quantity Buttons */
.qty-box {
    display: flex; align-items: center;
    border: 1px solid #eee; border-radius: 4px;
}
.qty-box button {
    background: none; border: none; padding: 5px 10px; cursor: pointer; color: #555;
}
.qty-box span { font-size: 0.9rem; padding: 0 5px; font-weight: 500; }

.item-remove {
    position: absolute; top: 0; right: 0;
    background: none; border: none; color: #999; font-size: 1.2rem; cursor: pointer;
}
.item-remove:hover { color: #d93025; }

/* 5. Footer */
.cart-footer {
    padding: 25px;
    background: #fafafa;
    border-top: 1px solid #eee;
}
.cart-total { display: flex; justify-content: space-between; font-weight: 700; font-size: 1.1rem; color: #0D261F; margin-bottom: 10px; }
.shipping-note { font-size: 0.75rem; color: #888; margin-bottom: 20px; }
.checkout-btn {
    width: 100%; padding: 15px;
    background: #0D261F; color: #fff;
    border: none; text-transform: uppercase; font-weight: bold; letter-spacing: 1px;
    cursor: pointer; transition: background 0.3s;
    text-decoration: none; display: block; text-align: center;
}
.checkout-btn:hover { background: #C5A059; }

/* --- MOBILE VIEW: BOTTOM SHEET --- */
@media (max-width: 768px) {
    .cart-drawer {
        top: auto; /* Not top */
        bottom: 0; /* Pin to bottom */
        right: 0; left: 0;
        width: 100%;
        height: 85vh; /* Takes up 85% of screen height */
        border-radius: 20px 20px 0 0;
        transform: translateY(100%); /* Start hidden below */
        transition: transform 0.4s ease;
    }
    
    /* FIX: Changed from .active to .open here too */
    .cart-drawer.open {
        right: 0; /* Reset desktop property */
        transform: translateY(0); /* Slide Up */
    }
    
    .cart-header { text-align: center; }
}