/**
 * Booking form (Contact Form 7). CF7's own stylesheet is not loaded, so this
 * file also covers its status messages, error tips, and screen-reader region.
 */

.booking-form {
	position: relative;
	max-width: 40rem;
	container: booking-form / inline-size;

	/* Clear the sticky header when a booking button scrolls here. */
	scroll-margin-top: var(--space-9);
}

.booking-form__intro {
	margin-bottom: var(--space-6);
	color: var(--color-text-muted);
}

/* Ime | Prezime always share a row; the other fields join them in pairs
   once the form is wide enough, except full ones (the contact form's name
   and message). */
.booking-form__fields {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0 var(--space-4);
}

.booking-form__wide,
.booking-form__full {
	grid-column: 1 / -1;
}

@container booking-form (min-width: 28rem) {

	.booking-form__fields .booking-form__wide:not(:last-child) {
		grid-column: auto;
	}
}

/* align-content: inputs in a row line up even when one label wraps. */
.booking-form .field {
	gap: var(--space-1);
	align-content: end;
	margin-bottom: var(--space-4);
}

.field__optional {
	color: var(--color-text-muted);
	font-size: var(--step--1);
	font-weight: 400;
}

.booking-form .wpcf7-form-control-wrap {
	display: block;
}

/* CF7 wraps its hidden fields in a fieldset. */
.booking-form .hidden-fields-container {
	margin: 0;
	padding: 0;
	border: 0;
}

/* Honeypot: invisible to people and to assistive technology. */
.booking-form__trap {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* Error tip under a field (aria-hidden; the field's aria-describedby points
   to the screen-reader list instead). */
.booking-form .wpcf7-not-valid-tip {
	display: block;
	margin-top: var(--space-2);
	color: var(--color-error);
	font-size: var(--step--1);
	font-weight: 600;
}

/* While "Pošalji" is pressed (booking-form.js): tips must not move it. */
.booking-form form.is-pressing .wpcf7-not-valid-tip {
	display: none;
}

.booking-form .wpcf7 .screen-reader-response {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.booking-form__privacy {
	margin-bottom: var(--space-4);
	color: var(--color-text-muted);
	font-size: var(--step--1);
}

/* Cloudflare Turnstile (contact form, once its keys are set). */
.booking-form .wpcf7-turnstile {
	margin-bottom: var(--space-4);
}

.booking-form__actions {
	display: flex;
	gap: var(--space-3);
	align-items: center;
}

@container booking-form (max-width: 27.99rem) {

	.booking-form__actions .wpcf7-submit {
		width: 100%;
	}
}

.booking-form .wpcf7-spinner {
	display: none;
}

.booking-form form.submitting .wpcf7-submit {
	opacity: 0.6;
	cursor: progress;
}

/* Status message after sending. */
.booking-form .wpcf7-response-output {
	margin: var(--space-5) 0 0;
	padding: var(--space-4);
	border: 2px solid var(--color-border-strong);
	border-radius: var(--radius-card);
	font-weight: 600;
}

/* The confirmation replaces CF7's message (still shown without JS). */
.booking-form:has(.booking-form__success) .wpcf7-response-output {
	display: none;
}

.booking-form form.init .wpcf7-response-output,
.booking-form form.resetting .wpcf7-response-output,
.booking-form form.submitting .wpcf7-response-output {
	display: none;
}

.booking-form form.sent .wpcf7-response-output {
	border-color: var(--color-success);
	color: var(--color-success);
}

.booking-form form.invalid .wpcf7-response-output,
.booking-form form.unaccepted .wpcf7-response-output,
.booking-form form.spam .wpcf7-response-output,
.booking-form form.failed .wpcf7-response-output,
.booking-form form.aborted .wpcf7-response-output {
	border-color: var(--color-error);
	color: var(--color-error);
}

/* Confirmation over the sent form (booking-form.js), in the form's space. */
.booking-form__success {
	position: absolute;
	z-index: 1;
	inset: 0;
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
	align-items: center;
	justify-content: center;
	padding: var(--space-5);
	background: var(--color-surface);
	color: var(--color-text);
	font-size: var(--step-1);
	font-weight: 600;
	text-align: center;
}

.booking-form__success p {
	max-width: 26rem;
	margin: 0;
}

.booking-form__success-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 4rem;
	height: 4rem;
	border-radius: var(--radius-pill);
	background: color-mix(in srgb, var(--color-success) 12%, var(--color-surface));
	color: var(--color-success);
}
