/* assets/css/cart-modern.css */

/* General Layout and Container */
.container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 20px;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column; /* Default for mobile */
    gap: 30px; /* Space between cart items and summary */
}

.cart-img{
    margin: 100px auto;
}

@media (min-width: 768px) {
    .container {
        flex-direction: row; /* Desktop layout: cart items next to summary */
        align-items: flex-start; /* Align content to the top */
    }
}

.page-title {
    font-size: 2.2em;
    color: #333;
    text-align: center;
    margin-bottom: 30px;
    font-weight: 700;
    width: 100%; /* Ensure title takes full width */
}

.loading-message {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 20px;
    font-size: 1.1em;
}

/* Cart Items Grid */
.cart-items-grid {
    flex: 2; /* Takes more space on desktop */
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.cart-item {
    display: flex;
    align-items: center;
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    gap: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    flex-wrap: wrap; /* Allow items to wrap on smaller screens */
}

/* Image Wrapper and Placeholder */
.cart-item-image-wrapper {
    width: 100px; /* Fixed size for the image container */
    height: 100px;
    min-width: 100px; /* Prevent shrinking */
    background-color: #eceff1; /* Light grey background for placeholder */
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
    color: #546e7a;
    text-align: center;
    border: 1px dashed #cfd8dc; /* Dashed border for empty/error state */
}

.cart-item-image {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ensures image covers the area, crops if necessary */
    border-radius: 6px; /* Match container border-radius */
    display: block; /* Remove extra space below image */
}

.image-placeholder {
    display: flex; /* Centering for text */
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background-color: #f0f0f0;
    color: #666;
    font-size: 0.9em;
    padding: 5px;
    box-sizing: border-box; /* Include padding in dimensions */
}


/* Item Details */
.item-info {
    flex-grow: 1; /* Allows it to take available space */
    min-width: 180px; /* Ensure it doesn't get too small */
}

.item-name {
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
    margin: 0 0 5px 0;
}

.item-price-unit {
    font-size: 0.9em;
    color: #666;
    margin: 0;
}

/* Quantity Controls */
.item-quantity-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px; /* Space on small screens */
    flex-basis: 100%; /* Take full width on small screens */
    justify-content: flex-start; /* Align left on small screens */
}

@media (min-width: 576px) {
    .item-quantity-controls {
        flex-basis: auto; /* Revert to auto on wider screens */
        margin-top: 0;
    }
}

.quantity-btn {
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    width: 30px;
    height: 30px;
    font-size: 1.2em;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quantity-btn:hover {
    background-color: #0056b3;
}

.quantity-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.quantity-display {
    font-size: 1.1em;
    font-weight: 500;
    color: #333;
    min-width: 25px; /* Ensure space for number */
    text-align: center;
}

/* Item Total Price */
.item-total-price {
    font-size: 1.1em;
    font-weight: 700;
    color: #28a745; /* Success green */
    margin-left: auto; /* Pushes to the right */
    min-width: 80px; /* Ensure space for price */
    text-align: right;
    margin-top: 10px; /* For smaller screens */
    flex-basis: 100%; /* Take full width on small screens */
}

@media (min-width: 576px) {
    .item-total-price {
        margin-top: 0;
        flex-basis: auto;
    }
}


/* Remove Button */
.remove-btn {
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 0.9em;
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-left: 0; /* Align left if it wraps */
    margin-top: 15px; /* Give it space after quantity on smaller screens */
    flex-basis: 100%; /* Full width on smaller screens for better tap target */
}

@media (min-width: 576px) {
    .remove-btn {
        margin-left: 15px; /* Space from price on wider screens */
        margin-top: 0;
        flex-basis: auto;
    }
}

.remove-btn:hover {
    background-color: #c82333;
}

/* Empty Cart Message */
.empty-cart-message {
    text-align: center;
    font-size: 1.2em;
    color: #555;
    padding: 50px;
    border: 1px dashed #ccc;
    border-radius: 8px;
    background-color: #fcfcfc;
}

.empty-cart-message a {
    color: #007bff;
    text-decoration: none;
    font-weight: 600;
}

.empty-cart-message a:hover {
    text-decoration: underline;
}

/* Cart Summary Section */
.cart-summary-section {
    flex: 1; /* Takes less space than cart items on desktop */
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 280px; /* Prevent summary from becoming too narrow */
}

.cart-summary-box {
    background-color: #f1f8e9; /* Light green background */
    border: 1px solid #dcedc8;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.summary-title {
    font-size: 1.5em;
    color: #2e7d32; /* Dark green */
    margin-bottom: 15px;
    font-weight: 600;
    text-align: center;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 1em;
    color: #555;
}

.summary-line span:first-child {
    font-weight: 500;
}

.summary-total {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #c8e6c9; /* Lighter green border */
    font-size: 1.4em;
    font-weight: 700;
    color: #28a745; /* Success green */
}

/* Action Buttons Group */
.cart-actions-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.btn-primary, .btn-secondary {
    display: block;
    width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    font-size: 1.1em;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
    transform: translateY(-2px);
}

/* Notifications Container */
#notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 300px;
}

.notification {
    background-color: #4CAF50; /* Success green */
    color: white;
    padding: 12px 20px;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    opacity: 1;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: translateY(0);
}

.notification.info { background-color: #2196F3; } /* Blue for info */
.notification.warning { background-color: #ff9800; } /* Orange for warning */
.notification.error { background-color: #f44336; } /* Red for error */

.notification.hide {
    opacity: 0;
    transform: translateY(-20px);
}

/* Responsive adjustments for cart item layout */
@media (max-width: 575px) {
    .cart-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .cart-item-image-wrapper {
        width: 80px;
        height: 80px;
        min-width: 80px;
        margin-right: 0;
        margin-bottom: 10px;
    }

    .item-info {
        width: 100%;
        text-align: left;
    }

    .item-quantity-controls {
        width: 100%;
        justify-content: space-between; /* Spread buttons and quantity */
    }

    .item-total-price {
        width: 100%;
        text-align: right;
    }

    .remove-btn {
        width: 100%;
        margin-left: 0;
    }
}