/**
 * GFCH checkout — grid layout (no WooCommerce float overlap).
 * Keeps gfch-core address-book, dual-comment, license, and EBizCharge fields working.
 */

.gfch-woo-page--checkout,
.gfch-checkout,
body.woocommerce-checkout .woocommerce,
body.woocommerce-checkout form.checkout {
	width: 100% !important;
	max-width: 100% !important;
	box-sizing: border-box;
	float: none !important;
	clear: both !important;
}

.gfch-checkout__layout {
	display: grid !important;
	grid-template-columns: minmax(0, 1fr) minmax(300px, 400px);
	gap: 1.5rem 1.75rem;
	align-items: start;
	width: 100% !important;
	float: none !important;
}

.gfch-checkout__main,
.gfch-checkout__sidebar,
.gfch-checkout__customer,
.gfch-checkout__billing,
.gfch-checkout__panel,
.gfch-checkout__order-card {
	float: none !important;
	width: 100% !important;
	max-width: 100% !important;
	min-width: 0;
	box-sizing: border-box;
	position: relative;
	z-index: 1;
}

.gfch-checkout__sidebar {
	position: sticky;
	top: 6.5rem;
	z-index: 2;
}

.gfch-checkout__customer {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
}

/* Kill legacy WooCommerce col2-set floats if any markup still uses them */
body.woocommerce-checkout .col2-set,
body.woocommerce-checkout .col2-set .col-1,
body.woocommerce-checkout .col2-set .col-2,
.gfch-checkout .col2-set,
.gfch-checkout .col-1,
.gfch-checkout .col-2 {
	float: none !important;
	width: 100% !important;
	max-width: 100% !important;
	clear: none !important;
}

body.woocommerce-checkout .col2-set::before,
body.woocommerce-checkout .col2-set::after,
.gfch-checkout::before,
.gfch-checkout::after {
	content: none !important;
	display: none !important;
}

/* Contact email card (replaces Billing details) */
.gfch-checkout-contact,
.gfch-checkout__panel,
.woocommerce-shipping-fields,
.woocommerce-additional-fields,
.gfch-checkout__order-card {
	background: #fff;
	border: 1px solid #e8edf2;
	border-radius: 16px;
	padding: 1.25rem 1.35rem 1.4rem;
	box-shadow: 0 8px 28px rgba(15, 23, 42, 0.05);
}

/* Logged-in: keep billing fields for Woo/gfch-core, hide the UI card */
.gfch-checkout-contact--locked,
.gfch-checkout__billing:has(.gfch-checkout-contact--locked) {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	clip-path: inset(50%) !important;
	border: 0 !important;
	white-space: nowrap !important;
	box-shadow: none !important;
	background: transparent !important;
	pointer-events: none;
}

.gfch-checkout__panel--shipping .woocommerce-shipping-fields,
.gfch-checkout__panel--shipping .woocommerce-additional-fields {
	background: transparent;
	border: 0;
	border-radius: 0;
	padding: 0;
	box-shadow: none;
}

.gfch-checkout__panel--shipping .woocommerce-additional-fields {
	margin-top: 1.15rem;
	padding-top: 1.15rem;
	border-top: 1px solid #eef2f6;
}

.gfch-checkout-contact__title,
.gfch-checkout-shipping__title,
.gfch-checkout__order-title,
#order_review_heading,
.woocommerce-shipping-fields h3.gfch-checkout-shipping__title {
	margin: 0 0 1rem !important;
	padding: 0 !important;
	border: 0 !important;
	font-size: 1.15rem !important;
	font-weight: 800 !important;
	color: #005028 !important;
}

/* Hide WC ship-to-different checkbox (gfch-core address-book flow) */
#ship-to-different-address.gfch-checkout-ship-diff,
.gfch-checkout #ship-to-different-address {
	display: none !important;
}

.gfch-checkout .shipping_address {
	display: block !important;
}

/* Form fields — never float inside checkout (breaks EBizCharge) */
.gfch-checkout .form-row,
.woocommerce-checkout .form-row {
	margin: 0 0 0.9rem !important;
	padding: 0 !important;
	float: none !important;
	width: 100% !important;
	clear: both !important;
}

.gfch-checkout .form-row-first,
.gfch-checkout .form-row-last,
.woocommerce-checkout .form-row-first,
.woocommerce-checkout .form-row-last {
	float: none !important;
	width: 100% !important;
}

.woocommerce-checkout .form-row label {
	display: block;
	margin: 0 0 0.35rem;
	font-size: 0.86rem;
	font-weight: 700;
	color: #334155;
}

.woocommerce-checkout .form-row .required {
	color: #b91c1c;
	text-decoration: none;
}

.woocommerce-checkout .input-text,
.woocommerce-checkout textarea,
.woocommerce-checkout select,
.woocommerce-checkout .select2-container .select2-selection--single {
	width: 100% !important;
	max-width: 100% !important;
	min-height: 2.65rem;
	padding: 0.65rem 0.9rem !important;
	border: 1px solid #dbe3ea !important;
	border-radius: 12px !important;
	background: #fff !important;
	color: #0f172a !important;
	font: inherit !important;
	box-shadow: none !important;
	box-sizing: border-box !important;
}

.woocommerce-checkout textarea {
	min-height: 6rem;
	resize: vertical;
}

.woocommerce-checkout .select2-container {
	width: 100% !important;
}

.woocommerce-checkout .select2-container .select2-selection--single {
	display: flex !important;
	align-items: center;
	height: 2.65rem !important;
	padding: 0 0.9rem !important;
}

.woocommerce-checkout .select2-container--default .select2-selection--single .select2-selection__rendered {
	padding: 0 !important;
	line-height: 1.3 !important;
	color: #0f172a !important;
}

.woocommerce-checkout .select2-container--default .select2-selection--single .select2-selection__arrow {
	height: 100% !important;
	right: 0.6rem !important;
}

/* Saved Shipping Address picker (native select, custom chrome) */
.woocommerce-checkout .gfch-checkout-saved-shipping-picker select,
.gfch-checkout .gfch-checkout-saved-shipping-picker select,
#gfch_shipping_address_choice {
	appearance: none !important;
	-webkit-appearance: none !important;
	background-image:
		linear-gradient(45deg, transparent 50%, #005028 50%),
		linear-gradient(135deg, #005028 50%, transparent 50%),
		linear-gradient(to right, #eef5f1, #eef5f1) !important;
	background-position:
		calc(100% - 1.15rem) calc(50% - 0.15rem),
		calc(100% - 0.75rem) calc(50% - 0.15rem),
		calc(100% - 2.5rem) 50% !important;
	background-size: 0.4rem 0.4rem, 0.4rem 0.4rem, 1px 1.4rem !important;
	background-repeat: no-repeat !important;
	padding-right: 2.85rem !important;
	font-weight: 700 !important;
	border-color: #005028 !important;
	min-height: 3rem !important;
}

.woocommerce-checkout .gfch-checkout-saved-shipping-picker > label,
.gfch-checkout .gfch-checkout-saved-shipping-picker > label {
	font-size: 0.78rem !important;
	font-weight: 700 !important;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: #64748b !important;
}

/* Order review table */
.gfch-checkout__order {
	background: transparent;
	border: 0;
	border-radius: 0;
	padding: 0;
	box-shadow: none;
}

.woocommerce-checkout-review-order-table {
	width: 100% !important;
	border: 0 !important;
	margin: 0 0 1rem !important;
	border-collapse: collapse !important;
	table-layout: auto !important;
}

.woocommerce-checkout-review-order-table th,
.woocommerce-checkout-review-order-table td {
	padding: 0.7rem 0 !important;
	border: 0 !important;
	border-bottom: 1px solid #eef2f6 !important;
	background: transparent !important;
	vertical-align: top;
	font-size: 0.95rem;
	float: none !important;
}

.woocommerce-checkout-review-order-table thead th {
	font-size: 0.78rem !important;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #64748b !important;
	font-weight: 800 !important;
}

.woocommerce-checkout-review-order-table .product-name {
	color: #0f172a;
	font-weight: 600;
	padding-right: 0.75rem !important;
}

.woocommerce-checkout-review-order-table .product-total,
.woocommerce-checkout-review-order-table .order-total td,
.woocommerce-checkout-review-order-table tfoot td {
	text-align: right !important;
	font-weight: 800 !important;
	color: #005028 !important;
	white-space: nowrap;
}

.woocommerce-checkout-review-order-table .cart-subtotal th,
.woocommerce-checkout-review-order-table .order-total th,
.woocommerce-checkout-review-order-table .shipping th {
	font-weight: 700 !important;
	color: #334155 !important;
	text-align: left !important;
}

.woocommerce-checkout-review-order-table .order-total th,
.woocommerce-checkout-review-order-table .order-total td {
	font-size: 1.08rem !important;
	border-bottom: 0 !important;
	padding-top: 0.9rem !important;
}

/* Shipping methods in order review */
.woocommerce-checkout-review-order-table .woocommerce-shipping-totals th,
.woocommerce-checkout-review-order-table .woocommerce-shipping-totals td,
.woocommerce-checkout-review-order-table tr.shipping th,
.woocommerce-checkout-review-order-table tr.shipping td {
	display: block !important;
	width: 100% !important;
	text-align: left !important;
}

.woocommerce-checkout-review-order-table ul#shipping_method {
	list-style: none;
	margin: 0.4rem 0 0;
	padding: 0;
}

.woocommerce-checkout-review-order-table ul#shipping_method li {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
	margin: 0.45rem 0;
	line-height: 1.4;
	text-align: left;
	font-weight: 600;
	color: #0f172a;
}

/* Payment */
.woocommerce-checkout-payment {
	background: transparent !important;
	border: 0 !important;
	padding: 0 !important;
	margin: 0.75rem 0 0 !important;
}

.woocommerce-checkout-payment ul.payment_methods {
	list-style: none;
	margin: 0 0 1rem !important;
	padding: 0 !important;
	border: 0 !important;
}

.woocommerce-checkout-payment ul.payment_methods > li {
	margin: 0 0 0.65rem;
	padding: 0.9rem 1rem;
	border: 1px solid #e8edf2;
	border-radius: 12px;
	background: #f8fafc;
	overflow: hidden;
}

.woocommerce-checkout-payment ul.payment_methods > li > label {
	display: flex !important;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.45rem 0.55rem;
	font-weight: 700;
	color: #0f172a;
	cursor: pointer;
	line-height: 1.3;
}

.woocommerce-checkout-payment ul.payment_methods > li > label img {
	width: 36px !important;
	height: auto !important;
	max-height: 24px;
	object-fit: contain;
	flex-shrink: 0;
}

.woocommerce-checkout-payment .payment_box {
	margin: 0.85rem 0 0 !important;
	padding: 0.85rem 0 0 !important;
	background: transparent !important;
	border: 0 !important;
	border-top: 1px solid #e8edf2 !important;
	color: #64748b;
	font-size: 0.9rem;
	float: none !important;
	width: 100% !important;
}

.woocommerce-checkout-payment .payment_box::before {
	display: none !important;
}

/* EBizCharge card form */
.payment_box.payment_method_ebizcharge,
.payment_method_ebizcharge .payment_box,
#ebizcharge-new-info,
#ebizcharge-stored-info,
#ebizcharge-update-info {
	margin-left: 0 !important;
	padding-left: 0 !important;
	float: none !important;
	width: 100% !important;
	max-width: 100% !important;
}

.payment_method_ebizcharge fieldset,
.payment_method_ebizcharge .fieldset-style {
	border: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	min-width: 0 !important;
}

.payment_method_ebizcharge .form-row {
	display: block !important;
	float: none !important;
	width: 100% !important;
	margin: 0 0 0.85rem !important;
}

.payment_method_ebizcharge .form-row-first,
.payment_method_ebizcharge .form-row-last {
	float: none !important;
	width: 100% !important;
}

.payment_method_ebizcharge select,
.payment_method_ebizcharge input.input-text,
.payment_method_ebizcharge #ccnum,
.payment_method_ebizcharge #ccholder,
.payment_method_ebizcharge #cardtype,
.payment_method_ebizcharge #expmonth,
.payment_method_ebizcharge #expyear,
.payment_method_ebizcharge #cvv {
	width: 100% !important;
	max-width: 100% !important;
	min-height: 2.65rem !important;
	box-sizing: border-box !important;
}

/* Expiration + CVV row */
.payment_method_ebizcharge .form-row-first:has(#expmonth),
.payment_method_ebizcharge .form-row-last:has(#cvv) {
	display: block !important;
}

.payment_method_ebizcharge .form-row-first:has(#expmonth) {
	display: grid !important;
	grid-template-columns: 1fr 1fr;
	gap: 0.55rem 0.65rem;
	align-items: end;
}

.payment_method_ebizcharge .form-row-first:has(#expmonth) > label {
	grid-column: 1 / -1;
}

.payment_method_ebizcharge .form-row-first:has(#expmonth) > select {
	width: 100% !important;
	max-width: none !important;
}

.payment_method_ebizcharge #cvv,
.payment_method_ebizcharge input#cvv,
.payment_method_ebizcharge input[name="cvv"] {
	width: 100% !important;
	max-width: 100% !important;
	min-width: 0 !important;
}

.payment_method_ebizcharge .clear {
	clear: both;
	height: 0;
	margin: 0;
	padding: 0;
	overflow: hidden;
}

.payment_method_ebizcharge label img,
.payment_method_ebizcharge .payment_method_ebizcharge label img {
	width: 36px !important;
}

#place_order,
.woocommerce-checkout button#place_order,
.woocommerce-checkout .button.alt {
	display: flex !important;
	align-items: center;
	justify-content: center;
	width: 100% !important;
	min-height: 3rem !important;
	margin: 0.5rem 0 0 !important;
	padding: 0.85rem 1.25rem !important;
	border: 0 !important;
	border-radius: 999px !important;
	background: #005028 !important;
	color: #fff !important;
	font: inherit !important;
	font-weight: 800 !important;
	font-size: 1rem !important;
	cursor: pointer;
	box-shadow: none !important;
	float: none !important;
}

#place_order:hover,
.woocommerce-checkout button#place_order:hover,
.woocommerce-checkout .button.alt:hover {
	background: #f7941d !important;
	color: #fff !important;
}

/* Address book notices */
.gfch-checkout-address-book-notice {
	margin: 0 0 1rem !important;
	padding: 0.9rem 1rem !important;
	border: 1px solid #d7dde5 !important;
	border-radius: 12px !important;
	background: #f7fafc !important;
	color: #1f2937 !important;
	display: flex !important;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
}

.gfch-checkout-address-book-notice--warning {
	border-color: #f0c36d !important;
	background: #fffbeb !important;
	color: #78350f !important;
}

.gfch-checkout-address-book-notice__btn,
.gfch-checkout-address-book-notice .button {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	min-height: 2.4rem;
	padding: 0 1rem !important;
	border-radius: 999px !important;
	background: #005028 !important;
	color: #fff !important;
	font-weight: 800 !important;
	text-decoration: none !important;
	border: 0 !important;
}

.gfch-checkout-address-book-notice__btn:hover,
.gfch-checkout-address-book-notice .button:hover {
	background: #f7941d !important;
	color: #fff !important;
}

/* Checkout — Add New Shipping Address panel */
.gfch-checkout-add-ship {
	margin: 0 0 1.25rem;
}

.gfch-checkout-add-ship[hidden] {
	display: none !important;
}

.gfch-checkout-add-ship__card {
	background: #fff;
	border: 1px solid #e2e8e4;
	border-radius: 16px;
	padding: 1.2rem 1.25rem 1.3rem;
	box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.gfch-checkout-add-ship__title {
	margin: 0 0 1rem !important;
	color: #005028 !important;
	font-size: 1.1rem !important;
	font-weight: 800 !important;
}

.gfch-checkout-add-ship__error {
	margin: 0 0 0.85rem;
	padding: 0.7rem 0.85rem;
	border-radius: 10px;
	background: #fff1f2;
	color: #991b1b;
	font-size: 0.9rem;
	font-weight: 600;
}

.gfch-checkout-add-ship__error[hidden] {
	display: none !important;
}

.gfch-checkout-add-ship__grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.85rem 1rem;
}

.gfch-checkout-add-ship__field--full {
	grid-column: 1 / -1;
}

.gfch-checkout-add-ship__field label {
	display: block;
	margin: 0 0 0.3rem;
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: #64748b;
}

.gfch-checkout-add-ship__field .required {
	color: #b91c1c;
	text-decoration: none;
}

.gfch-checkout-add-ship__field input,
.gfch-checkout-add-ship__field select {
	width: 100%;
	min-height: 2.65rem;
	padding: 0.55rem 0.85rem;
	border: 1.5px solid #d5ddd8;
	border-radius: 12px;
	background: #fff;
	color: #0f172a;
	font: inherit;
	box-sizing: border-box;
}

.gfch-checkout-add-ship__field input:focus,
.gfch-checkout-add-ship__field select:focus {
	outline: none;
	border-color: #005028;
	box-shadow: 0 0 0 3px rgba(0, 80, 40, 0.12);
}

.gfch-checkout-add-ship__actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 0.65rem;
	margin-top: 1.1rem;
}

.gfch-checkout-add-ship__cancel,
.gfch-checkout-add-ship__submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 2.65rem;
	padding: 0 1.2rem;
	border-radius: 999px;
	font: inherit;
	font-weight: 800;
	font-size: 0.92rem;
	cursor: pointer;
}

.gfch-checkout-add-ship__cancel {
	border: 1.5px solid #d5ddd8;
	background: #fff;
	color: #005028;
}

.gfch-checkout-add-ship__cancel:hover {
	border-color: #f7941d;
	color: #c2410c;
}

.gfch-checkout-add-ship__submit {
	border: 0;
	background: #005028;
	color: #fff;
}

.gfch-checkout-add-ship__submit:hover {
	background: #f7941d;
}

.gfch-checkout-add-ship__submit:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

@media (max-width: 640px) {
	.gfch-checkout-add-ship__grid {
		grid-template-columns: 1fr;
	}

	.gfch-checkout-add-ship__actions {
		flex-direction: column-reverse;
	}

	.gfch-checkout-add-ship__cancel,
	.gfch-checkout-add-ship__submit {
		width: 100%;
	}
}

.woocommerce-checkout .woocommerce-info,
.woocommerce-checkout .woocommerce-message,
.woocommerce-checkout .woocommerce-error,
.woocommerce-checkout .woocommerce-NoticeGroup {
	border-radius: 12px;
	border: 0;
	padding: 0.9rem 1.1rem;
	margin: 0 0 1.15rem;
	background: #f1f5f1;
	color: #005028;
	list-style: none;
}

.woocommerce-checkout .woocommerce-error,
.woocommerce-checkout .woocommerce-NoticeGroup-checkout .woocommerce-error {
	background: #fff1f2;
	color: #991b1b;
}

.woocommerce-checkout .woocommerce-info::before,
.woocommerce-checkout .woocommerce-message::before,
.woocommerce-checkout .woocommerce-error::before {
	display: none;
}

.gfch-comment-section {
	margin-bottom: 1rem;
}

.gfch-textarea-wrapper textarea {
	width: 100%;
}

.gfch-char-counter {
	margin-top: 0.35rem;
	font-size: 0.75rem;
	color: #6b7280;
	text-align: right;
}

.gfch-char-counter.is-over {
	color: #b91c1c;
	font-weight: 700;
}

.woocommerce-checkout .notice.notice-error {
	margin: 0 0 0.85rem;
	padding: 0.85rem 1rem;
	border-radius: 12px;
	background: #fff1f2;
	color: #991b1b;
	border: 0;
}

@media (max-width: 1024px) {
	.gfch-checkout__layout {
		grid-template-columns: 1fr !important;
		gap: 1.25rem;
	}

	.gfch-checkout__sidebar {
		position: static;
		order: -1;
	}
}

@media (max-width: 640px) {
	.gfch-checkout-contact,
	.gfch-checkout__panel,
	.gfch-checkout__order-card {
		padding: 1rem;
		border-radius: 14px;
	}

	.woocommerce-checkout-review-order-table thead {
		display: none;
	}

	.woocommerce-checkout-review-order-table,
	.woocommerce-checkout-review-order-table tbody,
	.woocommerce-checkout-review-order-table tfoot,
	.woocommerce-checkout-review-order-table tr {
		display: block;
		width: 100%;
	}

	.woocommerce-checkout-review-order-table td,
	.woocommerce-checkout-review-order-table th {
		display: flex !important;
		justify-content: space-between;
		align-items: flex-start;
		gap: 0.75rem;
		width: 100% !important;
		text-align: left !important;
	}

	.woocommerce-checkout-review-order-table .product-total,
	.woocommerce-checkout-review-order-table tfoot td {
		text-align: right !important;
		justify-content: flex-end;
	}

	.payment_method_ebizcharge .form-row-first:has(#expmonth) {
		grid-template-columns: 1fr;
	}

	#place_order {
		min-height: 3.15rem !important;
	}
}

/* Fallback when :has() unsupported — still full-width selects */
@supports not selector(:has(*)) {
	.payment_method_ebizcharge #expmonth,
	.payment_method_ebizcharge #expyear {
		display: inline-block;
		width: calc(50% - 0.35rem) !important;
		margin-right: 0.35rem;
		vertical-align: top;
	}

	.payment_method_ebizcharge #expyear {
		margin-right: 0;
	}
}
