/* Imprima Mobile: página do carrinho (só até 767px). */

@media (max-width: 767px) {

	body.woocommerce-cart.imm-active {
		--imm-text: #333333;
		--imm-muted: #99968F;
		--imm-line: #E7E3DA;
		--imm-accent: #0CB69C;
		--imm-accent-dark: #0C8B78;
		padding-bottom: calc(84px + env(safe-area-inset-bottom));
	}

	/* ---- Itens: de tabela para cards ---- */
	.imm-active .woocommerce-cart-form table.shop_table,
	.imm-active .woocommerce-cart-form table.shop_table tbody { display: block; width: 100%; border: 0; margin: 0; background: transparent; }
	.imm-active .woocommerce-cart-form table.shop_table thead { display: none; }

	.imm-active .woocommerce-cart-form tr.cart_item {
		position: relative;
		display: grid;
		grid-template-columns: 64px auto minmax(0, 1fr) 32px;
		grid-template-areas:
			"thumb name name  remove"
			"thumb qty  total total"
			"thumb qty  unit  unit";
		column-gap: 10px;
		row-gap: 6px;
		align-items: center;
		padding: 16px 0;
		margin: 0;
		border: 0;
		border-bottom: 1px solid var(--imm-line);
		background: transparent;
	}
	.imm-active .woocommerce-cart-form tr.cart_item td {
		display: block;
		padding: 0;
		border: 0;
		background: transparent !important;
		text-align: left !important;
		font-size: 15px;
		min-width: 0 !important; /* o widget do Elementor põe 80px na quantidade e estoura a tela */
		width: auto !important;
	}
	/* O widget Cart do Elementor aplica 30px de respiro lateral e fontes de 18–20px. */
	.imm-active .e-cart__container .e-shop-table { padding: 0 16px !important; }
	.imm-active .e-cart__container .e-cart-totals,
	.imm-active .e-cart__container .coupon.e-cart-section { box-sizing: border-box; max-width: 100%; }
	.imm-active .woocommerce-cart-form tr.cart_item td::before { display: none !important; content: none !important; }

	.imm-active .woocommerce-cart-form td.product-thumbnail { grid-area: thumb; align-self: start; display: block !important; width: 64px; }
	.imm-active .woocommerce-cart-form td.product-thumbnail a { display: block; width: 64px; height: 64px; overflow: hidden; border-radius: 10px; background: #F2EFEA; }
	.imm-active .woocommerce-cart-form td.product-thumbnail img { display: block; width: 100% !important; max-width: none !important; height: 100% !important; object-fit: cover; margin: 0; }

	.imm-active .woocommerce-cart-form td.product-name { grid-area: name; font-size: 15px; line-height: 1.3; }
	/* O YITH insere um <script> antes do link, então não dá para usar :first-child. */
	.imm-active .woocommerce-cart-form td.product-name > a:not(.upload-file) { font-size: 16px !important; font-weight: 700; line-height: 1.3; color: var(--imm-text); text-decoration: none; }
	.imm-active .woocommerce-cart-form td.product-name > br { display: none; }
	.imm-active .woocommerce-cart-form td.product-name dl.variation { margin: 4px 0 0; font-size: 13px; color: var(--imm-muted); }
	.imm-active .woocommerce-cart-form td.product-name dl.variation dt,
	.imm-active .woocommerce-cart-form td.product-name dl.variation dd { display: inline; margin: 0; padding: 0; float: none; }
	.imm-active .woocommerce-cart-form td.product-name dl.variation dd p { display: inline; margin: 0; }

	/* Botão de envio de arte (YITH) com a identidade do site */
	.imm-active .woocommerce-cart-form td.product-name a.upload-file {
		display: inline-flex;
		align-items: center;
		gap: 6px;
		margin-top: 10px;
		padding: 8px 14px;
		border: 1.5px solid var(--imm-accent);
		border-radius: 999px;
		background: transparent;
		color: var(--imm-accent-dark);
		font-size: 14px;
		font-weight: 700;
		line-height: 1.2;
		text-decoration: none;
	}
	.imm-active .woocommerce-cart-form td.product-name a.upload-file::before {
		content: "";
		width: 16px;
		height: 16px;
		background: currentColor;
		-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 15V4M7 9l5-5 5 5M5 20h14'/%3E%3C/svg%3E") center / contain no-repeat;
		mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 15V4M7 9l5-5 5 5M5 20h14'/%3E%3C/svg%3E") center / contain no-repeat;
	}
	.imm-active .woocommerce-cart-form td.product-name a.upload-file:not(.modify) { background: var(--imm-accent); color: #fff; }
	.imm-active .woocommerce-cart-form td.product-name a.upload-file.upload-errors { border-color: #A5483D; background: #FDECEA; color: #A5483D; }

	/* Quantidade (os botões −/+ vêm do snippet "Quantidade"; aqui só o visual em pílula) */
	.imm-active .woocommerce-cart-form td.product-quantity { grid-area: qty; align-self: center; justify-self: start; }
	.imm-active .woocommerce-cart-form td.product-quantity .quantity { height: 36px; border: 1px solid var(--imm-line) !important; border-radius: 999px !important; background: #fff; }
	.imm-active .woocommerce-cart-form td.product-quantity .qty-btn-custom { width: 32px !important; background: transparent !important; color: var(--imm-text) !important; font-size: 18px; }
	.imm-active .woocommerce-cart-form td.product-quantity input.qty { width: 30px !important; min-width: 30px !important; height: 34px; padding: 0; background: transparent; font-size: 15px; font-weight: 700; color: var(--imm-text); }

	/* Preços: total da linha em destaque; unitário só quando a quantidade > 1 */
	.imm-active .woocommerce-cart-form td.product-subtotal { grid-area: total; justify-self: end; text-align: right !important; white-space: nowrap; }
	.imm-active .woocommerce-cart-form td.product-subtotal,
	.imm-active .woocommerce-cart-form td.product-subtotal * { font-size: 16px !important; font-weight: 700 !important; color: var(--imm-text); }
	.imm-active .woocommerce-cart-form td.product-price { grid-area: unit; justify-self: end; text-align: right !important; white-space: nowrap; }
	.imm-active .woocommerce-cart-form td.product-price,
	.imm-active .woocommerce-cart-form td.product-price * { font-size: 12px !important; font-weight: 400 !important; color: var(--imm-muted) !important; }
	.imm-active .woocommerce-cart-form td.product-price::after { content: " / un."; }
	.imm-active .woocommerce-cart-form tr.imm-qty-1 td.product-price { display: none !important; }
	.imm-active .woocommerce-cart-form tr.imm-qty-1 { grid-template-areas: "thumb name name remove" "thumb qty total total"; }

	/* Remover */
	.imm-active .woocommerce-cart-form td.product-remove { grid-area: remove; align-self: start; justify-self: end; width: 32px; margin-top: -6px !important; }
	.imm-active .woocommerce-cart-form td.product-remove a.remove {
		display: block;
		width: 32px;
		height: 32px;
		font-size: 0 !important;
		line-height: 0;
		color: var(--imm-muted) !important;
		background: none !important;
	}
	.imm-active .woocommerce-cart-form td.product-remove a.remove::before {
		content: "";
		display: block;
		width: 20px;
		height: 20px;
		margin: 6px;
		background: currentColor;
		-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h16M10 11v6M14 11v6M6 7l1 13a1.5 1.5 0 0 0 1.5 1.4h7a1.5 1.5 0 0 0 1.5-1.4L18 7M9 7V4.5A1 1 0 0 1 10 3.5h4a1 1 0 0 1 1 1V7'/%3E%3C/svg%3E") center / contain no-repeat;
		mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h16M10 11v6M14 11v6M6 7l1 13a1.5 1.5 0 0 0 1.5 1.4h7a1.5 1.5 0 0 0 1.5-1.4L18 7M9 7V4.5A1 1 0 0 1 10 3.5h4a1 1 0 0 1 1 1V7'/%3E%3C/svg%3E") center / contain no-repeat;
	}

	/* Linha de ações (botão "atualizar" já é automático pelo snippet "Atualizar Valor") */
	.imm-active .woocommerce-cart-form tr:not(.cart_item) { display: block; border: 0; }
	.imm-active .woocommerce-cart-form td.actions { display: block; padding: 0; border: 0; }
	.imm-active .woocommerce-cart-form td.actions button[name="update_cart"] { display: none !important; }

	/* ---- Cupom: recolhido num link ---- */
	.imm-active .imm-coupon-toggle {
		box-sizing: border-box;
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 100%;
		margin: 16px 0 0;
		padding: 12px 0;
		border: 0;
		border-bottom: 1px solid var(--imm-line);
		border-radius: 0;
		background: transparent !important;
		color: var(--imm-text) !important;
		font-family: inherit;
		font-size: 15px;
		font-weight: 600;
		text-transform: none;
		letter-spacing: normal;
		box-shadow: none;
	}
	.imm-active .imm-coupon-toggle span:last-child { color: var(--imm-accent-dark); text-decoration: underline; text-underline-offset: 3px; }
	.imm-active .coupon.imm-coupon-collapsed { display: none !important; }
	.imm-active .coupon.e-cart-section { margin-top: 12px; padding: 0; border: 0; background: transparent; }
	.imm-active .coupon .coupon-col { display: flex !important; gap: 8px; }
	.imm-active .coupon .coupon-col-start { flex: 1 1 auto; }
	.imm-active .coupon .coupon-col-end { flex: 0 0 auto; }
	.imm-active .coupon #coupon_code { height: 44px; font-size: 16px; }
	.imm-active .coupon .e-apply-coupon {
		height: 44px;
		padding: 0 16px !important;
		border: 1px solid var(--imm-line) !important;
		border-radius: 999px !important;
		background: transparent !important;
		color: var(--imm-text) !important;
		font-size: 14px !important;
		font-weight: 700;
		text-transform: none !important;
		white-space: nowrap;
	}

	/* ---- Barra fixa: total + finalizar ---- */
	.imm-cart-bar {
		box-sizing: border-box;
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 9980;
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
		padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
		background: #fff;
		border-top: 1px solid var(--imm-line);
		box-shadow: 0 -6px 16px rgba(0, 0, 0, .06);
		font-family: "Urbanist", sans-serif;
		transition: transform .2s ease;
	}
	.imm-cart-bar.is-hidden { transform: translateY(110%); }
	.imm-cart-bar__total { display: flex; flex-direction: column; line-height: 1.2; color: var(--imm-text); }
	.imm-cart-bar__total small { font-size: 13px; color: var(--imm-muted); }
	.imm-cart-bar__total strong { font-size: 19px; }
	.imm-cart-bar__btn {
		flex: 0 0 auto;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		min-height: 48px;
		padding: 0 22px;
		border-radius: 999px;
		background: var(--imm-accent);
		color: #fff !important;
		font-size: 16px;
		font-weight: 700;
		text-decoration: none !important;
	}
	.imm-cart-bar__btn:active { background: var(--imm-accent-dark); }

	/* O balão do chat sobe para não cobrir a barra */
	body.woocommerce-cart.imm-active #brevo-conversations { bottom: calc(84px + env(safe-area-inset-bottom)) !important; }
}
