/**
 * Stili del frontend.
 *
 * Tutte le classi sono prefissate `lh-` e i valori derivano da custom
 * properties, così il tema può sovrascriverle senza toccare il plugin
 * (RF-8.4, rischio "conflitti CSS con il tema" §14).
 *
 * Lo stato di uno slot non è mai comunicato dal solo colore: c'è sempre
 * un'etichetta testuale o un simbolo (RNF-4.5).
 */

.lh-prenotazioni {
	--lh-color-primary: #2271b1;
	--lh-color-bg: #ffffff;
	--lh-color-text: #1d2327;
	--lh-color-muted: #646970;
	--lh-color-border: #dcdcde;
	--lh-color-success: #1a7f37;
	--lh-color-warning: #bb6a00;
	--lh-color-danger: #b32d2e;
	--lh-radius: 8px;
	--lh-font-family: inherit;
	--lh-max-width: 860px;
	--lh-spacing: 16px;

	box-sizing: border-box;
	max-width: var(--lh-max-width);
	margin-inline: auto;
	padding: var(--lh-spacing);
	background: var(--lh-color-bg);
	color: var(--lh-color-text);
	font-family: var(--lh-font-family);
	line-height: 1.5;
}

.lh-prenotazioni *,
.lh-prenotazioni *::before,
.lh-prenotazioni *::after {
	box-sizing: inherit;
}

.lh-prenotazioni :focus-visible,
.lh-account :focus-visible {
	outline: 2px solid var(--lh-color-primary, #2271b1);
	outline-offset: 2px;
}

/* -------------------------------------------------------------------------
 * Testata e passi
 * ---------------------------------------------------------------------- */

.lh-title {
	margin: 0 0 4px;
	font-size: 1.4rem;
}

.lh-subtitle {
	margin: 0 0 var(--lh-spacing);
	color: var(--lh-color-muted);
}

.lh-steps {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 var(--lh-spacing);
	padding: 0;
	list-style: none;
	counter-reset: lh-step;
}

.lh-steps__item {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 12px;
	border: 1px solid var(--lh-color-border);
	border-radius: 999px;
	color: var(--lh-color-muted);
	font-size: 0.85rem;
	counter-increment: lh-step;
}

.lh-steps__btn {
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	cursor: pointer;
}

.lh-steps__btn:disabled {
	color: inherit;
	cursor: default;
}

.lh-steps__item.is-done .lh-steps__btn {
	color: var(--lh-color-primary);
	text-decoration: underline;
}

.lh-steps__item::before {
	content: counter(lh-step);
	display: grid;
	place-items: center;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: var(--lh-color-border);
	color: var(--lh-color-text);
	font-size: 0.75rem;
	font-weight: 700;
}

.lh-steps__item.is-active {
	border-color: var(--lh-color-primary);
	color: var(--lh-color-text);
	font-weight: 600;
}

.lh-steps__item.is-active::before,
.lh-steps__item.is-done::before {
	background: var(--lh-color-primary);
	color: #fff;
}

.lh-steps__item.is-done::before {
	content: "✓";
}

.lh-live {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* -------------------------------------------------------------------------
 * Selettore prodotti
 * ---------------------------------------------------------------------- */

.lh-product-selector {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-bottom: var(--lh-spacing);
}

.lh-product-tab {
	padding: 8px 14px;
	border: 1px solid var(--lh-color-border);
	border-radius: var(--lh-radius);
	background: transparent;
	color: inherit;
	font: inherit;
	cursor: pointer;
}

.lh-product-tab.is-active {
	border-color: var(--lh-color-primary);
	background: var(--lh-color-primary);
	color: #fff;
}

.lh-product-selector--dropdown {
	display: block;
}

/* -------------------------------------------------------------------------
 * Layout calendario + slot
 * ---------------------------------------------------------------------- */

/*
 * Il layout reagisce alla larghezza del CONTENITORE, non della finestra.
 * È la differenza fra funzionare ovunque e funzionare solo a tutta pagina:
 * incorporato in una barra laterale di 400px su uno schermo da 1600px, con le
 * media query il calendario resterebbe a due colonne e sarebbe illeggibile.
 */
.lh-prenotazioni {
	container-type: inline-size;
	container-name: lh;
}

.lh-picker {
	display: grid;
	gap: var(--lh-spacing);
	grid-template-columns: 1fr;
}

@container lh (min-width: 680px) {
	.lh-picker {
		grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
	}

	.lh-calendar-right .lh-calendar {
		order: 2;
	}

	.lh-calendar-top .lh-picker {
		grid-template-columns: 1fr;
	}
}

/* Ripiego per i browser senza container query. */
@supports not (container-type: inline-size) {
	@media (min-width: 720px) {
		.lh-picker {
			grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
		}

		.lh-calendar-right .lh-calendar {
			order: 2;
		}
	}
}

/* -------------------------------------------------------------------------
 * Calendario
 * ---------------------------------------------------------------------- */

.lh-calendar {
	border: 1px solid var(--lh-color-border);
	border-radius: var(--lh-radius);
	padding: 12px;
}

.lh-calendar__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 8px;
}

.lh-calendar__month {
	margin: 0;
	font-size: 1rem;
	text-transform: capitalize;
}

.lh-calendar__nav {
	width: 36px;
	height: 36px;
	border: 1px solid var(--lh-color-border);
	border-radius: var(--lh-radius);
	background: transparent;
	color: inherit;
	font-size: 1.1rem;
	cursor: pointer;
}

.lh-calendar__nav:hover {
	border-color: var(--lh-color-primary);
}

.lh-calendar__grid {
	width: 100%;
	border-collapse: collapse;
	table-layout: fixed;
}

.lh-calendar__grid th {
	padding: 6px 0;
	color: var(--lh-color-muted);
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
}

.lh-day {
	padding: 2px;
	text-align: center;
}

.lh-day__btn {
	position: relative;
	display: grid;
	place-items: center;
	width: 100%;
	min-height: 40px;
	padding: 4px;
	border: 1px solid transparent;
	border-radius: var(--lh-radius);
	background: transparent;
	color: inherit;
	font: inherit;
	cursor: pointer;
}

.lh-day__btn[disabled] {
	color: var(--lh-color-muted);
	cursor: not-allowed;
	opacity: 0.55;
}

.lh-day__mark {
	display: block;
	width: 6px;
	height: 6px;
	margin-top: 3px;
	border-radius: 50%;
	background: transparent;
}

.lh-day--available .lh-day__mark {
	background: var(--lh-color-success);
}

.lh-day--limited .lh-day__mark {
	background: var(--lh-color-warning);
}

.lh-day--full .lh-day__mark,
.lh-day--closed .lh-day__mark {
	background: var(--lh-color-border);
}

/* Lo stato "esaurito" ha anche una barratura: non solo colore (RNF-4.5). */
.lh-day--full .lh-day__num {
	text-decoration: line-through;
}

.lh-day.is-selected .lh-day__btn {
	border-color: var(--lh-color-primary);
	background: var(--lh-color-primary);
	color: #fff;
}

.lh-day.is-selected .lh-day__mark {
	background: #fff;
}

/* Vista a elenco dei prossimi giorni disponibili (RF-4.3). */
.lh-day--row {
	padding: 0;
	text-align: left;
}

.lh-day__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	width: 100%;
	padding: 10px 12px;
	border: 0;
	border-bottom: 1px solid var(--lh-color-border);
	background: transparent;
	color: inherit;
	font: inherit;
	text-align: left;
	cursor: pointer;
}

.lh-day--row.is-selected .lh-day__row {
	background: var(--lh-color-primary);
	color: #fff;
}

.lh-day__count {
	padding: 2px 9px;
	border-radius: 999px;
	background: var(--lh-color-success);
	color: #fff;
	font-size: 0.72rem;
	font-weight: 700;
}

.lh-layout--single .lh-step {
	margin-bottom: calc( var(--lh-spacing) * 1.5 );
	padding-bottom: var(--lh-spacing);
	border-bottom: 1px solid var(--lh-color-border);
}

.lh-layout--single .lh-step:last-of-type {
	border-bottom: 0;
}

/* Promemoria della scelta, dal secondo passo in poi. */
.lh-recap {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: var(--lh-spacing);
	padding: 12px 14px;
	border: 1px solid var(--lh-color-primary);
	border-radius: var(--lh-radius);
	background: rgba(34, 113, 177, 0.07);
	background: color-mix(in srgb, var(--lh-color-primary) 7%, transparent);
}

.lh-recap__body {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 10px;
}

.lh-recap__label {
	color: var(--lh-color-muted);
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	flex-basis: 100%;
}

.lh-recap__value {
	font-size: 1rem;
}

.lh-recap__extra {
	color: var(--lh-color-muted);
	font-size: 0.85rem;
}

.lh-recap__change {
	padding: 6px 14px;
	border: 1px solid var(--lh-color-primary);
	border-radius: var(--lh-radius);
	background: transparent;
	color: var(--lh-color-primary);
	font: inherit;
	font-weight: 600;
	font-size: 0.85rem;
	cursor: pointer;
}

/* Mese senza disponibilità. */
.lh-calendar__empty {
	margin-top: 12px;
	padding: 14px;
	border: 1px dashed var(--lh-color-border);
	border-radius: var(--lh-radius);
	text-align: center;
}

.lh-calendar__empty-text {
	margin: 0 0 10px;
	color: var(--lh-color-muted);
	font-size: 0.9rem;
}

.lh-btn--small {
	padding: 7px 14px;
	font-size: 0.85rem;
}

.lh-tz-note {
	margin: 10px 0 0;
	padding: 8px 10px;
	border-radius: var(--lh-radius);
	background: rgba(100, 105, 112, 0.08);
	background: color-mix(in srgb, var(--lh-color-muted) 8%, transparent);
	color: var(--lh-color-muted);
	font-size: 0.78rem;
}

.lh-calendar__loading,
.lh-calendar__error {
	padding: 24px 0;
	color: var(--lh-color-muted);
	text-align: center;
}

.lh-calendar__hint {
	margin: 8px 0 0;
	color: var(--lh-color-muted);
	font-size: 0.75rem;
}

.lh-legend-list {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin: 12px 0 0;
	padding: 0;
	list-style: none;
	color: var(--lh-color-muted);
	font-size: 0.75rem;
}

.lh-legend-list li {
	display: flex;
	align-items: center;
	gap: 5px;
}

.lh-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--lh-color-border);
}

.lh-dot--available {
	background: var(--lh-color-success);
}

.lh-dot--limited {
	background: var(--lh-color-warning);
}

.lh-dot--full {
	background: var(--lh-color-danger);
}

.lh-tz {
	margin-top: 12px;
}

/* -------------------------------------------------------------------------
 * Slot
 * ---------------------------------------------------------------------- */

.lh-slots__title {
	margin: 0 0 8px;
	font-size: 1rem;
}

.lh-slots__list {
	display: grid;
	gap: 8px;
	grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	margin: 0;
	padding: 0;
	list-style: none;
}

.lh-slot {
	display: flex;
	flex-direction: column;
	gap: 2px;
	width: 100%;
	padding: 10px;
	border: 1px solid var(--lh-color-border);
	border-radius: var(--lh-radius);
	background: transparent;
	color: inherit;
	font: inherit;
	text-align: left;
	cursor: pointer;
}

.lh-slot__time {
	font-weight: 600;
}

.lh-slot__meta {
	color: var(--lh-color-muted);
	font-size: 0.75rem;
}

.lh-slot--limited {
	border-color: var(--lh-color-warning);
}

.lh-slot[disabled] {
	cursor: not-allowed;
	opacity: 0.55;
}

.lh-slot[disabled] .lh-slot__time {
	text-decoration: line-through;
}

.lh-slot.is-selected {
	border-color: var(--lh-color-primary);
	background: var(--lh-color-primary);
	color: #fff;
}

.lh-slot.is-selected .lh-slot__meta {
	color: rgba(255, 255, 255, 0.85);
}

/* -------------------------------------------------------------------------
 * Campi
 * ---------------------------------------------------------------------- */

.lh-fieldset {
	margin: 0 0 var(--lh-spacing);
	padding: 0;
	border: 0;
}

.lh-legend {
	padding: 0;
	margin-bottom: 8px;
	font-size: 0.95rem;
	font-weight: 700;
}

.lh-grid {
	display: grid;
	gap: 12px;
	grid-template-columns: repeat(6, 1fr);
}

.lh-field {
	grid-column: span 6;
}

@container lh (min-width: 520px) {
	.lh-field--half {
		grid-column: span 3;
	}

	.lh-field--third {
		grid-column: span 2;
	}
}

@supports not (container-type: inline-size) {
	@media (min-width: 600px) {
		.lh-field--half {
			grid-column: span 3;
		}

		.lh-field--third {
			grid-column: span 2;
		}
	}
}

.lh-field__label {
	display: block;
	margin-bottom: 4px;
	font-size: 0.85rem;
	font-weight: 600;
}

.lh-field__required {
	color: var(--lh-color-danger);
}

.lh-input {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--lh-color-border);
	border-radius: var(--lh-radius);
	background: var(--lh-color-bg);
	color: var(--lh-color-text);
	font: inherit;
}

.lh-input:focus {
	border-color: var(--lh-color-primary);
}

.lh-field.has-error .lh-input {
	border-color: var(--lh-color-danger);
	border-width: 2px;
}

.lh-field__help {
	margin: 4px 0 0;
	color: var(--lh-color-muted);
	font-size: 0.78rem;
}

.lh-field__error {
	margin: 4px 0 0;
	color: var(--lh-color-danger);
	font-size: 0.8rem;
	font-weight: 600;
}

.lh-field__error::before {
	content: "⚠ ";
}

.lh-choices {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.lh-choice,
.lh-consent {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	font-size: 0.9rem;
	cursor: pointer;
}

.lh-consent {
	margin-bottom: 10px;
}

.lh-consent input {
	margin-top: 3px;
}

.lh-hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.lh-seats {
	margin-bottom: var(--lh-spacing);
}

.lh-input--seats {
	max-width: 140px;
}

.lh-attendee {
	margin-bottom: 12px;
	padding: 12px;
	border: 1px dashed var(--lh-color-border);
	border-radius: var(--lh-radius);
}

.lh-attendee__title {
	margin: 0 0 8px;
	font-size: 0.9rem;
}

/* -------------------------------------------------------------------------
 * Hold, azioni, messaggi
 * ---------------------------------------------------------------------- */

.lh-hold {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: var(--lh-spacing);
	padding: 10px 12px;
	border: 1px solid var(--lh-color-warning);
	border-radius: var(--lh-radius);
	color: var(--lh-color-warning);
	font-size: 0.85rem;
	font-weight: 600;
}

.lh-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: var(--lh-spacing);
}

.lh-btn {
	display: inline-block;
	padding: 11px 20px;
	border: 1px solid transparent;
	border-radius: var(--lh-radius);
	font: inherit;
	font-weight: 600;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
}

.lh-btn--primary {
	background: var(--lh-color-primary);
	color: #fff;
}

.lh-btn--secondary {
	border-color: var(--lh-color-primary);
	background: transparent;
	color: var(--lh-color-primary);
}

.lh-btn--ghost {
	border-color: var(--lh-color-border);
	background: transparent;
	color: var(--lh-color-text);
}

.lh-btn--danger {
	border-color: var(--lh-color-danger);
	background: transparent;
	color: var(--lh-color-danger);
}

.lh-btn[disabled] {
	cursor: not-allowed;
	opacity: 0.5;
}

.lh-notice {
	margin: 0 0 var(--lh-spacing);
	padding: 12px 14px;
	border-left: 4px solid var(--lh-color-primary);
	border-radius: var(--lh-radius);
	background: rgba(34, 113, 177, 0.07);
	font-size: 0.9rem;
}

.lh-notice--warning {
	border-left-color: var(--lh-color-warning);
	background: rgba(187, 106, 0, 0.08);
}

.lh-errors {
	margin: var(--lh-spacing) 0;
	padding: 12px 14px;
	border-left: 4px solid var(--lh-color-danger);
	border-radius: var(--lh-radius);
	background: rgba(179, 45, 46, 0.07);
	color: var(--lh-color-danger);
	font-weight: 600;
}

.lh-alternatives {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 10px 0 0;
	padding: 0;
	list-style: none;
}

/* -------------------------------------------------------------------------
 * Riepilogo e conferma
 * ---------------------------------------------------------------------- */

.lh-summary__list,
.lh-confirmation__meta,
.lh-card__meta {
	display: grid;
	gap: 6px 16px;
	grid-template-columns: auto 1fr;
	margin: 0;
}

.lh-summary__list dt,
.lh-confirmation__meta dt,
.lh-card__meta dt {
	color: var(--lh-color-muted);
	font-size: 0.85rem;
}

.lh-summary__list dd,
.lh-confirmation__meta dd,
.lh-card__meta dd {
	margin: 0;
	font-weight: 600;
}

.lh-confirmation {
	padding: 22px;
	border: 1px solid var(--lh-color-success);
	border-radius: var(--lh-radius);
	text-align: left;
}

.lh-confirmation__icon {
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	margin-bottom: 12px;
	border-radius: 50%;
	background: var(--lh-color-success);
	color: #fff;
	font-size: 1.3rem;
}

.lh-confirmation__title {
	margin: 0 0 6px;
	font-size: 1.2rem;
}

.lh-confirmation__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 18px;
}

.lh-confirmation__note {
	margin: 14px 0 0;
	color: var(--lh-color-muted);
	font-size: 0.8rem;
}

/* -------------------------------------------------------------------------
 * Catalogo prodotti
 * ---------------------------------------------------------------------- */

.lh-products {
	display: grid;
	gap: 18px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.lh-products--cols-2 {
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.lh-products--cols-3 {
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.lh-products--cols-4 {
	grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}

.lh-product-card__link {
	display: block;
	height: 100%;
	padding: 14px;
	border: 1px solid #dcdcde;
	border-radius: 8px;
	color: inherit;
	text-decoration: none;
}

.lh-product-card__image {
	width: 100%;
	height: auto;
	margin-bottom: 10px;
	border-radius: 6px;
}

.lh-product-card__title {
	margin: 0 0 6px;
	font-size: 1rem;
}

.lh-product-card__excerpt,
.lh-product-card__meta {
	margin: 0 0 10px;
	color: #646970;
	font-size: 0.85rem;
}

/* -------------------------------------------------------------------------
 * Area cliente
 * ---------------------------------------------------------------------- */

.lh-account {
	max-width: 720px;
	margin-inline: auto;
}

.lh-prenotazioni-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.lh-card {
	margin-bottom: 16px;
	padding: 16px;
	border: 1px solid #dcdcde;
	border-radius: 8px;
}

.lh-card--cancelled {
	opacity: 0.65;
}

.lh-card__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 10px;
}

.lh-card__title {
	margin: 0;
	font-size: 1.05rem;
}

.lh-badge {
	padding: 3px 10px;
	border: 1px solid currentColor;
	border-radius: 999px;
	font-size: 0.72rem;
	font-weight: 700;
	text-transform: uppercase;
}

.lh-badge--confirmed {
	color: #1a7f37;
}

.lh-badge--pending {
	color: #bb6a00;
}

.lh-badge--cancelled,
.lh-badge--no_show {
	color: #b32d2e;
}

.lh-card__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 14px;
}

.lh-card__reschedule {
	margin-top: 14px;
	padding-top: 14px;
	border-top: 1px solid #dcdcde;
}

/*
 * Conferma di disdetta: sta dentro la scheda, con un bordo rosso che la
 * distingue dal pannello di spostamento. È un'azione irreversibile e deve
 * sembrarlo, senza per questo diventare un muro.
 */
.lh-card__cancel {
	margin-top: 14px;
	padding: 14px;
	border: 1px solid #d63638;
	border-left-width: 4px;
	border-radius: 6px;
	background: #fcf0f1;
}

.lh-card__cancel[hidden] {
	display: none;
}

.lh-card__cancel-question {
	margin: 0 0 8px;
	line-height: 1.5;
}

.lh-card__cancel .lh-input {
	margin-bottom: 12px;
}

.lh-card__cancel-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.lh-card__message {
	margin: 12px 0 0;
	font-weight: 600;
}

.lh-magic {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: end;
}

.lh-profile {
	margin-top: 26px;
	padding-top: 16px;
	border-top: 1px solid #dcdcde;
}

.lh-profile summary {
	cursor: pointer;
	font-weight: 600;
}

/* -------------------------------------------------------------------------
 * Preferenze utente
 * ---------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.lh-prenotazioni *,
	.lh-account * {
		animation: none !important;
		transition: none !important;
		scroll-behavior: auto !important;
	}
}

@media print {
	.lh-actions,
	.lh-card__actions,
	.lh-calendar__nav {
		display: none;
	}
}
