/*
 * Cart: products on the left, totals on the right (stacked on narrow screens),
 * matching the checkout. Overrides WooCommerce's floats, borders and colours.
 */

.woocommerce-cart .entry-content .woocommerce {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(20rem, 24rem);
	gap: 1.5rem 2rem;
	align-items: start;
}

.woocommerce-cart .entry-content .woocommerce::before,
.woocommerce-cart .entry-content .woocommerce::after {
	display: none;
}

.woocommerce-cart .woocommerce > :is(.woocommerce-notices-wrapper, .cart-empty, .return-to-shop, .wc-empty-cart-message) {
	grid-column: 1 / -1;
}

.woocommerce-cart .woocommerce-notices-wrapper:empty {
	display: none;
}

/* Products. */
.woocommerce-cart .woocommerce-cart-form {
	padding: 0.5rem 1.5rem;
	background: var(--leguma-surface);
	border: 1px solid var(--leguma-border);
	border-radius: var(--account-radius);
}

.woocommerce-cart table.shop_table.cart {
	margin: 0;
	border: 0;
	border-collapse: collapse;
}

.woocommerce-cart table.shop_table.cart :is(th, td) {
	padding: 1rem 0.5rem;
	background: none;
	border: 0;
	border-top: 1px solid var(--leguma-border);
	vertical-align: middle;
}

.woocommerce-cart table.shop_table.cart thead th {
	padding-block: 0.85rem;
	color: var(--leguma-muted);
	border-top: 0;
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.woocommerce-cart table.shop_table.cart td.product-thumbnail {
	width: 5rem;
}

.woocommerce-cart table.shop_table.cart td.product-thumbnail img {
	display: block;
	width: 4.5rem;
	height: 4.5rem;
	padding: 0.25rem;
	object-fit: contain;
	background: var(--leguma-surface);
	border: 1px solid var(--leguma-border);
	border-radius: 10px;
}

.woocommerce-cart table.shop_table.cart td.product-name a {
	color: var(--leguma-text);
	font-weight: 600;
	line-height: 1.4;
	text-decoration: none;
}

.woocommerce-cart table.shop_table.cart td.product-name a:hover {
	color: var(--leguma-accent);
}

.woocommerce-cart table.shop_table.cart td.product-price {
	color: var(--leguma-muted);
	white-space: nowrap;
}

.woocommerce-cart table.shop_table.cart td.product-subtotal {
	color: var(--leguma-secondary-dark);
	font-weight: 800;
	white-space: nowrap;
}

/* Remove: a round "×" that turns red on hover. */
.woocommerce-cart table.shop_table.cart td.product-remove {
	width: 2.75rem;
}

.woocommerce-cart table.shop_table.cart a.remove {
	display: grid;
	place-items: center;
	width: 2rem;
	height: 2rem;
	color: var(--leguma-muted) !important;
	background: var(--leguma-surface-hover);
	border-radius: 50%;
	font-size: 1.25rem;
	font-weight: 400;
	line-height: 1;
	transition: color var(--leguma-transition), background-color var(--leguma-transition);
}

.woocommerce-cart table.shop_table.cart a.remove:hover {
	color: #fff !important;
	background: #d92d20;
}

/* Quantity. */
.woocommerce-cart table.shop_table.cart .quantity .qty {
	width: 4.5rem;
	height: 2.75rem;
	padding: 0 0.5rem;
	color: var(--leguma-text);
	background: var(--leguma-surface);
	border: 1px solid var(--leguma-border);
	border-radius: 10px;
	font: inherit;
	font-weight: 600;
	text-align: center;
}

.woocommerce-cart table.shop_table.cart .quantity .qty:focus {
	border-color: var(--leguma-secondary);
	outline: none;
	box-shadow: 0 0 0 4px rgb(157 190 0 / 18%);
}

/* Actions row: "Update cart" as a quiet outlined button. */
.woocommerce-cart table.shop_table.cart td.actions {
	padding-block: 1rem;
	text-align: right;
}

.woocommerce-cart table.shop_table.cart td.actions button[name="update_cart"] {
	min-height: 2.75rem;
	padding: 0.5rem 1.25rem;
	color: var(--leguma-text, #222222);
	background: none;
	border: 1px solid var(--account-field-border);
	border-radius: 10px;
	font-size: 0.875rem;
}

.woocommerce-cart table.shop_table.cart td.actions button[name="update_cart"]:not(:disabled):hover {
	color: var(--leguma-text, #222222);
	background: none;
	border-color: var(--leguma-secondary, #9dbe00);
}

.woocommerce-cart table.shop_table.cart td.actions button[name="update_cart"]:disabled {
	opacity: 0.5;
}

/* Totals: the same tinted summary card as the checkout. */
.woocommerce-cart .cart-collaterals {
	width: auto;
}

.woocommerce-cart .cart-collaterals .cart_totals {
	float: none;
	width: auto;
	padding: 1.5rem;
	background: var(--leguma-surface-hover);
	border-radius: var(--account-radius);
}

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

/* The totals table is laid out as rows (label left, amount right) rather than a table,
   so the shipping block can span the full width; labels stay visible on phones too. */
.woocommerce-cart .cart_totals :is(table.shop_table, tbody) {
	display: block;
	width: 100%;
	margin: 0;
	border: 0;
	font-size: 0.9375rem;
}

.woocommerce-cart .cart_totals table.shop_table tr {
	display: flex;
	gap: 1rem;
	justify-content: space-between;
	border-bottom: 1px solid var(--leguma-border);
}

.woocommerce-cart .cart_totals table.shop_table tbody :is(th, td) {
	display: block;
	padding: 0.85rem 0;
	background: none;
	border: 0;
}

.woocommerce-cart .cart_totals table.shop_table th {
	flex-shrink: 0;
	font-weight: 600;
	text-align: left;
	white-space: nowrap;
}

.woocommerce-cart .cart_totals table.shop_table td {
	text-align: right;
}

/* WooCommerce's small-screen "Label:" prefixes; the labels (th) are shown instead. */
.woocommerce-cart .cart_totals table.shop_table td::before {
	display: none;
}

/* Shipping: label on top, option cards full width below. */
.woocommerce-cart .cart_totals table.shop_table tr.shipping {
	display: block;
}

.woocommerce-cart .cart_totals table.shop_table tr.shipping th {
	padding-bottom: 0.5rem;
}

.woocommerce-cart .cart_totals table.shop_table tr.shipping td {
	padding-top: 0;
	text-align: left;
}

.woocommerce-cart .woocommerce-shipping-destination {
	margin: 0.6rem 0 0;
	color: var(--leguma-muted);
	font-size: 0.8125rem;
}

.woocommerce-cart .cart_totals table.shop_table tr.order-total {
	border-bottom: 0;
}

.woocommerce-cart .cart_totals .order-total :is(th, td) {
	padding-top: 1rem;
}

.woocommerce-cart .cart_totals .order-total th {
	font-size: 1.0625rem;
	font-weight: 700;
}

.woocommerce-cart .cart_totals .order-total strong {
	color: var(--leguma-secondary-dark);
	font-size: 1.375rem;
	font-weight: 800;
}

.woocommerce-cart .cart_totals .includes_tax {
	display: block;
	color: var(--leguma-muted);
	font-size: 0.8125rem;
}

.woocommerce-cart .wc-proceed-to-checkout {
	padding: 1.25rem 0 0;
}

.woocommerce-cart .wc-proceed-to-checkout a.checkout-button {
	display: flex;
	width: 100%;
	min-height: 3.5rem;
	margin: 0;
	font-size: 1.0625rem;
}

/* Mobile: the theme's only breakpoint (see style.css Tokens). WooCommerce's own
   responsive table (labels from data-title) takes over the product rows. */
@media (max-width: 64rem) {
	.woocommerce-cart .entry-content .woocommerce {
		grid-template-columns: minmax(0, 1fr);
	}

	.woocommerce-cart .woocommerce-cart-form {
		padding: 0.25rem 1rem;
	}

	/* Each product as a compact card: thumbnail | name + unit price | remove,
	   with quantity and line total underneath. Replaces WooCommerce's labelled rows. */
	.woocommerce-cart table.shop_table.cart :is(thead, tbody) {
		display: block;
	}

	.woocommerce-cart table.shop_table.cart thead {
		display: none;
	}

	.woocommerce-cart table.shop_table.cart tr.cart_item {
		display: grid;
		grid-template-columns: 4.5rem minmax(0, 1fr) auto;
		grid-template-areas:
			"thumb name remove"
			"thumb price price"
			"thumb qty total";
		gap: 0.35rem 1rem;
		align-items: center;
		padding: 1rem 0;
		border-top: 1px solid var(--leguma-border);
	}

	.woocommerce-cart table.shop_table.cart tr.cart_item:first-child {
		border-top: 0;
	}

	.woocommerce-cart table.shop_table.cart tr.cart_item td {
		display: block;
		padding: 0;
		text-align: left !important;
		background: none !important;
		border: 0;
	}

	.woocommerce-cart table.shop_table.cart tr.cart_item td::before {
		display: none;
	}

	.woocommerce-cart table.shop_table.cart td.product-thumbnail {
		display: block !important;
		grid-area: thumb;
		align-self: start;
		width: auto;
	}

	.woocommerce-cart table.shop_table.cart td.product-name {
		grid-area: name;
	}

	.woocommerce-cart table.shop_table.cart td.product-price {
		grid-area: price;
		font-size: 0.875rem;
	}

	.woocommerce-cart table.shop_table.cart td.product-quantity {
		grid-area: qty;
	}

	.woocommerce-cart table.shop_table.cart td.product-subtotal {
		grid-area: total;
		text-align: right !important;
	}

	.woocommerce-cart table.shop_table.cart td.product-remove {
		grid-area: remove;
		align-self: start;
		width: auto;
	}

	.woocommerce-cart table.shop_table.cart tr:not(.cart_item) {
		display: block;
	}

	.woocommerce-cart table.shop_table.cart td.actions {
		display: block;
		text-align: center;
	}
}
