/* ==========================================================================
   CF7 FORM BLOCK
   Figma: node 4699:3904
   ========================================================================== */

/* Variabili locali non presenti in tokens.css */
:root {
	--stroke-sub-300: #cdd0d5;
	--stroke-soft-200: #e2e4e9;
}

.s4w-cf7-form {
	width: 100%;
	padding: 64px 0;
}

.s4w-cf7-form__inner {
	max-width: 890px;
	margin: 0 auto;
}

/* CF7 inserisce <br> dopo le label — li nascondiamo */
.s4w-cf7-form .form-group br {
	display: none;
}

/* ==========================================================================
   WPCF7 FORM LAYOUT
   ========================================================================== */

.s4w-cf7-form .wpcf7 {
	width: 100%;
}

/* Righe a 2 colonne */
.s4w-cf7-form .form-row {
	display: flex;
	flex-direction: row;
	gap: 10px;
	align-items: flex-start;
	width: 100%;
	margin-bottom: 32px;
}

.s4w-cf7-form .form-row:last-child {
	margin-bottom: 0;
}

/* Singolo gruppo campo */
.s4w-cf7-form .form-group {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 0;
}

.s4w-cf7-form .form-group p {
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 16px;
	width: 100%;
}

/* ==========================================================================
   LABEL
   ========================================================================== */

.s4w-cf7-form .form-group label {
	font-family: var(--font-primary);
	font-weight: var(--weight-regular);
	font-size: var(--label-large);
	line-height: 1;
	letter-spacing: -0.05em;
	text-transform: uppercase;
	color: var(--text-main-900);
}

/* ==========================================================================
   INPUT / TEXTAREA
   ========================================================================== */

.s4w-cf7-form .wpcf7-form-control-wrap {
	display: block;
	width: 100%;
}

.s4w-cf7-form input[type="text"],
.s4w-cf7-form input[type="email"],
.s4w-cf7-form input[type="tel"],
.s4w-cf7-form input[type="date"],
.s4w-cf7-form select,
.s4w-cf7-form textarea {
	width: 100%;
	height: 54px;
	padding: 15px 10px;
	background-color: var(--bg-white-0);
	border: 1px solid var(--stroke-sub-300);
	border-radius: 0;
	outline: none;
	font-family: 'Merriweather', serif;
	font-weight: var(--weight-regular);
	font-size: var(--paragraph-small);
	line-height: 1.6;
	letter-spacing: 0;
	color: var(--text-main-900);
	appearance: none;
	-webkit-appearance: none;
	box-sizing: border-box;
	transition: border-color 0.2s ease;
}

.s4w-cf7-form input[type="text"]::placeholder,
.s4w-cf7-form input[type="email"]::placeholder,
.s4w-cf7-form input[type="tel"]::placeholder,
.s4w-cf7-form textarea::placeholder {
	color: var(--text-soft-400);
}

/* Select custom - freccia e colore placeholder */
.s4w-cf7-form select,
.s4w-cf7-form .wpcf7-select {
	width: 100%;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%23525866' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	padding-right: 36px;
	cursor: pointer;
}

.s4w-cf7-form select option[value=""] {
	color: var(--text-soft-400);
}

.s4w-cf7-form select:invalid,
.s4w-cf7-form select option:first-child {
	color: var(--text-soft-400);
}

.s4w-cf7-form input[type="text"]:focus,
.s4w-cf7-form input[type="email"]:focus,
.s4w-cf7-form input[type="tel"]:focus,
.s4w-cf7-form input[type="date"]:focus,
.s4w-cf7-form select:focus,
.s4w-cf7-form textarea:focus {
	border-color: var(--text-main-900);
}

.s4w-cf7-form textarea {
	height: 120px;
	resize: none;
}

/* Input date - rimuovi icona browser */
.s4w-cf7-form input[type="date"]::-webkit-calendar-picker-indicator {
	opacity: 0.5;
	cursor: pointer;
}

/* ==========================================================================
   CHECKBOX
   ========================================================================== */

.s4w-cf7-form .wpcf7-acceptance {
	display: block;
	width: 100%;
}

.s4w-cf7-form .wpcf7-list-item {
	margin: 0;
}

.s4w-cf7-form .wpcf7-list-item label {
	display: flex;
	flex-direction: row;
	align-items: flex-end;
	gap: 9px;
	cursor: pointer;
}

.s4w-cf7-form .wpcf7-list-item input[type="checkbox"] {
	width: 21px;
	height: 21px;
	min-width: 21px;
	min-height: 21px;
	background-color: var(--bg-weak-100);
	border: 1px solid var(--stroke-sub-300);
	border-radius: 0;
	appearance: none;
	-webkit-appearance: none;
	cursor: pointer;
	flex-shrink: 0;
	transition: background-color 0.2s ease;
}

.s4w-cf7-form .wpcf7-list-item input[type="checkbox"]:checked {
	background-color: var(--text-main-900);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='10' viewBox='0 0 13 10'%3E%3Cpath d='M1 5l4 4 7-8' stroke='%23ffffff' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: center;
}

.s4w-cf7-form .wpcf7-list-item-label {
	font-family: 'Merriweather', serif;
	font-weight: var(--weight-regular);
	font-size: var(--paragraph-small);
	line-height: 1.6;
	letter-spacing: 0;
	text-transform: none;
	color: var(--text-soft-400);
}

.s4w-cf7-form .wpcf7-list-item-label a {
	color: var(--text-soft-400);
	text-decoration: underline;
	text-underline-offset: 2px;
	text-transform: none;
}

/* ==========================================================================
   SUBMIT BUTTON
   ========================================================================== */

/* Riga con acceptance checkbox: riduce spazio sopra e sotto */
.s4w-cf7-form .form-row:has(.wpcf7-acceptance) {
	margin-bottom: 16px;
}

/* Riga precedente alle checkbox (note textarea): riduce spazio sotto */
.s4w-cf7-form .form-row:has(textarea) {
	margin-bottom: 16px;
}

/* Riga con il submit: centrata, senza margin extra */
.s4w-cf7-form .form-row:has(input[type="submit"]) {
	justify-content: center;
	margin-bottom: 0;
}

.s4w-cf7-form input[type="submit"] {
	display: block;
	width: auto;
	min-width: 240px;
	white-space: nowrap;
	margin: 0 auto;
	padding: 18px 32px;
	background-color: var(--text-main-900);
	color: var(--bg-white-0);
	border: none;
	border-radius: 0;
	font-family: var(--font-primary);
	font-weight: var(--weight-regular);
	font-size: var(--paragraph-small);
	line-height: 1;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	text-align: center;
	cursor: pointer;
	transition: opacity 0.2s ease;
	appearance: none;
	-webkit-appearance: none;
}

.s4w-cf7-form input[type="submit"]:hover {
	opacity: 0.8;
}

/* CF7 spinner */
.s4w-cf7-form .wpcf7-spinner {
	margin: 0 0 0 8px;
}

/* ==========================================================================
   VALIDATION STATES
   ========================================================================== */

.s4w-cf7-form .wpcf7-not-valid {
	border-color: #e74c3c !important;
}

.s4w-cf7-form .wpcf7-not-valid-tip {
	display: block;
	font-family: 'Merriweather', serif;
	font-size: 12px;
	color: #e74c3c;
	margin-top: 4px;
}

.s4w-cf7-form .wpcf7-response-output {
	margin: 16px 0 0;
	padding: 12px 16px;
	font-family: 'Merriweather', serif;
	font-size: var(--paragraph-small);
	line-height: 1.6;
	border: 1px solid transparent;
}

.s4w-cf7-form .wpcf7-mail-sent-ok {
	border-color: #27ae60;
	color: #27ae60;
}

.s4w-cf7-form .wpcf7-mail-sent-ng,
.s4w-cf7-form .wpcf7-aborted,
.s4w-cf7-form .wpcf7-validation-errors,
.s4w-cf7-form .wpcf7-spam-blocked {
	border-color: #e74c3c;
	color: #e74c3c;
}

/* ==========================================================================
   RESPONSIVE (≤768px)
   ========================================================================== */

@media (max-width: 768px) {
	.s4w-cf7-form {
		padding: 40px 0;
	}

	.s4w-cf7-form .form-row {
		flex-direction: column;
		gap: 24px;
		margin-bottom: 24px;
	}

	.s4w-cf7-form .form-group {
		width: 100%;
	}

	.s4w-cf7-form .form-row--submit {
		margin-top: 32px;
	}

	.s4w-cf7-form .form-row:has(input[type="submit"]) {
		justify-content: center;
	}
}
