/*
 * APC Avvalimenti – stili del modulo (restyling coerente con apconsultingsrl.it).
 * Tutti i colori e le misure sono variabili: per adattarli basta ridefinirle,
 * es. nel CSS aggiuntivo del tema:  .apc-avv { --apc-avv-accent: #0b4f8a; }
 * Le regole stanno sotto .apc-avv per non entrare in conflitto con il tema.
 */
.apc-avv {
	--apc-avv-primario: #1c244b;      /* blu istituzionale: titoli, pulsante */
	--apc-avv-primario-hover: #2b3570;
	--apc-avv-secondario: #474a71;
	--apc-avv-accent: #467ff7;        /* focus */
	--apc-avv-oro: #b39964;           /* dettagli */
	--apc-avv-text: #33373d;
	--apc-avv-muted: #5a6371;
	--apc-avv-border: #d3d9e2;
	--apc-avv-bg: #ffffff;
	--apc-avv-bg-soft: #f9fafd;
	--apc-avv-bg-box: #f3f5f8;
	--apc-avv-error: #a4161a;
	--apc-avv-success: #1b6b3a;
	--apc-avv-radius: 4px;
	--apc-avv-radius-card: 8px;
	--apc-avv-gap: 1.25rem;
	--apc-avv-trans: 180ms ease;
	--apc-avv-font: Roboto, system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
	--apc-avv-font-titoli: "HK Nova", Poppins, Roboto, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;

	box-sizing: border-box;
	max-width: 56rem;
	margin: 0 auto;
	padding: 0.5rem 0 2rem;
	font-family: var(--apc-avv-font);
	font-size: 16px;
	line-height: 1.5;
	color: var(--apc-avv-text);
	counter-reset: apc-avv-passo;
}

.apc-avv *,
.apc-avv *::before,
.apc-avv *::after { box-sizing: border-box; }

/* ---------- Gruppi (card numerate) ---------- */
.apc-avv .apc-avv-group {
	min-width: 0;
	margin: 0 0 1.5rem;
	padding: 1.5rem 1.25rem 0.5rem;
	background: var(--apc-avv-bg-soft);
	border: 1px solid var(--apc-avv-border);
	border-top: 3px solid var(--apc-avv-oro);
	border-radius: var(--apc-avv-radius-card);
}
.apc-avv .apc-avv-group > legend {
	float: left;          /* la legenda resta dentro la card */
	width: 100%;
	margin: 0 0 1.25rem;
	padding: 0;
	font-family: var(--apc-avv-font-titoli);
	font-size: 1.125rem;
	font-weight: 700;
	line-height: 1.3;
	color: var(--apc-avv-primario);
}
.apc-avv .apc-avv-group > legend::before {
	counter-increment: apc-avv-passo;
	content: counter(apc-avv-passo);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	margin-right: 10px;
	font-size: 0.875rem;
	color: #fff;
	background: var(--apc-avv-primario);
	border-radius: 50%;
}
.apc-avv .apc-avv-group > legend + * { clear: both; }
.apc-avv .apc-avv-group--consensi > legend::before { content: "\2713"; }

.apc-avv .apc-avv-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 var(--apc-avv-gap); }
@media (min-width: 700px) {
	.apc-avv .apc-avv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.apc-avv .apc-avv-field--wide { grid-column: 1 / -1; }
	.apc-avv .apc-avv-group { padding: 1.75rem 1.75rem 0.75rem; }
}

/* ---------- Campi ---------- */
.apc-avv .apc-avv-field { min-width: 0; margin-bottom: 1.25rem; }
.apc-avv .apc-avv-label {
	display: block;
	margin: 0 0 0.4rem;
	padding: 0;
	font-family: var(--apc-avv-font-titoli);
	font-size: 0.9375rem;
	font-weight: 700;
	color: var(--apc-avv-primario);
}
.apc-avv .apc-avv-req { color: var(--apc-avv-error); }

.apc-avv input[type="text"],
.apc-avv input[type="email"],
.apc-avv input[type="tel"],
.apc-avv input[type="datetime-local"],
.apc-avv textarea {
	display: block;
	width: 100%;
	max-width: 100%;
	min-height: 48px;
	padding: 0.7rem 0.9rem;
	font: inherit;
	line-height: 1.4;
	color: var(--apc-avv-text);
	background: var(--apc-avv-bg);
	border: 1px solid var(--apc-avv-border);
	border-radius: var(--apc-avv-radius);
	transition: border-color var(--apc-avv-trans), box-shadow var(--apc-avv-trans);
}
.apc-avv input[type="text"]:hover,
.apc-avv input[type="email"]:hover,
.apc-avv input[type="tel"]:hover,
.apc-avv input[type="datetime-local"]:hover,
.apc-avv textarea:hover { border-color: var(--apc-avv-secondario); }
.apc-avv textarea { min-height: 7rem; resize: vertical; }

.apc-avv input[type="file"] {
	display: block;
	width: 100%;
	max-width: 100%;
	padding: 0.8rem 0.9rem;
	font: inherit;
	font-size: 0.9375rem;
	color: var(--apc-avv-text);
	background: var(--apc-avv-bg);
	border: 1px dashed var(--apc-avv-secondario);
	border-radius: var(--apc-avv-radius);
	cursor: pointer;
	transition: background-color var(--apc-avv-trans);
}
.apc-avv input[type="file"]:hover { background: var(--apc-avv-bg-box); }

.apc-avv input:disabled,
.apc-avv textarea:disabled { color: #8a93a0; background: var(--apc-avv-bg-box); cursor: not-allowed; }

.apc-avv input:focus-visible,
.apc-avv textarea:focus-visible,
.apc-avv button:focus-visible,
.apc-avv a:focus-visible {
	outline: 3px solid var(--apc-avv-accent);
	outline-offset: 2px;
}

.apc-avv .apc-avv-hint { margin: 0.4rem 0 0; font-size: 0.875rem; color: var(--apc-avv-muted); }
.apc-avv a { color: var(--apc-avv-primario); text-decoration: underline; text-decoration-color: var(--apc-avv-oro); text-underline-offset: 2px; }
.apc-avv a:hover { color: var(--apc-avv-accent); }

/* ---------- Scelte (radio come pulsanti) ---------- */
.apc-avv .apc-avv-choices { min-width: 0; margin: 0; padding: 0; border: 0; }
.apc-avv .apc-avv-choices__list { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.apc-avv .apc-avv-choice {
	position: relative;
	display: inline-flex;
	align-items: center;
	min-height: 48px;
	margin: 0;
	padding: 0.55rem 1.1rem;
	font-family: var(--apc-avv-font);
	font-weight: 500;
	color: var(--apc-avv-text);
	background: var(--apc-avv-bg);
	border: 1px solid var(--apc-avv-border);
	border-radius: var(--apc-avv-radius);
	cursor: pointer;
	transition: border-color var(--apc-avv-trans), background-color var(--apc-avv-trans), box-shadow var(--apc-avv-trans);
}
.apc-avv .apc-avv-choice:hover { border-color: var(--apc-avv-secondario); background: var(--apc-avv-bg-soft); }
.apc-avv .apc-avv-choice input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}
.apc-avv .apc-avv-choice:has(input:checked) {
	color: #fff;
	background: var(--apc-avv-primario);
	border-color: var(--apc-avv-primario);
}
.apc-avv .apc-avv-choice:has(input:focus-visible) { outline: 3px solid var(--apc-avv-accent); outline-offset: 2px; }
.apc-avv .has-error .apc-avv-choice { border-color: var(--apc-avv-error); }

/* ---------- Consensi ---------- */
.apc-avv .apc-avv-consent { display: flex; align-items: flex-start; gap: 0.7rem; }
.apc-avv .apc-avv-consent input {
	flex: none;
	width: 1.25rem;
	height: 1.25rem;
	margin: 0.15rem 0 0;
	accent-color: var(--apc-avv-primario);
}
.apc-avv .apc-avv-consent label { font-weight: 600; color: var(--apc-avv-primario); cursor: pointer; }
.apc-avv .apc-avv-consent__text { margin-left: 1.95rem; }
.apc-avv .apc-avv-field--consent { padding: 0.9rem 1rem 0.1rem; background: var(--apc-avv-bg); border: 1px solid var(--apc-avv-border); border-radius: var(--apc-avv-radius); }

/* ---------- Errori ---------- */
.apc-avv .apc-avv-error { margin: 0.4rem 0 0; font-size: 0.875rem; font-weight: 600; color: var(--apc-avv-error); }
.apc-avv .apc-avv-error[hidden] { display: none; }
.apc-avv .has-error input[type="text"],
.apc-avv .has-error input[type="email"],
.apc-avv .has-error input[type="tel"],
.apc-avv .has-error input[type="datetime-local"],
.apc-avv .has-error input[type="file"],
.apc-avv .has-error textarea {
	border-color: var(--apc-avv-error);
	box-shadow: 0 0 0 1px var(--apc-avv-error);
}
.apc-avv .has-error.apc-avv-field--consent { border-color: var(--apc-avv-error); }

/* ---------- Avvisi ---------- */
.apc-avv .apc-avv-notice,
.apc-avv-notice {
	margin: 0 0 1.5rem;
	padding: 1rem 1.2rem;
	background: #fdecea;
	border-left: 4px solid var(--apc-avv-error);
	border-radius: var(--apc-avv-radius);
}
.apc-avv .apc-avv-notice[hidden] { display: none; }
.apc-avv .apc-avv-notice p { margin: 0.25rem 0; }
.apc-avv .apc-avv-notice__title { font-family: var(--apc-avv-font-titoli); font-weight: 700; }
.apc-avv .apc-avv-notice--success { background: #e8f5ec; border-left-color: var(--apc-avv-success); }

/* ---------- Pulsante ---------- */
.apc-avv .apc-avv-required-note { margin: 0 0 1rem; font-size: 0.875rem; color: var(--apc-avv-muted); }
.apc-avv .apc-avv-actions { margin: 0; }
.apc-avv .apc-avv-submit {
	display: block;
	width: 100%;
	min-height: 52px;
	padding: 0.9rem 1.8rem;
	font-family: var(--apc-avv-font);
	font-size: 0.9375rem;
	font-weight: 500;
	line-height: 1.2;
	color: #fff;
	background: var(--apc-avv-primario);
	border: 2px solid var(--apc-avv-primario);
	border-radius: var(--apc-avv-radius);
	cursor: pointer;
	transition: background-color var(--apc-avv-trans), border-color var(--apc-avv-trans);
}
.apc-avv .apc-avv-submit:hover { color: #fff; background: var(--apc-avv-primario-hover); border-color: var(--apc-avv-primario-hover); }
.apc-avv .apc-avv-submit[disabled] { opacity: 0.6; cursor: progress; }
@media (min-width: 700px) { .apc-avv .apc-avv-submit { display: inline-block; width: auto; min-width: 16rem; } }

/* Honeypot: fuori schermo per le persone, visibile ai bot */
.apc-avv .apc-avv-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

.apc-avv, .apc-avv-notice { scroll-margin-top: 6rem; }

@media (prefers-reduced-motion: reduce) {
	.apc-avv *, .apc-avv *::before, .apc-avv *::after { transition: none !important; animation: none !important; }
}
