/**
 * Contact Form 7 visual skin — Lovable input style ported into CF7 markup.
 *
 * Loaded only when:
 *   - the CF7 plugin is active, AND
 *   - the current page renders an alteo/contact-form block (see functions.php).
 *
 * Plain CSS (not Tailwind utilities) — CF7 generates fixed HTML that we don't
 * own, so we target it with concrete selectors scoped under `.alteo-scope`.
 *
 * Tokens are CSS variables exposed by theme.json (--wp--preset--color--*),
 * keeping the palette as the single source of truth.
 */

.alteo-scope .wpcf7 {
	font-family: 'Inter', system-ui, sans-serif;
	color: var(--wp--preset--color--foreground);
}

.alteo-scope .wpcf7-form > p {
	margin: 0 0 1.25rem;
}

.alteo-scope .wpcf7-form label {
	display: block;
	font-family: 'Lexend', system-ui, sans-serif;
	font-weight: 500;
	font-size: 0.875rem;
	color: var(--wp--preset--color--foreground);
	margin-bottom: 0.5rem;
}

.alteo-scope .wpcf7-form .wpcf7-form-control-wrap {
	display: block;
}

.alteo-scope .wpcf7-form input[type="text"],
.alteo-scope .wpcf7-form input[type="email"],
.alteo-scope .wpcf7-form input[type="tel"],
.alteo-scope .wpcf7-form input[type="number"],
.alteo-scope .wpcf7-form input[type="url"],
.alteo-scope .wpcf7-form input[type="date"],
.alteo-scope .wpcf7-form input[type="search"],
.alteo-scope .wpcf7-form textarea,
.alteo-scope .wpcf7-form select {
	width: 100%;
	background: var(--wp--preset--color--surface-container-low);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 0.75rem;
	padding: 0.75rem 1rem;
	font-size: 0.875rem;
	color: var(--wp--preset--color--foreground);
	transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
	outline: none;
	font-family: inherit;
	line-height: 1.4;
}

.alteo-scope .wpcf7-form textarea {
	min-height: 7rem;
	resize: vertical;
}

.alteo-scope .wpcf7-form input::placeholder,
.alteo-scope .wpcf7-form textarea::placeholder {
	color: var(--wp--preset--color--muted-foreground);
	opacity: 1;
}

.alteo-scope .wpcf7-form input:focus,
.alteo-scope .wpcf7-form textarea:focus,
.alteo-scope .wpcf7-form select:focus {
	border-color: var(--wp--preset--color--primary);
	box-shadow: 0 0 0 3px rgba(109, 166, 58, 0.2);
}

/* Radio-group fieldsets — no browser chrome, legend styled like a label */
.alteo-scope .wpcf7-form fieldset {
	border: none;
	margin: 0 0 1.25rem;
	padding: 0;
	min-width: 0;
}

.alteo-scope .wpcf7-form fieldset legend {
	display: block;
	font-family: 'Lexend', system-ui, sans-serif;
	font-weight: 500;
	font-size: 0.875rem;
	color: var(--wp--preset--color--foreground);
	margin-bottom: 0.5rem;
	padding: 0;
}

/* File inputs — same box as text inputs, pill-styled chooser button */
.alteo-scope .wpcf7-form input[type="file"] {
	width: 100%;
	background: var(--wp--preset--color--surface-container-low);
	border: 1px dashed var(--wp--preset--color--border);
	border-radius: 0.75rem;
	padding: 0.55rem 1rem;
	font-size: 0.875rem;
	color: var(--wp--preset--color--muted-foreground);
	font-family: inherit;
	cursor: pointer;
	transition: border-color 0.15s ease;
}

.alteo-scope .wpcf7-form input[type="file"]:hover,
.alteo-scope .wpcf7-form input[type="file"]:focus {
	border-color: var(--wp--preset--color--primary);
	outline: none;
}

.alteo-scope .wpcf7-form input[type="file"]::file-selector-button {
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--primary-foreground);
	border: none;
	border-radius: 999px;
	padding: 0.35rem 1rem;
	margin-right: 0.75rem;
	font-family: 'Lexend', system-ui, sans-serif;
	font-weight: 600;
	font-size: 0.75rem;
	cursor: pointer;
}

/* Inline hint lines under file inputs (allowed types / max size) */
.alteo-scope .wpcf7-form label em {
	display: block;
	margin-top: 0.35rem;
	font-style: normal;
	font-size: 0.75rem;
	font-weight: 400;
	color: var(--wp--preset--color--muted-foreground);
}

/* Radio + checkbox lists — chip-style "Igen / Nem" rendering */
.alteo-scope .wpcf7-form .wpcf7-radio,
.alteo-scope .wpcf7-form .wpcf7-checkbox {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
}

.alteo-scope .wpcf7-form .wpcf7-list-item {
	flex: 1 1 auto;
	margin: 0;
}

.alteo-scope .wpcf7-form .wpcf7-list-item label {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.75rem 1rem;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 0.75rem;
	background: var(--wp--preset--color--surface-container-low);
	cursor: pointer;
	margin: 0;
	font-size: 0.875rem;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.alteo-scope .wpcf7-form .wpcf7-list-item label:hover {
	border-color: rgba(109, 166, 58, 0.5);
}

.alteo-scope .wpcf7-form .wpcf7-list-item:has(input:checked) label {
	border-color: var(--wp--preset--color--primary);
	background: rgba(109, 166, 58, 0.06);
}

.alteo-scope .wpcf7-form input[type="radio"],
.alteo-scope .wpcf7-form input[type="checkbox"] {
	accent-color: var(--wp--preset--color--primary);
}

/* Submit button — primary pill */
.alteo-scope .wpcf7-form .wpcf7-submit,
.alteo-scope .wpcf7-form input[type="submit"] {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--primary-foreground);
	border: none;
	border-radius: 999px;
	padding: 0.75rem 1.5rem;
	font-family: 'Lexend', system-ui, sans-serif;
	font-weight: 600;
	font-size: 0.875rem;
	cursor: pointer;
	transition: background-color 0.15s ease, transform 0.05s ease;
}

.alteo-scope .wpcf7-form .wpcf7-submit:hover,
.alteo-scope .wpcf7-form input[type="submit"]:hover {
	background: var(--wp--preset--color--primary-container);
}

.alteo-scope .wpcf7-form .wpcf7-submit:active,
.alteo-scope .wpcf7-form input[type="submit"]:active {
	transform: scale(0.97);
}

.alteo-scope .wpcf7-form .wpcf7-spinner {
	background-color: var(--wp--preset--color--primary);
}

/* Acceptance (privacy checkbox) — full-width row, not chip */
.alteo-scope .wpcf7-form .wpcf7-acceptance .wpcf7-list-item {
	flex: 0 0 100%;
}

.alteo-scope .wpcf7-form .wpcf7-acceptance .wpcf7-list-item label {
	border: none;
	background: transparent;
	padding: 0;
	gap: 0.75rem;
	align-items: flex-start;
}

.alteo-scope .wpcf7-form .wpcf7-acceptance a {
	color: var(--wp--preset--color--primary);
	font-weight: 600;
	text-underline-offset: 2px;
}

/* Validation / response */
.alteo-scope .wpcf7-not-valid-tip {
	color: var(--wp--preset--color--destructive);
	font-size: 0.75rem;
	margin-top: 0.25rem;
}

.alteo-scope .wpcf7 .wpcf7-not-valid {
	border-color: var(--wp--preset--color--destructive);
	box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.alteo-scope .wpcf7-response-output {
	border-radius: 0.75rem;
	padding: 0.75rem 1rem;
	margin: 1rem 0 0;
	font-size: 0.875rem;
}

.alteo-scope .wpcf7 form.sent .wpcf7-response-output {
	background: rgba(109, 166, 58, 0.1);
	border: 1px solid var(--wp--preset--color--primary);
	color: var(--wp--preset--color--primary);
}

.alteo-scope .wpcf7 form.invalid .wpcf7-response-output,
.alteo-scope .wpcf7 form.unaccepted .wpcf7-response-output,
.alteo-scope .wpcf7 form.spam .wpcf7-response-output,
.alteo-scope .wpcf7 form.failed .wpcf7-response-output {
	background: rgba(239, 68, 68, 0.08);
	border: 1px solid var(--wp--preset--color--destructive);
	color: var(--wp--preset--color--destructive);
}

/* Two-column input grid utility — CF7 forms can use a wrapper class to opt in */
.alteo-scope .alteo-cf7-wrap .wpcf7-form .alteo-cf7-row {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1.25rem;
}

@media (min-width: 768px) {
	.alteo-scope .alteo-cf7-wrap .wpcf7-form .alteo-cf7-row {
		grid-template-columns: 1fr 1fr;
	}
}
