/**
 * NGO Donation Checkout - visual layer.
 * Scoped under .woocommerce-checkout so it only affects the checkout page.
 */

.woocommerce-checkout {
	--ngodc-primary: #d62828;
	--ngodc-success: #2e7d32;
	--ngodc-border: #eaeaea;
	--ngodc-bg: #f8f8f8;
	--ngodc-card: #ffffff;
	--ngodc-radius: 16px;
	--ngodc-shadow: 0 10px 30px rgba( 0, 0, 0, 0.08 );
}

/* ---------- Banner ---------- */

.ngodc-top-message {
	background: var( --ngodc-card );
	border-inline-start: 4px solid var( --ngodc-primary );
	border-radius: 12px;
	box-shadow: var( --ngodc-shadow );
	padding: 16px 20px;
	margin-bottom: 24px;
}

.ngodc-top-message p {
	margin: 0 0 4px;
	color: #333;
}

.ngodc-top-message p:last-child {
	margin-bottom: 0;
	color: #666;
	font-size: 0.95em;
}

/* ---------- Two column layout (desktop) ---------- */

.woocommerce-checkout form.checkout {
	display: grid;
	grid-template-columns: 1.05fr 1fr;
	column-gap: 32px;
	align-items: start;
	background: var( --ngodc-bg );
}

.woocommerce-checkout form.checkout #customer_details {
	grid-column: 1;
	grid-row: 1 / span 2;
}

.woocommerce-checkout form.checkout #order_review_heading {
	grid-column: 2;
	grid-row: 1;
	margin-top: 0;
}

.woocommerce-checkout form.checkout #order_review {
	grid-column: 2;
	grid-row: 2;
}

@media ( max-width: 782px ) {
	.woocommerce-checkout form.checkout {
		display: block;
	}

	.woocommerce-checkout form.checkout #customer_details,
	.woocommerce-checkout form.checkout #order_review_heading,
	.woocommerce-checkout form.checkout #order_review {
		grid-column: auto;
		grid-row: auto;
	}
}

/* ---------- Donor Information card ---------- */

#customer_details .col-1,
#customer_details .col-2 {
	width: 100%;
	float: none;
}

.woocommerce-billing-fields,
.woocommerce-billing-fields__field-wrapper {
	background: var( --ngodc-card );
	border-radius: var( --ngodc-radius );
	box-shadow: var( --ngodc-shadow );
	padding: 24px;
}

.woocommerce-billing-fields h3,
#order_review_heading {
	font-size: 1.2em;
	font-weight: 700;
	color: #222;
}

/* ---------- Order review / Donation Summary card ---------- */

#order_review,
.woocommerce-checkout-review-order {
	background: transparent;
}

#order_review table.shop_table,
.woocommerce-checkout-review-order-table {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0 12px;
	background: transparent;
}

#order_review table.shop_table thead {
	display: none;
}

#order_review table.shop_table tbody tr.cart_item {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	position: relative;
	background: var( --ngodc-card );
	border: 1px solid var( --ngodc-border );
	border-radius: var( --ngodc-radius );
	box-shadow: var( --ngodc-shadow );
	padding: 16px;
}

#order_review table.shop_table tbody tr.cart_item td {
	border: none;
	padding: 4px 6px;
	background: transparent;
}

#order_review table.shop_table tbody tr.cart_item td.product-name {
	flex: 1 1 100%;
	order: 1;
}

#order_review table.shop_table tbody tr.cart_item td.product-total {
	order: 2;
	font-weight: 700;
	color: var( --ngodc-primary );
	padding-inline-start: 86px; /* aligns roughly under the product name text */
}

#order_review table.shop_table tfoot tr {
	display: flex;
	justify-content: space-between;
	background: var( --ngodc-card );
	border: 1px solid var( --ngodc-border );
	border-radius: 12px;
	padding: 12px 16px;
	margin-top: 8px;
}

#order_review table.shop_table tfoot th,
#order_review table.shop_table tfoot td {
	border: none;
	background: transparent;
}

#order_review table.shop_table tfoot tr.order-total th,
#order_review table.shop_table tfoot tr.order-total td {
	font-size: 1.15em;
	font-weight: 700;
	color: var( --ngodc-success );
}

/* ---------- Product card (image + remove button) ---------- */

.ngodc-product-card {
	position: relative;
	display: flex;
	align-items: center;
	gap: 14px;
	padding-inline-end: 28px;
}

.ngodc-product-thumb-wrap img.ngodc-product-thumb {
	width: 70px;
	height: 70px;
	object-fit: cover;
	border-radius: 10px;
	display: block;
}

.ngodc-product-name {
	font-weight: 600;
	color: #222;
}

/* `all: unset` strips whatever the theme/page-builder's global button
   style (padding, pill shape, accent background, box-shadow, min-width…)
   would otherwise inject into a bare <button>, then we reapply only what
   we want. The extra selector weight + !important keep it from being
   overridden again by a more specific theme rule loaded after ours. */
button.ngodc-remove-item {
	all: unset;
	box-sizing: border-box !important;
	position: absolute !important;
	top: 10px !important;
	inset-inline-end: 10px !important;
	width: 24px !important;
	height: 24px !important;
	min-width: 24px !important;
	line-height: 22px !important;
	text-align: center !important;
	background: #fff !important;
	border: 1px solid var( --ngodc-border ) !important;
	border-radius: 50% !important;
	color: #999 !important;
	font-size: 15px !important;
	font-weight: 700 !important;
	cursor: pointer !important;
	padding: 0 !important;
	margin: 0 !important;
	z-index: 2;
	transition: background 0.15s ease, color 0.15s ease;
}

button.ngodc-remove-item:hover {
	background: var( --ngodc-primary ) !important;
	border-color: var( --ngodc-primary ) !important;
	color: #fff !important;
}

button.ngodc-remove-item.is-loading {
	opacity: 0.5;
	pointer-events: none;
}

/* ---------- Payment methods ---------- */

/* Safety net: some themes/page builders ship a global rule that hides
   #payment until a script toggles it on (normally meant for the cart
   page, not checkout). Force it visible here. */
#order_review #payment,
#order_review .woocommerce-checkout-payment {
	display: block !important;
	width: 100%;
	background: transparent !important;
}

#order_review ul.wc_payment_methods {
	background: var( --ngodc-card );
	border-radius: var( --ngodc-radius );
	box-shadow: var( --ngodc-shadow );
	padding: 16px;
	margin-top: 16px;
}

#order_review ul.wc_payment_methods li.wc_payment_method {
	border: 1px solid var( --ngodc-border );
	border-radius: 12px;
	padding: 12px 16px;
	margin-bottom: 10px;
}

#order_review ul.wc_payment_methods li.wc_payment_method:last-child {
	margin-bottom: 0;
}

#order_review ul.wc_payment_methods input[type="radio"] {
	accent-color: var( --ngodc-primary );
	width: 18px;
	height: 18px;
	margin-inline-end: 8px;
}

#order_review ul.wc_payment_methods label {
	font-weight: 600;
}

/* The gateway's own brand images are fully replaced by our own badges
   (see .ngodc-card-badges below), so hide anything it still tries to
   render on its own — no more fighting its CSS/positioning. */
#order_review ul.wc_payment_methods li.wc_payment_method label img:not(.ngodc-badge),
#order_review ul.wc_payment_methods li.wc_payment_method img:not(.ngodc-badge) {
	display: none !important;
}

.ngodc-card-badges {
	display: inline-flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 4px;
	margin-inline-start: 6px;
	vertical-align: middle;
}

.ngodc-card-badges .ngodc-badge {
	display: inline-block;
	height: 20px;
	width: auto;
	object-fit: contain;
	background: #fff;
	border: 1px solid var( --ngodc-border );
	border-radius: 4px;
	padding: 2px 4px;
}

/* ---------- Inputs ---------- */

.woocommerce-checkout input.input-text,
.woocommerce-checkout select,
.woocommerce-checkout textarea {
	height: 52px;
	border: 1px solid var( --ngodc-border );
	border-radius: 10px;
	padding: 0 16px;
	width: 100%;
	background: #fff;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.woocommerce-checkout textarea {
	height: auto;
	padding: 12px 16px;
}

.woocommerce-checkout input.input-text:focus,
.woocommerce-checkout select:focus,
.woocommerce-checkout textarea:focus {
	border-color: var( --ngodc-primary );
	box-shadow: 0 0 0 3px rgba( 214, 40, 40, 0.15 );
	outline: none;
}

.woocommerce-checkout .form-row label {
	font-weight: 600;
	color: #333;
	margin-bottom: 6px;
	display: inline-block;
}

/* ---------- Validation ---------- */

.woocommerce-checkout .form-row.woocommerce-invalid input.input-text,
.woocommerce-checkout .form-row.woocommerce-invalid select {
	border-color: var( --ngodc-primary );
	box-shadow: 0 0 0 3px rgba( 214, 40, 40, 0.12 );
}

.woocommerce-checkout .woocommerce-error {
	border-inline-start: 4px solid var( --ngodc-primary );
	border-radius: 12px;
	background: #fff;
}

/* ---------- Donate button ---------- */

#place_order {
	width: 100%;
	height: 56px;
	border-radius: 12px;
	background: var( --ngodc-primary );
	color: #fff;
	font-weight: 700;
	font-size: 1.05em;
	border: none;
	cursor: pointer;
	transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
	box-shadow: var( --ngodc-shadow );
}

#place_order:hover {
	transform: translateY( -2px );
	background: #b71f1f;
}

#place_order:active {
	transform: translateY( 0 );
}
