// 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


// ── Step indicator ────────────────────────────────────────
.step-indicator {
	display: flex;
	align-items: center;
	padding: 12px 20px 8px;
	background: var(--ion-background-color, #fff);
	border-bottom: 1px solid var(--ion-color-light-shade);
}

.step-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	cursor: default;
	min-width: 52px;

	&.done { cursor: pointer; }
}

.step-dot {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	border: 2px solid var(--ion-color-light-shade);
	background: var(--ion-item-background, #fff);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	font-weight: 700;
	color: var(--ion-color-medium);
	transition: background 0.2s, border-color 0.2s;

	.step-item.active & {
		border-color: var(--ion-color-primary);
		background: var(--ion-color-primary);
		color: #fff;
	}

	.step-item.done & {
		border-color: var(--ion-color-success);
		background: var(--ion-color-success);
		color: #fff;
	}
}

.step-label {
	font-size: 10px;
	margin-top: 4px;
	color: var(--ion-color-medium);
	text-align: center;
	white-space: nowrap;

	.step-item.active & { color: var(--ion-color-primary); font-weight: 600; }
	.step-item.done &   { color: var(--ion-color-success); }
}

.step-line {
	flex: 1;
	height: 2px;
	background: var(--ion-color-light-shade);
	margin: 0 4px 18px;

	&.done { background: var(--ion-color-success); }
}

// ── Date sulla stessa riga ────────────────────────────────
.date-row {
	display: flex;
	gap: 10px;
	align-items: flex-end;
	padding-bottom: 8px;
}

.date-field {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.date-label {
	font-size: 12px;
	font-weight: 600;
	color: var(--ion-color-medium);
	padding-left: 2px;
}

.date-input {
	width: 100%;
	border: 1.5px solid var(--ion-color-light-shade);
	border-radius: 8px;
	padding: 8px 10px;
	font-size: 14px;
	background: var(--ion-item-background, #fff);
	color: var(--ion-text-color);
	box-sizing: border-box;
	-webkit-appearance: none;

	&:focus {
		outline: none;
		border-color: var(--ion-color-primary);
	}
}

// ── Slot orari ────────────────────────────────────────────
.slot-title {
	font-size: 13px;
	font-weight: 600;
	color: var(--ion-color-medium);
	margin: 0 0 6px;
}

.slots-container {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding-bottom: 4px;
}

// ── Tab full-width ────────────────────────────────────────
.risorse-segment {
	width: 100%;
	margin: 8px 0 0;
}

// ── Mappa wrapper ─────────────────────────────────────────
.mappa-wrapper {
	width: 100%;
	min-height: 300px;
	overflow: hidden;
	position: relative;
	background: #e8c87a;
	border-top: 2px solid #c8aa60;

	// L2: sfondo uguale al canvas sabbia per continuità visiva
	&.canvas-l2-bg {
		background-image: linear-gradient(180deg, #f0d878 0%, #c9a038 100%);
		background-size: 100% 100%;
	}
}

// ── Contenitore scaled (clippa canvas in L2) ──────────────
.canvas-scaled-outer {
	overflow: hidden;
	position: relative;
	flex-shrink: 0;
}

// ── Canvas landscape 900×auto ────────────────────────────
.mappa-canvas {
	position: relative;
	box-sizing: border-box;
	overflow: hidden;
	transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);

	// L2: solo sabbia, nessun mare
	&.canvas-beach.canvas-l2 {
		background-image: linear-gradient(180deg, #f0d878 0%, #c9a038 100%);
		background-size: 100% 100%;
	}

	// Spiaggia
	&.canvas-beach {
		background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='540'%3E%3Cdefs%3E%3ClinearGradient id='sea' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0%25' stop-color='%23082744'/%3E%3Cstop offset='55%25' stop-color='%231a6ea8'/%3E%3Cstop offset='100%25' stop-color='%233d98cc'/%3E%3C/linearGradient%3E%3ClinearGradient id='sand' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0%25' stop-color='%23f0d878'/%3E%3Cstop offset='100%25' stop-color='%23c9a038'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='900' height='540' fill='url(%23sand)'/%3E%3Cpath d='M0,90 Q75,78 150,90 Q225,102 300,90 Q375,78 450,90 Q525,102 600,90 Q675,78 750,90 Q825,102 900,90 L900,0 L0,0 Z' fill='url(%23sea)'/%3E%3Cellipse cx='150' cy='38' rx='100' ry='3' fill='white' opacity='0.13'/%3E%3Cellipse cx='450' cy='58' rx='130' ry='3' fill='white' opacity='0.10'/%3E%3Cellipse cx='730' cy='35' rx='90' ry='3' fill='white' opacity='0.12'/%3E%3Cpath d='M0,88 Q75,80 150,88 Q225,96 300,88 Q375,80 450,88 Q525,96 600,88 Q675,80 750,88 Q825,96 900,88' stroke='rgba(255,255,255,0.35)' stroke-width='2' fill='none'/%3E%3C/svg%3E");
		background-size: 100% 100%;
		background-repeat: no-repeat;
		border-color: #2980b9;
	}

	// Generico (ristorante/altro)
	&.canvas-generic {
		background-color: #ffffff;
		background-image: radial-gradient(circle, #ccc 1px, transparent 1px);
		background-size: 20px 20px;
	}
}

// ── Zone fila spiaggia (bande orizzontali) ─────────────────
.fila-zone {
	position: absolute;
	left: 0;
	right: 0;
	z-index: 4;
	pointer-events: none;
	box-sizing: border-box;
	border-top: 3px solid;
	border-bottom: 3px solid;
	border-left: none;
	border-right: none;
	box-shadow: inset 0 3px 8px rgba(0,0,0,0.10), inset 0 -3px 8px rgba(0,0,0,0.10);
}

// ── Sfondo zona L1 BEACH (colonne verticali) ──────────────
.beach-l1-zone-bg {
	position: absolute;
	top: 0;
	bottom: 0;
	z-index: 2;
	box-sizing: border-box;

	&--clickable {
		cursor: pointer;
		transition: filter 0.15s;

		&:hover {
			filter: brightness(1.15);
		}
	}
}

// ── Card info zona L1 BEACH ───────────────────────────────
.beach-l1-zone-card {
	position: absolute;
	top: 8px;
	display: flex;
	align-items: center;
	gap: 8px;
	background: rgba(0, 0, 0, 0.60);
	border-radius: 6px;
	padding: 5px 12px;
	pointer-events: none;
	z-index: 20;
	white-space: nowrap;
}

.blz-label {
	font-size: 10px;
	font-weight: 700;
	color: #fff;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin-right: 2px;
}

.blz-stat {
	display: flex;
	align-items: center;
	gap: 4px;
	font-size: 11px;
	font-weight: 600;
	color: #fff;
}

.blz-dot {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	border: 1.5px solid rgba(255, 255, 255, 0.7);
	flex-shrink: 0;

	&.blz-dot--free  { background: #27ae60; }
	&.blz-dot--palma { background: #f39c12; width: 11px; height: 11px; }
}

// ── Puntino stato BEACH (livello 1) ───────────────────────
.beach-status-dot {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 24px;
	height: 24px;
	border-radius: 50%;
	border: 2px solid rgba(255, 255, 255, 0.88);
	z-index: 12;
	pointer-events: none;
	box-shadow: 0 1px 5px rgba(0, 0, 0, 0.40);

	&.free   { background: #27ae60; }
	&.booked { background: #e74c3c; }

	&.beach-status-dot--palma {
		width: 40px;
		height: 40px;
		border-width: 2.5px;
	}
}

// ── Contatore zona in L2 (centrato in cima al wrapper) ────
.l2-zone-counter {
	position: absolute;
	top: 10px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 30;
	white-space: nowrap;
	pointer-events: none;
}

// ── Bottone torna a vista generale ────────────────────────
.zone-back-btn {
	position: absolute;
	top: 10px;
	left: 10px;
	z-index: 30;
	display: flex;
	align-items: center;
	gap: 5px;
	background: rgba(0, 0, 0, 0.65);
	color: #fff;
	border: 1px solid rgba(255, 255, 255, 0.4);
	border-radius: 20px;
	padding: 5px 14px;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s;

	ion-icon { font-size: 14px; }
	&:active { background: rgba(0, 0, 0, 0.85); }
}

// ── Risorsa sul canvas ────────────────────────────────────
.resource-on-canvas {
	position: absolute;
	cursor: pointer;
	user-select: none;
	z-index: 10;

	// Vista zona L2 BEACH
	&.resource-beach-l2 {
		background: #fff;
		border-radius: 5px;
		box-shadow: 0 1px 4px rgba(0,0,0,0.18);

		&.resource-beach-l2--booked {
			outline: 2px solid #e74c3c;
			cursor: not-allowed;
			opacity: 0.80;
		}

		&.resource-beach-l2--free {
			outline: 2px solid #27ae60;
		}
	}

	// Risorsa selezionata
	&.resource-selezionato {
		outline: 2.5px solid #3880ff !important;
		background: rgba(56, 128, 255, 0.18) !important;
		box-shadow: 0 0 7px rgba(56, 128, 255, 0.65) !important;
	}
}

// ── Icona risorsa (SVG) ───────────────────────────────────
.resource-icon {
	width: 100%;
	height: 100%;
	display: block;
	filter: drop-shadow(1px 2px 3px rgba(0, 0, 0, 0.3));
}

// ── Etichetta risorsa ─────────────────────────────────────
.resource-label {
	position: absolute;
	bottom: 1px;
	left: 50%;
	transform: translateX(-50%);
	font-size: 9px;
	font-weight: 700;
	background: rgba(255, 255, 255, 0.92);
	border-radius: 3px;
	padding: 0px 4px;
	border: 1px solid rgba(0, 0, 0, 0.15);
	white-space: nowrap;
	pointer-events: none;
	line-height: 1.4;
}

// ── Overlay stato (risorse non-beach) ─────────────────────
.status-overlay {
	position: absolute;
	inset: 0;
	border-radius: 4px;
	opacity: 0.35;
	pointer-events: none;
	z-index: 11;
	transition: opacity 0.15s;

	&.free   { background: #2ecc71; }
	&.booked { background: #e74c3c; }
}

// ── Footer prezzi: occupa solo lo spazio libero, scroll interno
ion-footer {
	max-height: 42vh;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

// ── Legenda prezzi per fila ───────────────────────────────
.prezzi-fila {
	margin: 4px 12px 8px;
	border: 1px solid var(--ion-color-light-shade);
	border-radius: 10px;
	overflow-y: auto;
	flex: 1;
	min-height: 0;
	background: var(--ion-item-background, #fff);
}

.prezzi-fila-header {
	background: var(--ion-color-light);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.5px;
	color: var(--ion-color-medium-shade);
	padding: 6px 12px;
	border-bottom: 1px solid var(--ion-color-light-shade);
	display: flex;
	justify-content: space-between;
	align-items: center;
	cursor: pointer;
	user-select: none;
}

.prezzi-toggle-icon {
	font-size: 16px;
	color: var(--ion-color-medium);
}

.prezzi-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;

	thead tr th {
		padding: 4px 8px;
		color: var(--ion-color-medium);
		font-size: 11px;
		font-weight: 600;
		border-bottom: 1px solid var(--ion-color-light-shade);
	}

	tbody tr {
		border-bottom: 1px solid var(--ion-color-light);
		&:last-child { border-bottom: none; }
	}

	tbody tr td {
		padding: 6px 8px;
		vertical-align: middle;
	}
}

.col-color { width: 28px; }
.col-nome  { font-weight: 500; }
.col-price {
	text-align: right;
	font-weight: 500;
	color: var(--ion-color-dark);
	min-width: 52px;
}

.no-price { color: var(--ion-color-medium); }

.fila-color-box {
	width: 18px;
	height: 18px;
	border: 2px solid;
	border-radius: 3px;
}

.periodo-name {
	font-size: 11px;
	color: var(--ion-color-medium);
	padding: 4px 12px 2px;
	font-style: italic;
}

.disp-legend {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 6px 12px 8px;
	font-size: 12px;
	color: var(--ion-color-dark);
}

.dot {
	display: inline-block;
	width: 12px;
	height: 12px;
	border-radius: 50%;
}
.dot-libero    { background: #27ae60; }
.dot-prenotato { background: #e74c3c; }

// ── Lista gruppi/risorse ──────────────────────────────────
.lista-filter-row {
	--padding-start: 8px;
}

.group-avail {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	margin-right: 4px;
	line-height: 1.3;
}

.group-free {
	font-size: 15px;
	font-weight: 700;
	color: var(--ion-color-success-shade);
	&.no-free { color: var(--ion-color-danger); }
}

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

.prezzo-info {
	font-size: 11px;
	color: var(--ion-color-medium-shade);
	margin-top: 2px;
}

// ── Riepilogo prezzo (step 3) ─────────────────────────────
.prezzo-riepilogo {
	margin: 12px 0 4px;
	border: 1px solid var(--ion-color-light-shade);
	border-radius: 10px;
	overflow: hidden;
	background: var(--ion-item-background, #fff);
}

.prezzo-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 10px 14px;
	background: var(--ion-color-light);
	border-bottom: 1px solid var(--ion-color-light-shade);

	ion-icon {
		margin-right: 5px;
		vertical-align: middle;
	}
}

.prezzo-label {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.4px;
	color: var(--ion-color-medium-shade);
	text-transform: uppercase;
}

.prezzo-totale {
	font-size: 16px;
	color: var(--ion-color-success-shade);
}

.prezzo-riga {
	display: flex;
	justify-content: space-between;
	padding: 6px 14px;
	font-size: 13px;
	color: var(--ion-color-medium-shade);
	border-bottom: 1px solid var(--ion-color-light);

	&:last-child { border-bottom: none; }
}

.fila-price {
	background: rgba(255,255,255,0.85);
	border-radius: 4px;
	padding: 2px 4px;
	font-size: 9px;
	font-weight: 700;
	color: #333;
	writing-mode: vertical-rl;
	text-orientation: mixed;
	white-space: nowrap;
}

// ── Stabilimento ─────────────────────────────────────────
.stabilimento-ro {
	position: absolute;
	z-index: 3;
	box-sizing: border-box;
	box-shadow: 0 3px 10px rgba(0,0,0,0.30);
	pointer-events: none;
	border-radius: 4px;
	overflow: hidden;
}

// ── Passerelle ────────────────────────────────────────────
.passerella-ro {
	position: absolute;
	background: #e8e0d0;
	border: 2px solid #e8e0d0;
	border-radius: 0;
	z-index: 5;
	box-sizing: border-box;
	pointer-events: none;
}

// ── Ristorante: calendario + slot ─────────────────────────
.restaurant-calendar-wrapper {
	display: flex;
	justify-content: center;
	margin-top: 6px;

	ion-datetime {
		max-width: 360px;
		width: 100%;
		--background: var(--ion-item-background, #fff);
		border-radius: 12px;
	}
}

.legend-row {
	display: flex;
	justify-content: center;
	gap: 14px;
	margin-top: 8px;
	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: #27ae60; }
	&--yellow { background: #f1c40f; }
	&--red    { background: #e74c3c; }
}

.guests-stepper {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 18px;
	margin-top: 4px;

	.guests-count {
		font-size: 22px;
		font-weight: 700;
		min-width: 48px;
		text-align: center;
	}
}

.slots-list {
	background: transparent;

	ion-item {
		--padding-start: 12px;
		--inner-padding-end: 12px;
		margin-bottom: 4px;
		border-radius: 10px;
		--background: var(--ion-item-background, #fff);
	}
}

.slot-bar {
	margin-top: 6px;
	height: 6px;
	background: var(--ion-color-light, #eee);
	border-radius: 3px;
	overflow: hidden;
}

.slot-bar-fill {
	height: 100%;
	background: #27ae60;
	transition: width 0.2s, background 0.2s;

	&--yellow { background: #f1c40f; }
	&--red    { background: #e74c3c; }
}

.slot-avail {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	font-size: 12px;

	.slot-free {
		font-weight: 700;
		font-size: 16px;
		color: var(--ion-color-success);

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

.restaurant-summary {
	display: flex;
	align-items: center;
	gap: 8px;
	background: rgba(56, 128, 255, 0.08);
	border-left: 3px solid var(--ion-color-primary);
	padding: 10px 12px;
	border-radius: 6px;
	margin-bottom: 12px;
	font-size: 13px;
	line-height: 1.35;
}

// ── Ristorante: recap step 3 ──────────────────────────────
.restaurant-recap {
	background: var(--ion-color-light, #f5f5f5);
	border-radius: 10px;
	padding: 12px 14px;
	margin-bottom: 16px;

	.recap-row {
		display: flex;
		align-items: center;
		gap: 10px;
		padding: 4px 0;
		font-size: 14px;
		text-transform: capitalize;

		ion-icon { font-size: 18px; flex-shrink: 0; }
	}
}
