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

.compact-grid {
	--ion-grid-padding: 0px; // Rimuove padding extra dalla griglia
	--ion-grid-column-padding: 4px; // Spaziatura ridotta tra le colonne
}

.compact-col {
	padding: 4px; // Riduce il padding delle colonne
}

.compact-item {
	--padding-start: 4px; // Riduce il padding a sinistra
	--padding-end: 4px; // Riduce il padding a destra
	--inner-padding: 2px; // Riduce il padding interno dell'elemento ionico
}

ion-label,
ion-input,
ion-select {
	--padding-top: 2px;
	--padding-bottom: 2px;
	--padding-start: 4px;
	--padding-end: 4px;
	font-size: 12px; // Riduce la dimensione del testo nel select
}

.required-asterisk {
	color: red;
	margin-left: 0.25rem; /* Spazio tra il testo e l'asterisco */
}

app-suggestion-simple-input {
	width: 100%;
}

/* ═══════════════════════════════════════════════════════════════
   TYPE 15 — ATTIVITÀ (rapportino dipendente)
   ═══════════════════════════════════════════════════════════════ */
$att-brand: var(--app-brand);
$att-ink: #0f172a;
$att-ink-soft: #475569;
$att-ink-mute: #64748b;
$att-line: #e2e8f0;
$att-mist: #f1f5f9;

.attivita-card {
	border: 1.5px solid $att-line;
	border-radius: 14px;
	background: #fff;
	padding: 12px;
	margin: 6px 0;
	width: 100%;
	box-shadow: 0 6px 16px -14px rgba(15, 23, 42, 0.25);
}

/* ─── EDIT ─────────────────────────────────────────────────── */
.att-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 8px;
	padding-bottom: 10px;
	border-bottom: 1px dashed $att-line;
	margin-bottom: 10px;
}

.att-presente {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	font-weight: 700;
	color: $att-ink;
	cursor: pointer;

	input[type='checkbox'] {
		width: 18px;
		height: 18px;
		accent-color: $att-brand;
		cursor: pointer;
	}
}

.att-tot {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: 12px;
	font-weight: 600;
	color: $att-ink-soft;

	ion-icon {
		font-size: 14px;
		color: $att-brand;
	}

	strong {
		font-family: 'Menlo', 'Consolas', monospace;
		color: $att-ink;
		font-size: 13px;
		font-variant-numeric: tabular-nums;
	}
}

.att-rows {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.att-row {
	display: grid;
	grid-template-columns: 1fr 80px 36px;
	gap: 6px;
	align-items: center;
}

.att-row--ro {
	grid-template-columns: 1fr 70px;
	padding: 8px 10px;
	background: $att-mist;
	border: 1px solid $att-line;
	border-radius: 10px;
	font-size: 12.5px;

	.att-row-desc {
		color: $att-ink;
		font-weight: 600;
		line-height: 1.3;
	}

	.att-row-dur {
		text-align: right;
		font-family: 'Menlo', 'Consolas', monospace;
		font-weight: 800;
		color: $att-brand;
		font-variant-numeric: tabular-nums;
	}
}

.att-row-input {
	width: 100%;
	height: 36px;
	padding: 6px 10px;
	border: 1.5px solid $att-line;
	border-radius: 10px;
	background: #fff;
	font-size: 13px;
	color: $att-ink;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;

	&:focus {
		outline: none;
		border-color: $att-brand;
		box-shadow: 0 0 0 3px rgba(var(--app-brand-rgb), 0.15);
	}

	&:disabled {
		background: $att-mist;
		color: $att-ink-mute;
	}

	&.att-row-dur {
		text-align: center;
		font-family: 'Menlo', 'Consolas', monospace;
		font-weight: 700;
		font-variant-numeric: tabular-nums;
	}
}

.att-row-del {
	width: 36px;
	height: 36px;
	border-radius: 10px;
	border: 1.5px solid #fecaca;
	background: #fff;
	color: #ef4444;
	display: grid;
	place-items: center;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;

	&:active {
		background: #ef4444;
		color: #fff;
	}

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

.att-add {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 10px;
	padding: 8px 14px;
	border: 1.5px dashed $att-brand;
	border-radius: 10px;
	background: rgba(var(--app-brand-rgb), 0.06);
	color: $att-brand;
	font-size: 12.5px;
	font-weight: 700;
	cursor: pointer;

	&:active {
		background: rgba(var(--app-brand-rgb), 0.14);
	}

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

.att-note-edit {
	margin-top: 12px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.att-note-label {
	font-size: 10.5px;
	font-weight: 800;
	letter-spacing: 1.2px;
	text-transform: uppercase;
	color: $att-ink-mute;
}

.att-note-input {
	width: 100%;
	min-height: 48px;
	padding: 8px 10px;
	border: 1.5px solid $att-line;
	border-radius: 10px;
	background: #fff;
	font-size: 13px;
	color: $att-ink;
	font-family: inherit;
	resize: vertical;

	&:focus {
		outline: none;
		border-color: $att-brand;
		box-shadow: 0 0 0 3px rgba(var(--app-brand-rgb), 0.15);
	}

	&:disabled {
		background: $att-mist;
		color: $att-ink-mute;
	}
}

/* ─── READONLY ─────────────────────────────────────────────── */
.att-readonly {
	.att-meta {
		display: flex;
		flex-wrap: wrap;
		gap: 8px;
		margin-bottom: 10px;
	}

	.att-chip {
		display: inline-flex;
		align-items: center;
		gap: 5px;
		padding: 4px 10px;
		border-radius: 999px;
		font-size: 11.5px;
		font-weight: 700;
		border: 1px solid;

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

		&[data-on='yes'] {
			background: #d1fae5;
			border-color: #a7f3d0;
			color: #065f46;
		}

		&[data-on='no'] {
			background: #fee2e2;
			border-color: #fecaca;
			color: #991b1b;
		}
	}
}

.att-note {
	margin-top: 10px;
	padding: 8px 10px;
	border-radius: 10px;
	background: $att-mist;
	border: 1px solid $att-line;

	.att-note-label {
		display: block;
		margin-bottom: 4px;
	}

	p {
		margin: 0;
		font-size: 12.5px;
		color: $att-ink-soft;
		line-height: 1.5;
		white-space: pre-wrap;
	}
}
