/* Cart page (classic cart, woocommerce/cart/cart.php). */

/* ========================================
   Header and notices
======================================== */

.bc-cart__header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-4) var(--space-6);
	margin-bottom: var(--space-8);
}

.bc-cart__header .page-title {
	margin: 0;
}

.bc-cart__actions {
	display: flex;
	align-items: center;
	gap: var(--space-3);
}

.bc-cart__actions .btn {
	flex: 0 0 auto;
}

.bc-cart__actions--bottom {
	display: none;
}

/* The update itself runs from bc-cart-page.js; the button stays for a page without JS. */
.woocommerce-js .bc-cart__update {
	display: none;
}

/* Success notices ("Cart updated", "… removed") read as a plain line here; errors keep their box. */
.woocommerce-cart .woocommerce-notices-wrapper .woocommerce-message {
	padding: 0;
	border: 0;
	background-color: transparent;
	box-shadow: none;
	grid-template-columns: auto auto auto;
	justify-content: start;
	column-gap: var(--space-2);
}

/* "Undo?" follows the text; the icon keeps its usual 16px from it. */
.woocommerce-cart .woocommerce-notices-wrapper .woocommerce-message::before {
	margin-inline-end: var(--space-2);
}

.woocommerce-cart .woocommerce-notices-wrapper .woocommerce-message .restore-item {
	justify-self: start;
}

/* ========================================
   Items
======================================== */

.bc-cart__table {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0 var(--space-2);
	margin-block: calc(var(--space-2) * -1) 0;
}

.bc-cart__table th {
	padding: 0 var(--space-5);
	color: var(--color-text-muted);
	font-size: var(--text-meta);
	font-weight: var(--font-normal);
	text-align: center;
}

.bc-cart__table th.product-name {
	text-align: left;
}

.bc-cart-item td {
	padding: var(--space-4) var(--space-5);
	background-color: var(--color-surface-raised);
	text-align: center;
	vertical-align: middle;
}

.bc-cart-item td:first-child {
	border-start-start-radius: var(--radius);
	border-end-start-radius: var(--radius);
}

.bc-cart-item td:last-child {
	border-start-end-radius: var(--radius);
	border-end-end-radius: var(--radius);
}

.bc-cart-item .product-price,
.bc-cart-item .product-subtotal {
	white-space: nowrap;
}

.bc-cart-item .product-subtotal {
	font-weight: var(--font-bold);
}

.bc-cart-item__product {
	display: flex;
	align-items: center;
	gap: var(--space-5);
}

.bc-cart-item .product-name {
	text-align: left;
}

.bc-cart-item__thumb {
	flex: 0 0 auto;
	display: block;
	inline-size: 5rem;
}

.bc-cart-item__thumb img {
	display: block;
	inline-size: 100%;
	block-size: auto;
	border-radius: var(--radius-s);
}

.bc-cart-item__info {
	display: grid;
	gap: var(--space-1);
	min-width: 0;
}

.bc-cart-item__name {
	color: var(--color-link);
	font-weight: var(--font-mild);
	line-height: var(--leading-short);
	text-decoration: none;
}

a.bc-cart-item__name:hover {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.bc-cart-item__options {
	color: var(--color-text-muted);
	font-size: var(--text-meta);
}

/* A compact stepper, the mini cart's size rather than the product page's. */
.bc-cart .quantity {
	display: inline-flex;
	align-items: center;
	justify-content: space-between;
	inline-size: 7rem;
	block-size: 2.5rem;
	padding-inline: var(--space-1);
	border: var(--border-width) solid var(--color-border-strong);
	border-radius: var(--radius-s);
	background-color: var(--color-surface-raised);
}

.bc-cart .quantity .qty {
	min-width: 0;
	font-size: var(--text-ui);
}

.bc-cart .qty-btn {
	inline-size: 2rem;
	block-size: 2rem;
}

.bc-cart .qty-btn__svg {
	inline-size: 1.25rem;
	block-size: 1.25rem;
}

.bc-cart-item .product-remove {
	inline-size: 1px;
	padding-inline-start: 0;
}

.bc-cart-item__remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	inline-size: 2.5rem;
	block-size: 2.5rem;
	border-radius: 50%;
	color: var(--color-text);
	transition: background-color var(--duration-fast) var(--ease);
}

.bc-cart-item__remove:hover {
	background-color: var(--color-surface-hover);
}

.bc-cart-item__remove svg {
	inline-size: 1.25rem;
	block-size: 1.25rem;
}

/* ========================================
   Total and free shipping
======================================== */

.bc-cart__totals {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	justify-content: space-between;
	gap: var(--space-4) var(--space-8);
	margin-top: var(--space-2);
	padding: var(--space-4) var(--space-5);
	border-radius: var(--radius);
	background-color: var(--color-surface-raised);
}

.bc-cart__summary {
	display: grid;
	gap: var(--space-2);
	margin-inline-start: auto;
}

/* Coupon: a quiet link that opens the field, so a customer without a code is not sent looking for one. */
.bc-cart-coupon__toggle {
	display: inline-block;
	padding-block: var(--space-2);
	font-size: var(--text-ui);
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
	list-style: none;
}

.bc-cart-coupon__toggle::-webkit-details-marker {
	display: none;
}

.bc-cart-coupon__toggle:hover {
	color: var(--color-action);
}

.bc-cart-coupon__form {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2);
	margin-top: var(--space-2);
}

.bc-cart-coupon__form .bc-field {
	inline-size: 14rem;
	max-inline-size: 100%;
}

.bc-cart-coupon__form .btn {
	flex: 0 0 auto;
}

.bc-cart-coupon .coupon-error-notice {
	flex-basis: 100%;
	margin: 0;
	color: var(--color-danger);
	font-size: var(--text-meta);
}

.bc-cart__row {
	display: flex;
	align-items: baseline;
	justify-content: flex-end;
	gap: var(--space-8);
}

.bc-cart__row > :last-child {
	min-inline-size: 7rem;
	text-align: right;
	white-space: nowrap;
}

.bc-cart__row--total {
	font-size: var(--text-body-l);
}

.bc-cart__row--total strong {
	font-weight: var(--font-bold);
}

.bc-cart__row--discount .woocommerce-remove-coupon {
	margin-inline-start: var(--space-2);
	font-size: var(--text-meta);
}

.bc-cart__note {
	margin: 0;
	color: var(--color-text-muted);
	font-size: var(--text-meta);
	text-align: right;
}

.bc-cart .bc-free-shipping {
	margin-top: var(--space-6);
}

/* ========================================
   Empty cart
======================================== */

.bc-cart-empty {
	display: grid;
	justify-items: start;
	gap: var(--space-6);
}

.bc-cart-empty__text {
	margin: 0;
	font-size: var(--text-body-l);
}

.bc-cart-empty .btn {
	flex: 0 0 auto;
}

.bc-cart-empty__products {
	margin-top: var(--space-16);
}

/* ========================================
   Narrow screens
======================================== */

/* One card per item; the buttons move below the cart. */

@media (max-width: 767px) {
	.bc-cart__header {
		margin-bottom: var(--space-6);
	}

	.bc-cart__actions--top {
		display: none;
	}

	.bc-cart__actions--bottom {
		display: grid;
		justify-items: center;
		gap: var(--space-5);
		margin-top: var(--space-6);
	}

	.bc-cart__actions--bottom .btn {
		inline-size: 100%;
	}

	.bc-cart__table,
	.bc-cart__table tbody {
		display: block;
		margin: 0;
	}

	.bc-cart__table thead {
		display: none;
	}

	.bc-cart-item {
		display: grid;
		grid-template-columns: 1fr auto;
		grid-template-areas:
			"product remove"
			"quantity subtotal";
		margin-bottom: var(--space-2);
		border-radius: var(--radius);
		background-color: var(--color-surface-raised);
	}

	.bc-cart-item td {
		display: flex;
		align-items: center;
		padding: var(--space-4);
		background-color: transparent;
		border-radius: 0;
	}

	.bc-cart-item .product-name {
		grid-area: product;
		gap: var(--space-4);
	}

	.bc-cart-item .product-price {
		display: none;
	}

	.bc-cart-item .product-remove {
		grid-area: remove;
		align-items: flex-start;
		inline-size: auto;
		padding-inline-start: 0;
	}

	.bc-cart-item .product-quantity,
	.bc-cart-item .product-subtotal {
		border-top: var(--border-width) solid var(--color-separator);
	}

	.bc-cart-item .product-quantity {
		grid-area: quantity;
	}

	.bc-cart-item .product-subtotal {
		grid-area: subtotal;
		justify-content: flex-end;
	}

	.bc-cart-item__thumb {
		inline-size: 4.5rem;
	}

	.bc-cart__row {
		justify-content: space-between;
	}

	.bc-cart__row > :last-child {
		min-inline-size: 0;
	}

	.bc-cart__summary {
		inline-size: 100%;
	}

	.bc-cart-coupon {
		order: 2;
		inline-size: 100%;
		padding-top: var(--space-2);
		border-top: var(--border-width) solid var(--color-separator);
	}

	.bc-cart-coupon__form .bc-field {
		flex: 1 1 0;
		inline-size: auto;
		min-inline-size: 0;
	}
}
