* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: url('https://images.unsplash.com/photo-1598633881208-272c17616aeb?q=80&w=2073&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D') center/cover fixed;
    color: #333;
    line-height: 1.6;
    padding: 20px;
}

.cart-container {
    max-width: 900px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.986);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 30px;
}

h1 {
    font-size: 24px;
    margin-bottom: 30px;
    color: black;
    text-align: center;
}

.cart-items {
    margin: 20px 0;
}

.cart-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    border-bottom: 1px solid #eee;
    width: 100%; /* Ensure the item width is 100% */
}

.product-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1; /* Allow the product-info to take up remaining space */
}

.product-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
}

.product-name {
    flex-grow: 1; /* This ensures it takes up as much space as needed */
    white-space: nowrap; /* Prevents the text from wrapping */
    overflow: hidden; /* Hides overflowing text */
    text-overflow: ellipsis; /* Adds "..." for truncated text */
    min-width: 150px; /* Set a minimum width for consistency */
}

.quantity {
    text-align: center;
    min-width: 60px; /* Ensures consistent column width */
    color: #333;
    font-weight: bold;
    padding-right: 40px;
}

.price {
    flex-shrink: 0; /* Prevents the price from shrinking */
    text-align: right; /* Aligns price text to the right */
    min-width: 80px; /* Ensures the price column stays consistent */
    color: #666;
    padding-right: 40px;
}

.delete-btn {
    background-color: #ff4444;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;

}

.delete-btn:hover {
    background-color: #cc0000;
}

.cart-summary {
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 4px;
    margin-top: 20px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.total {
    font-weight: bold;
    border-top: 1px solid #ddd;
    padding-top: 10px;
    margin-top: 10px;
}

.checkout-btn {
    width: 100%;
    background-color: #4CAF50;
    color: white;
    padding: 12px;
    border: none;
    border-radius: 4px;
    margin-top: 15px;
    cursor: pointer;
}

.checkout-btn:hover {
    background-color: #45a049;
}

.continue-shopping {
    display: block;
    text-align: center;
    margin-top: 15px;
    color: #666;
    text-decoration: none;
}

.continue-shopping:hover {
    color: #333;
}

.empty-cart {
    text-align: center;
    padding: 40px 0;
    color: #666;
}

.empty-cart p {
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .cart-item {
        flex-direction: row; /* Ensures items stay on the same line */
        justify-content: space-between; /* Evenly spaces out the elements */
        text-align: left; /* Aligns text to the left */
        flex-wrap: wrap; /* Allows wrapping of items if necessary */
    }

    .product-info {
        flex-grow: 1;
    }

    .quantity, .price {
        text-align: center; /* Keeps quantity and price centered */
        min-width: 60px; /* Ensures consistent column width */
    }

    .delete-btn {
        margin-left: 15px;
    }

    .product-image {
        margin: 0;
    }

    .product-name {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        text-align: left;
        min-width: 150px;
    }

    .quantity, .price {
        min-width: 70px; /* Ensures no column is too narrow */
    }

    /* Ensure all elements are aligned and spaced appropriately */
    .cart-item {
        justify-content: flex-start;
    }

    .delete-btn {
        margin-left: 10px;
        margin-top: 10px; /* Prevent the delete button from overflowing */
    }
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 40px;
}

.quantity-btn {
    width: 24px;
    height: 24px;
    border: 1px solid #ddd;
    background: #f5f5f5;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quantity-btn:hover {
    background: #e0e0e0;
}

.quantity-input {
    width: 50px;
    height: 24px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Prevent spinner buttons in number input */
.quantity-input::-webkit-inner-spin-button,
.quantity-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.quantity-input {
    -moz-appearance: textfield;
}