/* stylelint-disable selector-id-pattern */
#contact_details {
	float: none;
}

#contact_details + #customer_details {
	display: block;
}
/* stylelint-enable selector-id-pattern */

#contact-fields,
.woopay-billing-email {
	.wc-block-components-text-input,
	.woocommerce-input-wrapper {
		display: inline-block;
		position: relative;
		width: 100%;

		.wc-block-components-spinner {
			right: 10px;
			width: 24px;
		}
	}
}

.woopay-login-session-iframe {
	width: 100%;
	height: 100vh;
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate( -50%, -50% );
	z-index: 355000;
	border: 0;
	background: #fff;
	visibility: hidden;
	&.open {
		transition: top 500ms;
		visibility: visible;
	}
}

@media screen and ( min-width: 768px ) {
	.woopay-login-session-iframe-wrapper {
		position: fixed;
		background: rgba( 117, 117, 117, 0.6 );
		top: 0;
		left: 0;
		width: 100vw;
		height: 100vh;
		content: ' ';
		display: block;
		z-index: 355000;

		.woopay-login-session-iframe {
			transition: none;
			height: 90vh;
			max-height: 520px;
			position: absolute;
			max-width: 374px;
			border-radius: 8px;
		}
	}
}

.woopay-otp-iframe {
	transition: top 500ms;
	width: 100%;
	height: 100dvh; /* stylelint-disable-line unit-no-unknown */
	position: fixed;
	top: 100%;
	left: 0;
	z-index: 355000;
	border: 0;
	background: #fff;
	&.open {
		top: 0;
	}
}

.woopay-otp-iframe-wrapper {
	.arrow {
		position: fixed;
		top: 100%;
	}
}

@media screen and ( min-width: 768px ) {
	.woopay-otp-iframe-wrapper {
		position: fixed;
		background: rgba( 117, 117, 117, 0.6 );
		top: 0;
		left: 0;
		width: 100vw;
		height: 100vh;
		content: ' ';
		display: block;
		z-index: 355000;

		.woopay-otp-iframe {
			transition: none;
			height: 90vh;
			max-height: 650px;
			position: absolute;
			max-width: 374px;
			border-radius: 8px;
			right: 50px;
			left: auto;
		}

		.arrow {
			position: absolute;
			right: calc( 15px / 2 );
			background: transparent;
			width: 0;
			height: 0;
			z-index: 355001;
			border-top: 15px solid transparent;
			border-bottom: 15px solid transparent;
			border-right: 15px solid #fff;
		}
	}
}

.woopay-express-button {
	font-size: 18px;
	font-weight: 500;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue',
		'Helvetica', 'Roboto', 'Arial', sans-serif;
	letter-spacing: 0.8px;
	height: 40px;
	background: $white !important;
	border: 1px solid $white !important;
	color: $studio-black !important;
	width: 100%;
	border-radius: 4px;
	padding-top: 1px;
	padding-bottom: 1px;
	display: flex !important;
	align-items: center;
	justify-content: center;
	white-space: nowrap;
	text-transform: none;
	list-style-type: none;

	&:not( :disabled ):hover {
		background: #e0e0e0 !important;
		cursor: pointer;
	}

	&:disabled {
		opacity: 0.5;
		cursor: not-allowed;
	}

	&.is-loading,
	&.is-loading:hover,
	&.is-loading:disabled {
		opacity: 1 !important;
	}

	svg {
		fill: $studio-woocommerce-purple-60;
		position: relative;
		top: 1px;
	}

	&[data-type='buy'],
	&[data-type='book'],
	&[data-type='donate'] {
		min-width: 200px;

		svg {
			flex-shrink: 0.4;
			margin-left: 6px;
		}
	}

	&[data-width-type='wide'] {
		svg {
			flex-shrink: 1;
		}
	}

	&[data-theme='dark'] {
		background: $studio-woocommerce-purple-60 !important;
		color: $white !important;
		border-color: $studio-woocommerce-purple-60 !important;

		svg {
			fill: $white;
		}
		&:not( :disabled ):hover {
			background: #533582 !important;
		}
	}

	&[data-theme='light-outline'] {
		border-color: $studio-black !important;
		&:not( :disabled ):hover {
			background: #e0e0e0 !important;
		}
	}

	&[data-size='medium'] {
		font-size: 22px;
		height: 48px;

		svg {
			top: 2px;
			width: auto;
			height: 27px;
			min-width: 60px;
		}

		&[data-type='buy'],
		&[data-type='book'],
		&[data-type='donate'] {
			min-width: 229px;

			svg {
				flex-shrink: 0.6;
				margin-left: 8px;
			}
		}

		&[data-width-type='wide'] {
			&[data-type='buy'],
			&[data-type='book'],
			&[data-type='donate'] {
				svg {
					flex-shrink: 1;
				}
			}
		}
	}

	&[data-size='large'] {
		font-size: 26px;
		height: 55px;

		svg {
			top: 3px;
			width: auto;
			height: 32px;
			min-width: 70px;
		}

		&[data-type='buy'],
		&[data-type='book'],
		&[data-type='donate'] {
			min-width: 229px;

			svg {
				flex-shrink: 0.6;
				margin-left: 10px;
				margin-bottom: 0.25rem;
			}
		}

		&[data-width-type='wide'] {
			&[data-type='buy'],
			&[data-type='book'],
			&[data-type='donate'] {
				svg {
					flex-shrink: 1;
					margin-bottom: 0;
				}
			}
		}

		// For this width range, the button's text is too large to fit
		// in the button. The text is reduced to 22px to fit.
		@media screen and ( min-width: 785px ) and ( max-width: 850px ) {
			font-size: 22px;
		}
	}
}

@keyframes spinner__animation {
	0% {
		animation-timing-function: cubic-bezier(
			0.5856,
			0.0703,
			0.4143,
			0.9297
		);
		transform: rotate( 0deg );
	}
	100% {
		transform: rotate( 360deg );
	}
}

/**
 * Sourced from https://github.com/woocommerce/woocommerce-blocks/blob/4dfe904f761423c1ac494f0d6319c602965b5efe/assets/js/base/components/spinner/style.scss.
 * Depending on the wc-blocks version, these styles are not loaded, so they need to be included here.
 */
.wc-block-components-spinner {
	position: absolute;
	width: 100%;
	height: 100%;
	color: inherit;
	box-sizing: content-box;
	text-align: center;
	font-size: 1.25em;

	&::after {
		content: ' ';
		position: absolute;
		top: 50%;
		left: 50%;
		margin: -0.5em 0 0 -0.5em;
		width: 1em;
		height: 1em;
		box-sizing: border-box;
		transform-origin: 50% 50%;
		transform: translateZ( 0 ) scale( 0.5 );
		backface-visibility: hidden;
		border-radius: 50%;
		border: 0.2em solid currentColor;
		border-left-color: transparent;
		animation: spinner__animation 1s infinite linear;
	}
}
