/**
 * PT Booking Popup
 * Full-screen booking modal for Perfect Teeth.
 */

.pt-bp-overlay {
	position: fixed;
	inset: 0;
	/* Fallback for browsers without inset support. */
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	box-sizing: border-box;
	background: rgba(0, 0, 0, 0.72);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	/* Visibility is switched with a delay rather than transitioned. Putting
	   it in the transition would keep the computed value "hidden" until the
	   animation starts, and a hidden element cannot take focus. The delay
	   holds it visible for the length of the fade out. */
	transition: opacity 200ms ease, visibility 0s linear 200ms;
}

.pt-bp-overlay.is-open {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	/* No delay on the way in, so the overlay is focusable straight away. */
	transition: opacity 200ms ease, visibility 0s linear 0s;
	/* Touch handling belongs on the open state only. Once the portal has been
	   preloaded the overlay stays in the page, and a permanent full-viewport
	   layer with touch-action:none would stop the page scrolling on a phone. */
	-webkit-overflow-scrolling: auto;
	overscroll-behavior: contain;
	touch-action: none;
}

.pt-bp-overlay * {
	box-sizing: border-box;
}

/* Modal container */
.pt-bp-modal {
	position: relative;
	width: 100%;
	max-width: 900px;
	height: 100%;
	max-height: 900px;
	background: #fff;
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
	transform: translateY(12px) scale(0.99);
	transition: transform 200ms ease;
}

.pt-bp-overlay.is-open .pt-bp-modal {
	transform: translateY(0) scale(1);
}

/* Iframe */
.pt-bp-frame {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
	opacity: 0;
	transition: opacity 200ms ease;
	background: transparent;
}

.pt-bp-modal.is-loaded .pt-bp-frame {
	opacity: 1;
}

/* Close button */
.pt-bp-close {
	position: absolute;
	top: 8px;
	right: 8px;
	z-index: 2;
	width: 44px;
	height: 44px;
	min-width: 44px;
	min-height: 44px;
	padding: 0;
	margin: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 50%;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
	color: #1a1a1a;
	cursor: pointer;
	line-height: 1;
	-webkit-appearance: none;
	appearance: none;
	transition: background 150ms ease, color 150ms ease;
}

.pt-bp-close:hover,
.pt-bp-close:focus {
	background: #1a1a1a;
	color: #fff;
	outline: none;
}

.pt-bp-close:focus-visible {
	outline: 2px solid #0a7ea4;
	outline-offset: 2px;
}

.pt-bp-close svg {
	display: block;
	width: 18px;
	height: 18px;
	pointer-events: none;
}

/* Loading state */
.pt-bp-loader {
	position: absolute;
	inset: 0;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #fff;
	transition: opacity 200ms ease, visibility 0s linear 0s;
}

.pt-bp-modal.is-loaded .pt-bp-loader {
	opacity: 0;
	visibility: hidden;
	transition: opacity 200ms ease, visibility 0s linear 200ms;
}

.pt-bp-spinner {
	width: 38px;
	height: 38px;
	border: 3px solid rgba(0, 0, 0, 0.12);
	border-top-color: #1a1a1a;
	border-radius: 50%;
	animation: pt-bp-spin 700ms linear infinite;
}

@keyframes pt-bp-spin {
	to {
		transform: rotate(360deg);
	}
}

/* Screen-reader only text */
.pt-bp-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Scroll lock */
html.pt-bp-locked,
body.pt-bp-locked {
	overflow: hidden !important;
}

body.pt-bp-locked {
	/* iOS Safari keeps scrolling the body behind a fixed overlay unless the
	   body itself is taken out of the scroll flow. The JS restores the
	   original scroll position on close. */
	position: fixed;
	width: 100%;
	touch-action: none;
}

/* Mobile: true full screen */
@media (max-width: 767px) {
	.pt-bp-overlay {
		padding: 0;
		background: rgba(0, 0, 0, 0.9);
	}

	.pt-bp-modal {
		width: 100%;
		max-width: none;
		height: 100%;
		max-height: none;
		border-radius: 0;
		box-shadow: none;
	}

	.pt-bp-close {
		/* Fixed so it never scrolls away inside the viewport. */
		position: fixed;
		top: 10px;
		right: 10px;
		width: 46px;
		height: 46px;
	}
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
	.pt-bp-overlay,
	.pt-bp-modal,
	.pt-bp-frame,
	.pt-bp-loader {
		transition-duration: 1ms;
	}

	.pt-bp-spinner {
		animation-duration: 2s;
	}
}
