/* DS Event Booking – form di prenotazione
   Colori e spaziature personalizzabili dal tema sovrascrivendo le variabili su .dseb-wrap */

.dseb-wrap {
	--dseb-accent: #2f9ad6;
	--dseb-button: #0a66b2;
	--dseb-button-hover: #08528f;
	--dseb-bg: #eeeeee;
	--dseb-band: #e1e0e0;
	--dseb-text: #555555;
	--dseb-border: #c9c9c9;
	--dseb-error: #c62828;
	--dseb-success: #2e7d32;
	--dseb-radius: 3px;
	--dseb-gap: 24px;
	--dseb-pad: clamp(16px, 3vw, 32px);

	container: dseb / inline-size;
	background: var(--dseb-bg);
	color: var(--dseb-text);
	font-size: 14px;
	line-height: 1.5;
	padding-top: var(--dseb-pad);
	box-sizing: border-box;
}

.dseb-wrap *,
.dseb-wrap *::before,
.dseb-wrap *::after {
	box-sizing: border-box;
}

.dseb-title {
	color: var(--dseb-accent);
	text-align: center;
	text-transform: uppercase;
	font-weight: 400;
	letter-spacing: .02em;
	font-size: clamp(28px, 4vw, 40px);
	line-height: 1.1;
	margin: 0 var(--dseb-pad) 10px;
}

.dseb-intro {
	text-align: center;
	margin: 0 var(--dseb-pad) 24px;
}

.dseb-closed,
.dseb-notice {
	text-align: center;
	padding: var(--dseb-pad);
	margin: 0;
}

.dseb-notice--error {
	color: var(--dseb-error);
}

/* ---------- Sezioni ---------- */

.dseb-section {
	padding: var(--dseb-pad);
}

.dseb-section--stay {
	padding-top: 8px;
}

.dseb-section--card {
	background: var(--dseb-band);
	padding-top: calc(var(--dseb-pad) + 16px);
	padding-bottom: calc(var(--dseb-pad) + 16px);
}

.dseb-section--billing {
	padding-top: calc(var(--dseb-pad) + 16px);
}

.dseb-grid {
	display: grid;
	gap: var(--dseb-gap);
}

.dseb-grid--stay,
.dseb-grid--card {
	grid-template-columns: 1fr 1fr 1fr;
}

.dseb-grid--card {
	align-items: start;
}

.dseb-grid--billing {
	grid-template-columns: 1fr 1fr;
}

.dseb-col {
	display: flex;
	flex-direction: column;
}

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

.dseb-field {
	margin: 0 0 14px;
	position: relative;
}

.dseb-wrap input[type="text"],
.dseb-wrap input[type="tel"],
.dseb-wrap input[type="email"],
.dseb-wrap input[type="password"],
.dseb-wrap select,
.dseb-wrap textarea {
	display: block;
	width: 100%;
	height: 42px;
	margin: 0;
	padding: 8px 10px;
	background-color: #ffffff;
	border: 1px solid var(--dseb-border);
	border-radius: var(--dseb-radius);
	box-shadow: none;
	color: #333333;
	font: inherit;
	font-size: 14px;
	line-height: 1.3;
}

.dseb-wrap select {
	padding-right: 32px;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23333' stroke-width='2' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
}

.dseb-wrap select:invalid {
	color: #777777;
}

.dseb-wrap select option {
	color: #333333;
}

.dseb-wrap select option[value=""] {
	color: #777777;
}

.dseb-wrap textarea {
	height: 100%;
	min-height: 156px;
	resize: vertical;
}

.dseb-field--notes {
	flex: 1;
	display: flex;
	margin-bottom: 0;
}

.dseb-wrap ::placeholder {
	color: #8a8a8a;
	opacity: 1;
}

.dseb-date {
	cursor: pointer;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	padding-right: 36px !important;
}

.dseb-wrap input:focus,
.dseb-wrap select:focus,
.dseb-wrap textarea:focus {
	outline: 2px solid var(--dseb-accent);
	outline-offset: 0;
	border-color: var(--dseb-accent);
}

.dseb-label {
	display: block;
	margin: 0 0 4px;
	font-size: 14px;
	color: #444444;
}

.dseb-sr,
.dseb-hp {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Errori */
.dseb-error {
	display: block;
	color: var(--dseb-error);
	font-size: 12px;
	line-height: 1.3;
	margin-top: 4px;
}

.dseb-error:empty {
	display: none;
}

.dseb-field.has-error input,
.dseb-field.has-error select,
.dseb-field.has-error textarea {
	border-color: var(--dseb-error);
}

/* ---------- Carta ---------- */

.dseb-card-fields {
	grid-column: span 2;
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	column-gap: var(--dseb-gap);
	align-items: start;
}

.dseb-card-fields > .dseb-field:nth-child(1),
.dseb-card-fields > .dseb-field:nth-child(2),
.dseb-card-fields > .dseb-field:nth-child(3) {
	grid-column: span 2;
}

.dseb-card-fields > .dseb-field:nth-child(1),
.dseb-card-fields > .dseb-field:nth-child(2) {
	margin-bottom: 22px;
}

.dseb-expiry {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
}

.dseb-wrap .dseb-expiry input {
	min-width: 0;
	padding-left: 6px;
	padding-right: 6px;
	text-align: center;
}

.dseb-text p {
	margin: 0 0 10px;
}

.dseb-text ul {
	margin: 0 0 12px;
	padding: 0;
	list-style: none;
}

.dseb-text li {
	position: relative;
	padding-left: 12px;
}

.dseb-text li::before {
	content: "";
	position: absolute;
	left: 0;
	top: .6em;
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: var(--dseb-accent);
}

.dseb-guarantee strong:first-child,
.dseb-accent,
.dseb-accent strong {
	color: var(--dseb-accent);
	font-weight: 600;
}

.dseb-policy > p:first-child strong {
	color: #444444;
}

/* ---------- Fatturazione ---------- */

.dseb-billing-title {
	color: var(--dseb-accent);
	font-weight: 600;
	margin: 0 0 12px;
}

.dseb-billing-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	column-gap: var(--dseb-gap);
}

.dseb-billing-grid .dseb-field {
	margin-bottom: 12px;
}

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

.dseb-footer {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: var(--dseb-gap);
	margin-top: var(--dseb-gap);
}

.dseb-privacy {
	flex: 1 1 420px;
	max-width: 560px;
}

.dseb-privacy-title {
	margin: 0;
	font-weight: 600;
	color: #444444;
}

.dseb-privacy-sub {
	margin: 0 0 6px;
	font-size: 12px;
	font-weight: 600;
}

.dseb-field--check {
	margin: 0;
}

.dseb-check {
	display: flex;
	gap: 8px;
	align-items: flex-start;
	font-size: 12px;
	line-height: 1.5;
	cursor: pointer;
}

.dseb-check input {
	flex: 0 0 auto;
	width: 16px;
	height: 16px;
	margin: 2px 0 0;
	accent-color: var(--dseb-button);
}

.dseb-check a {
	color: inherit;
	text-decoration: underline;
}

.dseb-button {
	display: inline-block;
	min-width: 180px;
	padding: 10px 28px;
	border: 0;
	border-radius: var(--dseb-radius);
	background: var(--dseb-button);
	color: #ffffff;
	font: inherit;
	font-size: 20px;
	line-height: 1.3;
	cursor: pointer;
	transition: background-color .15s ease;
}

.dseb-button:hover {
	background: var(--dseb-button-hover);
	color: #ffffff;
}

.dseb-button:focus-visible {
	outline: 3px solid var(--dseb-accent);
	outline-offset: 2px;
}

.dseb-button[disabled] {
	opacity: .7;
	cursor: wait;
}

/* ---------- Messaggi ---------- */

.dseb-message {
	margin: 0 var(--dseb-pad) var(--dseb-pad);
	padding: 14px 16px;
	border-left: 4px solid;
	background: #ffffff;
	font-size: 15px;
}

.dseb-message.is-error {
	border-color: var(--dseb-error);
	color: var(--dseb-error);
}

.dseb-message.is-success {
	border-color: var(--dseb-success);
	color: #1b4d1e;
}

.dseb-message:focus {
	outline: none;
}

/* ---------- Calendario (jQuery UI) ---------- */

.dseb-datepicker.ui-datepicker {
	z-index: 99999 !important;
	width: 290px;
	padding: 10px;
	background: #ffffff;
	border: 1px solid var(--dseb-border, #c9c9c9);
	border-radius: 4px;
	box-shadow: 0 6px 24px rgba(0, 0, 0, .15);
	font-size: 14px;
	color: #333333;
}

.dseb-datepicker .ui-datepicker-header {
	position: relative;
	padding: 4px 0 10px;
	text-align: center;
}

.dseb-datepicker .ui-datepicker-title {
	font-weight: 600;
	line-height: 30px;
}

.dseb-datepicker .ui-datepicker-prev,
.dseb-datepicker .ui-datepicker-next {
	position: absolute;
	top: 4px;
	width: 30px;
	height: 30px;
	border-radius: 3px;
	cursor: pointer;
	overflow: hidden;
	text-indent: -9999px;
}

.dseb-datepicker .ui-datepicker-prev { left: 0; }
.dseb-datepicker .ui-datepicker-next { right: 0; }

.dseb-datepicker .ui-datepicker-prev::after,
.dseb-datepicker .ui-datepicker-next::after {
	content: "";
	position: absolute;
	top: 11px;
	left: 12px;
	width: 7px;
	height: 7px;
	border-top: 2px solid #333333;
	border-left: 2px solid #333333;
	transform: rotate(-45deg);
}

.dseb-datepicker .ui-datepicker-next::after {
	left: 9px;
	transform: rotate(135deg);
}

.dseb-datepicker .ui-state-disabled.ui-datepicker-prev,
.dseb-datepicker .ui-state-disabled.ui-datepicker-next {
	opacity: .25;
	cursor: default;
}

.dseb-datepicker .ui-datepicker-prev:not(.ui-state-disabled):hover,
.dseb-datepicker .ui-datepicker-next:not(.ui-state-disabled):hover {
	background: #f0f0f0;
}

.dseb-datepicker table {
	width: 100%;
	margin: 0;
	border-collapse: collapse;
	table-layout: fixed;
}

.dseb-datepicker th {
	padding: 4px 0;
	font-size: 12px;
	font-weight: 600;
	color: #888888;
	text-align: center;
	border: 0;
	background: none;
}

.dseb-datepicker td {
	padding: 1px;
	border: 0;
	background: none;
	text-align: center;
}

.dseb-datepicker td a,
.dseb-datepicker td span {
	display: block;
	padding: 7px 0;
	border-radius: 3px;
	color: #333333;
	text-decoration: none;
}

.dseb-datepicker td a:hover {
	background: #e8f3fb;
}

.dseb-datepicker .ui-state-disabled span {
	color: #c4c4c4;
}

.dseb-datepicker .ui-datepicker-other-month a {
	color: #999999;
}

.dseb-datepicker .ui-state-highlight {
	box-shadow: inset 0 0 0 1px #2f9ad6;
}

.dseb-datepicker .ui-state-active,
.dseb-datepicker .ui-state-active:hover {
	background: #0a66b2 !important;
	color: #ffffff !important;
}

/* ---------- Responsive ----------
   Container query: il form si adatta alla larghezza della colonna del tema,
   non solo a quella dello schermo. */

@container dseb (max-width: 900px) {
	.dseb-grid--stay {
		grid-template-columns: 1fr 1fr;
	}

	.dseb-col--notes {
		grid-column: 1 / -1;
	}

	.dseb-wrap textarea {
		min-height: 120px;
	}

	.dseb-grid--card,
	.dseb-grid--billing {
		grid-template-columns: 1fr;
	}

	.dseb-card-fields {
		grid-column: auto;
	}
}

@container dseb (max-width: 560px) {
	.dseb-form {
		--dseb-gap: 14px;
	}

	.dseb-grid--stay {
		grid-template-columns: 1fr;
		gap: 0;
	}

	.dseb-card-fields {
		grid-template-columns: 1fr 1fr;
	}

	.dseb-card-fields > .dseb-field:nth-child(1),
	.dseb-card-fields > .dseb-field:nth-child(2),
	.dseb-card-fields > .dseb-field:nth-child(3) {
		grid-column: 1 / -1;
		margin-bottom: 14px;
	}

	.dseb-billing-grid {
		grid-template-columns: 1fr;
	}

	/* Ordine naturale su una colonna */
	.dseb-billing-first_name { order: 1; }
	.dseb-billing-last_name  { order: 2; }
	.dseb-billing-company    { order: 3; }
	.dseb-billing-address    { order: 4; }
	.dseb-billing-email      { order: 5; }
	.dseb-billing-phone      { order: 6; }
	.dseb-billing-vat        { order: 7; }
	.dseb-billing-tax_code   { order: 8; }
	.dseb-billing-sdi        { order: 9; }

	.dseb-footer {
		flex-direction: column;
		align-items: stretch;
	}

	.dseb-privacy {
		flex-basis: auto;
	}

	.dseb-button {
		width: 100%;
	}
}

@media (max-width: 600px) {
	.dseb-datepicker.ui-datepicker {
		width: calc(100vw - 32px);
		max-width: 340px;
	}
}
