/**
 * WPTE Stripe Wallet Gateway — inline booking form.
 *
 * Theme-agnostic: everything is scoped under .wpte-swg-bf and sized with
 * custom properties. The accent colour inherits WP Travel Engine's primary
 * colour unless overridden in the plugin settings.
 */

.wpte-swg-bf {
	--wpte-swg-accent: var(--wpte-primary-color, var(--primary-color, #f0592a));
	--wpte-swg-text: #1d1d1f;
	--wpte-swg-muted: #6b7280;
	--wpte-swg-border: #d9dde3;
	--wpte-swg-bg: #ffffff;
	--wpte-swg-soft: #fdf6f1;
	--wpte-swg-dark: #111111;
	--wpte-swg-radius: 12px;
	--wpte-swg-control-h: 52px;

	box-sizing: border-box;
	container-type: inline-size;
	width: 100%;
	max-width: 100%;
	margin: 24px 0;
	padding: 24px;
	background: var(--wpte-swg-bg);
	border: 1px solid var(--wpte-swg-border);
	border-radius: 16px;
	box-shadow: 0 8px 30px rgba(17, 17, 17, 0.05);
	color: var(--wpte-swg-text);
	font-size: 15px;
	line-height: 1.45;
}

.wpte-swg-bf *,
.wpte-swg-bf *::before,
.wpte-swg-bf *::after {
	box-sizing: border-box;
}

/* WTE pads its price block and button wrap individually (0 24px); match them. */
.wpte-bf-outer .wpte-swg-bf {
	margin: 16px 0 0;
	padding: 0 24px;
	border: 0;
	box-shadow: none;
	border-radius: 0;
}

/* Hide WTE's modal trigger when the inline form replaces it. */
.wpte-swg-bf-replaces-button .wpte-bf-btn-wrap .wte-book-now {
	display: none !important;
}

.wpte-swg-bf__loading,
.wpte-swg-bf__empty,
.wpte-swg-bf__error {
	padding: 18px 0;
	color: var(--wpte-swg-muted);
	text-align: center;
}

.wpte-swg-bf__loading::before {
	content: '';
	display: inline-block;
	width: 16px;
	height: 16px;
	margin: 0 8px -3px 0;
	border: 2px solid var(--wpte-swg-border);
	border-top-color: var(--wpte-swg-accent);
	border-radius: 50%;
	animation: wpte-swg-spin 0.8s linear infinite;
}

@keyframes wpte-swg-spin {
	to { transform: rotate(360deg); }
}

.wpte-swg-bf__form {
	margin: 0;
}

/* ----- Field grid ----------------------------------------------------- */

.wpte-swg-bf__grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 16px 20px;
}

.wpte-swg-bf__field[hidden] {
	display: none;
}

.wpte-swg-bf__field--package,
.wpte-swg-bf__field--custom {
	grid-column: 1 / -1;
}

.wpte-swg-bf label.wpte-swg-bf__label {
	display: block;
	margin: 0 0 8px;
	font-weight: 600;
	font-size: 15px;
	color: var(--wpte-swg-text);
}

.wpte-swg-bf__control {
	position: relative;
}

.wpte-swg-bf .wpte-swg-bf__form input.wpte-swg-bf__input,
.wpte-swg-bf .wpte-swg-bf__form select.wpte-swg-bf__select {
	display: block;
	width: 100%;
	height: var(--wpte-swg-control-h);
	margin: 0;
	padding: 0 16px;
	background: #fff;
	border: 1px solid var(--wpte-swg-border);
	border-radius: var(--wpte-swg-radius);
	font: inherit;
	font-size: 16px;
	color: var(--wpte-swg-text);
	outline: none;
	box-shadow: none;
	transition: border-color 0.15s, box-shadow 0.15s;
}

.wpte-swg-bf .wpte-swg-bf__form input.wpte-swg-bf__input:focus,
.wpte-swg-bf .wpte-swg-bf__form select.wpte-swg-bf__select:focus {
	border-color: var(--wpte-swg-accent);
	box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}

.wpte-swg-bf .wpte-swg-bf__form select.wpte-swg-bf__select {
	padding-right: 44px;
	-webkit-appearance: none;
	appearance: none;
	background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23111' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M3 6l5 5 5-5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 16px center;
	background-size: 16px;
	cursor: pointer;
}

.wpte-swg-bf .wpte-swg-bf__form input.wpte-swg-bf__input--date {
	text-align: center;
	cursor: pointer;
}

.wpte-swg-bf .wpte-swg-bf__form .wpte-swg-bf__control--date input[type='date'] {
	text-align: left;
}

.wpte-swg-bf .wpte-swg-bf__form .wpte-swg-bf__control--date input.flatpickr-input[readonly] {
	background: #fff;
	cursor: pointer;
}

.wpte-swg-bf__hint {
	margin: 6px 0 0;
	font-size: 13px;
	color: var(--wpte-swg-muted);
}

.wpte-swg-bf__hint:empty {
	display: none;
}

.wpte-swg-bf .wpte-swg-bf__form .has-error input.wpte-swg-bf__input,
.wpte-swg-bf .wpte-swg-bf__form .has-error select.wpte-swg-bf__select,
.wpte-swg-bf .wpte-swg-bf__section.has-error {
	border-color: #d23f31;
}

.wpte-swg-bf__section.has-error {
	box-shadow: inset 3px 0 0 #d23f31;
	padding-left: 12px;
}

/* ----- Sections (travelers / extras) ---------------------------------- */

.wpte-swg-bf__section {
	margin-top: 20px;
}

.wpte-swg-bf__section[hidden] {
	display: none;
}

.wpte-swg-bf__section-title {
	margin: 0 0 8px;
	font-weight: 600;
	font-size: 15px;
}

.wpte-swg-bf__rows {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.wpte-swg-bf__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 12px 14px;
	border: 1px solid var(--wpte-swg-border);
	border-radius: var(--wpte-swg-radius);
}

.wpte-swg-bf__row-main {
	min-width: 0;
	flex: 1 1 auto;
}

.wpte-swg-bf__row-label {
	font-weight: 600;
	font-size: 15px;
}

.wpte-swg-bf__row-sublabel {
	font-weight: 500;
	font-size: 14px;
}

.wpte-swg-bf__row-meta {
	margin-top: 2px;
	font-size: 13px;
	color: var(--wpte-swg-muted);
}

.wpte-swg-bf__row-meta p {
	margin: 0;
}

.wpte-swg-bf__row-price {
	margin-top: 4px;
	font-size: 14px;
}

.wpte-swg-bf__price {
	font-weight: 700;
	color: var(--wpte-swg-text);
}

.wpte-swg-bf__price-regular {
	color: var(--wpte-swg-muted);
	font-weight: 400;
}

.wpte-swg-bf__per {
	color: var(--wpte-swg-muted);
}

.wpte-swg-bf__tiers {
	margin-top: 4px;
	font-size: 13px;
	color: var(--wpte-swg-muted);
}

.wpte-swg-bf__tiers summary {
	cursor: pointer;
	color: var(--wpte-swg-accent);
	font-weight: 600;
	list-style: none;
}

.wpte-swg-bf__tiers summary::-webkit-details-marker {
	display: none;
}

.wpte-swg-bf__tiers ul {
	margin: 4px 0 0;
	padding: 0 0 0 14px;
}

.wpte-swg-bf__tiers li {
	margin: 0;
}

/* Extra services */

.wpte-swg-bf__service {
	padding: 12px 14px;
	border: 1px solid var(--wpte-swg-border);
	border-radius: var(--wpte-swg-radius);
}

.wpte-swg-bf__service > .wpte-swg-bf__row-label {
	margin-bottom: 8px;
}

.wpte-swg-bf__service .wpte-swg-bf__row {
	padding: 8px 0 0;
	border: 0;
	border-radius: 0;
}

.wpte-swg-bf__service .wpte-swg-bf__row + .wpte-swg-bf__row {
	border-top: 1px dashed var(--wpte-swg-border);
	padding-top: 10px;
	margin-top: 4px;
}

.wpte-swg-bf__service .wpte-swg-bf__control {
	margin-bottom: 6px;
}

.wpte-swg-bf__badge {
	display: inline-block;
	margin-left: 6px;
	padding: 2px 8px;
	border-radius: 999px;
	background: #eef0f3;
	color: var(--wpte-swg-muted);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	vertical-align: middle;
}

.wpte-swg-bf__badge--req {
	background: var(--wpte-swg-soft);
	color: var(--wpte-swg-accent);
}

/* ----- Counter -------------------------------------------------------- */

.wpte-swg-bf__counter {
	display: inline-flex;
	align-items: center;
	flex: 0 0 auto;
	height: 44px;
	border: 1px solid var(--wpte-swg-border);
	border-radius: 10px;
	overflow: hidden;
	background: #fff;
}

.wpte-swg-bf button.wpte-swg-bf__step {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: var(--wpte-swg-dark);
	color: #fff;
	font: inherit;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	transition: opacity 0.15s, background-color 0.15s;
	-webkit-appearance: none;
	appearance: none;
}

.wpte-swg-bf button.wpte-swg-bf__step:hover:not(:disabled) {
	background: var(--wpte-swg-accent);
	color: #fff;
}

.wpte-swg-bf button.wpte-swg-bf__step:focus-visible {
	outline: 2px solid var(--wpte-swg-accent);
	outline-offset: -3px;
}

.wpte-swg-bf button.wpte-swg-bf__step:disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

.wpte-swg-bf output.wpte-swg-bf__count {
	min-width: 44px;
	padding: 0 6px;
	text-align: center;
	font-weight: 600;
	font-size: 16px;
	font-variant-numeric: tabular-nums;
}

/* ----- Footer / button ------------------------------------------------ */

.wpte-swg-bf__footer {
	margin-top: 20px;
}

.wpte-swg-bf__footer .wpte-swg-bf__hint {
	text-align: center;
}

.wpte-swg-bf button.wpte-swg-bf__btn {
	display: block;
	width: 100%;
	height: var(--wpte-swg-control-h);
	margin: 0;
	padding: 0 20px;
	border: 1px solid transparent;
	border-radius: var(--wpte-swg-radius);
	font: inherit;
	font-size: 17px;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.15s, opacity 0.15s, transform 0.05s;
	-webkit-appearance: none;
	appearance: none;
}

.wpte-swg-bf button.wpte-swg-bf__btn--primary {
	background: var(--wpte-swg-accent);
	color: #fff;
}

.wpte-swg-bf button.wpte-swg-bf__btn--primary:hover:not(:disabled) {
	filter: brightness(0.94);
}

.wpte-swg-bf button.wpte-swg-bf__btn--primary:active:not(:disabled) {
	transform: translateY(1px);
}

.wpte-swg-bf button.wpte-swg-bf__btn--primary:disabled {
	background: #e9ebee;
	color: #8b939c;
	cursor: not-allowed;
}

.wpte-swg-bf button.wpte-swg-bf__btn--ghost {
	width: auto;
	height: 40px;
	margin: 8px auto 0;
	background: transparent;
	border-color: var(--wpte-swg-border);
	color: var(--wpte-swg-text);
	font-size: 14px;
}

.wpte-swg-bf button.wpte-swg-bf__btn:focus-visible {
	outline: 2px solid var(--wpte-swg-accent);
	outline-offset: 2px;
}

/* ----- Summary -------------------------------------------------------- */

.wpte-swg-bf__summary {
	margin-top: 20px;
	padding: 16px 20px;
	background: var(--wpte-swg-soft);
	border: 1px solid rgba(0, 0, 0, 0.04);
	border-radius: var(--wpte-swg-radius);
}

.wpte-swg-bf__when {
	margin-bottom: 8px;
	font-size: 13px;
	font-weight: 600;
	color: var(--wpte-swg-muted);
}

.wpte-swg-bf__line {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 16px;
	padding: 4px 0;
	color: var(--wpte-swg-muted);
	font-size: 15px;
}

.wpte-swg-bf__line-label {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.wpte-swg-bf__line-label small {
	font-size: 12px;
	opacity: 0.8;
}

.wpte-swg-bf__line-amount {
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

.wpte-swg-bf__line--total {
	margin-top: 8px;
	padding-top: 12px;
	border-top: 1px solid rgba(0, 0, 0, 0.08);
	color: var(--wpte-swg-text);
	font-weight: 700;
	font-size: 18px;
}

.wpte-swg-bf__total {
	color: var(--wpte-swg-accent);
	font-size: 20px;
}

.wpte-swg-bf__note {
	margin: 10px 0 0;
	font-size: 13px;
	color: var(--wpte-swg-muted);
}

/* ----- Messages ------------------------------------------------------- */

.wpte-swg-bf__message {
	margin-top: 12px;
	font-size: 14px;
	color: var(--wpte-swg-muted);
}

.wpte-swg-bf__message:empty {
	display: none;
}

.wpte-swg-bf__message.is-error {
	padding: 10px 14px;
	border-radius: 10px;
	background: #fdecea;
	color: #b3261e;
}

.wpte-swg-bf__message.is-success {
	padding: 10px 14px;
	border-radius: 10px;
	background: #e8f5ec;
	color: #1e7b3a;
}

/* ----- Flatpickr accents ---------------------------------------------- */

.wpte-swg-bf__control--date .flatpickr-wrapper {
	display: block;
	position: relative;
	width: 100%;
}

.wpte-swg-bf__control--date .flatpickr-calendar.static.open {
	z-index: 20;
	margin-top: 6px;
	border: 1px solid var(--wpte-swg-border);
	box-shadow: 0 10px 30px rgba(17, 17, 17, 0.12);
}

.wpte-swg-bf__control--date .flatpickr-day.selected,
.wpte-swg-bf__control--date .flatpickr-day.selected:hover {
	background: var(--wpte-swg-accent);
	border-color: var(--wpte-swg-accent);
}

.flatpickr-day.wpte-swg-bf__day--low {
	box-shadow: inset 0 -3px 0 var(--wpte-swg-accent, #f0592a);
}

/* ----- Sidebar placement: denser on desktop so it fits beside the content  */

@media (min-width: 1025px) {
	.wpte-bf-outer .wpte-swg-bf {
		--wpte-swg-control-h: 46px;
		--wpte-swg-radius: 10px;
		font-size: 14px;
	}

	.wpte-bf-outer .wpte-swg-bf .wpte-swg-bf__grid {
		gap: 12px 16px;
	}

	.wpte-bf-outer .wpte-swg-bf label.wpte-swg-bf__label,
	.wpte-bf-outer .wpte-swg-bf .wpte-swg-bf__section-title {
		margin-bottom: 6px;
		font-size: 14px;
	}

	.wpte-bf-outer .wpte-swg-bf .wpte-swg-bf__form input.wpte-swg-bf__input,
	.wpte-bf-outer .wpte-swg-bf .wpte-swg-bf__form select.wpte-swg-bf__select {
		font-size: 15px;
		padding-left: 14px;
	}

	.wpte-bf-outer .wpte-swg-bf .wpte-swg-bf__section {
		margin-top: 14px;
	}

	.wpte-bf-outer .wpte-swg-bf .wpte-swg-bf__rows {
		gap: 8px;
	}

	.wpte-bf-outer .wpte-swg-bf .wpte-swg-bf__row,
	.wpte-bf-outer .wpte-swg-bf .wpte-swg-bf__service {
		padding: 10px 12px;
	}

	.wpte-bf-outer .wpte-swg-bf .wpte-swg-bf__row-label {
		font-size: 14px;
	}

	.wpte-bf-outer .wpte-swg-bf .wpte-swg-bf__row-meta,
	.wpte-bf-outer .wpte-swg-bf .wpte-swg-bf__row-price {
		font-size: 13px;
	}

	.wpte-bf-outer .wpte-swg-bf .wpte-swg-bf__counter {
		height: 40px;
	}

	.wpte-bf-outer .wpte-swg-bf button.wpte-swg-bf__step {
		width: 40px;
		font-size: 18px;
	}

	.wpte-bf-outer .wpte-swg-bf output.wpte-swg-bf__count {
		min-width: 40px;
		font-size: 15px;
	}

	.wpte-bf-outer .wpte-swg-bf .wpte-swg-bf__footer,
	.wpte-bf-outer .wpte-swg-bf .wpte-swg-bf__summary {
		margin-top: 14px;
	}

	.wpte-bf-outer .wpte-swg-bf button.wpte-swg-bf__btn {
		font-size: 16px;
	}

	.wpte-bf-outer .wpte-swg-bf .wpte-swg-bf__summary {
		padding: 12px 16px;
	}

	.wpte-bf-outer .wpte-swg-bf .wpte-swg-bf__line {
		padding: 2px 0;
		font-size: 14px;
	}

	.wpte-bf-outer .wpte-swg-bf .wpte-swg-bf__line--total {
		margin-top: 6px;
		padding-top: 8px;
		font-size: 16px;
	}

	.wpte-bf-outer .wpte-swg-bf .wpte-swg-bf__total {
		font-size: 18px;
	}

	/* Inside a sticky/fixed sidebar: cap at the viewport and scroll internally (height set by JS). */
	.wpte-swg-bf-fit {
		overflow-y: auto;
		overscroll-behavior: contain;
		scrollbar-width: thin;
	}

	.wpte-swg-bf-fit::-webkit-scrollbar {
		width: 6px;
	}

	.wpte-swg-bf-fit::-webkit-scrollbar-thumb {
		background: rgba(0, 0, 0, 0.18);
		border-radius: 3px;
	}
}

/* ----- Sidebar placement: inline on desktop, full-screen sheet on mobile  */

/* WTE styles .wpte-bf-btn with deep selectors — !important is deliberate. */
button.wpte-swg-bf-trigger.wpte-bf-btn {
	display: none !important;
}

.wpte-swg-bf__sheet-head {
	display: none;
}

html.wpte-swg-bf-lock,
html.wpte-swg-bf-lock body {
	overflow: hidden !important;
}

@media (max-width: 1024px) {
	button.wpte-swg-bf-trigger.wpte-bf-btn {
		display: inline-flex !important;
		align-items: center;
		justify-content: center;
		white-space: nowrap;
	}

	.wpte-swg-bf--sheet {
		display: none;
		position: fixed;
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		z-index: 100001;
		margin: 0;
		padding: 0 20px calc(32px + env(safe-area-inset-bottom, 0px));
		border: 0;
		border-radius: 0;
		box-shadow: none;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		overscroll-behavior: contain;
	}

	.wpte-swg-bf--sheet.is-open {
		display: block;
	}

	.wpte-swg-bf--sheet .wpte-swg-bf__sheet-head {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
		position: sticky;
		top: 0;
		z-index: 2;
		margin: 0 -20px 16px;
		padding: calc(14px + env(safe-area-inset-top, 0px)) 20px 14px;
		background: var(--wpte-swg-bg);
		border-bottom: 1px solid var(--wpte-swg-border);
	}

	.wpte-swg-bf__sheet-title {
		font-weight: 700;
		font-size: 17px;
		line-height: 1.3;
	}

	.wpte-swg-bf button.wpte-swg-bf__close {
		flex: 0 0 auto;
		width: 40px;
		height: 40px;
		margin: 0;
		padding: 0;
		border: 1px solid var(--wpte-swg-border);
		border-radius: 50%;
		background: #fff;
		color: var(--wpte-swg-text);
		font: inherit;
		font-size: 26px;
		line-height: 1;
		cursor: pointer;
		-webkit-appearance: none;
		appearance: none;
	}

	.wpte-swg-bf button.wpte-swg-bf__close:focus-visible {
		outline: 2px solid var(--wpte-swg-accent);
		outline-offset: 2px;
	}
}

/* ----- Responsive ----------------------------------------------------- */

@media (max-width: 480px) {
	.wpte-swg-bf {
		padding: 18px;
	}

	.wpte-swg-bf__grid {
		grid-template-columns: minmax(0, 1fr);
	}

	.wpte-swg-bf__row {
		flex-wrap: wrap;
	}

	.wpte-swg-bf__row .wpte-swg-bf__counter {
		margin-left: auto;
	}
}

/* Narrow sidebars: stack Date/Time whatever the viewport. */
@container (max-width: 420px) {
	.wpte-swg-bf__grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

@media (prefers-reduced-motion: reduce) {
	.wpte-swg-bf * {
		transition: none !important;
		animation: none !important;
	}
}
