/**
 * AG Stripe Elements — checkout wrappers (Stripe fields render inside iframes).
 *
 * High-specificity rules + flex row so theme / Woo “payment box” resets do not
 * strip borders or force one column. Merchants may override in the theme.
 */

.ag-stripe-elements-ui {
	box-sizing: border-box;
	max-width: 100%;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.ag-stripe-elements-ui *,
.ag-stripe-elements-ui *::before,
.ag-stripe-elements-ui *::after {
	box-sizing: border-box;
}

/* Muted panel */
.ag-stripe-elements-panel {
	position: relative;
	margin-top: 10px;
}

.ag-stripe-elements-panel--single::before {
	left: 50%;
	margin-left: -7px;
}

/* One row: number ~half, expiry + CVC ~quarter each (flex survives more theme resets than grid) */
#payment .payment_method_ag_stripe_elements .ag-stripe-elements-row--inline,
.woocommerce-checkout #payment .payment_method_ag_stripe_elements .ag-stripe-elements-row--inline,
.ag-stripe-elements-ui--split_card .ag-stripe-elements-row--inline {
	display: flex !important;
	flex-direction: row !important;
	flex-wrap: nowrap !important;
	align-items: flex-end !important;
	justify-content: flex-start !important;
	width: 100% !important;
	max-width: 100% !important;
	gap: 0.75rem 1rem !important;
	clear: both !important;
	position: relative;
	z-index: 1;
}

#payment .payment_method_ag_stripe_elements .ag-stripe-elements-row--inline > .ag-stripe-elements-field,
.woocommerce-checkout #payment .payment_method_ag_stripe_elements .ag-stripe-elements-row--inline > .ag-stripe-elements-field,
.ag-stripe-elements-ui--split_card .ag-stripe-elements-row--inline > .ag-stripe-elements-field {
	float: none !important;
	clear: none !important;
	margin: 0 !important;
	min-width: 0 !important;
	width: auto !important;
	max-width: none !important;
	display: flex !important;
	flex-direction: column !important;
	align-items: stretch !important;
}

#payment .payment_method_ag_stripe_elements .ag-stripe-elements-field--number,
.woocommerce-checkout #payment .payment_method_ag_stripe_elements .ag-stripe-elements-field--number,
.ag-stripe-elements-ui--split_card .ag-stripe-elements-field--number {
	flex: 2 1 0% !important;
}

#payment .payment_method_ag_stripe_elements .ag-stripe-elements-field--expiry,
#payment .payment_method_ag_stripe_elements .ag-stripe-elements-field--cvc,
.woocommerce-checkout #payment .payment_method_ag_stripe_elements .ag-stripe-elements-field--expiry,
.woocommerce-checkout #payment .payment_method_ag_stripe_elements .ag-stripe-elements-field--cvc,
.ag-stripe-elements-ui--split_card .ag-stripe-elements-field--expiry,
.ag-stripe-elements-ui--split_card .ag-stripe-elements-field--cvc {
	flex: 1 1 0% !important;
}

.ag-stripe-elements-label {
	display: block;
	font-size: 0.8125rem;
	font-weight: 500;
	color: #3c434a;
	margin-bottom: 6px;
	line-height: 1.3;
	letter-spacing: 0.01em;
}

/* Stripe mount targets: visible “input box” around iframe */
#payment .payment_method_ag_stripe_elements .ag-stripe-elements-mount,
.woocommerce-checkout #payment .payment_method_ag_stripe_elements .ag-stripe-elements-mount,
#ag-stripe-elements-card-block .ag-stripe-elements-mount,
.ag-stripe-elements-ui .ag-stripe-elements-mount {
	display: block !important;
	width: 100% !important;
	max-width: 100% !important;
	padding: 10px 12px !important;
	min-height: 39px !important;
	background: #fff !important;
	background-color: #fff !important;
	border: 1px solid #8c8f94 !important;
	border-radius: 6px !important;
	box-shadow: none !important;
	line-height: normal !important;
}

#payment .payment_method_ag_stripe_elements .ag-stripe-elements-mount:focus-within,
.woocommerce-checkout #payment .payment_method_ag_stripe_elements .ag-stripe-elements-mount:focus-within,
#ag-stripe-elements-card-block .ag-stripe-elements-mount:focus-within,
.ag-stripe-elements-ui .ag-stripe-elements-mount:focus-within {
	border-color: #1d2327 !important;
	box-shadow: 0 0 0 1px #1d2327 !important;
}

/* Payment Element single column */
.ag-stripe-elements-panel--single .ag-stripe-elements-field--payment {
	max-width: 100%;
}

.ag-stripe-elements-ui--payment_element .ag-stripe-elements-panel--single {
	padding-top: 1rem;
}

#ag-stripe-elements-errors {
	color: #b81c23;
	margin-top: 10px;
	font-size: 0.875rem;
}

#ag-stripe-elements-card-block {
	margin-top: 8px;
}

/* Only stack on very narrow viewports (avoid multi-column checkout triggering this early) */
@media (max-width: 400px) {
	#payment .payment_method_ag_stripe_elements .ag-stripe-elements-row--inline,
	.woocommerce-checkout #payment .payment_method_ag_stripe_elements .ag-stripe-elements-row--inline,
	.ag-stripe-elements-ui--split_card .ag-stripe-elements-row--inline {
		flex-wrap: wrap !important;
	}

	#payment .payment_method_ag_stripe_elements .ag-stripe-elements-row--inline > .ag-stripe-elements-field,
	.woocommerce-checkout #payment .payment_method_ag_stripe_elements .ag-stripe-elements-row--inline > .ag-stripe-elements-field,
	.ag-stripe-elements-ui--split_card .ag-stripe-elements-row--inline > .ag-stripe-elements-field {
		flex: 1 1 100% !important;
	}

	.ag-stripe-elements-panel::before {
		left: 1.25rem;
	}
}
