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

.cu-content {
	--background: #f4f6f9;
}

.cu-hero {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 18px 16px 16px;
	background: linear-gradient(135deg, var(--ion-color-primary) 0%, #0a5a92 100%);
	color: #fff;
	border-bottom-left-radius: 22px;
	border-bottom-right-radius: 22px;
	h1 { margin: 0; font-size: 1.4rem; font-weight: 800; letter-spacing: -0.4px; }
	p { margin: 2px 0 0; opacity: 0.85; font-size: 0.82rem; }

	.cu-mill {
		flex: 0 0 auto;
		text-align: center;
		background: rgba(255, 255, 255, 0.16);
		border-radius: 14px;
		padding: 8px 14px;
		backdrop-filter: blur(4px);
		.n { display: block; font-size: 1.15rem; font-weight: 800; small { font-size: 0.7rem; opacity: 0.8; font-weight: 600; } }
		.l { display: block; font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.4px; opacity: 0.85; }
		&.ok { background: rgba(25, 200, 120, 0.28); }
	}
}

.cu-search {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 12px 14px 4px;
	padding: 0 12px;
	height: 42px;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 1px 4px rgba(20, 40, 70, 0.06);
	ion-icon { color: var(--ion-color-medium); font-size: 1.1rem; }
	input { flex: 1; border: none; outline: none; background: transparent; font-size: 0.9rem; }
}

.cu-list { padding: 12px 14px 24px; }

.cu-card {
	background: #fff;
	border-radius: 16px;
	padding: 14px;
	margin-bottom: 12px;
	box-shadow: 0 2px 10px rgba(20, 40, 70, 0.07);

	.cu-card-head { display: flex; align-items: flex-start; gap: 12px; }
	.cu-ic {
		flex: 0 0 auto;
		width: 44px; height: 44px;
		border-radius: 12px;
		background: linear-gradient(135deg, rgba(var(--app-brand-rgb),0.14), rgba(64,142,226,0.14));
		display: inline-flex; align-items: center; justify-content: center;
		ion-icon { font-size: 1.4rem; color: var(--ion-color-primary); }
	}
	.cu-titles { flex: 1; min-width: 0; }
	h2 { margin: 0; font-size: 1.02rem; font-weight: 700; color: #1b2733; .cu-int { color: #93a1b0; font-weight: 600; } }
	.cu-sub {
		margin: 4px 0 0; font-size: 0.8rem; color: #6b7a89; display: flex; flex-wrap: wrap; gap: 4px 10px;
		span { position: relative; }
		span + span::before { content: '·'; position: absolute; left: -7px; color: #c3ccd6; }
	}
	.cu-badge {
		flex: 0 0 auto; text-align: center;
		background: #eef2f7; border-radius: 10px; padding: 5px 10px;
		.n { font-size: 1.05rem; font-weight: 800; color: var(--ion-color-primary); }
		.l { font-size: 0.7rem; color: #93a1b0; }
	}

	.cu-members {
		display: flex; align-items: center; gap: 7px;
		margin-top: 10px; padding-top: 10px; border-top: 1px solid #f0f3f6;
		font-size: 0.82rem; color: #5a6b7b;
		ion-icon { color: var(--ion-color-primary); font-size: 1rem; flex: 0 0 auto; }
	}

	.cu-ref {
		margin-top: 10px;
		label {
			display: inline-flex; align-items: center; gap: 5px;
			font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: #93a1b0;
			margin-bottom: 4px;
			ion-icon { font-size: 0.9rem; color: var(--ion-color-warning); }
		}
		ion-select {
			width: 100%;
			border: 1.5px solid #e3e8ee;
			border-radius: 10px;
			--padding-start: 12px;
			--padding-end: 10px;
			min-height: 40px;
			background: #fbfcfd;
			font-size: 0.88rem;
		}
	}
}

.cu-empty {
	text-align: center; padding: 56px 24px; color: var(--ion-color-medium);
	ion-icon { font-size: 4rem; opacity: 0.4; }
	h3 { margin: 12px 0 4px; font-size: 1.05rem; color: #5a6b7b; }
	p { margin: 0; font-size: 0.85rem; }
}

.cu-skel { padding: 12px 14px; .cu-skel-card { height: 140px; border-radius: 16px; margin-bottom: 12px; background: linear-gradient(90deg, #eceff3 25%, #f6f8fa 37%, #eceff3 63%); background-size: 400% 100%; animation: cu-shimmer 1.3s ease infinite; } }
@keyframes cu-shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* card cliccabile per modifica (solo admin) */
.cu-card-head.cu-editable { cursor: pointer; }

/* ── Modale crea/modifica unità ───────────────────────── */
.uf-header ion-toolbar {
	--background: var(--ion-color-primary);
	--color: #fff;
}
.uf-header ion-buttons ion-button { --color: #fff; }

.uf-content { --background: #f3f5f9; }
.uf-wrap { padding: 14px; }

.uf-row { display: flex; gap: 8px; .uf-field { flex: 1; min-width: 0; } }

.uf-field {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin-bottom: 12px;
	label { font-size: 12px; font-weight: 600; color: var(--ion-color-medium); }
}

.uf-input {
	width: 100%;
	border: 1px solid var(--ion-color-light-shade, #e0e0e0);
	border-radius: 10px;
	padding: 9px 12px;
	font-size: 14px;
	background: #fff;
	color: var(--ion-color-dark);
	outline: none;
	&:focus { border-color: var(--ion-color-primary); }
}

.uf-select {
	width: 100%;
	border: 1px solid var(--ion-color-light-shade, #e0e0e0);
	border-radius: 10px;
	--padding-start: 12px;
	--padding-end: 10px;
	min-height: 42px;
	background: #fff;
	font-size: 14px;
}

.uf-footer {
	background: #fff;
	box-shadow: 0 -4px 16px -10px rgba(17, 24, 39, 0.25);
}
.uf-actions {
	display: flex;
	gap: 10px;
	padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
	ion-button { flex: 1; margin: 0; height: 46px; --border-radius: 12px; font-weight: 700; }
}
