/* POS-BOOKING booking widget and cost breakdown. License: GPLv3. */

.posbooking-mobile-booking-entry {
	display: none;
}

.posbooking-mobile-booking-header a {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	color: var(--pb-brand);
	text-decoration: underline;
}

.posbooking-mobile-booking-header a:focus-visible {
	outline: 2px solid var(--pb-brand);
	outline-offset: 2px;
}

@media (max-width: 600px) {
	#buchen .posbooking-mobile-booking-entry {
		display: block;
	}

	#buchen .posbooking-mobile-booking-entry a {
		display: flex;
		justify-content: center;
		min-height: 44px;
	}

	#buchen .posbooking-mobile-booking-entry + .latepoint-book-form-wrapper {
		display: none;
	}

	.latepoint-clean-body.with-pattern > .latepoint-w:has(> .posbooking-mobile-booking-header) {
		display: grid;
		grid-template-rows: auto 1fr;
		min-height: 100vh;
		min-height: 100dvh;
		padding: 0;
		background: var(--pb-surface);
	}

	.posbooking-mobile-booking-header {
		padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
		border-bottom: 1px solid var(--pb-line);
	}

	.posbooking-mobile-booking-header + .latepoint-book-form-wrapper > .latepoint-inline-form {
		height: 100%;
		margin: 0;
	}

	.posbooking-mobile-booking-header + .latepoint-book-form-wrapper > .latepoint-inline-form .latepoint-booking-form-element {
		border-radius: 0;
		box-shadow: none;
	}

	.posbooking-mobile-booking-header + .latepoint-book-form-wrapper .latepoint-form-w,
	.posbooking-mobile-booking-header + .latepoint-book-form-wrapper .latepoint-heading-w {
		border-radius: 0;
	}

	.posbooking-mobile-booking-header + .latepoint-book-form-wrapper .time-selector-w {
		margin-inline: 0;
		padding-inline: 12px;
	}

	.posbooking-mobile-booking-header + .latepoint-book-form-wrapper .latepoint-heading-w .latepoint-lightbox-summary-trigger {
		min-width: 44px;
		min-height: 44px;
		align-content: center;
		text-align: center;
	}

	.posbooking-mobile-booking-header + .latepoint-book-form-wrapper .dp-timebox {
		align-content: center;
		min-height: 44px;
	}

	/* Keep the unit-price label and optional quantity inside the extra card. */
	:is(.posbooking-mobile-booking-header + .latepoint-book-form-wrapper > .latepoint-inline-form, .latepoint-w.latepoint-lightbox-form) .os-service-extras .os-item > .os-service-extra-selector {
		flex-wrap: wrap;
	}

	:is(.posbooking-mobile-booking-header + .latepoint-book-form-wrapper > .latepoint-inline-form, .latepoint-w.latepoint-lightbox-form) .os-service-extras .os-item > .os-service-extra-selector .os-item-name-w {
		flex: 1 1 7rem;
		min-width: 0;
		overflow-wrap: anywhere;
	}

	:is(.posbooking-mobile-booking-header + .latepoint-book-form-wrapper > .latepoint-inline-form, .latepoint-w.latepoint-lightbox-form) .os-service-extras .os-item > .os-service-extra-selector .os-item-price-w {
		flex: 0 1 max(36%, 8rem);
		margin-left: auto;
	}

	:is(.posbooking-mobile-booking-header + .latepoint-book-form-wrapper > .latepoint-inline-form, .latepoint-w.latepoint-lightbox-form) .os-service-extras .os-item > .os-service-extra-selector .os-item-price-w > .os-item-price-label {
		white-space: normal;
		overflow-wrap: anywhere;
	}
}

/* Give long labels their own wrapping column; keep the complete amount apart. */
.latepoint-w .summary-price-breakdown-wrapper .summary-price-item-w {
	display: grid;
	grid-template-columns: minmax(0, 1fr) max-content;
	column-gap: 12px;
	align-items: baseline;
}

.latepoint-w .summary-price-breakdown-wrapper .summary-price-item-w > .spi-name {
	min-width: 0;
	overflow-wrap: anywhere;
}

.latepoint-w .summary-price-breakdown-wrapper .summary-price-item-w > .spi-price {
	white-space: nowrap;
	text-align: right;
}

/* Use the same maximum width as the inline booking form. */
:where(body:not(.wp-admin)) .booking-form-in-lightbox:has(> .latepoint-lightbox-i > .latepoint-lightbox-form) {
	grid-template-columns: min(100%, 1060px);
}

:where(body:not(.wp-admin)) .booking-form-in-lightbox > .latepoint-lightbox-i:has(> .latepoint-lightbox-form) {
	min-width: 0;
}

:where(body:not(.wp-admin)) .latepoint-lightbox-form > .latepoint-booking-form-element {
	width: 100%;
	min-width: 0;
}

:where(body:not(.wp-admin)) .latepoint-lightbox-form .latepoint-booking-form-element > .latepoint-form-w {
	flex: 1 1 0;
	min-width: 0;
}

/* Use the available page/Divi column width, including on wide screens. */
:where(body:not(.wp-admin)) :is(.latepoint-book-form-wrapper, .latepoint-lightbox-form) {
	container: posbooking-booking / inline-size;
	max-width: 100%;
}

:where(body:not(.wp-admin)) .latepoint-book-form-wrapper > .latepoint-inline-form .latepoint-booking-form-element {
	width: 1060px;
	max-width: 100%;
	min-width: 0;
}

:where(body:not(.wp-admin)) .latepoint-book-form-wrapper > .latepoint-inline-form .latepoint-booking-form-element > .latepoint-form-w {
	flex: 1 1 0;
	width: auto;
	max-width: 100%;
	min-width: 0;
}

/* Native display:none, open-state transform and transitions remain authoritative. */
:where(body:not(.wp-admin)) :is(.latepoint-book-form-wrapper > .latepoint-inline-form, .latepoint-w.latepoint-lightbox-form) .latepoint-booking-form-element > .latepoint-summary-w {
	flex: 0 0 390px;
	width: 390px;
}

/* Keep each amount/currency together, with its existing label on the next line. */
:where(body:not(.wp-admin)) :is(.latepoint-book-form-wrapper > .latepoint-inline-form, .latepoint-w.latepoint-lightbox-form) .os-item-price-w > .os-item-price {
	white-space: nowrap;
}

:where(body:not(.wp-admin)) :is(.latepoint-book-form-wrapper > .latepoint-inline-form, .latepoint-w.latepoint-lightbox-form) .step-services-w .os-services.os-as-rows .os-item-name-w {
	min-width: 0;
	overflow-wrap: anywhere;
}

/* Duration offers need normal flow for the complete cart/item price labels. */
:where(body:not(.wp-admin)) :is(.latepoint-book-form-wrapper > .latepoint-inline-form, .latepoint-w.latepoint-lightbox-form) .latepoint-booking-form-element .latepoint-step-content .os-service-durations {
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}

:where(body:not(.wp-admin)) :is(.latepoint-book-form-wrapper > .latepoint-inline-form, .latepoint-w.latepoint-lightbox-form) .latepoint-booking-form-element .latepoint-step-content .os-service-durations .os-duration-item {
	min-width: 0;
	break-inside: avoid;
}

:where(body:not(.wp-admin)) :is(.latepoint-book-form-wrapper > .latepoint-inline-form, .latepoint-w.latepoint-lightbox-form) .latepoint-booking-form-element .latepoint-step-content .os-service-durations .os-duration-item > .os-service-duration-selector {
	display: flex;
	flex-direction: column;
	gap: 12px;
	min-width: 0;
	padding: 20px 16px;
}

:where(body:not(.wp-admin)) :is(.latepoint-book-form-wrapper > .latepoint-inline-form, .latepoint-w.latepoint-lightbox-form) .latepoint-booking-form-element .latepoint-step-content .os-service-durations .os-duration-name {
	font-weight: 600;
	line-height: 1.4;
	overflow-wrap: anywhere;
}

:where(body:not(.wp-admin)) :is(.latepoint-book-form-wrapper > .latepoint-inline-form, .latepoint-w.latepoint-lightbox-form) .latepoint-booking-form-element .latepoint-step-content .os-service-durations .os-duration-price {
	position: static;
	width: 100%;
	min-width: 0;
	margin-top: auto;
	padding: 12px 0 0;
	border-top: 1px solid var(--pb-line);
}

:where(body:not(.wp-admin)) :is(.latepoint-book-form-wrapper > .latepoint-inline-form, .latepoint-w.latepoint-lightbox-form) .latepoint-booking-form-element .latepoint-step-content .os-service-durations .os-duration-price .os-item-price-w {
	display: flex;
	flex-direction: column;
	gap: 6px;
	width: 100%;
	max-width: none;
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

:where(body:not(.wp-admin)) :is(.latepoint-book-form-wrapper > .latepoint-inline-form, .latepoint-w.latepoint-lightbox-form) .latepoint-booking-form-element .latepoint-step-content .os-service-durations .os-duration-price .os-item-price-w .os-item-price-label {
	white-space: normal;
	overflow-wrap: anywhere;
	line-height: 1.4;
}

/* On narrow forms give each service price its own row, keeping the amount intact. */
@container posbooking-booking (width < 600px) {
	:where(body:not(.wp-admin)) :is(.latepoint-book-form-wrapper > .latepoint-inline-form, .latepoint-w.latepoint-lightbox-form) .step-services-w .os-services.os-as-rows .os-item-i {
		flex-wrap: wrap;
	}

	:where(body:not(.wp-admin)) :is(.latepoint-book-form-wrapper > .latepoint-inline-form, .latepoint-w.latepoint-lightbox-form) .step-services-w .os-services.os-as-rows .os-item-name-w {
		flex: 1 1 0;
	}

	:where(body:not(.wp-admin)) :is(.latepoint-book-form-wrapper > .latepoint-inline-form, .latepoint-w.latepoint-lightbox-form) .step-services-w .os-services.os-as-rows .os-item-i > .os-item-price-w {
		flex: 0 0 100%;
		max-width: 100%;
		margin: 12px 0 0;
		padding: 12px 0 0;
		border-left: 0;
		border-top: 1px solid var(--pb-line);
	}
}

/* Below 670 + 390 px, reuse the native summary toggle as an overlay. */
@container posbooking-booking (width < 1060px) {
	:where(body:not(.wp-admin)) .latepoint-book-form-wrapper > .latepoint-inline-form .latepoint-booking-form-element {
		width: 100%;
	}

	:where(body:not(.wp-admin)) .latepoint-book-form-wrapper > .latepoint-inline-form .latepoint-booking-form-element > .latepoint-form-w {
		flex: 1 1 auto;
		width: 100%;
	}

	:where(body:not(.wp-admin)) :is(.latepoint-book-form-wrapper > .latepoint-inline-form, .latepoint-w.latepoint-lightbox-form) .latepoint-summary-w {
		display: none !important;
	}

	:where(body:not(.wp-admin)) :is(.latepoint-book-form-wrapper > .latepoint-inline-form, .latepoint-w.latepoint-lightbox-form).latepoint-with-summary.latepoint-summary-is-open .latepoint-booking-form-element .latepoint-lightbox-summary-trigger {
		display: block;
	}

	:where(body:not(.wp-admin)) :is(.latepoint-book-form-wrapper > .latepoint-inline-form, .latepoint-w.latepoint-lightbox-form).latepoint-with-summary.latepoint-summary-is-open.show-summary-on-mobile .latepoint-booking-form-element::before {
		content: "";
		position: fixed;
		inset: 0;
		background-color: var(--pb-overlay);
		z-index: 3;
	}

	:where(body:not(.wp-admin)) :is(.latepoint-book-form-wrapper > .latepoint-inline-form, .latepoint-w.latepoint-lightbox-form).latepoint-with-summary.latepoint-summary-is-open.show-summary-on-mobile .latepoint-booking-form-element > .latepoint-summary-w {
		display: flex !important;
		position: fixed;
		top: 50%;
		left: 50%;
		bottom: auto;
		flex: 1;
		width: min(390px, 90vw);
		min-width: 0;
		max-width: 90vw;
		max-height: 90vh;
		z-index: 4;
		overflow: hidden;
		border: 1px solid var(--pb-line);
		border-radius: var(--pb-radius-lg);
		box-shadow: var(--pb-shadow-modal);
		transform: translate3d(-50%, -50%, 0);
		animation: 0.4s cubic-bezier(0.45, 1, 0.4, 1.1) 0ms LatepointSlideUpMobileSummary both;
	}

	/* Let the native inner scroll area shrink at tablet/desktop widths too. */
	:where(body:not(.wp-admin)) :is(.latepoint-book-form-wrapper > .latepoint-inline-form, .latepoint-w.latepoint-lightbox-form) .latepoint-summary-w > .os-summary-contents {
		min-height: 0;
		overflow: hidden;
	}
}

/* Terms consent box in the verify step (#566, #570). */
:where(body:not(.wp-admin)) .latepoint-w .posbooking-terms-consent {
	margin: 16px 0 0;
	padding: 12px 14px;
	border: 1px solid var(--pb-line);
	border-radius: var(--pb-radius-sm);
	background: var(--pb-surface);
}

:where(body:not(.wp-admin)) .latepoint-w .posbooking-terms-consent label {
	display: grid;
	grid-template-columns: 18px minmax(0, 1fr);
	gap: 10px;
	align-items: start;
	margin: 0;
	color: var(--pb-text);
	font-size: 14px;
	font-weight: 400;
	line-height: 1.5;
	cursor: pointer;
}

:where(body:not(.wp-admin)) .latepoint-w .posbooking-terms-consent input[type="checkbox"] {
	width: 18px;
	height: 18px;
	margin: 2px 0 0;
	accent-color: var(--pb-brand);
	cursor: pointer;
}

:where(body:not(.wp-admin)) .latepoint-w .posbooking-terms-consent input[type="checkbox"]:focus-visible {
	outline: 2px solid var(--pb-brand);
	outline-offset: 2px;
}

:where(body:not(.wp-admin)) .latepoint-w .posbooking-terms-consent a {
	color: var(--pb-brand-strong);
	text-decoration: underline;
	text-underline-offset: 2px;
}
