.bd-cf-form {
	max-width: 700px;
}

.bd-cf-fields-wrap {
	display: flex;
	flex-wrap: wrap;
	gap: 0 20px;
}

.bd-cf-width-full {
	width: 100%;
}

.bd-cf-width-half,
.bd-cf-width-half_mobile {
	width: calc( 50% - 10px );
}

/* Su schermi stretti, i campi "metà riga" tornano a riga intera per leggibilità.
   I campi impostati su "metà riga (anche su mobile)" restano affiancati anche qui. */
@media ( max-width: 600px ) {
	.bd-cf-width-half {
		width: 100%;
	}
}

.bd-cf-field {
	margin-bottom: 20px;
	box-sizing: border-box;
}

.bd-cf-form .bd-cf-field label {
	display: block;
	font-weight: 600;
	margin-bottom: 6px;
	color: var( --bd-cf-text-color, inherit ) !important;
	font-family: var( --bd-cf-font-family, inherit ) !important;
}

.bd-cf-form .bd-cf-field input[type="text"],
.bd-cf-form .bd-cf-field input[type="email"],
.bd-cf-form .bd-cf-field input[type="tel"],
.bd-cf-form .bd-cf-field input[type="number"],
.bd-cf-form .bd-cf-field input[type="date"],
.bd-cf-form .bd-cf-field input[type="url"],
.bd-cf-form .bd-cf-field textarea {
	width: 100%;
	padding: 10px;
	box-sizing: border-box;
	border: 1px solid var( --bd-cf-border-color, #ccc ) !important;
	border-radius: var( --bd-cf-border-radius, 4px ) !important;
	font-size: 15px;
	font-family: var( --bd-cf-font-family, inherit ) !important;
	line-height: normal;
	background-color: var( --bd-cf-bg-color, #fff ) !important;
	color: var( --bd-cf-text-color, inherit ) !important;
}

.bd-cf-heading {
	margin: 0 0 16px;
	font-size: 20px;
	font-weight: 700;
	color: var( --bd-cf-text-color, inherit );
	font-family: var( --bd-cf-font-family, inherit );
}

.bd-cf-radio-option,
.bd-cf-checkbox-option {
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: normal;
	margin-bottom: 6px;
	cursor: pointer;
}

.bd-cf-radio-option input,
.bd-cf-checkbox-option input {
	width: auto;
	margin: 0;
}

.bd-cf-recaptcha {
	margin-bottom: 20px;
}

.bd-cf-login-required {
	max-width: 700px;
	padding: 20px;
	border: 1px solid #ccd0d4;
	border-radius: 4px;
	background: #f6f7f7;
}

.bd-cf-login-required a {
	font-weight: 600;
}

.bd-cf-login-required-custom {
	text-align: center;
}

.bd-cf-form .bd-cf-field select {
	width: 100%;
	box-sizing: border-box;
	border: 1px solid var( --bd-cf-border-color, #ccc ) !important;
	border-radius: var( --bd-cf-border-radius, 4px ) !important;
	font-size: 15px;
	font-family: var( --bd-cf-font-family, inherit ) !important;
	color: var( --bd-cf-text-color, inherit ) !important;
	background-color: var( --bd-cf-bg-color, #fff ) !important;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	cursor: pointer;
	padding-inline-end: 36px;
	background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23666'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 10px center;
	background-size: 16px;
}

.bd-cf-field select:focus {
	outline: none;
	border-color: #1d2327;
}

.bd-cf-required {
	color: #d63638;
}

.bd-cf-hint {
	font-size: 13px;
	color: #666;
	margin-top: 4px;
}

.bd-cf-honeypot {
	position: absolute;
	left: -9999px;
	top: -9999px;
	opacity: 0;
	height: 0;
	overflow: hidden;
}

.bd-cf-form button.bd-cf-submit[type="submit"] {
	background: var( --bd-cf-button-bg, #1d2327 ) !important;
	color: var( --bd-cf-button-text, #fff ) !important;
	border: none !important;
	padding: 12px 30px;
	border-radius: var( --bd-cf-button-radius, 4px ) !important;
	font-size: 16px;
	font-family: var( --bd-cf-font-family, inherit ) !important;
	cursor: pointer;
}

.bd-cf-form button.bd-cf-submit[type="submit"]:hover {
	opacity: 0.85;
}

.bd-cf-message {
	padding: 12px 16px;
	border-radius: 4px;
	margin-bottom: 20px;
	font-weight: 600;
}

.bd-cf-success {
	background: #d1e7dd;
	color: #0f5132;
	border: 1px solid #badbcc;
}

.bd-cf-error {
	background: #f8d7da;
	color: #842029;
	border: 1px solid #f5c2c7;
}

/* ==========================================================================
   Dark mode (.custom-dark, BD Dark Mode)
   I colori base dei campi arrivano dalle variabili CSS generate in PHP
   (palette dark di default + eventuali personalizzazioni del form).
   Qui si sistemano gli elementi con colori fissi e i dettagli del browser.
   ========================================================================== */

.custom-dark .bd-cf-form {
	color-scheme: dark; /* date picker, spinner, scrollbar delle textarea in versione scura */
}

.custom-dark .bd-cf-form .bd-cf-field input::placeholder,
.custom-dark .bd-cf-form .bd-cf-field textarea::placeholder {
	color: var( --bd-cf-text-color, #e6e6e6 );
	opacity: 0.55;
}

/* Autocompilazione Chrome/Edge/Safari: evita lo sfondo chiaro forzato dal browser. */
.custom-dark .bd-cf-form .bd-cf-field input:-webkit-autofill,
.custom-dark .bd-cf-form .bd-cf-field input:-webkit-autofill:hover,
.custom-dark .bd-cf-form .bd-cf-field input:-webkit-autofill:focus,
.custom-dark .bd-cf-form .bd-cf-field textarea:-webkit-autofill {
	-webkit-text-fill-color: var( --bd-cf-text-color, #e6e6e6 ) !important;
	-webkit-box-shadow: 0 0 0 1000px var( --bd-cf-bg-color, #1f2124 ) inset !important;
	box-shadow: 0 0 0 1000px var( --bd-cf-bg-color, #1f2124 ) inset !important;
	caret-color: var( --bd-cf-text-color, #e6e6e6 );
	transition: background-color 9999s ease-out 0s;
}

.custom-dark .bd-cf-form .bd-cf-field select {
	background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23bbb'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd'/%3E%3C/svg%3E");
}

.custom-dark .bd-cf-form .bd-cf-field select option {
	background-color: var( --bd-cf-bg-color, #1f2124 );
	color: var( --bd-cf-text-color, #e6e6e6 );
}

.custom-dark .bd-cf-form .bd-cf-field input:focus,
.custom-dark .bd-cf-form .bd-cf-field textarea:focus,
.custom-dark .bd-cf-field select:focus {
	border-color: #8a8f98 !important;
}

.custom-dark .bd-cf-radio-option,
.custom-dark .bd-cf-checkbox-option {
	color: var( --bd-cf-text-color, inherit );
}

.custom-dark .bd-cf-hint {
	color: #a7aaad;
}

.custom-dark .bd-cf-required {
	color: #ff6b6d;
}

.custom-dark .bd-cf-login-required {
	background: #1f2124;
	border-color: #3c3f44;
	color: #e6e6e6;
}

.custom-dark .bd-cf-success {
	background: #0f2e22;
	color: #a3dfc0;
	border-color: #1d5c42;
}

.custom-dark .bd-cf-error {
	background: #3a1417;
	color: #f5b5bb;
	border-color: #6e2a30;
}

/* ==========================================================================
   Pulsanti Accedi / Registrati (messaggio personalizzato del blocco)
   ========================================================================== */

.bd-cf-login-actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px;
	margin: 14px 0 0;
}

.bd-cf-login-required a.bd-cf-login-btn {
	display: inline-block;
	padding: 9px 22px;
	border-radius: 4px;
	border: 1px solid currentColor;
	text-decoration: none;
	font-weight: 600;
}

.bd-cf-login-required a.bd-cf-login-btn-primary {
	background: #1d2327;
	border-color: #1d2327;
	color: #fff;
}

.custom-dark .bd-cf-login-required a.bd-cf-login-btn-primary {
	background: #e6e6e6;
	border-color: #e6e6e6;
	color: #1f2124;
}

/* ==========================================================================
   Popup di esito invio
   ========================================================================== */

html.bd-cf-modal-open {
	overflow: hidden;
}

.bd-cf-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	box-sizing: border-box;
}

.bd-cf-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba( 0, 0, 0, 0.55 );
	animation: bd-cf-fade-in 0.2s ease;
}

.bd-cf-modal-box {
	position: relative;
	width: 100%;
	max-width: 420px;
	padding: 30px 26px 24px;
	border-radius: 10px;
	background: #fff;
	color: #1d2327;
	text-align: center;
	box-shadow: 0 20px 50px rgba( 0, 0, 0, 0.25 );
	animation: bd-cf-pop-in 0.22s ease;
}

.bd-cf-modal.is-closing .bd-cf-modal-backdrop,
.bd-cf-modal.is-closing .bd-cf-modal-box {
	opacity: 0;
	transition: opacity 0.18s ease;
}

@keyframes bd-cf-fade-in {
	from { opacity: 0; }
	to { opacity: 1; }
}

@keyframes bd-cf-pop-in {
	from { opacity: 0; transform: translateY( 12px ) scale( 0.98 ); }
	to { opacity: 1; transform: none; }
}

.bd-cf-modal-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	margin-bottom: 12px;
	border-radius: 50%;
}

.bd-cf-modal-success .bd-cf-modal-icon {
	background: #d1e7dd;
	color: #0f5132;
}

.bd-cf-modal-error .bd-cf-modal-icon {
	background: #f8d7da;
	color: #842029;
}

.bd-cf-modal .bd-cf-modal-title {
	margin: 0 0 8px;
	font-size: 20px;
	font-weight: 700;
	color: inherit;
}

.bd-cf-modal .bd-cf-modal-text {
	margin: 0 0 22px;
	font-size: 15px;
	line-height: 1.5;
	color: inherit;
}

.bd-cf-modal button.bd-cf-modal-close {
	min-width: 120px;
	padding: 10px 26px;
	border: none;
	border-radius: 4px;
	background: #1d2327;
	color: #fff;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
}

.bd-cf-modal button.bd-cf-modal-close:hover {
	opacity: 0.85;
}

.bd-cf-modal button.bd-cf-modal-close:focus-visible {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

.custom-dark .bd-cf-modal-box {
	background: #1f2124;
	color: #e6e6e6;
	box-shadow: 0 20px 50px rgba( 0, 0, 0, 0.6 );
	border: 1px solid #3c3f44;
}

.custom-dark .bd-cf-modal-backdrop {
	background: rgba( 0, 0, 0, 0.7 );
}

.custom-dark .bd-cf-modal-success .bd-cf-modal-icon {
	background: #0f2e22;
	color: #a3dfc0;
}

.custom-dark .bd-cf-modal-error .bd-cf-modal-icon {
	background: #3a1417;
	color: #f5b5bb;
}

.custom-dark .bd-cf-modal button.bd-cf-modal-close {
	background: #e6e6e6;
	color: #1f2124;
}

@media ( prefers-reduced-motion: reduce ) {
	.bd-cf-modal-backdrop,
	.bd-cf-modal-box {
		animation: none;
		transition: none;
	}
}

/* ==========================================================================
   Widget anti-bot (spazio riservato per evitare salti di layout)
   ========================================================================== */

.bd-cf-recaptcha-widget {
	min-height: 78px;
}

.bd-cf-turnstile {
	max-width: 400px;
}

.bd-cf-turnstile-widget {
	min-height: 65px;
}

/* ==========================================================================
   Invio AJAX: stato "in corso"
   ========================================================================== */

.bd-cf-form.is-sending button.bd-cf-submit[type="submit"] {
	opacity: 0.7 !important;
	cursor: progress;
}

.bd-cf-spinner {
	display: inline-block;
	width: 14px;
	height: 14px;
	margin-right: 8px;
	vertical-align: -2px;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: bd-cf-spin 0.7s linear infinite;
}

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