/* ==========================================================================
   Aminex Nova — Cart & Checkout (classic template redesign)
   Every element here is markup we wrote ourselves in
   woocommerce/cart/cart.php and woocommerce/checkout/form-checkout.php —
   no WordPress-block-generated wrapper divs, no guessing class names.
   ========================================================================== */

/* ---------- Cart — two-column grid ---------- */
.nova-cart2 {
	display: grid;
	grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr);
	gap: clamp(1.5rem, 4vw, 3rem);
	align-items: start;
	width: 100%;
}
@media (max-width: 900px) {
	.nova-cart2 { grid-template-columns: 1fr; }
}
.nova-cart2__items { min-width: 0; }
.nova-cart2__side {
	min-width: 0;
	position: sticky;
	top: 100px;
}

.nova-cart2__table .product-thumbnail img {
	width: 72px;
	border-radius: var(--nova-radius-sm);
	background: var(--nova-canvas-3);
}
.nova-cart2__table .product-name a {
	font-weight: 600;
	color: var(--nova-ink);
}
.nova-cart2__table td.actions {
	padding: 1.2rem !important;
	border-top: 1px solid var(--nova-line) !important;
}
.nova-cart2__table .coupon {
	display: inline-flex;
	gap: .5rem;
	margin-right: 1rem;
	flex-wrap: wrap;
}
.nova-cart2__table .coupon .input-text {
	width: auto;
	min-width: 180px;
}

/* Quantity stepper (cart + checkout review table) */
.woocommerce .quantity .qty,
.nova-cart2__table .quantity input.qty {
	width: 64px !important;
	text-align: center;
	padding: .6rem !important;
	border: 1px solid var(--nova-line-strong) !important;
	border-radius: var(--nova-radius-sm) !important;
	background: var(--nova-canvas) !important;
	color: var(--nova-ink) !important;
}

/* ---------- Cart items — mobile stacked cards ----------------------------
   Below 640px, WooCommerce's own default "shop_table_responsive" fallback
   was taking over (unstyled, plain "Label: value" text, generic remove
   icon) since we never overrode it for the cart table specifically.
   Replace it entirely with a themed stacked-card layout. */
@media (max-width: 640px) {
	/* !important throughout this block — WooCommerce's own core
	   shop_table_responsive small-screen stylesheet targets the same
	   elements at equal specificity and loads after our theme CSS, so a
	   plain (non-important) rule here was silently losing that fight and
	   falling back to WooCommerce's default plain-stacked layout. */
	.nova-cart2__table thead { display: none !important; }
	.nova-cart2__table,
	.nova-cart2__table tbody { display: block !important; width: 100% !important; }

	.nova-cart2__table tr.woocommerce-cart-form__cart-item {
		display: grid !important;
		grid-template-columns: 64px 1fr auto !important;
		grid-template-areas:
			"thumb name   remove"
			"thumb price  price"
			"thumb qty    qty"
			"thumb subtot subtot" !important;
		gap: .3rem .9rem !important;
		width: 100% !important;
		padding: 1.1rem 1.1rem !important;
		border-top: 1px solid var(--nova-line) !important;
	}
	.nova-cart2__table tr.woocommerce-cart-form__cart-item:first-child {
		border-top: 0 !important;
	}
	.nova-cart2__table tr.woocommerce-cart-form__cart-item td {
		display: block !important;
		border: 0 !important;
		padding: 0 !important;
		width: auto !important;
		text-align: left !important;
	}
	.nova-cart2__table td.product-thumbnail { grid-area: thumb !important; }
	.nova-cart2__table td.product-name      { grid-area: name !important; align-self: center !important; }
	.nova-cart2__table td.product-remove    { grid-area: remove !important; align-self: start !important; text-align: right !important; }
	.nova-cart2__table td.product-price     { grid-area: price !important; }
	.nova-cart2__table td.product-quantity  { grid-area: qty !important; margin-top: .3rem !important; }
	.nova-cart2__table td.product-subtotal  { grid-area: subtot !important; margin-top: .2rem !important; }

	/* Kill WooCommerce's own default ::before label on every cell first
	   (this is the source of the stray floating ":" — WC's core CSS adds
	   attr(data-title) to cells that don't have that attribute set, like
	   the remove and thumbnail cells, leaving just an empty ": "). Then
	   re-add our own label only on the three cells that need one. */
	.nova-cart2__table td::before {
		content: none !important;
	}
	.nova-cart2__table td.product-price::before,
	.nova-cart2__table td.product-quantity::before,
	.nova-cart2__table td.product-subtotal::before {
		content: attr(data-title) ": " !important;
		display: inline !important;
		font-size: .72rem;
		font-weight: 600;
		letter-spacing: .06em;
		text-transform: uppercase;
		color: var(--nova-ink-3);
	}
	.nova-cart2__table td.product-name {
		font-weight: 600;
		color: var(--nova-ink);
	}
	.nova-cart2__table td.product-thumbnail img {
		width: 64px !important;
		height: 64px !important;
		aspect-ratio: 1 / 1 !important;
		object-fit: cover !important;
	}
	.nova-cart2__table .remove {
		display: inline-flex !important;
		align-items: center;
		justify-content: center;
		width: 26px; height: 26px;
		border-radius: 50%;
		background: var(--nova-canvas-3);
		color: var(--nova-ink-3) !important;
		font-size: 1rem;
		text-decoration: none !important;
	}
	.nova-cart2__table .remove:hover {
		background: var(--nova-purple-soft);
		color: var(--nova-purple-deep) !important;
	}

	/* Coupon / update-cart action row */
	.nova-cart2__table td.actions {
		display: block !important;
		border-top: 1px solid var(--nova-line) !important;
		padding: 1.2rem 0 !important;
	}
	.nova-cart2__table .coupon {
		display: flex !important;
		width: 100% !important;
		margin: 0 0 .75rem !important;
	}
	.nova-cart2__table .coupon .input-text { flex: 1; min-width: 0; }
}

/* Cart totals card — single bordered container, no nested card */
.cart-collaterals {
	background: var(--nova-canvas);
	border: 1px solid var(--nova-line);
	border-radius: var(--nova-radius-lg);
	padding: var(--nova-space-5);
	width: 100%;
	max-width: 100%;
}
/* WooCommerce's own cart-totals.php floats this box right at 48% width by
   default (assumes a full-width row it shares with cross-sells). Our grid
   already handles the left/right split, so cancel that float entirely —
   this was the cause of the totals box shrinking and drifting right with
   dead space on its left. */
.cart-collaterals .cart_totals {
	float: none !important;
	width: 100% !important;
	clear: both;
}
.cart-collaterals .cart_totals h2 {
	margin: 0 0 var(--nova-space-4) !important;
}
/* Strip the table's own independent card styling (border/radius/background)
   so only the outer .cart-collaterals card is visible — prevents the
   "card inside a card" look. */
.cart-collaterals .cart_totals table.shop_table {
	width: 100% !important;
	max-width: 100% !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
	overflow: visible !important;
	border-collapse: collapse !important;
	margin: 0 !important;
}
.cart-collaterals .cart_totals table th,
.cart-collaterals .cart_totals table td {
	padding: .7rem 0 !important;
	border-top: 1px solid var(--nova-line) !important;
	border-bottom: 0 !important;
	text-align: left;
	background: transparent !important;
}
.cart-collaterals .cart_totals table tr:first-child th,
.cart-collaterals .cart_totals table tr:first-child td {
	border-top: 0 !important;
}
.cart-collaterals .cart_totals .order-total th,
.cart-collaterals .cart_totals .order-total td {
	font-weight: 700;
	font-size: 1.1rem;
	color: var(--nova-ink);
}
.cart-collaterals .cart_totals .woocommerce-shipping-destination {
	color: var(--nova-ink-3);
	font-size: .85rem;
	margin-top: .3rem;
}
.cart-collaterals .wc-proceed-to-checkout {
	margin-top: 1rem;
	float: none !important;
	width: 100% !important;
	clear: both;
}
.cart-collaterals .wc-proceed-to-checkout a.checkout-button {
	display: block;
	width: 100%;
}

/* Cross-sells */
.cart-collaterals .cross-sells {
	margin-bottom: var(--nova-space-6);
}
.cart-collaterals .cross-sells h2 {
	font-family: var(--nova-serif);
	font-size: 1.3rem;
	margin-bottom: var(--nova-space-4);
}
.cart-collaterals .cross-sells ul.products {
	grid-template-columns: 1fr !important;
}

/* ---------- Checkout — two-column grid ---------- */
.nova-checkout2 {
	display: grid;
	grid-template-columns: minmax(0, 1.4fr) minmax(360px, 1fr);
	gap: clamp(1.5rem, 4vw, 3rem);
	align-items: start;
	width: 100%;
}
@media (max-width: 900px) {
	.nova-checkout2 { grid-template-columns: 1fr; }
}
.nova-checkout2__col { min-width: 0; }
.nova-checkout2__col--review {
	position: sticky;
	top: 100px;
}

/* Section headings inside billing/shipping */
.woocommerce-billing-fields h3,
.woocommerce-shipping-fields h3,
.woocommerce-additional-fields h3,
#order_review_heading {
	font-family: var(--nova-serif);
	font-weight: 400;
	font-size: 1.4rem;
	letter-spacing: -0.01em;
	color: var(--nova-ink);
	margin: 0 0 1.25rem;
}
.woocommerce-shipping-fields,
.woocommerce-additional-fields {
	margin-top: var(--nova-space-6);
}
.woocommerce-billing-fields,
.woocommerce-shipping-fields,
.woocommerce-additional-fields,
#order_review {
	background: var(--nova-canvas);
	border: 1px solid var(--nova-line);
	border-radius: var(--nova-radius-lg);
	padding: var(--nova-space-5);
}
.woocommerce-shipping-fields,
.woocommerce-additional-fields {
	margin-bottom: 0;
}
.woocommerce-billing-fields { margin-bottom: var(--nova-space-6); }

.form-row { margin-bottom: 1rem; }
.form-row-first, .form-row-last { display: inline-block; width: 48%; }
.form-row-first { margin-right: 4%; }
@media (max-width: 500px) {
	.form-row-first, .form-row-last { width: 100%; margin-right: 0; }
}

/* Order review table */
.woocommerce-checkout-review-order-table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 1rem;
}
.woocommerce-checkout-review-order-table th,
.woocommerce-checkout-review-order-table td {
	padding: .8rem 0;
	border-top: 1px solid var(--nova-line);
	text-align: left;
}
.woocommerce-checkout-review-order-table thead th {
	border-top: 0;
	font-size: .78rem;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--nova-ink-3);
}
.woocommerce-checkout-review-order-table .order-total th,
.woocommerce-checkout-review-order-table .order-total td {
	font-weight: 700;
	font-size: 1.1rem;
	color: var(--nova-ink);
}
.woocommerce-checkout-review-order-table .product-name .product-quantity {
	color: var(--nova-ink-3);
	font-family: var(--nova-mono);
	font-size: .85rem;
}

/* Terms + place order footer */
.woocommerce-terms-and-conditions-wrapper {
	margin: 1rem 0;
	font-size: .9rem;
	color: var(--nova-ink-3);
}
.woocommerce-form__label-for-checkbox {
	display: flex;
	align-items: flex-start;
	gap: .5rem;
}
#place_order { width: 100%; }
