/**
 * PRD 12 — carrinho em grade.
 *
 * O ancestral .entry-content é o container. A query só estiliza descendentes.
 * 1100px fica literal: custom property não entra em @container.
 */

body.woocommerce-cart .entry-content {
	container-type: inline-size;
	container-name: claras-cart;
}

body.woocommerce-cart .woocommerce:has(> form.woocommerce-cart-form) {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	row-gap: 28px;
}

body.woocommerce-cart .woocommerce:has(> form.woocommerce-cart-form) > :not(form.woocommerce-cart-form):not(.cart-collaterals) {
	grid-column: 1 / -1;
}

body.woocommerce-cart .woocommerce-notices-wrapper:not(:has(*)) {
	display: none;
}

body.woocommerce-cart .cart-collaterals {
	align-self: start;
	width: 100%;
}

body.woocommerce-cart .cart-collaterals .cart_totals {
	background: var(--claras-cream-pay, #fff6ea);
	padding: 20px;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	float: none;
	width: 100%;
}

body.woocommerce-cart .cart-collaterals .cart_totals h2 {
	font-family: "Libre Baskerville", serif;
	font-size: 22px;
	letter-spacing: 1px;
	text-transform: none;
}

body.woocommerce-cart .cart-collaterals .cart_totals .claras-total-pending {
	display: block;
	font-size: 13px;
	font-weight: 400;
	line-height: 1.35;
	color: var(--claras-ink-soft, #5a5551);
	letter-spacing: 0;
}

body.woocommerce-cart .wc-proceed-to-checkout a.checkout-button {
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: 100%;
	min-height: 52px;
	margin: 0;
	padding: 16px 20px;
	background-color: #222222;
	color: #ffffff;
	border: 0;
	border-radius: 0;
	text-align: center;
}

body.woocommerce-cart .wc-proceed-to-checkout a.checkout-button:hover,
body.woocommerce-cart .wc-proceed-to-checkout a.checkout-button:focus {
	background-color: #000000;
	color: #ffffff;
}

body.woocommerce-cart .claras-cart-returns {
	margin: 14px 0 0;
	text-align: center;
}

body.woocommerce-cart .claras-cart-returns a {
	font: normal 13px Poppins, sans-serif;
	letter-spacing: 0.02em;
	color: #222222;
	text-decoration: underline;
}

body.woocommerce-cart .claras-cart-returns a:hover,
body.woocommerce-cart .claras-cart-returns a:focus {
	color: #000000;
}

body.woocommerce-cart .claras-cart-returns a:focus-visible {
	outline: 2px solid var(--claras-ink, #222222);
	outline-offset: 3px;
	color: #000000;
}

/* Cupom deixa de ficar em 105px e não entra na coluna de totais.
   Campo e “Aplicar cupom” ficam na mesma linha; o campo é que encolhe. */
body.woocommerce-cart table.cart td.actions .coupon {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 8px;
	float: none;
	width: 100%;
	margin: 0 0 12px;
}

body.woocommerce-cart table.cart td.actions .coupon .input-text {
	float: none;
	width: auto;
	flex: 1 1 auto;
	min-width: 0;
	margin: 0;
}

body.woocommerce-cart table.cart td.actions .button {
	float: none;
}

body.woocommerce-cart table.cart td.actions .coupon button[name="apply_coupon"] {
	display: inline-block;
	width: auto;
	max-width: 100%;
	flex: 0 0 auto;
}

/* No bloco estreito, “Atualizar carrinho” ocupa a linha de ações.
   A grade larga devolve a largura do texto, mais abaixo. */
body.woocommerce-cart table.cart td.actions button[name="update_cart"] {
	display: block;
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
}

body.woocommerce-cart table.cart td.actions {
	padding-top: 16px;
}

/* Itens: fundo branco, linha só embaixo, sem card. */
body.woocommerce-cart table.shop_table.cart {
	border: 0;
	border-radius: 0;
	background: transparent;
}

body.woocommerce-cart table.shop_table.cart td,
body.woocommerce-cart table.shop_table.cart th {
	border-color: #e3d9c8;
}

body.woocommerce-cart td.product-name a {
	font-family: Poppins, sans-serif;
	font-size: 15px;
	font-weight: 400;
	letter-spacing: 0;
	text-transform: none;
	color: #222222;
}

body.woocommerce-cart a.remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	min-height: 44px;
}

body.woocommerce-cart .woocommerce-cart-form .quantity .qty {
	min-height: 44px;
	height: 44px !important;
	width: 4.5em;
}

body.woocommerce-cart td.product-thumbnail img {
	width: 56px;
	height: 56px;
	max-width: 56px;
	object-fit: contain;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	background: transparent;
}

/*
 * Abaixo de 1100px a tabela empilha. O smallscreen do WooCommerce para em 768px,
 * então este bloco cobre também 769–1099.
 */
body.woocommerce-cart table.shop_table_responsive thead {
	display: none;
}

body.woocommerce-cart table.shop_table_responsive tr.woocommerce-cart-form__cart-item {
	display: flex;
	flex-wrap: wrap;
	align-items: stretch;
	column-gap: 12px;
	row-gap: 0;
	padding: 0 0 12px;
	margin: 0 0 24px;
	border-bottom: 1px solid #e3d9c8;
}

body.woocommerce-cart table.shop_table_responsive tr.woocommerce-cart-form__cart-item td {
	display: block;
	width: auto;
	padding: 12px 0;
	border: 0;
	background: transparent;
	text-align: left !important;
}

body.woocommerce-cart table.shop_table_responsive tr.woocommerce-cart-form__cart-item td.product-thumbnail {
	order: 1;
	flex: 0 0 56px;
	border-bottom: 1px solid #e3d9c8;
}

body.woocommerce-cart table.shop_table_responsive tr.woocommerce-cart-form__cart-item td.product-name {
	order: 2;
	flex: 1 1 0;
	min-width: 0;
	border-bottom: 1px solid #e3d9c8;
	text-align: left !important;
}

body.woocommerce-cart table.shop_table_responsive tr.woocommerce-cart-form__cart-item td.product-remove {
	order: 3;
	flex: 0 0 auto;
	margin-left: 0;
	border-bottom: 1px solid #e3d9c8;
}

body.woocommerce-cart table.shop_table_responsive tr.woocommerce-cart-form__cart-item td.product-thumbnail::before,
body.woocommerce-cart table.shop_table_responsive tr.woocommerce-cart-form__cart-item td.product-name::before,
body.woocommerce-cart table.shop_table_responsive tr.woocommerce-cart-form__cart-item td.product-remove::before {
	content: none;
	display: none;
}

body.woocommerce-cart table.shop_table_responsive tr.woocommerce-cart-form__cart-item td.product-price,
body.woocommerce-cart table.shop_table_responsive tr.woocommerce-cart-form__cart-item td.product-quantity,
body.woocommerce-cart table.shop_table_responsive tr.woocommerce-cart-form__cart-item td.product-subtotal {
	order: 4;
	flex: 1 1 100%;
	display: block;
	padding: 4px 0 4px 68px;
	border-bottom: 0;
	text-align: right !important;
}

body.woocommerce-cart table.shop_table_responsive tr.woocommerce-cart-form__cart-item td.product-price {
	padding-top: 12px;
}

body.woocommerce-cart table.shop_table_responsive tr.woocommerce-cart-form__cart-item td.product-subtotal {
	padding-bottom: 0;
	font-weight: 600;
}

body.woocommerce-cart table.shop_table_responsive tr.woocommerce-cart-form__cart-item td.product-price::before,
body.woocommerce-cart table.shop_table_responsive tr.woocommerce-cart-form__cart-item td.product-quantity::before,
body.woocommerce-cart table.shop_table_responsive tr.woocommerce-cart-form__cart-item td.product-subtotal::before {
	content: attr(data-title) ": ";
	font-weight: 500;
	color: var(--claras-ink-soft, #5a5551);
	float: left;
}

body.woocommerce-cart table.shop_table_responsive tr.woocommerce-cart-form__cart-item td.product-quantity .quantity {
	float: right;
}

body.woocommerce-cart .cart-collaterals .cart_totals table.shop_table_responsive tr td {
	text-align: right !important;
}

body.woocommerce-cart .cart-collaterals .cart_totals table.shop_table_responsive tr td::before {
	content: attr(data-title) ": ";
	float: left;
	font-weight: 600;
}

body.woocommerce-cart .shipping-calculator-form,
body.woocommerce-cart .shipping-calculator-form input,
body.woocommerce-cart .shipping-calculator-form select {
	text-align: left !important;
}

body.woocommerce-cart table.shop_table_responsive tr:not(.woocommerce-cart-form__cart-item) {
	display: block;
}

body.woocommerce-cart table.shop_table_responsive tr:not(.woocommerce-cart-form__cart-item) td {
	display: block;
	width: 100%;
	border: 0;
}

@container claras-cart (min-width: 1100px) {
	body.woocommerce-cart .woocommerce:has(> form.woocommerce-cart-form) {
		grid-template-columns: minmax(0, 1fr) var(--claras-checkout-rail, 380px);
		column-gap: var(--claras-rail-gap, 48px);
		row-gap: 32px;
	}

	body.woocommerce-cart .woocommerce:has(> form.woocommerce-cart-form) > form.woocommerce-cart-form,
	body.woocommerce-cart .woocommerce:has(> form.woocommerce-cart-form) > .cart-collaterals {
		min-width: 0;
	}

	body.woocommerce-cart td.product-thumbnail img {
		width: 72px;
		height: 72px;
		max-width: 72px;
	}

	body.woocommerce-cart table.shop_table_responsive thead {
		display: table-header-group;
	}

	body.woocommerce-cart table.shop_table_responsive tr.woocommerce-cart-form__cart-item,
	body.woocommerce-cart table.shop_table_responsive tr:not(.woocommerce-cart-form__cart-item) {
		display: table-row;
		padding: 0;
		margin: 0;
		border-bottom: 0;
	}

	body.woocommerce-cart table.shop_table_responsive tr.woocommerce-cart-form__cart-item td,
	body.woocommerce-cart table.shop_table_responsive tr:not(.woocommerce-cart-form__cart-item) td,
	body.woocommerce-cart table.shop_table_responsive thead th {
		display: table-cell;
		width: auto;
		padding: 12px 8px;
		border-bottom: 1px solid #e3d9c8;
		vertical-align: middle;
	}

	body.woocommerce-cart table.shop_table_responsive tr.woocommerce-cart-form__cart-item td.product-thumbnail,
	body.woocommerce-cart table.shop_table_responsive tr.woocommerce-cart-form__cart-item td.product-name,
	body.woocommerce-cart table.shop_table_responsive tr.woocommerce-cart-form__cart-item td.product-remove,
	body.woocommerce-cart table.shop_table_responsive tr.woocommerce-cart-form__cart-item td.product-price,
	body.woocommerce-cart table.shop_table_responsive tr.woocommerce-cart-form__cart-item td.product-quantity,
	body.woocommerce-cart table.shop_table_responsive tr.woocommerce-cart-form__cart-item td.product-subtotal {
		order: 0;
		flex: none;
		margin-left: 0;
	}

	body.woocommerce-cart table.shop_table_responsive tr.woocommerce-cart-form__cart-item td.product-thumbnail {
		width: 88px;
	}

	body.woocommerce-cart table.shop_table_responsive tr.woocommerce-cart-form__cart-item td.product-price,
	body.woocommerce-cart table.shop_table_responsive tr.woocommerce-cart-form__cart-item td.product-quantity,
	body.woocommerce-cart table.shop_table_responsive tr.woocommerce-cart-form__cart-item td.product-subtotal {
		display: table-cell;
		padding: 12px 8px;
		font-weight: inherit;
		text-align: left !important;
	}

	body.woocommerce-cart table.shop_table_responsive tr.woocommerce-cart-form__cart-item td.product-quantity .quantity {
		float: none;
	}

	body.woocommerce-cart table.shop_table_responsive tr.woocommerce-cart-form__cart-item td.product-price::before,
	body.woocommerce-cart table.shop_table_responsive tr.woocommerce-cart-form__cart-item td.product-quantity::before,
	body.woocommerce-cart table.shop_table_responsive tr.woocommerce-cart-form__cart-item td.product-subtotal::before,
	body.woocommerce-cart .cart-collaterals .cart_totals table.shop_table_responsive tr td::before {
		content: none;
		float: none;
	}

	body.woocommerce-cart .cart-collaterals .cart_totals table.shop_table_responsive tr td {
		text-align: left !important;
	}

	body.woocommerce-cart table.cart td.actions button[name="update_cart"] {
		display: inline-block;
		width: auto;
	}
}

/* Véu do WooCommerce ganha uma linha. Some se a resposta voltar antes de 300 ms. */
body.woocommerce-cart .woocommerce-cart-form,
body.woocommerce-cart div.cart_totals {
	position: relative;
}

body.woocommerce-cart .claras-cart-updating {
	position: absolute;
	inset: 0;
	z-index: 10050;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	pointer-events: none;
	font-family: Poppins, sans-serif;
	font-size: 13px;
	font-weight: 400;
	letter-spacing: 0.04em;
	color: var(--claras-ink-soft, #5a5551);
}
