/* Moduli Contatto – stile di base: eredita font, campi e pulsanti dal tema (Basel). */
.mcf-form {
	--mcf-error: #c0392b;
	--mcf-success: #2e7d32;
	--mcf-border: rgba(0, 0, 0, .14);
	--mcf-muted: #777;
	--mcf-gap: 20px;
	position: relative;
	margin: 0 0 1.5em;
	/* Si adatta alla colonna in cui è inserito, non alla larghezza dello schermo. */
	container-type: inline-size;
	container-name: mcf;
}

.mcf-form .mcf-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 0 var(--mcf-gap);
}

.mcf-form .mcf-field {
	flex: 1 1 100%;
	min-width: 0;
	margin: 0 0 18px;
}

/* Campi "a metà" affiancati solo se la colonna è larga almeno 520px. */
@container mcf (min-width: 520px) {
	.mcf-form .mcf-w-half {
		flex: 1 1 calc(50% - var(--mcf-gap) / 2);
		max-width: calc(50% - var(--mcf-gap) / 2);
	}
}

/* Browser molto vecchi senza container query: si usa la larghezza dello schermo. */
@supports not (container-type: inline-size) {
	@media (min-width: 600px) {
		.mcf-form .mcf-w-half {
			flex: 1 1 calc(50% - var(--mcf-gap) / 2);
			max-width: calc(50% - var(--mcf-gap) / 2);
		}
	}
}

.mcf-form label {
	display: block;
	margin-bottom: 6px;
}

.mcf-form input[type="text"],
.mcf-form input[type="email"],
.mcf-form input[type="tel"],
.mcf-form select,
.mcf-form textarea {
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	margin: 0;
}

.mcf-form textarea {
	min-height: 140px;
	resize: vertical;
}

.mcf-form .mcf-req {
	color: var(--mcf-error);
}

/* Errori */
.mcf-form .mcf-error {
	display: block;
	color: var(--mcf-error);
	font-size: 0.85em;
	line-height: 1.4;
}

.mcf-form .mcf-error:not(:empty) {
	margin-top: 6px;
}

.mcf-form .mcf-has-error input:not([type="checkbox"]),
.mcf-form .mcf-has-error textarea,
.mcf-form .mcf-has-error select {
	border-color: var(--mcf-error) !important;
}

/* Privacy */
.mcf-form .mcf-check {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin: 0;
	cursor: pointer;
	font-size: 0.95em;
	line-height: 1.5;
}

.mcf-form .mcf-check input {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	margin: 2px 0 0;
}

.mcf-form .mcf-check a {
	text-decoration: underline;
}

/* Campo trappola anti-bot */
.mcf-form .mcf-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* "Non sono un robot" */
.mcf-captcha {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	min-width: min(280px, 100%);
	max-width: 100%;
	box-sizing: border-box;
	padding: 12px 14px;
	background: #f9f9f9;
	border: 1px solid #d3d3d3;
	border-radius: 3px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
	font-size: 14px;
	color: #222;
}

.mcf-has-error .mcf-captcha {
	border-color: var(--mcf-error);
}

.mcf-captcha-box {
	position: relative;
	flex: 0 0 auto;
	width: 28px !important;
	height: 28px !important;
	min-width: 0 !important;
	min-height: 0 !important;
	padding: 0 !important;
	margin: 0 !important;
	background: #fff !important;
	border: 2px solid #c1c1c1 !important;
	border-radius: 2px !important;
	box-shadow: none !important;
	cursor: pointer;
	line-height: 1 !important;
	transition: border-color .15s;
}

.mcf-captcha-box:hover {
	border-color: #b2b2b2 !important;
}

.mcf-captcha-box:focus-visible {
	outline: 2px solid #4a90e2;
	outline-offset: 2px;
}

.mcf-captcha-label {
	flex: 1 1 auto;
	user-select: none;
}

.mcf-captcha-brand {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	margin-left: auto;
	padding-left: 10px;
	font-size: 10px;
	color: #8a8a8a;
	line-height: 1.1;
}

.mcf-captcha-brand svg {
	width: 22px;
	height: 22px;
	color: #9aa4b1;
}

.mcf-captcha-spinner,
.mcf-captcha-tick {
	position: absolute;
	inset: 0;
	margin: auto;
	opacity: 0;
	pointer-events: none;
}

.mcf-captcha-spinner {
	width: 18px;
	height: 18px;
	border: 3px solid #d6e4f5;
	border-top-color: #4a90e2;
	border-radius: 50%;
}

.mcf-captcha-tick {
	width: 24px;
	height: 24px;
	color: var(--mcf-success);
	transform: scale(.4);
}

.mcf-captcha[data-state="loading"] .mcf-captcha-box {
	border-color: transparent !important;
	background: transparent !important;
}

.mcf-captcha[data-state="loading"] .mcf-captcha-spinner {
	opacity: 1;
	animation: mcf-spin .8s linear infinite;
}

.mcf-captcha[data-state="checked"] .mcf-captcha-box {
	border-color: transparent !important;
	background: transparent !important;
	cursor: default;
}

.mcf-captcha[data-state="checked"] .mcf-captcha-tick {
	opacity: 1;
	transform: scale(1);
	transition: transform .25s cubic-bezier(.2, 1.6, .4, 1), opacity .15s;
}

@keyframes mcf-spin {
	to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
	.mcf-captcha[data-state="loading"] .mcf-captcha-spinner { animation-duration: 2s; }
	.mcf-captcha[data-state="checked"] .mcf-captcha-tick { transition: none; }
}

/* Colonne strette (es. 1/4 su desktop o telefono). */
@container mcf (max-width: 400px) {
	.mcf-captcha { width: 100%; }
	.mcf-form .mcf-submit { width: 100%; }
}

@container mcf (max-width: 260px) {
	.mcf-captcha { gap: 8px; padding: 10px; }
	.mcf-captcha-brand span { display: none; }
}

/* Invio */
.mcf-form .mcf-actions {
	margin-top: 4px;
}

.mcf-form.mcf-is-sending .mcf-submit {
	opacity: .6;
	cursor: wait;
}

.mcf-form .mcf-response:not(:empty) {
	margin-top: 18px;
	padding: 14px 16px;
	border-left: 4px solid currentColor;
	background: rgba(0, 0, 0, .03);
	line-height: 1.5;
}

.mcf-form .mcf-response--success { color: var(--mcf-success); }
.mcf-form .mcf-response--error { color: var(--mcf-error); }

.mcf-admin-notice {
	padding: 10px 14px;
	border: 1px dashed #c0392b;
	color: #c0392b;
}
