/* =============================
   1. RESET & VARIABLES
   ============================= */
:root {
    --primary: #2c3e50;
    --secondary: #e67e22;
    --bg-light: #f8f9fa;
    --white: #ffffff;
    --text-dark: #333333;
    --text-light: #666666;
    --border: #e1e1e1;
    --shadow: 0 4px 6px rgba(0,0,0,0.1);
    --radius: 8px;
    --sidebar-width: 280px; /* Width of slide-out menu */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: rgb(252, 249, 234);
    color: var(--text-dark);
    line-height: 1.6;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }

/* =============================
   2. NAVIGATION & LAYOUT
   ============================= */
.nav-bar {
    /* 1. Layout Control */
    display: flex;
    justify-content: space-between;
    align-items: center; 
    
    /* 2. Consolidated Styling */
    padding: 1.5rem;
    background-color: rgb(151, 168, 122); /* Overwrites the old var(--white) you had */
    border-bottom: 1px solid var(--border);
    
    /* 3. Positioning */
    position: sticky;
    top: 0;
    z-index: 50;
}

.nav-bar a {
    text-decoration: none;
    background-color: rgb(252, 249, 234);
    color: rgb(151, 168, 122);
    padding: 10px 20px;       
    border-radius: 50px;      
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1); 
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    /* display: inline-block; <-- Removed. The parent's Flexbox now controls the layout context. */
}

/* =============================
   3. CART PAGE LAYOUT
   ============================= */

.cart-wrapper {
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    gap: 2rem;
}

@media (min-width: 992px) {
    .cart-wrapper {
        flex-direction: row;
        align-items: flex-start;
    }
}

.cart-left-column {
    flex: 2; /* Takes up 2/3 of the space */
}

.cart-left-column h2 {
    font-family: 'Times New Roman', serif;
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: var(--primary);
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.btn-clear-cart {
    background-color: #e74c3c;
    color: var(--white);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background-color 0.3s;
}

.btn-clear-cart:hover {
    background-color: #c0392b;
}

.cart-right-column {
    flex: 1; /* Takes up 1/3 of the space */
    position: sticky;
    top: 120px; /* Adjust based on nav bar height */
}

/* =============================
   4. CART ITEMS
   ============================= */

#cart-items-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.cart-item-row {
    display: flex;
    gap: 1.5rem;
    padding: 1.5rem;
    background-color: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    align-items: center;
    position: relative;
}

.item-image img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: var(--radius);
}

.item-details {
    flex-grow: 1;
}

.item-details h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.item-details .customization {
    font-size: 0.9rem;
    color: var(--text-light);
    font-style: italic;
}

.item-details .price {
    font-weight: 700;
    color: var(--secondary);
}


.item-actions {
    text-align: right;
}

.quantity-controls {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.btn-qty {
    background: var(--bg-light);
    border: 1px solid var(--border);
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 1.2rem;
}

.qty-display {
    padding: 0 1rem;
    font-weight: 600;
}

.line-total {
    font-weight: 700;
    font-size: 1.1rem;
}

.btn-remove-item {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: #c0392b;
    cursor: pointer;
    padding: 0 0.5rem;
    transition: color 0.3s;
    line-height: 1;
}

.btn-remove-item:hover {
    color: #e74c3c;
}

/* =============================
   5. ORDER SUMMARY
   ============================= */

.cart-summary {
    background-color: var(--white);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.cart-summary h3 {
    font-family: 'Times New Roman', serif;
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.total-row {
    font-weight: 700;
    font-size: 1.2rem;
    border-top: 2px solid var(--border);
    padding-top: 1rem;
}

.btn-checkout {
    width: 100%;
    padding: 1rem;
    background-color: var(--secondary);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-checkout:hover:not(:disabled) {
    background-color: #d35400; /* Darker orange */
}

.btn-checkout:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

/* =============================
   6. UTILITY/STATES
   ============================= */

.empty-cart, .loading-state, .error-state {
    text-align: center;
    padding: 4rem 2rem;
    font-size: 1.2rem;
    color: var(--text-light);
    background: var(--bg-light);
    border-radius: var(--radius);
}

.free-delivery {
    color: var(--secondary);
    font-weight: bold;
}

#summary-delivery-fee del {
    color: var(--text-light);
    text-decoration: line-through;
}

.free-delivery-message {
    font-size: 0.9rem;
    color: #28a745;
    text-align: center;
    margin-top: -0.5rem;
    margin-bottom: 1rem;
}

.delivery-message {
    font-size: 1rem;
    color: #28a745;
    text-align: center;
    margin-top: -1rem;
    margin-bottom: 1rem;
}
