// Questo file fa parte di MyTown.
// MyTown è software libero: puoi ridistribuirlo e/o modificarlo secondo
// i termini della GNU Affero General Public License come pubblicata dalla
// Free Software Foundation, versione 3.
// Distribuito senza ALCUNA GARANZIA; vedi la GNU AGPL v3 per i dettagli.
// Copyright (C) Kondor Consulting & Services S.r.l.
// SPDX-License-Identifier: AGPL-3.0-or-later

// ═══════════════════════════════════════════════════════════════
//  PRENOTAZIONE EVENTO (biglietti → data → fascia oraria → carrello)
//  Design allineato al sistema MyTown: header brand, pannelli card
//  morbidi, step numerati, CTA sticky in fondo.
// ═══════════════════════════════════════════════════════════════

// ─── HEADER ───────────────────────────────────────────────────
.page-toolbar {
	--background: var(--app-brand);
	--color: var(--app-on-brand);
	--border-width: 0;

	ion-title {
		font-weight: 700;
		font-size: 17px;
		letter-spacing: 0.2px;
	}

	.back-btn {
		--color: var(--app-on-brand);
		--padding-start: 4px;
		--padding-end: 4px;

		ion-icon {
			font-size: 22px;
		}
	}
}

ion-content {
	--background: var(--ion-color-light);
}

.resv {
	padding: 14px 14px 12px;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

// ─── SUMMARY EVENTO ───────────────────────────────────────────
.event-summary {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	background: #fff;
	border-radius: 18px;
	padding: 14px 16px;
	border: 1px solid rgba(0, 0, 0, 0.05);
	box-shadow: 0 8px 24px -16px rgba(17, 24, 39, 0.25);

	.event-icon {
		flex-shrink: 0;
		width: 44px;
		height: 44px;
		border-radius: 13px;
		display: flex;
		align-items: center;
		justify-content: center;
		background: rgba(var(--app-brand-rgb), 0.12);

		ion-icon {
			font-size: 24px;
			color: var(--app-brand);
		}
	}

	.event-meta {
		min-width: 0;

		.event-title {
			margin: 0 0 3px;
			font-size: 16px;
			font-weight: 700;
			line-height: 1.3;
			color: var(--ion-color-dark);
		}

		.event-date {
			display: flex;
			align-items: center;
			gap: 5px;
			font-size: 13px;
			color: var(--ion-color-medium);

			ion-icon {
				font-size: 14px;
			}
		}
	}
}

// ─── PANNELLI / STEP ──────────────────────────────────────────
.panel {
	background: #fff;
	border-radius: 18px;
	padding: 16px;
	border: 1px solid rgba(0, 0, 0, 0.05);
	box-shadow: 0 8px 24px -16px rgba(17, 24, 39, 0.25);
}

.step-title {
	display: flex;
	align-items: center;
	gap: 9px;
	margin: 0 0 14px;
	font-size: 15px;
	font-weight: 700;
	color: var(--ion-color-dark);

	.step-num {
		flex-shrink: 0;
		width: 24px;
		height: 24px;
		border-radius: 50%;
		display: flex;
		align-items: center;
		justify-content: center;
		background: var(--app-brand);
		color: var(--app-on-brand);
		font-size: 12.5px;
		font-weight: 800;
	}
}

// ─── STEPPER BIGLIETTI ────────────────────────────────────────
.stepper {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 22px;
}

.step-btn {
	width: 46px;
	height: 46px;
	border-radius: 50%;
	border: 1.5px solid rgba(var(--app-brand-rgb), 0.35);
	background: rgba(var(--app-brand-rgb), 0.06);
	color: var(--app-brand);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: transform 0.12s, background 0.15s, opacity 0.15s;

	ion-icon {
		font-size: 22px;
	}

	&:active {
		transform: scale(0.9);
		background: rgba(var(--app-brand-rgb), 0.16);
	}

	&:disabled {
		opacity: 0.4;
		cursor: default;
	}
}

.step-val {
	font-size: 30px;
	font-weight: 800;
	min-width: 56px;
	text-align: center;
	color: var(--ion-color-dark);
	font-variant-numeric: tabular-nums;
}

.step-hint {
	margin: 12px 0 0;
	text-align: center;
	font-size: 12.5px;
	color: var(--ion-color-medium);
}

// ─── CALENDARIO ───────────────────────────────────────────────
.calendar-wrapper {
	display: flex;
	justify-content: center;

	ion-datetime {
		max-width: 360px;
		width: 100%;
		--background: transparent;
		border-radius: 14px;
	}
}

.legend-row {
	display: flex;
	justify-content: center;
	gap: 16px;
	margin-top: 12px;
	flex-wrap: wrap;
}

.legend-item {
	display: inline-flex;
	align-items: center;
	font-size: 12px;
	color: var(--ion-color-medium);
}

.legend-dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	margin-right: 5px;

	&--green {
		background: var(--ion-color-success);
	}
	&--yellow {
		background: var(--ion-color-warning);
	}
	&--red {
		background: var(--ion-color-danger);
	}
}

// ─── SLOT FASCE ORARIE ────────────────────────────────────────
.slots-list {
	background: transparent;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.slot-card {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	text-align: left;
	padding: 12px 14px;
	border-radius: 14px;
	border: 1.5px solid rgba(0, 0, 0, 0.07);
	background: var(--ion-color-light);
	cursor: pointer;
	transition: border-color 0.15s, background 0.15s, transform 0.12s;

	&:active {
		transform: scale(0.99);
	}

	&.is-selected {
		border-color: var(--app-brand);
		background: rgba(var(--app-brand-rgb), 0.07);
	}

	&.is-disabled {
		opacity: 0.5;
		pointer-events: none;
	}
}

.slot-main {
	flex: 1;
	min-width: 0;
}

.slot-time {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 15px;
	font-weight: 700;
	color: var(--ion-color-dark);

	ion-icon {
		font-size: 16px;
		color: var(--app-brand);
	}
}

.slot-price {
	margin-top: 2px;
	font-size: 13px;
	font-weight: 600;
	color: var(--ion-color-medium);
}

.slot-bar {
	margin-top: 8px;
	height: 6px;
	background: rgba(0, 0, 0, 0.07);
	border-radius: 3px;
	overflow: hidden;
}

.slot-bar-fill {
	height: 100%;
	background: var(--ion-color-success);
	transition: width 0.25s, background 0.25s;

	&--yellow {
		background: var(--ion-color-warning);
	}
	&--red {
		background: var(--ion-color-danger);
	}
}

.slot-side {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	flex-shrink: 0;
	gap: 1px;

	.slot-free {
		font-weight: 800;
		font-size: 18px;
		color: var(--ion-color-success);
		line-height: 1;

		&.no-free {
			color: var(--ion-color-danger);
		}
	}

	.slot-total {
		font-size: 11px;
		color: var(--ion-color-medium);
	}

	.slot-check {
		margin-top: 4px;
		font-size: 20px;
		color: var(--app-brand);
	}
}

// ─── EMPTY ────────────────────────────────────────────────────
.resv-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	padding: 28px 20px;
	color: var(--ion-color-medium);

	ion-icon {
		font-size: 40px;
		color: rgba(var(--app-brand-rgb), 0.4);
		margin-bottom: 10px;
	}

	p {
		margin: 0;
		font-size: 14px;
	}
}

// ─── CTA STICKY ───────────────────────────────────────────────
.cta-bar {
	position: sticky;
	bottom: 0;
	display: flex;
	align-items: center;
	gap: 14px;
	margin: 4px -14px -12px;
	padding: 12px 16px calc(env(safe-area-inset-bottom, 0px) + 14px);
	background: rgba(255, 255, 255, 0.92);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	border-top: 1px solid rgba(0, 0, 0, 0.06);

	.cta-total {
		display: flex;
		flex-direction: column;
		line-height: 1.15;

		.cta-total-label {
			font-size: 11px;
			font-weight: 600;
			text-transform: uppercase;
			letter-spacing: 0.5px;
			color: var(--ion-color-medium);
		}

		.cta-total-value {
			font-size: 22px;
			font-weight: 800;
			color: var(--ion-color-dark);
		}
	}

	.cta-btn {
		flex: 1;
		--border-radius: 14px;
		font-weight: 700;
		font-size: 15px;
		height: 50px;
		margin: 0;
	}
}
