/* Global Cart Page Styles */
.cart-page-container {
    background-color: #f8f9fa !important;
    min-height: 80vh;
}

.cart-wrapper {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 0 !important;
}

/* =========================================
   2-Column Layout (Desktop)
   ========================================= */
.woocommerce-cart .woocommerce {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    align-items: flex-start;
}

.woocommerce-cart .woocommerce-cart-form {
    flex: 1 1 35%;
    background: #fff;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 5px 20px rgba(0,0,0,0.03);
}

.woocommerce-cart .cart-collaterals {
    flex: 1 1 50%;
    width: 100%;
    position: -webkit-sticky; /* Safari */
    position: sticky;
    top: 2rem;
    align-self: flex-start; /* Ensure it doesn't stretch */
    z-index: 10; /* Ensure it stays on top if needed */
}

/* =========================================
   WooCommerce Table Styles - Minimalist
   ========================================= */
.woocommerce-cart table.shop_table {
    border: none;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 2rem;
    border-radius: 0;
    width: 100%;
}

/* Hide Table Headers for clean look */
.woocommerce-cart table.shop_table thead {
    display: none;
}

/* Row Styling */
.woocommerce-cart table.shop_table tbody tr.cart_item {
    background: #fff;
    border-bottom: 1px solid #eee;
    display: grid;
    /* Grid Layout: 
       Row 1: Image | Name | Remove
       Row 2: Image | Price | Quantity | Subtotal
    */
    grid-template-columns: 90px auto auto 1fr auto; /* Image | Price | Qty | Subtotal | Remove (via span) */
    grid-template-areas:
        "image name name name remove"
        "image price qty subtotal remove"; /* Remove can be in row 1 only, or span? User said Name and Remove vertical align. */
    gap: 1rem 1.5rem; /* Row Gap | Column Gap */
    align-items: center;
    padding: 1.5rem 0;
}

/* Specific Grid Areas mapping */
.woocommerce-cart table.shop_table .product-thumbnail {
    grid-area: image;
    width: 100%;
    align-self: center;
}

.woocommerce-cart table.shop_table .product-name {
    grid-area: name;
    margin-bottom: 0;
    align-self: center; /* Vertical align with Remove */
}

.woocommerce-cart table.shop_table .product-remove {
    grid-area: remove;
    justify-self: end;
    align-self: center; /* Vertical align with Name */
    margin-bottom: auto; /* Push to top if needed, or center */
}

.woocommerce-cart table.shop_table .product-price {
    grid-area: price;
    align-self: center;
    font-size: 0.95rem;
    color: var(--text-light);
    display: inline-block;
}

.woocommerce-cart table.shop_table .product-quantity {
    grid-area: qty;
    align-self: center;
    margin: 0;
    padding: 0 !important;
}

.woocommerce-cart table.shop_table .product-subtotal {
    grid-area: subtotal;
    align-self: center;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-dark);
    text-align: left;
}


/* Typography Adjustments */
.woocommerce-cart table.shop_table .product-name a {
    font-family: var(--font-heading);
    font-weight: 600; /* Less bold */
    color: var(--text-dark);
    text-decoration: none;
    font-size: 0.95rem; /* Smaller as requested */
    display: block;
    line-height: 1.3;
}

.woocommerce-cart table.shop_table .product-price .amount {
    font-weight: 500;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Quantity Input Styling Compact */
.woocommerce-cart .quantity {
    display: inline-flex;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: #fff;
    height: 32px; /* Smaller */
}

.woocommerce-cart .quantity .qty {
    width: 40px; /* Smaller */
    padding: 0;
    font-size: 0.85rem;
    height: 100%;
    border: none;
}

/* Remove Button */
.woocommerce-cart table.shop_table .product-remove a {
    color: #999;
    font-size: 1.2rem;
    width: 24px;
    height: 24px;
    line-height: 24px;
}
.woocommerce-cart table.shop_table .product-remove a:hover {
    color: var(--accent-color);
    background: none;
}

/* =========================================
   Coupon & Actions
   ========================================= */
.woocommerce-cart table.shop_table td.actions {
    grid-column: 1 / -1; /* Span full width */
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding-top: 1rem !important;
    border-top: 1px solid #eee !important;
    margin-top: 1rem;
}

.woocommerce-cart .coupon {
    flex: 1;
    min-width: 200px;
}

.woocommerce-cart .coupon input.input-text {
    width: 100%;
    max-width: 200px;
    padding: 10px 15px;
    font-size: 0.85rem;
}

.woocommerce-cart .coupon button.button {
    padding: 10px 20px;
    font-size: 0.8rem;
}

.woocommerce-cart button[name="update_cart"] {
    padding: 10px 20px;
    font-size: 0.8rem;
}

/* =========================================
   Cart Totals (Right Column)
   ========================================= */
.woocommerce-cart .cart-collaterals .cart_totals {
    float: none;
    width: 100%;
    max-width: 100%;
    margin: 0;
    background: #fff;
    border: none;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 5px 20px rgba(0,0,0,0.03);
    position: sticky;
    top: 90px; /* Sticky sidebar */
}

.woocommerce-cart .cart-collaterals .cart_totals h2 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
}

.woocommerce-cart .cart-collaterals .cart_totals table th,
.woocommerce-cart .cart-collaterals .cart_totals table td {
    padding: 1rem 0;
}

/* =========================================
   Responsive Adjustments
   ========================================= */
@media (max-width: 992px) {
    .woocommerce-cart .woocommerce {
        flex-direction: column;
    }
    
    .woocommerce-cart .woocommerce-cart-form,
    .woocommerce-cart .cart-collaterals {
        flex: 1 1 100%;
        width: 100%;
    }
    
    .woocommerce-cart .cart-collaterals .cart_totals {
        position: static;
    }
}

@media (max-width: 768px) {
    /* Mobile styles override the grid desktop styles */
    .woocommerce-cart table.shop_table tbody tr.cart_item {
        display: block; /* Back to block for mobile */
        position: relative;
        padding: 1rem;
        border: 1px solid #eee;
        border-radius: 8px;
        margin-bottom: 1rem;
    }

    .woocommerce-cart table.shop_table .product-thumbnail {
        width: 60px;
        height: 60px;
        float: left;
        margin-right: 15px;
        margin-bottom: 15px;
    }
    .woocommerce-cart table.shop_table .product-thumbnail img {
        width: 60px;
        height: 60px;
    }

    .woocommerce-cart table.shop_table .product-name,
    .woocommerce-cart table.shop_table .product-price,
    .woocommerce-cart table.shop_table .product-quantity,
    .woocommerce-cart table.shop_table .product-subtotal {
        display: block;
        width: auto;
        padding: 0;
        margin: 0;
    }
    
    .woocommerce-cart table.shop_table .product-name {
        margin-left: 75px;
        margin-bottom: 5px;
    }
    
    .woocommerce-cart table.shop_table .product-price {
        margin-left: 75px;
        display: inline-block;
        margin-right: 10px;
    }
    
    .woocommerce-cart table.shop_table .product-quantity {
        margin-left: 0;
        display: inline-block;
        transform: none;
    }
    
    .woocommerce-cart table.shop_table .product-remove {
        position: absolute;
        top: 10px;
        right: 10px;
    }
    
    .woocommerce-cart table.shop_table .product-subtotal {
        margin-top: 10px;
        text-align: right;
        font-size: 1.1rem;
        border-top: 1px solid #f9f9f9;
        padding-top: 10px;
    }
    
    .woocommerce-cart table.shop_table td.actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .woocommerce-cart .coupon {
        width: 100%;
        margin-bottom: 1rem;
    }
    
    .woocommerce-cart .coupon input.input-text {
        max-width: 100%;
    }
}
