/*
 * Widget di prenotazione — Terra Surti
 *
 * Due regole che sembrano pedanteria e non lo sono:
 *
 * 1. Ogni selettore è scopato sotto .tse-booking. Il tema attuale stila h3,
 *    button e input con selettori tipo ".fusion-post-content h3", che battono
 *    per specificità una classe da sola: senza il prefisso il titolo del mese
 *    esce nel corsivo decorativo del sito. Il prefisso aggiunge una classe e
 *    riporta il controllo dentro il widget, senza ricorrere a !important.
 * 2. I valori del tema attuale stanno tutti nelle variabili qui sotto. Per
 *    riportare il widget sul tema nuovo si cambiano quelle, non le regole.
 *
 * Il linguaggio grafico è quello della scheda esperienza: campi a pillola con
 * bordo scuro, titoli Montserrat, nessun colore d'accento — il sito è monocromo.
 */

.tse-booking {
	--tse-ink: #000;
	--tse-muted: rgba(0, 0, 0, .55);
	--tse-line: #707070;
	--tse-line-soft: #d8d8d8;
	--tse-surface: #fff;
	--tse-surface-alt: #f4f3f0;
	--tse-radius: 22px;
	--tse-radius-sm: 12px;
	--tse-font-head: "Montserrat", "Helvetica Neue", Arial, sans-serif;
	--tse-font-body: "Montserrat", "Helvetica Neue", Arial, sans-serif;
	--tse-gap: 18px;

	font-family: var(--tse-font-body);
	font-size: 15px;
	color: var(--tse-ink);
	/* width esplicita: dentro la colonna del page builder il widget è un
	   elemento flex e senza questa si restringe alla larghezza del contenuto. */
	width: 100%;
	max-width: 640px;
	margin: 0 auto;
	text-align: left;
	line-height: 1.5;
}

.tse-booking *,
.tse-booking *::before,
.tse-booking *::after { box-sizing: border-box; }

.tse-booking [hidden] { display: none !important; }

/* Neutralizza quello che il tema impone agli elementi che il widget usa. */
.tse-booking h3,
.tse-booking h4,
.tse-booking p,
.tse-booking button,
.tse-booking input,
.tse-booking textarea,
.tse-booking output,
.tse-booking label,
.tse-booking dt,
.tse-booking dd,
.tse-booking span,
.tse-booking small,
.tse-booking strong {
	font-family: inherit;
	line-height: inherit;
	text-transform: none;
	letter-spacing: normal;
	margin: 0;
	color: inherit;
}

.tse-fallback,
.tse-orelse {
	width: 100%;
	max-width: 640px;
	margin: 0 auto;
	font-family: "Montserrat", "Helvetica Neue", Arial, sans-serif;
	font-size: 14px;
	color: rgba(0, 0, 0, .55);
}

.tse-fallback {
	border: 2px solid #707070;
	border-radius: 12px;
	padding: 18px 22px;
}

/* Raccordo verso il modulo "Richiedi info", che resta attivo in parallelo
   come canale di riserva (§5 del capitolato). */
.tse-orelse {
	margin: 46px auto 22px;
	padding-top: 26px;
	border-top: 1px solid #d8d8d8;
	text-align: center;
}

/* --- passi --- */

.tse-booking .tse-step { margin-bottom: 34px; }
.tse-booking .tse-step:last-of-type { margin-bottom: 0; }

.tse-booking .tse-step-title,
.tse-booking .tse-cal-month {
	font-family: var(--tse-font-head);
	font-weight: 600;
	font-size: 17px;
	letter-spacing: .04em;
	text-transform: uppercase;
	margin: 0 0 16px;
	color: var(--tse-ink);
}

.tse-booking .tse-cal-month {
	margin: 0;
	text-transform: none;
	letter-spacing: .02em;
	font-size: 18px;
}

/* --- calendario --- */

.tse-booking .tse-cal-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 14px;
}

.tse-booking .tse-nav {
	width: 40px;
	height: 40px;
	flex: 0 0 40px;
	border: 2px solid var(--tse-line);
	border-radius: 50%;
	background: var(--tse-surface);
	color: var(--tse-ink);
	font-size: 20px;
	line-height: 1;
	padding: 0;
	cursor: pointer;
	transition: background .15s ease, color .15s ease;
}

.tse-booking .tse-nav:hover:not(:disabled) { background: var(--tse-ink); color: #fff; }
.tse-booking .tse-nav:disabled { opacity: .25; cursor: default; }

.tse-booking .tse-cal-weekdays,
.tse-booking .tse-cal-grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 6px;
}

.tse-booking .tse-cal-weekdays {
	margin-bottom: 6px;
	font-size: 11px;
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var(--tse-muted);
	text-align: center;
}

.tse-booking .tse-day {
	aspect-ratio: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 2px solid transparent;
	border-radius: 50%;
	background: none;
	font-family: inherit;
	font-size: 15px;
	color: var(--tse-line-soft);
	cursor: default;
	padding: 0;
	transition: background .15s ease, color .15s ease, border-color .15s ease;
}

/* Un giorno prenotabile si riconosce dal bordo, non da un colore:
   funziona anche per chi i colori non li distingue. */
.tse-booking .tse-day--open {
	color: var(--tse-ink);
	border-color: var(--tse-line);
	cursor: pointer;
}

.tse-booking .tse-day--open:hover { background: var(--tse-surface-alt); }

.tse-booking .tse-day--selected,
.tse-booking .tse-day--selected:hover {
	background: var(--tse-ink);
	border-color: var(--tse-ink);
	color: #fff;
}

.tse-booking .tse-day--today:not(.tse-day--selected) {
	font-weight: 700;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.tse-booking .tse-day--empty { visibility: hidden; }

.tse-booking .tse-hint {
	margin: 14px 0 0;
	font-size: 13px;
	color: var(--tse-muted);
}

/* --- orari --- */

.tse-booking .tse-times { display: flex; flex-wrap: wrap; gap: 10px; }

.tse-booking .tse-time {
	border: 2px solid var(--tse-line);
	border-radius: var(--tse-radius);
	background: var(--tse-surface);
	padding: 11px 20px;
	font-family: inherit;
	font-size: 15px;
	color: var(--tse-ink);
	cursor: pointer;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 2px;
	min-width: 118px;
	transition: background .15s ease, color .15s ease;
}

.tse-booking .tse-time:hover:not(:disabled) { background: var(--tse-surface-alt); }

.tse-booking .tse-time--selected,
.tse-booking .tse-time--selected:hover {
	background: var(--tse-ink);
	border-color: var(--tse-ink);
	color: #fff;
}

.tse-booking .tse-time:disabled { opacity: .35; cursor: default; }
.tse-booking .tse-time strong { font-size: 17px; font-weight: 600; letter-spacing: .02em; }
.tse-booking .tse-time small { font-size: 11.5px; opacity: .7; letter-spacing: .03em; }

/* --- partecipanti --- */

.tse-booking .tse-counter {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 14px 0;
	border-bottom: 1px solid var(--tse-line-soft);
}

.tse-booking .tse-counter-label { display: flex; flex-direction: column; }
.tse-booking .tse-counter-label span { font-weight: 600; }
.tse-booking .tse-counter-label small { font-size: 12.5px; color: var(--tse-muted); }

.tse-booking .tse-stepper {
	display: flex;
	align-items: center;
	gap: 4px;
	border: 2px solid var(--tse-line);
	border-radius: var(--tse-radius);
	padding: 3px;
}

.tse-booking .tse-stepper button {
	width: 34px;
	height: 34px;
	border: 0;
	border-radius: 50%;
	background: none;
	font-family: inherit;
	font-size: 19px;
	line-height: 1;
	color: var(--tse-ink);
	padding: 0;
	cursor: pointer;
}

.tse-booking .tse-stepper button:hover:not(:disabled) { background: var(--tse-surface-alt); }
.tse-booking .tse-stepper button:disabled { opacity: .25; cursor: default; }

.tse-booking .tse-stepper output {
	min-width: 30px;
	text-align: center;
	font-variant-numeric: tabular-nums;
	font-weight: 600;
}

.tse-booking .tse-total {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	margin-top: 20px;
	padding-top: 16px;
	border-top: 2px solid var(--tse-ink);
	font-family: var(--tse-font-head);
}

.tse-booking .tse-total strong {
	font-size: 24px;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

.tse-booking .tse-notice {
	margin: 14px 0 0;
	padding: 12px 16px;
	border-radius: var(--tse-radius-sm);
	background: var(--tse-surface-alt);
	font-size: 13.5px;
	color: var(--tse-muted);
}

.tse-booking .tse-notice a { color: var(--tse-ink); }

/* --- modulo --- */

.tse-booking .tse-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--tse-gap); }
.tse-booking .tse-field { display: block; margin-bottom: var(--tse-gap); }

.tse-booking .tse-label {
	display: block;
	font-size: 12px;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--tse-muted);
	margin-bottom: 6px;
}

.tse-booking .tse-field input,
.tse-booking .tse-field textarea {
	width: 100%;
	border: 2px solid var(--tse-line);
	border-radius: var(--tse-radius);
	background: var(--tse-surface);
	padding: 12px 18px;
	font-family: inherit;
	font-size: 15px;
	height: auto;
	color: var(--tse-ink);
}

.tse-booking .tse-field textarea { border-radius: var(--tse-radius-sm); resize: vertical; }

.tse-booking .tse-field input:focus,
.tse-booking .tse-field textarea:focus {
	outline: 2px solid var(--tse-ink);
	outline-offset: 1px;
	border-color: var(--tse-ink);
}

.tse-booking .tse-field input[aria-invalid="true"],
.tse-booking .tse-field textarea[aria-invalid="true"] { border-color: #b3261e; }

.tse-booking .tse-check {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin-bottom: 12px;
	font-size: 14px;
	color: var(--tse-muted);
}

.tse-booking .tse-check input {
	margin-top: 3px;
	flex: 0 0 auto;
	width: 16px;
	height: 16px;
	accent-color: var(--tse-ink);
}

.tse-booking .tse-check a { color: var(--tse-ink); }

.tse-booking .tse-submit {
	width: 100%;
	margin-top: 12px;
	border: 2px solid var(--tse-ink);
	border-radius: var(--tse-radius);
	background: var(--tse-ink);
	color: #fff;
	font-family: var(--tse-font-head);
	font-size: 14px;
	font-weight: 600;
	letter-spacing: .1em;
	text-transform: uppercase;
	padding: 16px 28px;
	cursor: pointer;
	transition: opacity .15s ease;
}

.tse-booking .tse-submit:hover:not(:disabled) { opacity: .82; }
.tse-booking .tse-submit:disabled { opacity: .4; cursor: default; }

.tse-booking .tse-error {
	margin: 0 0 14px;
	padding: 12px 16px;
	border-radius: var(--tse-radius-sm);
	background: #fdecea;
	color: #8c1d18;
	font-size: 14px;
}

/* --- riepilogo --- */

.tse-booking .tse-summary {
	border: 2px solid var(--tse-line);
	border-radius: var(--tse-radius-sm);
	padding: 20px 22px;
	margin-top: 30px;
	background: var(--tse-surface);
}

.tse-booking .tse-summary h4 {
	font-family: var(--tse-font-head);
	font-size: 14px;
	font-weight: 600;
	letter-spacing: .08em;
	text-transform: uppercase;
	margin: 0 0 14px;
}

.tse-booking .tse-summary dl { margin: 0; }

.tse-booking .tse-summary dl > div {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	padding: 5px 0;
	font-size: 14.5px;
}

.tse-booking .tse-summary dt { color: var(--tse-muted); }
.tse-booking .tse-summary dd { text-align: right; }

.tse-booking .tse-summary-total {
	border-top: 1px solid var(--tse-line-soft);
	margin-top: 8px;
	padding-top: 10px;
	font-weight: 600;
}

.tse-booking .tse-restart {
	margin-top: 14px;
	border: 0;
	background: none;
	padding: 0;
	font-family: inherit;
	font-size: 13px;
	color: var(--tse-muted);
	text-decoration: underline;
	cursor: pointer;
}

/* --- esito --- */

.tse-booking .tse-step--done {
	border: 2px solid var(--tse-ink);
	border-radius: var(--tse-radius-sm);
	padding: 26px 28px;
}

.tse-booking .tse-code {
	font-family: var(--tse-font-head);
	font-size: 26px;
	font-weight: 600;
	letter-spacing: .08em;
	margin-bottom: 10px;
}

.tse-booking .tse-loading { color: var(--tse-muted); font-size: 14px; }

/* --- schermi stretti --- */

@media (max-width: 560px) {
	.tse-booking .tse-row { grid-template-columns: 1fr; gap: 0; }
	.tse-booking .tse-cal-weekdays,
	.tse-booking .tse-cal-grid { gap: 4px; }
	.tse-booking .tse-day { font-size: 14px; }
	.tse-booking .tse-time { flex: 1 1 calc(50% - 5px); min-width: 0; }
	.tse-booking .tse-step-title,
	.tse-booking .tse-cal-month { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
	.tse-booking * { transition: none !important; }
}
