/* Xtendar front-end styles. Deliberately light-touch so themes stay in charge. */

.xtendar-form {
	margin: 0 0 2em;
}

.xtendar-form__title {
	margin-top: 0;
}

.xtendar-field {
	display: block;
	margin: 0 0 1em;
}

/*
 * The booking form keeps its optional rows — "How long", add-ons, address,
 * package, provider — in the markup and shows them with the `hidden` attribute
 * only once the chosen service needs them. A class selector like `.xtendar-field`
 * outranks the browser's own `[hidden] { display: none }`, so without this those
 * rows render (empty) on every form. Applies to every Xtendar element that is
 * toggled this way — filtered service cards, the "no matches" note — and never
 * to anything outside the plugin.
 */
[class*="xtendar-"][hidden] {
	display: none !important;
}

.xtendar-field label,
.xtendar-label {
	display: block;
	margin-bottom: 0.25em;
	font-weight: 600;
}

.xtendar-field input[type="text"],
.xtendar-field input[type="email"],
.xtendar-field input[type="tel"],
.xtendar-field input[type="date"],
.xtendar-field select,
.xtendar-field textarea {
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

.xtendar-required {
	color: #b32d2e;
}

/* The honeypot must be reachable by bots but invisible to people. */
.xtendar-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.xtendar-message {
	margin: 0 0 1em;
	padding: 0.75em 1em;
	border-left: 4px solid #767676;
	background: #f5f5f5;
}

.xtendar-message--success {
	border-left-color: #1c6b34;
	background: #eef7f0;
}

.xtendar-message--error {
	border-left-color: #b32d2e;
	background: #fbeeee;
}

.xtendar-message--info {
	border-left-color: #2271b1;
	background: #eef3fa;
}

.xtendar-slots__hint {
	margin: 0;
	color: #646970;
}

.xtendar-slots__list {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.xtendar-slot {
	display: inline-flex;
	align-items: center;
	padding: 0.4em 0.9em;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	cursor: pointer;
	font-weight: 500;
}

.xtendar-slot:focus-within {
	outline: 2px solid #2271b1;
	outline-offset: 1px;
}

.xtendar-slot__input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
}

/* Fallback for browsers without :has(). */
.xtendar-slot__input:checked + span {
	font-weight: 700;
	text-decoration: underline;
}

.xtendar-slot:has( .xtendar-slot__input:checked ) {
	border-color: #1c6b34;
	background: #eef7f0;
}

.xtendar-manage__details {
	margin: 0 0 1.5em;
	display: grid;
	grid-template-columns: minmax(8em, auto) 1fr;
	gap: 0.4em 1.5em;
}

.xtendar-manage__details dt {
	font-weight: 600;
}

.xtendar-manage__details dd {
	margin: 0;
}

.xtendar-manage__note {
	color: #646970;
}

.xtendar-button--danger {
	background: transparent;
	border: 1px solid #b32d2e;
	color: #b32d2e;
}

/* Service detail page. */

.xtendar-service-page {
	margin-top: 2em;
}

.xtendar-service-page__facts {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 2em;
	margin: 0 0 2em;
	padding: 1em 0;
	border-top: 1px solid rgba( 0, 0, 0, 0.1 );
	border-bottom: 1px solid rgba( 0, 0, 0, 0.1 );
}

.xtendar-service-page__label {
	display: block;
	font-size: 0.85em;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	opacity: 0.7;
}

.xtendar-service-page__value {
	display: block;
	font-size: 1.15em;
	font-weight: 600;
}

.xtendar-gateway {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	margin-right: 1em;
	font-weight: 500;
}

.xtendar-payment-note {
	margin: 0.5em 0 0;
	font-size: 0.9em;
	color: #646970;
}

/* Service list.
 *
 * The accent follows the active theme: block themes expose their palette as
 * --wp--preset--color--*, so the first one the theme actually defines wins. The
 * hex at the end is only reached on a theme that publishes no palette at all,
 * and a shortcode attribute or the setting overrides the lot.
 */
.xtendar-services-wrap {
	--xtendar-accent: var(
		--wp--preset--color--primary,
		var(
			--wp--preset--color--accent,
			var( --wp--preset--color--contrast, #14453a )
		)
	);
	--xtendar-columns: 3;

	margin: 0 0 2em;
}

.xtendar-filter {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 1.5em;
}

.xtendar-filter__button {
	padding: 0.45em 1.1em;
	border: 1px solid currentColor;
	border-radius: 999px;
	background: transparent;
	color: var( --xtendar-accent );
	font: inherit;
	font-size: 0.9em;
	line-height: 1.4;
	cursor: pointer;
	opacity: 0.75;
}

.xtendar-filter__button:hover,
.xtendar-filter__button:focus-visible {
	opacity: 1;
}

.xtendar-filter__button.is-active {
	background: var( --xtendar-accent );
	border-color: var( --xtendar-accent );
	color: #fff;
	opacity: 1;
}

.xtendar-filter__empty {
	color: #646970;
}

.xtendar-services {
	list-style: none;
	margin: 0;
	padding: 0;
}

.xtendar-services--grid {
	display: grid;
	grid-template-columns: repeat( auto-fill, minmax( 250px, 1fr ) );
	gap: 24px;
}

@media screen and (min-width: 900px) {
	.xtendar-services--grid {
		grid-template-columns: repeat( var( --xtendar-columns ), 1fr );
	}
}

.xtendar-services--grid .xtendar-service__card {
	position: relative;
	display: block;
	min-height: 320px;
	height: 100%;
	border-radius: 18px;
	overflow: hidden;
	text-decoration: none;
	color: #fff;
	background: var( --xtendar-accent );
	isolation: isolate;
}

.xtendar-service__image {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	z-index: -2;
}

.xtendar-service__wash {
	position: absolute;
	inset: 0;
	z-index: -1;
	/* Solid at the foot so the text always has contrast, clear at the top so
	   the photograph still reads. */
	background: linear-gradient( to bottom, rgba( 0, 0, 0, 0.05 ) 0%, rgba( 0, 0, 0, 0.25 ) 35%, var( --xtendar-accent ) 100% );
	opacity: 0.94;
}

.xtendar-services--grid .xtendar-service__card.has-no-image .xtendar-service__wash {
	background: var( --xtendar-accent );
	opacity: 1;
}

.xtendar-services--grid .xtendar-service__body {
	position: absolute;
	inset: auto 0 0 0;
	display: block;
	padding: 1.4em;
}

.xtendar-service__name {
	display: block;
	font-size: 1.25em;
	font-weight: 600;
	line-height: 1.3;
	margin-bottom: 0.35em;
}

.xtendar-service__description {
	display: block;
	font-size: 0.95em;
	line-height: 1.5;
	opacity: 0.92;
}

.xtendar-service__meta {
	display: flex;
	gap: 1em;
	margin-top: 0.6em;
	font-size: 0.85em;
	opacity: 0.85;
}

.xtendar-services--grid .xtendar-service__card:hover .xtendar-service__image,
.xtendar-services--grid .xtendar-service__card:focus-visible .xtendar-service__image {
	transform: scale( 1.04 );
}

.xtendar-service__image {
	transition: transform 0.4s ease;
}

@media ( prefers-reduced-motion: reduce ) {
	.xtendar-service__image {
		transition: none;
	}
}

/* List layout. */

.xtendar-services--list .xtendar-service {
	border-bottom: 1px solid rgba( 0, 0, 0, 0.1 );
}

.xtendar-services--list .xtendar-service__card {
	display: flex;
	gap: 1.2em;
	align-items: center;
	padding: 1.1em 0;
	text-decoration: none;
	color: inherit;
	position: relative;
}

.xtendar-services--list .xtendar-service__image {
	position: static;
	width: 88px;
	height: 88px;
	border-radius: 12px;
	flex: 0 0 88px;
	z-index: auto;
}

.xtendar-services--list .xtendar-service__wash {
	display: none;
}

.xtendar-services--list .xtendar-service__name {
	color: var( --xtendar-accent );
}

.xtendar-services--list .xtendar-service__description,
.xtendar-services--list .xtendar-service__meta {
	opacity: 1;
	color: #555;
}

/* ---------------------------------------------------------------------------
   The quote a customer opens from their email.
   --------------------------------------------------------------------------- */

.xtendar-quote {
	max-width: 720px;
}

.xtendar-quote__title {
	margin: 0 0 4px;
}

.xtendar-quote__meta {
	margin: 0 0 16px;
	opacity: 0.75;
	font-size: 0.9em;
}

.xtendar-quote__message {
	margin: 0 0 16px;
	white-space: pre-wrap;
}

.xtendar-quote__items {
	width: 100%;
	border-collapse: collapse;
	margin: 0 0 16px;
}

.xtendar-quote__items th,
.xtendar-quote__items td {
	padding: 8px 6px;
	text-align: left;
	border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.xtendar-quote__items thead th {
	font-size: 0.85em;
	text-transform: uppercase;
	letter-spacing: 0.4px;
	opacity: 0.7;
}

.xtendar-quote__items td:last-child,
.xtendar-quote__items th:last-child {
	text-align: right;
}

.xtendar-quote__items tfoot th {
	text-align: right;
	font-weight: 400;
}

.xtendar-quote__total th,
.xtendar-quote__total td {
	font-weight: 700;
	font-size: 1.1em;
}

.xtendar-quote__expiry,
.xtendar-quote__terms {
	font-size: 0.9em;
	opacity: 0.85;
}

.xtendar-quote__actions,
.xtendar-quote__pay {
	margin: 20px 0 0;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.xtendar-quote__decline textarea {
	width: 100%;
}

/* Enquiry and quote-request forms reuse the booking form's language. */
.xtendar-form--enquiry .xtendar-field {
	margin-bottom: 14px;
}

/* ------------------------------------------------------------------
 * Customer portal.
 *
 * Deliberately built from the same pieces as the booking form rather than
 * from a framework: the portal is part of the site the customer already
 * booked on, and it should not arrive looking like a different product.
 * Everything below is layout and spacing; colour comes from the theme.
 * ------------------------------------------------------------------ */

.xtendar-portal {
	max-width: 900px;
	margin: 0 auto;
}

.xtendar-portal__header {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: flex-end;
	justify-content: space-between;
	margin-bottom: 18px;
}

.xtendar-portal__eyebrow {
	margin: 0 0 2px;
	font-size: 0.8em;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	opacity: 0.65;
}

.xtendar-portal__title {
	margin: 0;
	line-height: 1.2;
}

.xtendar-portal__lede {
	margin: 0 0 18px;
	opacity: 0.8;
}

.xtendar-portal__signout {
	margin: 0;
}

.xtendar-portal__link-button {
	padding: 0;
	background: none;
	border: 0;
	color: inherit;
	font: inherit;
	text-decoration: underline;
	cursor: pointer;
	opacity: 0.75;
}

.xtendar-portal__link-button:hover,
.xtendar-portal__link-button:focus-visible {
	opacity: 1;
}

/* Scrolls sideways on a phone rather than wrapping into a stack of rows
 * that pushes the content off the first screen. */
.xtendar-portal__nav {
	display: flex;
	gap: 4px;
	overflow-x: auto;
	margin-bottom: 22px;
	padding-bottom: 2px;
	border-bottom: 1px solid rgba( 0, 0, 0, 0.12 );
	scrollbar-width: thin;
}

.xtendar-portal__tab {
	flex: 0 0 auto;
	padding: 9px 14px;
	border-bottom: 2px solid transparent;
	color: inherit;
	text-decoration: none;
	white-space: nowrap;
	opacity: 0.7;
}

.xtendar-portal__tab:hover,
.xtendar-portal__tab:focus-visible {
	opacity: 1;
}

.xtendar-portal__tab.is-current {
	border-bottom-color: currentColor;
	font-weight: 600;
	opacity: 1;
}

.xtendar-portal__heading {
	margin: 22px 0 10px;
	font-size: 1.05em;
}

.xtendar-portal__heading:first-child {
	margin-top: 0;
}

.xtendar-portal__empty {
	padding: 18px;
	border: 1px dashed rgba( 0, 0, 0, 0.18 );
	border-radius: 8px;
	opacity: 0.75;
}

.xtendar-portal__cards {
	display: grid;
	gap: 14px;
	grid-template-columns: repeat( auto-fit, minmax( 220px, 1fr ) );
}

.xtendar-portal__card {
	padding: 16px;
	border: 1px solid rgba( 0, 0, 0, 0.12 );
	border-radius: 10px;
}

.xtendar-portal__card-label {
	margin: 0 0 6px;
	font-size: 0.82em;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	opacity: 0.65;
}

.xtendar-portal__card-value {
	margin: 0;
	font-size: 1.25em;
	font-weight: 600;
	line-height: 1.25;
}

.xtendar-portal__card-note {
	margin: 4px 0 10px;
	opacity: 0.75;
}

.xtendar-portal__card-action {
	font-size: 0.92em;
}

.xtendar-portal__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.xtendar-portal__item {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
	align-items: flex-start;
	justify-content: space-between;
	padding: 16px 0;
	border-bottom: 1px solid rgba( 0, 0, 0, 0.1 );
}

.xtendar-portal__item.is-muted {
	opacity: 0.6;
}

.xtendar-portal__item-main {
	flex: 1 1 260px;
	min-width: 0;
}

.xtendar-portal__item-title {
	margin: 0;
	font-weight: 600;
}

.xtendar-portal__item-when {
	margin: 2px 0 8px;
	opacity: 0.8;
}

.xtendar-portal__item-actions {
	display: flex;
	flex-direction: column;
	gap: 8px;
	align-items: flex-start;
}

.xtendar-portal__facts {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 2px 14px;
	margin: 0;
	font-size: 0.94em;
}

.xtendar-portal__facts dt {
	opacity: 0.65;
}

.xtendar-portal__facts dd {
	margin: 0;
}

.xtendar-portal__sublist {
	margin: 6px 0 0;
	padding-left: 18px;
	font-size: 0.92em;
	opacity: 0.85;
}

/* Wide tables scroll inside their own box; the page never scrolls sideways. */
.xtendar-portal__scroller {
	overflow-x: auto;
}

.xtendar-portal__table {
	width: 100%;
	border-collapse: collapse;
}

.xtendar-portal__table th,
.xtendar-portal__table td {
	padding: 9px 12px;
	text-align: left;
	border-bottom: 1px solid rgba( 0, 0, 0, 0.1 );
	white-space: nowrap;
}

.xtendar-portal__table th {
	font-size: 0.82em;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	opacity: 0.65;
}

.xtendar-portal__grid {
	display: grid;
	gap: 0 14px;
	grid-template-columns: repeat( auto-fit, minmax( 200px, 1fr ) );
}

.xtendar-portal__form {
	max-width: 620px;
}

.xtendar-button--small {
	padding: 7px 12px;
	font-size: 0.92em;
}

@media ( max-width: 600px ) {
	.xtendar-portal__item {
		flex-direction: column;
	}

	.xtendar-portal__item-actions {
		flex-direction: row;
		flex-wrap: wrap;
		align-items: center;
	}
}

/* ---------------------------------------------------------------------------
 * Resource availability grid.
 * ------------------------------------------------------------------------- */

.xtendar-grid__controls {
	margin-bottom: .75rem;
}

.xtendar-grid__controls label {
	margin-right: .5rem;
	font-weight: 600;
}

.xtendar-grid__scroll {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.xtendar-grid__table {
	border-collapse: collapse;
	width: 100%;
	min-width: 32rem;
}

.xtendar-grid__table th,
.xtendar-grid__table td {
	border: 1px solid var(--xtendar-border, #d9d9de);
	padding: .35rem .5rem;
	text-align: center;
	font-size: .85rem;
	white-space: nowrap;
}

.xtendar-grid__table thead th,
.xtendar-grid__table tbody th {
	background: var(--xtendar-muted-bg, #f4f4f6);
}

.xtendar-grid__table tbody th {
	text-align: left;
}

.xtendar-grid__cell--free {
	background: #edfaef;
}

.xtendar-grid__cell--booked {
	background: #f6e9e9;
	color: #6b6b6b;
}

.xtendar-grid__cell--closed {
	background: #efeff2;
	color: #8a8a8a;
}

.xtendar-grid__cell--free a {
	display: block;
	font-weight: 600;
	text-decoration: none;
}

.xtendar-grid__cell--free a:focus {
	outline: 2px solid currentColor;
	outline-offset: 1px;
}

.xtendar-grid__key {
	margin-top: .5rem;
	font-size: .8rem;
	color: #555;
}

.xtendar-grid__swatch {
	display: inline-block;
	width: .8rem;
	height: .8rem;
	border: 1px solid var(--xtendar-border, #d9d9de);
	vertical-align: middle;
	margin: 0 .25rem 0 .75rem;
}

.xtendar-grid__swatch--free { background: #edfaef; }
.xtendar-grid__swatch--booked { background: #f6e9e9; }
.xtendar-grid__swatch--closed { background: #efeff2; }

.xtendar-grid__hint {
	color: #555;
	font-style: italic;
}

/* On a narrow screen the same table stacks: one block per resource, its times
 * as a labelled list. No second markup — the cells carry their own time label. */
@media (max-width: 600px) {
	.xtendar-grid__table,
	.xtendar-grid__table thead,
	.xtendar-grid__table tbody,
	.xtendar-grid__table tr,
	.xtendar-grid__table th,
	.xtendar-grid__table td {
		display: block;
		width: auto;
		min-width: 0;
	}

	.xtendar-grid__table thead {
		display: none;
	}

	.xtendar-grid__table tbody tr {
		margin-bottom: 1rem;
		border: 1px solid var(--xtendar-border, #d9d9de);
	}

	.xtendar-grid__table tbody th {
		font-size: 1rem;
		border-bottom: 2px solid var(--xtendar-border, #d9d9de);
	}

	.xtendar-grid__table td {
		display: flex;
		justify-content: space-between;
		text-align: right;
		border: 0;
		border-bottom: 1px solid var(--xtendar-border, #eee);
	}

	.xtendar-grid__table td::before {
		content: attr(data-label);
		font-weight: 600;
		text-align: left;
	}
}
