/* =========================================================================
   Checkout — Lovable parity (Blocks + shared shell). Scope: body.theme-checkout
   ========================================================================= */

body.theme-checkout {
	overflow-x: clip;
}

body.theme-checkout .site-main {
	min-height: 100vh;
	padding-bottom: 4rem;
}

body.theme-checkout .page-title {
	font-family: var(--font-display);
	font-weight: 700;
	font-size: clamp(1.875rem, 4vw, 2.25rem);
	line-height: 1.2;
	margin-bottom: 2.5rem;
}

body.theme-checkout .entry-content {
	max-width: none;
}

/* —— WooCommerce Blocks checkout —— */

body.theme-checkout .wc-block-checkout {
	display: block;
}

body.theme-checkout .wc-block-components-sidebar-layout,
body.theme-checkout .wc-block-components-sidebar-layout.wc-block-checkout.is-large {
	display: flex;
	flex-direction: column;
	gap: 3rem;
	align-items: stretch;
	width: 100% !important;
	max-width: none !important;
}

body.theme-checkout .wc-block-checkout__main {
	order: 1;
	min-width: 0;
	width: 100% !important;
	max-width: none !important;
}

body.theme-checkout .wc-block-checkout__sidebar {
	order: 2;
	min-width: 0;
	width: 100% !important;
	max-width: none !important;
}

@media (min-width: 1024px) {
	body.theme-checkout .wc-block-components-sidebar-layout,
	body.theme-checkout .wc-block-components-sidebar-layout.wc-block-checkout.is-large {
		display: grid !important;
		grid-template-columns: minmax(0, 5fr) minmax(0, 7fr) !important;
		gap: 4rem;
		align-items: start;
	}

	body.theme-checkout .wc-block-checkout__sidebar {
		order: 1;
		position: sticky;
		top: 7rem;
		align-self: start;
	}

	body.theme-checkout .wc-block-checkout__main {
		order: 2;
	}
}

body.theme-checkout .wc-block-components-notice-banner,
body.theme-checkout .wc-block-components-validation-error,
body.theme-checkout .wc-block-checkout__terms {
	grid-column: 1 / -1;
}

body.theme-checkout .wc-block-checkout__sidebar {
	background-color: hsl(var(--secondary) / 0.45);
	border: 1px solid hsl(var(--border));
	border-radius: 1rem;
	padding: 2rem;
}

body.theme-checkout .wc-block-components-title,
body.theme-checkout .wc-block-checkout__sidebar .wc-block-components-title {
	font-family: var(--font-display);
	font-weight: 700;
	font-size: 1.25rem;
	color: hsl(var(--foreground));
}

body.theme-checkout .wc-block-components-checkout-step__title {
	font-family: var(--font-display);
	font-weight: 700;
	font-size: 1.25rem;
	margin-bottom: 0;
}

/* —— Form column (2nd column desktop): step + field rhythm —— */

body.theme-checkout .wc-block-checkout__main {
	display: flex;
	flex-direction: column;
	gap: 2rem;
}

body.theme-checkout .wc-block-checkout__main .wc-block-components-checkout-step {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
	margin: 0 !important;
	padding: 0 !important;
}

body.theme-checkout .wc-block-checkout__main .wc-block-components-checkout-step__container,
body.theme-checkout .wc-block-checkout__main .wc-block-components-checkout-step__content {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
}

body.theme-checkout .wc-block-checkout__main .wc-block-components-text-input,
body.theme-checkout .wc-block-checkout__main .wc-block-components-combobox,
body.theme-checkout .wc-block-checkout__main .wc-block-components-select-input,
body.theme-checkout .wc-block-checkout__main .wc-block-components-textarea {
	margin: 0 !important;
}

body.theme-checkout .wc-block-checkout__main .wc-block-components-text-input label,
body.theme-checkout .wc-block-checkout__main .wc-block-components-combobox label,
body.theme-checkout .wc-block-checkout__main .wc-block-components-select-input label {
	display: block;
	margin-bottom: 0.375rem;
	font-family: var(--font-body);
	font-size: 0.8125rem;
	font-weight: 600;
	color: hsl(var(--foreground));
}

/* Address + contact fields: 2-column grid with clear gutters */
body.theme-checkout .wc-block-checkout__main .wc-block-components-address-form {
	display: grid !important;
	grid-template-columns: minmax(0, 1fr);
	gap: 1.25rem !important;
	width: 100%;
}

@media (min-width: 560px) {
	body.theme-checkout .wc-block-checkout__main .wc-block-components-address-form {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		column-gap: 1.25rem !important;
		row-gap: 1.25rem !important;
	}

	/* Full-width rows */
	body.theme-checkout .wc-block-checkout__main [class*="address-form__address-1"],
	body.theme-checkout .wc-block-checkout__main [class*="address-form__address-2"],
	body.theme-checkout .wc-block-checkout__main [class*="address-form__address_1"],
	body.theme-checkout .wc-block-checkout__main [class*="address-form__address_2"],
	body.theme-checkout .wc-block-checkout__main [class*="address-form__company"],
	body.theme-checkout .wc-block-checkout__main [class*="address-form__country"],
	body.theme-checkout .wc-block-checkout__main [class*="address-form__phone"],
	body.theme-checkout .wc-block-checkout__main [class*="address-form__email"] {
		grid-column: 1 / -1;
	}

	/* City / state / postcode share one row on wider form column */
	body.theme-checkout .wc-block-checkout__main [class*="address-form__city"],
	body.theme-checkout .wc-block-checkout__main [class*="address-form__state"],
	body.theme-checkout .wc-block-checkout__main [class*="address-form__postcode"] {
		grid-column: span 1;
	}
}

@media (min-width: 560px) and (max-width: 719px) {
	body.theme-checkout .wc-block-checkout__main [class*="address-form__city"],
	body.theme-checkout .wc-block-checkout__main [class*="address-form__state"],
	body.theme-checkout .wc-block-checkout__main [class*="address-form__postcode"] {
		grid-column: 1 / -1;
	}
}

@media (min-width: 720px) {
	body.theme-checkout .wc-block-checkout__main [class*="address-form__city"] {
		grid-column: 1 / 2;
	}

	body.theme-checkout .wc-block-checkout__main [class*="address-form__state"] {
		grid-column: 2 / 3;
	}

	body.theme-checkout .wc-block-checkout__main [class*="address-form__postcode"] {
		grid-column: 1 / -1;
	}
}

/* Contact information block (email / phone) — same vertical rhythm */
body.theme-checkout .wc-block-checkout__main .wc-block-components-contact-information,
body.theme-checkout .wc-block-checkout__main .wc-block-checkout-contact-information-block {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
}

/* Payment + actions block spacing */
body.theme-checkout .wc-block-checkout__main .wc-block-components-checkout-step--with-step-number {
	padding-top: 0.25rem;
}

body.theme-checkout .wc-block-checkout__main #payment-method,
body.theme-checkout .wc-block-checkout__main .wc-block-components-payment-methods {
	margin-top: 0.25rem;
}

body.theme-checkout .wc-block-checkout__main .wc-block-components-radio-control {
	gap: 0.75rem;
}

body.theme-checkout .wc-block-checkout__main .wc-block-components-radio-control__option {
	padding: 0.75rem 0;
}

body.theme-checkout .wc-block-components-text-input input,
body.theme-checkout .wc-block-components-textarea textarea,
body.theme-checkout .wc-block-components-select select,
body.theme-checkout .woocommerce-checkout .form-row .input-text {
	background-color: hsl(var(--background)) !important;
	border: 1px solid hsl(var(--foreground) / 0.15) !important;
	border-radius: calc(var(--radius) - 2px) !important;
	color: hsl(var(--foreground)) !important;
	font-family: var(--font-body) !important;
	font-size: 0.9375rem !important;
	line-height: 1.4 !important;
	min-height: 3rem !important;
	padding: 0.75rem 1rem !important;
	width: 100% !important;
	max-width: none !important;
	box-shadow: none !important;
}

body.theme-checkout .wc-block-components-textarea textarea {
	min-height: 6.5rem !important;
	padding-top: 0.875rem !important;
	padding-bottom: 0.875rem !important;
}

body.theme-checkout .wc-block-components-text-input input:focus,
body.theme-checkout .wc-block-components-textarea textarea:focus,
body.theme-checkout .wc-block-components-select select:focus,
body.theme-checkout .woocommerce-checkout .form-row .input-text:focus {
	border-color: hsl(var(--primary)) !important;
	box-shadow: 0 0 0 1px hsl(var(--primary)) !important;
	outline: none !important;
}

body.theme-checkout .wc-block-components-checkout-place-order-button,
body.theme-checkout .wc-block-components-button.wc-block-components-checkout-place-order-button {
	background-color: hsl(var(--primary)) !important;
	color: hsl(var(--primary-foreground)) !important;
	border-radius: 9999px !important;
	font-family: var(--font-body) !important;
	font-size: 0.9375rem !important;
	font-weight: 600 !important;
	min-height: 3rem !important;
	width: 100% !important;
	border: 0 !important;
	margin-top: 1rem !important;
}

body.theme-checkout .wc-block-components-button.wc-block-components-checkout-place-order-button:hover {
	background-color: hsl(var(--primary) / 0.9) !important;
}

body.theme-checkout .theme-checkout-policy-note {
	margin-top: 1rem;
	font-family: var(--font-body);
	font-size: 0.75rem;
	line-height: 1.5;
	text-align: center;
	color: hsl(var(--muted-foreground));
}

body.theme-checkout .wc-block-components-order-summary-item {
	display: grid !important;
	grid-template-columns: 5rem minmax(0, 1fr) auto;
	gap: 1rem;
	align-items: start;
	padding: 0.75rem 0;
	border: 0;
}

body.theme-checkout .wc-block-components-order-summary-item__image {
	display: block !important;
	width: 5rem !important;
	min-width: 5rem !important;
	height: 6rem !important;
	border-radius: calc(var(--radius) - 2px);
	overflow: hidden;
	background: hsl(var(--secondary));
	flex-shrink: 0;
}

body.theme-checkout .wc-block-components-order-summary-item__image img,
body.theme-checkout .wc-block-components-order-summary-item__image picture {
	width: 100% !important;
	height: 100% !important;
	object-fit: cover !important;
	display: block !important;
}

body.theme-checkout .wc-block-components-order-summary-item--has-image {
	grid-template-columns: 5rem minmax(0, 1fr) auto;
}

body.theme-checkout .wc-block-components-product-name {
	font-family: var(--font-body);
	font-size: 0.875rem;
	font-weight: 500;
	color: hsl(var(--foreground));
	display: block;
	margin-bottom: 0.25rem;
}

body.theme-checkout .wc-block-components-order-summary-item__description,
body.theme-checkout .wc-block-components-order-summary-item__individual-prices {
	font-family: var(--font-body);
	font-size: 0.75rem;
	color: hsl(var(--muted-foreground));
}

body.theme-checkout .wc-block-components-order-summary-item__total-price {
	font-family: var(--font-body);
	font-size: 0.875rem;
	font-weight: 500;
	white-space: nowrap;
}

body.theme-checkout .wc-block-components-totals-item,
body.theme-checkout .wc-block-components-totals-footer-item {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	font-family: var(--font-body);
	font-size: 0.875rem;
	padding: 0.35rem 0;
}

body.theme-checkout .wc-block-components-totals-footer-item {
	font-size: 1rem;
	font-weight: 600;
	padding-top: 0.75rem;
	margin-top: 0.5rem;
	border-top: 1px solid hsl(var(--border));
}

body.theme-checkout .wc-block-components-totals-item__label {
	color: hsl(var(--muted-foreground));
}

body.theme-checkout .wc-block-checkout__terms {
	margin-top: 1.25rem;
	margin-bottom: 0.5rem;
}

body.theme-checkout .wc-block-components-checkbox__label,
body.theme-checkout .wc-block-components-radio-control__label {
	font-family: var(--font-body);
	font-size: 0.875rem;
	color: hsl(var(--foreground));
}

/* Select2 / native selects — avoid clipping dropdowns */
body.theme-checkout .woocommerce-checkout,
body.theme-checkout .entry-content,
body.theme-checkout .wc-block-checkout {
	overflow: visible !important;
}

body.theme-checkout .select2-container {
	z-index: 100;
}

/* Empty checkout shell */
.theme-checkout-empty {
	max-width: 42rem;
	margin: 0 auto;
	padding: 5rem 0;
	text-align: center;
}

.theme-checkout-empty__actions {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	justify-content: center;
	margin-top: 2rem;
}

@media (min-width: 640px) {
	.theme-checkout-empty__actions {
		flex-direction: row;
	}
}
