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

.wf-content {
	--background: #f4f5f8;
}

.wf-exec {
	padding: 16px;
}

.wf-title {
	margin: 0 0 14px;
	font-size: 19px;
	font-weight: 700;
	color: #1f2430;
}

.wf-snapshot {
	background: #fff;
	border-radius: 12px;
	padding: 12px 14px;
	margin-bottom: 16px;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);

	h4 {
		margin: 0 0 8px;
		font-size: 13px;
		font-weight: 700;
		color: #3b4252;
	}
}

.wf-field {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	padding: 3px 0;
	font-size: 13px;

	.wf-field-label {
		color: #8a8f99;
	}

	.wf-field-value {
		color: #1f2430;
		font-weight: 500;
		text-align: right;
	}
}

.wf-file {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	margin-top: 8px;
	padding: 8px 10px;
	border: 1px solid #e5e8ec;
	border-radius: 8px;
	background: #f8f9fb;
	font-size: 13px;
	color: #1f2430;

	icon {
		font-size: 18px;
	}

	span {
		flex: 1;
		text-align: left;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	ion-icon {
		color: var(--ion-color-primary, #3880ff);
		font-size: 18px;
	}
}

// dati dei passi precedenti (read-only, compatto)
.wf-prev {
	background: #fff;
	border-radius: 12px;
	border-left: 3px solid var(--ion-color-primary, #3880ff);
	padding: 12px 14px;
	margin-bottom: 14px;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.wf-prev-head {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	color: #6b7280;
	margin-bottom: 10px;

	ion-icon {
		font-size: 14px;
		color: var(--ion-color-primary, #3880ff);
	}
}

.wf-prev-field {
	margin-bottom: 10px;

	.wf-prev-label {
		display: block;
		font-size: 12px;
		color: #8a8f99;
		margin-bottom: 2px;
	}

	.wf-prev-value {
		font-size: 14px;
		color: #1f2430;
		white-space: pre-line;
	}
}

.wf-form {
	background: #fff;
	border-radius: 12px;
	padding: 12px 14px;
	margin-bottom: 14px;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.wf-comp-title {
	font-size: 13px;
	font-weight: 700;
	color: #3b4252;
	margin-bottom: 8px;
}

.wf-input {
	margin-bottom: 12px;

	label {
		display: block;
		font-size: 13px;
		color: #6b7280;
		margin-bottom: 4px;

		.req {
			color: var(--ion-color-danger, #eb445a);
			margin-left: 2px;
		}
	}

	input {
		width: 100%;
		border: 1px solid #d7dbe2;
		border-radius: 8px;
		padding: 10px 12px;
		font-size: 15px;
		outline: none;

		&:focus {
			border-color: var(--ion-color-primary, #3880ff);
		}
	}

	ion-select {
		width: 100%;
		border: 1px solid #d7dbe2;
		border-radius: 8px;
		--padding-start: 12px;
		--padding-end: 12px;
		--padding-top: 10px;
		--padding-bottom: 10px;
	}
}

// nota / istruzioni (read-only, testo intero)
.wf-note {
	display: flex;
	gap: 8px;
	background: #eef4ff;
	border: 1px solid #d6e4ff;
	border-radius: 8px;
	padding: 10px 12px;

	ion-icon {
		color: var(--ion-color-primary, #3880ff);
		font-size: 18px;
		flex: 0 0 auto;
		margin-top: 1px;
	}

	.wf-note-text {
		font-size: 14px;
		color: #2b3445;
		white-space: pre-line; // mostra il testo per intero, a capo inclusi
		line-height: 1.4;
	}
}

// nota collassabile (vista "pre"): chiusa di default, si apre cliccando l'icona
.wf-note.wf-note-collapsible {
	display: block;
	padding: 6px 10px;

	.wf-note-toggle {
		display: flex;
		align-items: center;
		gap: 8px;
		width: 100%;
		background: transparent;
		border: none;
		padding: 4px 0;
		font-size: 13px;
		font-weight: 600;
		color: var(--ion-color-primary, #3880ff);

		.wf-note-title {
			flex: 1;
			text-align: left;
		}

		.wf-note-caret {
			font-size: 16px;
			color: #9aa0ab;
		}
	}

	.wf-note-text {
		margin-top: 6px;
	}
}

// upload allegati (type 8)
.wf-upload {
	.wf-upload-btn {
		display: inline-flex;
		align-items: center;
		gap: 8px;
		border: 1px dashed #b5bdc9;
		border-radius: 8px;
		background: #f8f9fb;
		padding: 10px 14px;
		font-size: 14px;
		color: var(--ion-color-primary, #3880ff);

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

	.wf-uploaded {
		display: flex;
		align-items: center;
		gap: 8px;
		margin-top: 8px;
		padding: 8px 10px;
		background: #f0f1f4;
		border-radius: 8px;
		font-size: 13px;

		.wf-uploaded-name {
			flex: 1;
			overflow: hidden;
			text-overflow: ellipsis;
			white-space: nowrap;
		}

		.wf-uploaded-del {
			color: #9aa0ab;
			font-size: 18px;
		}
	}
}

.wf-input textarea {
	width: 100%;
	border: 1px solid #d7dbe2;
	border-radius: 8px;
	padding: 10px 12px;
	font-size: 15px;
	outline: none;
	resize: vertical;
	font-family: inherit;

	&:focus {
		border-color: var(--ion-color-primary, #3880ff);
	}
}

.wf-actions {
	margin-top: 18px;

	ion-button {
		margin-bottom: 10px;
	}
}

.wf-noaction {
	display: flex;
	align-items: center;
	gap: 8px;
	color: #8a8f99;
	font-size: 13px;
	padding: 12px;
	background: #eef0f3;
	border-radius: 8px;

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

.wf-empty {
	text-align: center;
	color: #9aa0ab;
	padding: 48px 16px;

	ion-icon {
		font-size: 48px;
		margin-bottom: 8px;
	}
}

.wf-loading {
	display: flex;
	justify-content: center;
	padding: 32px;
}
