/* ==========================================================================
   Empere — Cart page
   Loaded on the cart page only (functions.php -> empere_cart_page_assets).
   Every rule is scoped to body.woocommerce-cart. Markup is WooCommerce's own
   cart templates (cart/cart.php, cart/cart-totals.php, cart/cart-empty.php);
   nothing functional is replaced.

   Why the old layout broke: custom-color.css has a site-wide rule
     .cart { display:flex !important; flex-direction:row !important; flex-wrap:wrap }
   meant for the product page's "quantity + Add to cart" row. The cart table is
   <table class="shop_table ... cart ...">, so it was turned into a flex row too:
   the header row shrank to its text width and the item rows wrapped under it.
   Additional CSS (Customizer) also adds ".cart .quantity{margin-bottom:20px}"
   and ".cart button{width:60%}". These are overridden here for the cart page
   only, so the product page keeps them.

   Colours follow the site: accent #D79E0B (Search / checkout buttons),
   dark buttons #333e48, links #1B75BC, pill-shaped buttons.
   ========================================================================== */

body.woocommerce-cart {
	--ec-accent: #D79E0B;
	--ec-accent-dark: #b9870a;
	--ec-dark: #333e48;
	--ec-blue: #1B75BC;
	--ec-ink: #111827;
	--ec-text: #374151;
	--ec-muted: #6b7280;
	--ec-line: #e5e7eb;
	--ec-soft: #f8fafc;
	--ec-radius: 12px;
}

/* ---------- Page layout: items (left) | totals (right) ---------- */
@media (min-width: 992px) {
	body.woocommerce-cart .woocommerce {
		display: grid;
		grid-template-columns: minmax(0, 1fr) 350px;
		column-gap: 28px;
		align-items: start;
	}
	body.woocommerce-cart .woocommerce > * { grid-column: 1 / -1; order: 0; }
	body.woocommerce-cart .woocommerce > .woocommerce-cart-form { grid-column: 1; order: 1; }
	/* totals sit beside the items; cross-sells (if any) go full width below */
	body.woocommerce-cart .woocommerce > .cart-collaterals { display: contents; }
	body.woocommerce-cart .cart-collaterals > .cart_totals { grid-column: 2; order: 2; }
	body.woocommerce-cart .cart-collaterals > .cross-sells { grid-column: 1 / -1; order: 3; }
}

/* ---------- Cart items table ---------- */
body.woocommerce-cart table.shop_table.cart {
	display: table !important;            /* undo the global .cart flex rule */
	width: 100% !important;
	margin: 0 0 14px !important;
	border: 1px solid var(--ec-line) !important;
	border-collapse: separate !important;
	border-spacing: 0 !important;
	border-radius: var(--ec-radius);
	background: #fff;
	overflow: hidden;
	box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
}
body.woocommerce-cart table.shop_table.cart thead th {
	padding: 13px 16px !important;
	border: 0 !important;
	border-bottom: 1px solid var(--ec-line) !important;
	background: var(--ec-soft);
	font-size: 12px !important;
	font-weight: 700 !important;
	line-height: 1.4 !important;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	text-align: left;
	color: var(--ec-muted) !important;
	white-space: nowrap;
}
body.woocommerce-cart table.shop_table.cart td {
	padding: 18px 16px !important;
	border: 0 !important;
	border-top: 1px solid var(--ec-line) !important;
	vertical-align: middle !important;
	font-size: 15px !important;
	line-height: 1.45 !important;
	color: var(--ec-text);
	background: transparent;
}
body.woocommerce-cart table.shop_table.cart tbody tr:first-child td { border-top: 0 !important; }

/* column widths */
body.woocommerce-cart table.shop_table.cart .product-remove { width: 52px; padding-right: 0 !important; text-align: center; }
body.woocommerce-cart table.shop_table.cart .product-thumbnail { width: 104px; }
body.woocommerce-cart table.shop_table.cart .product-price { width: 110px; white-space: nowrap; }
body.woocommerce-cart table.shop_table.cart .product-quantity { width: 110px; }
body.woocommerce-cart table.shop_table.cart .product-subtotal { width: 130px; text-align: right; white-space: nowrap; }
body.woocommerce-cart table.shop_table.cart thead .product-subtotal { text-align: right; }

/* remove (x) */
body.woocommerce-cart table.shop_table.cart td.product-remove a.remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	font-size: 20px !important;
	line-height: 1 !important;
	color: #9ca3af !important;
	background: #f3f4f6;
	text-decoration: none;
	transition: background 0.15s, color 0.15s;
}
body.woocommerce-cart table.shop_table.cart td.product-remove a.remove:hover,
body.woocommerce-cart table.shop_table.cart td.product-remove a.remove:focus {
	color: #dc2626 !important;
	background: #fee2e2;
}

/* thumbnail */
body.woocommerce-cart table.shop_table.cart td.product-thumbnail a { display: block; }
body.woocommerce-cart table.shop_table.cart td.product-thumbnail img {
	display: block;
	width: 76px !important;
	height: 76px !important;
	max-width: none;
	padding: 4px;
	object-fit: contain;
	border: 1px solid var(--ec-line);
	border-radius: 10px;
	background: #fff;
}

/* name */
body.woocommerce-cart table.shop_table.cart td.product-name,
body.woocommerce-cart table.shop_table.cart td.product-name a {
	font-size: 15px !important;
	font-weight: 600;
	line-height: 1.45 !important;
	color: var(--ec-ink) !important;
	text-decoration: none;
}
body.woocommerce-cart table.shop_table.cart td.product-name a:hover,
body.woocommerce-cart table.shop_table.cart td.product-name a:focus { color: var(--ec-blue) !important; }
body.woocommerce-cart table.shop_table.cart td.product-name dl.variation,
body.woocommerce-cart table.shop_table.cart td.product-name .backorder_notification {
	margin: 4px 0 0;
	font-size: 13px;
	font-weight: 400;
	color: var(--ec-muted);
}

/* prices */
body.woocommerce-cart table.shop_table.cart td.product-price { color: var(--ec-text); }
body.woocommerce-cart table.shop_table.cart td.product-subtotal { font-weight: 700; color: var(--ec-ink); }
body.woocommerce-cart table.shop_table.cart td.product-subtotal .tax_label,
body.woocommerce-cart table.shop_table.cart td.product-price .tax_label {
	display: block;
	margin-top: 2px;
	font-size: 12px;
	font-weight: 400;
	color: var(--ec-muted);
}

/* quantity (undo ".cart .quantity{margin-bottom:20px}" from Additional CSS) */
body.woocommerce-cart table.shop_table.cart .quantity {
	display: inline-flex !important;
	align-items: center;
	margin: 0 !important;
	float: none !important;
}
body.woocommerce-cart table.shop_table.cart .quantity input.qty {
	width: 76px !important;
	height: 42px !important;
	margin: 0 !important;
	padding: 0 6px 0 14px !important;
	border: 1px solid #d1d5db !important;
	border-radius: 10px !important;
	background: #fff !important;
	font-size: 15px !important;
	font-weight: 600;
	text-align: center;
	color: var(--ec-ink) !important;
	box-shadow: none !important;
}
body.woocommerce-cart table.shop_table.cart .quantity input.qty:focus {
	border-color: var(--ec-blue) !important;
	outline: 2px solid rgba(27, 117, 188, 0.18);
}

/* ---------- Actions row: coupon | update cart ---------- */
body.woocommerce-cart table.shop_table.cart td.actions {
	padding: 16px !important;
	border-top: 1px solid var(--ec-line) !important;
	background: var(--ec-soft) !important;
	text-align: right;
}
body.woocommerce-cart table.shop_table.cart td.actions::after { content: ""; display: table; clear: both; }
body.woocommerce-cart table.shop_table.cart td.actions .coupon {
	display: flex !important;
	flex-direction: row !important;   /* theme stacks it below 576px */
	flex-wrap: nowrap !important;
	float: left;
	align-items: stretch;
	width: auto !important;
	max-width: 420px;
	margin: 0 !important;
	position: static;
}
body.woocommerce-cart table.shop_table.cart td.actions .coupon .input-text {
	width: 220px !important;
	height: 44px !important;
	margin: 0 !important;
	padding: 0 18px !important;
	border: 1px solid #d1d5db !important;
	border-right: 0 !important;
	border-radius: 22px 0 0 22px !important;
	background: #fff !important;
	font-size: 14px !important;
	box-shadow: none !important;
}
body.woocommerce-cart table.shop_table.cart td.actions .coupon .button,
body.woocommerce-cart table.shop_table.cart td.actions button[name="update_cart"] {
	width: auto !important;
	height: 44px;
	margin: 0 !important;
	padding: 0 24px !important;
	border: 0 !important;
	background: var(--ec-dark) !important;
	color: #fff !important;
	font-size: 14px !important;
	font-weight: 700 !important;
	line-height: 44px !important;
	white-space: nowrap;
	box-shadow: none !important;
}
body.woocommerce-cart table.shop_table.cart td.actions .coupon .button { border-radius: 0 22px 22px 0 !important; }
body.woocommerce-cart table.shop_table.cart td.actions button[name="update_cart"] {
	display: inline-block !important;
	border-radius: 22px !important;
}
body.woocommerce-cart table.shop_table.cart td.actions .coupon .button:hover,
body.woocommerce-cart table.shop_table.cart td.actions button[name="update_cart"]:not(:disabled):hover { background: #1f2933 !important; }
body.woocommerce-cart table.shop_table.cart td.actions button[name="update_cart"]:disabled { cursor: not-allowed; opacity: 0.55 !important; }
/* the checkout button is shown once, in the Cart totals box */
body.woocommerce-cart table.shop_table.cart td.actions .wc-proceed-to-checkout { display: none !important; }

/* Continue shopping (functions.php -> empere_cart_continue_shopping) */
body.woocommerce-cart .empere-cart-continue { margin: 0 0 24px; }
body.woocommerce-cart .empere-cart-continue a {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	font-weight: 600;
	color: var(--ec-blue);
	text-decoration: none;
}
body.woocommerce-cart .empere-cart-continue a::before { content: "\2190"; font-size: 16px; line-height: 1; }
body.woocommerce-cart .empere-cart-continue a:hover { color: #12558A; text-decoration: underline; }

/* ---------- Cart totals ---------- */
body.woocommerce-cart .cart-collaterals { margin: 0 !important; }
body.woocommerce-cart .cart-collaterals .cart_totals {
	width: auto !important;
	max-width: none !important;
	margin: 0 0 24px !important;
	padding: 22px 22px 24px !important;
	float: none !important;
	border: 1px solid var(--ec-line);
	border-radius: var(--ec-radius);
	background: #fff;
	box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
}
body.woocommerce-cart .cart-collaterals .cart_totals > h2 {
	margin: 0 0 6px !important;
	padding: 0 0 14px !important;
	border-bottom: 1px solid var(--ec-line);
	font-size: 20px !important;
	font-weight: 700 !important;
	line-height: 1.3 !important;
	color: var(--ec-ink) !important;
}
body.woocommerce-cart .cart-collaterals .cart_totals > h2::after { display: none !important; }
body.woocommerce-cart .cart_totals table.shop_table {
	display: table !important;
	width: 100% !important;
	margin: 0 0 18px !important;
	border: 0 !important;
	border-collapse: collapse !important;
}
body.woocommerce-cart .cart_totals table.shop_table tbody { display: table-row-group !important; }
body.woocommerce-cart .cart_totals table.shop_table tr { display: table-row !important; border: 0 !important; }
body.woocommerce-cart .cart_totals table.shop_table th,
body.woocommerce-cart .cart_totals table.shop_table td { display: table-cell !important; } /* keep label | value on phones too */
body.woocommerce-cart .cart_totals table.shop_table th,
body.woocommerce-cart .cart_totals table.shop_table td {
	padding: 13px 0 !important;
	border: 0 !important;
	border-bottom: 1px solid #eef0f3 !important;
	vertical-align: top !important;
	font-size: 14.5px !important;
	line-height: 1.5 !important;
	background: transparent !important;
}
body.woocommerce-cart .cart_totals table.shop_table th {
	width: 40%;
	padding-right: 12px !important;
	font-weight: 500 !important;
	color: var(--ec-muted) !important;
	text-align: left !important;
}
body.woocommerce-cart .cart_totals table.shop_table td {
	text-align: right !important;
	font-weight: 600;
	color: var(--ec-ink) !important;
}
body.woocommerce-cart .cart_totals table.shop_table td::before { display: none !important; } /* responsive-table labels: the th already says it */
body.woocommerce-cart .cart_totals .tax_label,
body.woocommerce-cart .cart_totals .includes_tax {
	display: block;
	margin-top: 2px;
	font-size: 12px !important;
	font-weight: 400 !important;
	color: var(--ec-muted) !important;
}
/* shipping */
body.woocommerce-cart .cart_totals ul#shipping_method { margin: 0 !important; padding: 0 !important; list-style: none !important; }
body.woocommerce-cart .cart_totals ul#shipping_method li { margin: 0 0 4px !important; padding: 0 !important; text-indent: 0 !important; font-weight: 600; }
body.woocommerce-cart .cart_totals ul#shipping_method li input { margin: 0 6px 0 0; vertical-align: middle; }
/* theme pins the shipping price with position:absolute -> overlaps the label here */
body.woocommerce-cart .cart_totals ul#shipping_method li label { margin: 0 !important; font-weight: 600 !important; }
body.woocommerce-cart .cart_totals ul#shipping_method li label > span { position: static !important; }
body.woocommerce-cart .cart_totals .woocommerce-shipping-destination {
	margin: 6px 0 4px !important;
	font-size: 12.5px !important;
	font-weight: 400;
	line-height: 1.5;
	color: var(--ec-muted);
}
body.woocommerce-cart .cart_totals .woocommerce-shipping-destination strong { color: var(--ec-text); font-weight: 600; }
body.woocommerce-cart .cart_totals .shipping-calculator-button {
	font-size: 13px !important;
	font-weight: 600;
	color: var(--ec-blue) !important;
	text-decoration: none;
}
body.woocommerce-cart .cart_totals .shipping-calculator-button:hover { text-decoration: underline; }
body.woocommerce-cart .cart_totals .shipping-calculator-form { margin-top: 10px; text-align: left; }
body.woocommerce-cart .cart_totals .shipping-calculator-form .form-row { margin: 0 0 8px !important; padding: 0 !important; }
body.woocommerce-cart .cart_totals .shipping-calculator-form .input-text,
body.woocommerce-cart .cart_totals .shipping-calculator-form select {
	width: 100% !important;
	height: 40px;
	border: 1px solid #d1d5db !important;
	border-radius: 8px !important;
	font-size: 14px !important;
}
body.woocommerce-cart .cart_totals .shipping-calculator-form .button {
	padding: 9px 22px !important;
	border-radius: 20px !important;
	background: var(--ec-dark) !important;
	color: #fff !important;
	font-size: 13px !important;
	font-weight: 700 !important;
}
/* coupon / fee rows */
body.woocommerce-cart .cart_totals .cart-discount td { color: #15803d !important; }
body.woocommerce-cart .cart_totals .woocommerce-remove-coupon { margin-left: 4px; font-size: 12px; font-weight: 600; color: #dc2626; }
/* order total */
body.woocommerce-cart .cart_totals table.shop_table tr.order-total th,
body.woocommerce-cart .cart_totals table.shop_table tr.order-total td {
	padding-top: 16px !important;
	border-bottom: 0 !important;
}
body.woocommerce-cart .cart_totals table.shop_table tr.order-total th { font-size: 16px !important; font-weight: 700 !important; color: var(--ec-ink) !important; }
body.woocommerce-cart .cart_totals table.shop_table tr.order-total td strong,
body.woocommerce-cart .cart_totals table.shop_table tr.order-total td > .amount {
	font-size: 22px !important;
	font-weight: 800 !important;
	color: var(--ec-ink) !important;
}

/* checkout button */
body.woocommerce-cart .cart_totals .wc-proceed-to-checkout {
	display: block !important;
	margin: 0 !important;
	padding: 0 !important;
}
body.woocommerce-cart .cart_totals .wc-proceed-to-checkout a.checkout-button {
	display: flex !important;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100% !important;
	height: 50px;
	margin: 0 !important;
	padding: 0 24px !important;
	border: 0 !important;
	border-radius: 25px !important;
	background: var(--ec-accent) !important;
	color: #fff !important;
	font-size: 16px !important;
	font-weight: 700 !important;
	line-height: 1 !important;
	text-align: center;
	text-decoration: none;
	box-shadow: 0 6px 16px rgba(215, 158, 11, 0.28);
	transition: background 0.15s;
}
body.woocommerce-cart .cart_totals .wc-proceed-to-checkout a.checkout-button::after {
	content: "\2192" !important;
	position: static !important;
	font-family: inherit !important;
	font-size: 18px;
	line-height: 1;
	transform: none !important;
}
body.woocommerce-cart .cart_totals .wc-proceed-to-checkout a.checkout-button:hover,
body.woocommerce-cart .cart_totals .wc-proceed-to-checkout a.checkout-button:focus { background: var(--ec-accent-dark) !important; color: #fff !important; }

/* ---------- Empty cart ---------- */
body.woocommerce-cart .wc-empty-cart-message { max-width: 560px; margin: 10px auto 0; }
body.woocommerce-cart .cart-empty.woocommerce-info {
	margin: 0 !important;
	padding: 112px 24px 8px !important;
	border: 0 !important;
	background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23D79E0B' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='21' r='1.3'/%3E%3Ccircle cx='19' cy='21' r='1.3'/%3E%3Cpath d='M1 1h4l2.7 13.4a2 2 0 0 0 2 1.6h9.7a2 2 0 0 0 2-1.6L23 6H6'/%3E%3C/svg%3E") no-repeat center 18px / 72px 72px !important;
	font-size: 22px !important;
	font-weight: 700 !important;
	line-height: 1.4 !important;
	text-align: center;
	color: var(--ec-ink) !important;
}
body.woocommerce-cart .cart-empty.woocommerce-info::before { display: none !important; }
body.woocommerce-cart .return-to-shop { margin: 18px 0 70px !important; text-align: center; }
body.woocommerce-cart .return-to-shop .button {
	display: inline-flex !important;
	align-items: center;
	height: 48px;
	padding: 0 30px !important;
	border: 0 !important;
	border-radius: 24px !important;
	background: var(--ec-accent) !important;
	color: #fff !important;
	font-size: 15px !important;
	font-weight: 700 !important;
	line-height: 48px !important;
	text-decoration: none;
}
body.woocommerce-cart .return-to-shop .button:hover { background: var(--ec-accent-dark) !important; }

/* ---------- Tablet / mobile ---------- */
@media (max-width: 991.98px) {
	body.woocommerce-cart .cart-collaterals { display: block !important; }
	body.woocommerce-cart .cart-collaterals .cart_totals { width: 100% !important; margin: 0 0 24px !important; }
}
@media (min-width: 768px) and (max-width: 991.98px) {
	body.woocommerce-cart .cart-collaterals .cart_totals { max-width: 480px !important; margin-left: auto !important; }
}

/* Phones: each cart row becomes a compact card */
@media (max-width: 767.98px) {
	body.woocommerce-cart table.shop_table.cart thead { display: none !important; }
	body.woocommerce-cart table.shop_table.cart,
	body.woocommerce-cart table.shop_table.cart tbody { display: block !important; }
	body.woocommerce-cart table.shop_table.cart tr.cart_item {
		display: grid !important;
		grid-template-columns: 72px minmax(0, 1fr) auto;
		grid-template-areas:
			"thumb name remove"
			"thumb price price"
			"qty qty subtotal";
		column-gap: 12px;
		row-gap: 6px;
		align-items: center;
		padding: 14px !important;
		border-top: 1px solid var(--ec-line);
	}
	body.woocommerce-cart table.shop_table.cart tbody tr.cart_item:first-child { border-top: 0; }
	body.woocommerce-cart table.shop_table.cart tr.cart_item td {
		display: block !important;
		width: auto !important;
		padding: 0 !important;
		border: 0 !important;
		text-align: left !important;
		background: transparent !important;
	}
	body.woocommerce-cart table.shop_table.cart tr.cart_item td::before { display: none !important; }
	body.woocommerce-cart table.shop_table.cart td.product-thumbnail { grid-area: thumb; align-self: start; }
	body.woocommerce-cart table.shop_table.cart td.product-thumbnail img { width: 72px !important; height: 72px !important; }
	body.woocommerce-cart table.shop_table.cart td.product-name { grid-area: name; align-self: start; }
	body.woocommerce-cart table.shop_table.cart td.product-name,
	body.woocommerce-cart table.shop_table.cart td.product-name a { font-size: 14px !important; }
	body.woocommerce-cart table.shop_table.cart td.product-remove { grid-area: remove; align-self: start; }
	body.woocommerce-cart table.shop_table.cart td.product-price { grid-area: price; align-self: start; font-size: 13.5px !important; color: var(--ec-muted); }
	body.woocommerce-cart table.shop_table.cart td.product-price .tax_label { display: inline; margin-left: 4px; }
	body.woocommerce-cart table.shop_table.cart td.product-quantity { grid-area: qty; margin-top: 6px; }
	body.woocommerce-cart table.shop_table.cart td.product-subtotal { grid-area: subtotal; margin-top: 6px; text-align: right !important; }

	body.woocommerce-cart table.shop_table.cart tr:not(.cart_item) { display: block !important; }
	body.woocommerce-cart table.shop_table.cart td.actions { display: block !important; padding: 14px !important; text-align: left; }
	body.woocommerce-cart table.shop_table.cart td.actions .coupon {
		float: none;
		width: 100% !important;
		max-width: none;
		margin: 0 0 10px !important;
	}
	body.woocommerce-cart table.shop_table.cart td.actions .coupon .input-text { flex: 1 1 auto !important; width: auto !important; min-width: 0 !important; }
	body.woocommerce-cart table.shop_table.cart td.actions .coupon .button { flex: 0 0 auto !important; padding: 0 18px !important; }
	body.woocommerce-cart table.shop_table.cart td.actions button[name="update_cart"] { display: block !important; width: 100% !important; }
	body.woocommerce-cart .cart-collaterals .cart_totals { padding: 18px 16px 20px !important; }
}
