/* --- Professional Blue/White Theme --- */

/* General Page Layout */
.cart-container {
    display: flex;
    justify-content: center;
    gap: 30px;
    padding: 25px; 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    background-color: #f4f7fa; 
    color: #333; 
    min-height: 85vh;
}

/* Cart Items Section */
.cart-items-list {
    flex: 2;
    background-color: #ffffff; 
    padding: 25px;
    border-radius: 10px; 
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.cart-items-list h2 {
    color: #007bff; 
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.cart-item {
    display: flex;
    align-items: flex-start; /* Align to top for better mobile stacking */
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e9ecef;
    position: relative;
}

.cart-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Product Image */
.cart-item img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 6px;
    margin-right: 20px;
    border: 1px solid #ced4da;
    flex-shrink: 0;
}

/* Product Details */
.item-details {
    flex-grow: 1;
}

/* FIX: Ensure links do not have underlines (for best practice) */
.item-details a {
    text-decoration: none; 
    color: inherit;
}

.item-details h4 {
    margin: 0 0 5px;
    font-size: 1.25rem;
    color: #343a40;
}

/* Price and Subtotal */
.item-price-details {
    margin-top: 10px;
    color: #6c757d; 
    font-size: 1rem;
}

/* Quantity Controls */
.qty-control-wrapper {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 10px 0;
}

.qty-control-wrapper label {
    font-size: 0.95rem;
    color: #6c757d;
}

.qty-btn {
    background-color: #007bff;
    color: #ffffff;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
    border-radius: 4px;
    font-weight: bold;
    transition: background-color 0.2s;
    font-size: 1rem;
    min-width: 30px; 
    height: 22px;
    line-height: 1; 
    text-align: center;
}

.qty-btn:hover {
    background-color: #0056b3;
}

.item-qty-display {
    padding: 0 5px;
    min-width: 25px;
    text-align: center;
    font-weight: bold;
    color: #333;
}


/* Remove Button */
.remove-btn {
    position: absolute;
    top: 30px;
    right: 10px;
    background: #dc3545;
    color: white;
    padding: 10px 12px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background-color 0.3s;
}

.remove-btn:hover {
    background-color: #c82333;
    
}

/* Cart Summary */
.cart-summary {
    flex: 1;
    background-color: #ffffff; 
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.cart-summary h3 {
    margin-top: 0;
    font-size: 1.5rem;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 15px;
    margin-bottom: 20px;
    color: #343a40;
}

.cart-summary p {
    font-size: 1.05rem;
    margin: 10px 0;
    color: #495057;
}

.cart-summary p:last-of-type {
    font-size: 1.25rem;
    font-weight: bold;
    color: #007bff;
    padding-top: 10px;
    border-top: 1px solid #e9ecef;
}

.checkout-btn {
    display: block;
    width: 100%; 
    text-align: center;
    background-color: #28a745;
    color: #ffffff;
    padding: 15px; 
    border-radius: 6px;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: bold;
    transition: background-color 0.3s;
    margin-top: 25px;
    align-self: auto;
}

.checkout-btn:hover {
    background-color: #1e7e34;
    padding: 15px 15px; 
}


/* ========================================= */
/* --- MOBILE FIX: Perfect Stacking (768px and below) --- */
/* ========================================= */
@media (max-width: 768px) {
    .cart-container {
        flex-direction: column;
        padding: 10px; 
        gap: 20px;
    }
    
    .cart-items-list, .cart-summary {
        width: 100%; 
        padding: 15px;
        box-sizing: border-box; 
    }
    
    .cart-item {
        flex-wrap: nowrap; /* Keep Image and Details on one line */
        align-items: flex-start;
        padding-right: 60px; /* Space for absolute remove button */
    }

    .cart-item img {
        width: 70px;
        height: 70px;
        margin-right: 15px;
        flex-shrink: 0;
    }
    
    /* FIX: Make item-details a column container to stack its children */
    .item-details {
        min-width: 0; 
        flex-basis: 100%; 
        display: flex; 
        flex-direction: column;
    }
    
    .item-details h4 {
        /* 1. Product Name */
        order: 1; 
        white-space: nowrap; 
        /* overflow: hidden; */
        text-overflow: ellipsis;
        max-width: 100%;
    }
    
    .qty-control-wrapper {
        /* 2. Quantity Edit Button */
        order: 2; 
        margin-top: 2px;
        margin-bottom: 5px;
    }
    
    .item-price-details {
        /* 3. Price */
        order: 3; 
        margin-top: 0px; 
        margin-bottom: 0px;
        white-space: nowrap; 
        /* overflow: hidden; */
        text-overflow: ellipsis;
        max-width: 100%;
        
    }
    
    /* Remove Button (fixed to top-right) */
    .remove-btn {
        position: absolute;
        top: 90px; 
        right: 12px; 
        padding: 6px 15px;
        font-size: 0.75rem;
    }
    
    .checkout-btn {
        padding: 10px;
        font-size: 1.1rem;
    }
}