@import '../style';

#payment .payment_method_woocommerce_payments .testmode-info {
	margin-bottom: 0.5em;
}

#wcpay-upe-element,
.wcpay-upe-element {
	padding: 7px 7px;
	margin-bottom: 0.5em;

	&.processing {
		min-height: 70px;
	}
}

.wcpay-checkout-email-field {
	position: relative;
}

.wcpay-checkout-email-field button.wcpay-stripelink-modal-trigger {
	display: none;
	position: absolute;
	right: 5px;
	width: 64px;
	height: 40px;
	background: no-repeat url( 'assets/images/payment-methods/link.svg?asset' );
	background-color: none;
	cursor: pointer;
	border: none;
}

#payment .payment_methods {
	li[class*='payment_method_woocommerce_payments'] > label > img {
		float: right;
		border: 0;
		padding: 0;
		height: 24px !important;
		max-height: 24px !important;
	}

	&.wc_payment_methods,
	&.woocommerce-PaymentMethods {
		li.payment_method_woocommerce_payments {
			display: grid;
			grid-template-columns: 0fr 0fr 1fr;
			grid-template-rows: max-content;

			> input[name='payment_method'] {
				align-self: center;
			}
			> label {
				grid-column: 3;
				display: grid;
				grid-template-columns: 0fr auto;
				grid-template-rows: max-content;
				grid-gap: 0;
				margin-bottom: 0;

				> .label-title-container {
					grid-area: 1 / 2 / 2 / 3;
				}

				.payment-method-title {
					margin-right: 8px;
				}

				.test-mode.badge {
					display: inline-block;
					background-color: #fff2d7;
					border-radius: 4px;
					padding: 4px 6px;
					font-size: 12px;
					font-weight: 400;
					line-height: 16px;
					color: #4d3716;
					vertical-align: middle;
				}

				img {
					float: none;
					grid-area: 1 / 4 / 2 / 5;
					align-self: baseline;
					justify-self: end;
					margin-left: 1em;
				}
			}
			> div.payment_box {
				grid-area: 2 / 1 / 3 / 4;
			}
		}
	}
}

li.wc_payment_method:has( .input-radio:not( :checked )
		+ label
		.stripe-pmme-container ) {
	display: grid;
	grid-template-columns: min-content 1fr;
	grid-template-rows: auto auto;
	align-items: baseline;

	.input-radio {
		grid-row: 1;
		grid-column: 1;
	}

	label {
		grid-column: 2;
		grid-row: 1;
	}

	img {
		grid-row: 1 / span 2;
		align-self: center;
	}

	.stripe-pmme-container {
		width: 100%;
		grid-column: 1;
		grid-row-start: 2;
		pointer-events: none;
	}

	.payment_box {
		flex: 0 0 100%;
		grid-row: 2;
		grid-column: 1 / span 2;
	}
}

li.wc_payment_method:has( .input-radio:checked
		+ label
		.stripe-pmme-container ) {
	display: block;

	.input-radio:checked {
		+ label {
			.stripe-pmme-container {
				display: none;
			}

			img {
				grid-column: 2;
			}
		}
	}
}
