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

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

/* ── Hero (coerente con Assemblee / Unità) ─────────────── */
.ct-hero {
	padding: 18px 16px 14px;
	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.5rem;
		font-weight: 800;
		letter-spacing: -0.4px;
		color: #fff;
	}
	p {
		margin: 2px 0 0;
		font-size: 0.82rem;
		opacity: 0.85;
		color: #fff;
	}
}

.ct-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 {
		font-size: 1.1rem;
		color: var(--ion-color-medium);
	}
	input {
		flex: 1;
		border: none;
		background: transparent;
		font-size: 0.9rem;
		outline: none;
		color: var(--ion-color-dark);
	}
}

.ct-list {
	padding: 10px 14px 120px;
}

/* card cantiere — stile coerente con le "protocol card" dell'app (rail colorato + meta) */
.ws-card {
	position: relative;
	display: flex;
	align-items: center;
	gap: 10px;
	overflow: hidden;
	padding: 14px 12px 14px 18px;
	margin-bottom: 12px;
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 6px 18px -10px rgba(17, 24, 39, 0.25);
	cursor: pointer;
	transition: transform 0.12s ease;

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

	.ws-rail {
		position: absolute;
		left: 0;
		top: 0;
		bottom: 0;
		width: 5px;
		background: var(--ion-color-success);
	}
	&[data-stato='closed'] .ws-rail {
		background: var(--ion-color-danger);
	}

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

	.ws-head {
		display: flex;
		align-items: flex-start;
		justify-content: space-between;
		gap: 8px;
	}

	.ws-name {
		margin: 0;
		font-size: 16px;
		font-weight: 700;
		line-height: 1.25;
		color: var(--ion-color-dark);
		/* il nome va a capo, non viene troncato */
		white-space: normal;
		overflow-wrap: anywhere;
	}

	.ws-status {
		flex-shrink: 0;
		display: inline-flex;
		align-items: center;
		gap: 4px;
		font-size: 11px;
		font-weight: 700;
		padding: 3px 9px;
		border-radius: 999px;
		background: rgba(45, 211, 111, 0.14);
		color: var(--ion-color-success-shade, #1c7a44);
		ion-icon {
			font-size: 9px;
		}
		&[data-stato='closed'] {
			background: rgba(235, 68, 90, 0.14);
			color: var(--ion-color-danger-shade, #b22a3a);
		}
	}

	.ws-meta {
		display: flex;
		flex-wrap: wrap;
		gap: 4px 14px;
		margin-top: 8px;

		.m {
			display: inline-flex;
			align-items: center;
			gap: 4px;
			font-size: 12px;
			color: var(--ion-color-medium);
			ion-icon {
				font-size: 13px;
			}
		}
	}

	.ws-desc {
		margin: 8px 0 0;
		font-size: 12.5px;
		color: var(--ion-color-medium);
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
		overflow: hidden;
	}

	.ws-chevron {
		flex-shrink: 0;
		font-size: 18px;
		color: var(--ion-color-medium);
	}
}

.ct-empty {
	text-align: center;
	padding: 48px 16px;
	color: var(--ion-color-medium);
	ion-icon {
		font-size: 48px;
	}
	h3 {
		margin: 12px 0 4px;
		font-size: 16px;
	}
	p {
		margin: 0;
		font-size: 13px;
	}
}

.ct-skel {
	padding: 8px 14px;
	.ct-skel-card {
		height: 84px;
		border-radius: 16px;
		margin-bottom: 12px;
		background: linear-gradient(90deg, #f0f0f0 25%, #e6e6e6 37%, #f0f0f0 63%);
		background-size: 400% 100%;
		animation: ct-shimmer 1.3s ease infinite;
	}
}

@keyframes ct-shimmer {
	0% {
		background-position: 100% 50%;
	}
	100% {
		background-position: 0 50%;
	}
}
