/*
 * Kontakt- und Schadenformular: Beschriftungen, Raster, Meldungen, Fehler, Spam-Fangfeld.
 * Markup aus includes/forms.php, Verhalten aus assets/js/forms.js.
 */

/* Fangfeld für Bots: für Menschen unsichtbar */
.fm-hp {
	position: absolute !important;
	left: -10000px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.fm-form[hidden],
.fm-form-success[hidden],
.fm-form-message[hidden] {
	display: none !important;
}

.fm-required-note {
	margin: 0 0 18px;
	color: var(--fm-text-soft);
	font-size: 14px;
}

.fm-req {
	color: var(--fm-error-ink);
	font-weight: 600;
}

/* ---------- Abschnitte (Schadenformular) ---------- */
.fm-fieldset {
	min-width: 0;
	margin: 0 0 12px;
	padding: 0;
	border: 0;
}

.fm-fieldset legend {
	margin: 0 0 14px;
	padding: 0;
	color: var(--fm-blue);
	font: 600 22px/1.3 var(--fm-font);
}

/* ---------- Felder ---------- */
.fm-field {
	min-width: 0;
	margin: 0 0 18px;
}

.fm-field > label {
	display: block;
	margin: 0 0 6px;
	color: var(--fm-text-strong);
	font: 600 15px/1.4 var(--fm-font);
}

.fm-hint {
	display: block;
	margin: -2px 0 6px;
	color: var(--fm-text-soft);
	font-size: 14px;
	line-height: 1.45;
}

/* Zwei Felder nebeneinander, auf schmalen Bildschirmen untereinander */
.fm-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 0 20px;
}

.fm-row--narrow-first {
	grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
}

@media (max-width: 600px) {
	.fm-row,
	.fm-row--narrow-first {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* Einheitliche, gut treffbare Eingabefelder; 16px verhindert das Zoomen auf iPhones */
.fm-form .wpcf7-form-control:not([type="submit"]):not([type="file"]) {
	box-sizing: border-box;
	width: 100%;
	max-width: none;
	min-height: 44px;
	padding: 9px 12px;
	font-size: 16px;
	line-height: 1.4;
}

.fm-form textarea.wpcf7-form-control {
	min-height: 140px;
	resize: vertical;
}

.fm-form input[type="file"] {
	max-width: 100%;
	font-size: 15px;
}

/* Feldränder mit ausreichendem Kontrast (mind. 3:1) */
.fm-form input[type="text"],
.fm-form input[type="email"],
.fm-form input[type="tel"],
.fm-form input[type="date"],
.fm-form input[type="time"],
.fm-form input[type="file"],
.fm-form select,
.fm-form textarea {
	border-color: var(--fm-field-edge) !important;
}

/* ---------- Fehler ---------- */
.fm-form-error {
	display: block;
	margin-top: 6px;
	color: var(--fm-error-ink);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
}

.fm-form-error:empty {
	display: none;
}

/* Fehlerhafte Felder rot (nach der Feldrand-Regel) */
.fm-form .fm-field--invalid .wpcf7-form-control,
.fm-form .wpcf7-form-control[aria-invalid="true"] {
	border-color: var(--fm-error) !important;
	background-color: var(--fm-error-tint) !important;
}

/* Sammelmeldung über dem Formular */
.fm-form-message {
	margin: 0 0 20px;
	padding: 12px 16px;
	border: 1px solid var(--fm-blue);
	border-radius: 3px;
	background: var(--fm-tint);
	color: var(--fm-blue);
	font-size: 15px;
	line-height: 1.5;
}

.fm-form-message--error {
	border-color: var(--fm-error);
	background: var(--fm-error-tint);
	color: var(--fm-error-ink);
	font-weight: 600;
}

.fm-form-message:focus {
	outline: none;
}

/* ---------- Datenschutz-Einwilligung ---------- */
.fm-consent-check {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	font-weight: 400;
	line-height: 1.55;
	cursor: pointer;
}

.fm-consent-check input {
	flex: none;
	width: 18px;
	height: 18px;
	margin: 3px 0 0;
	accent-color: var(--fm-blue);
}

.fm-consent-check a {
	color: var(--fm-blue);
	text-decoration: underline;
}

.fm-field--check.fm-field--invalid .fm-consent-check input {
	outline: 2px solid var(--fm-error);
	outline-offset: 2px;
}

/* ---------- Senden ---------- */
.fm-form-actions {
	margin: 8px 0 0;
}

.fm-form .wpcf7-submit:active {
	transform: translateY(1px);
}

.fm-form .wpcf7-submit:disabled {
	cursor: progress;
	opacity: .65;
}

/* ---------- Erfolgsmeldung ---------- */
.fm-form-success {
	margin: 0 0 24px;
	padding: 24px 24px 20px;
	border-top: 3px solid var(--fm-blue);
	background: var(--fm-tint);
	color: var(--fm-text-strong);
}

.fm-form-success:focus {
	outline: none;
}

.fm-form-success p {
	margin: 0 0 10px;
}

.fm-form-success .fm-form-success__title {
	color: var(--fm-blue);
	font: 600 20px/1.35 var(--fm-font);
}

.fm-form-success a {
	color: var(--fm-blue);
	font-weight: 600;
}

/* Felder und Buttons in der Hausschrift statt Systemschrift */
.fm-form input,
.fm-form select,
.fm-form textarea,
.fm-form button,
.fm-form input::file-selector-button {
	font-family: var(--fm-font);
}

/* Beispieltexte klar heller als echte Eingaben */
.fm-form .wpcf7-form-control::placeholder {
	color: var(--fm-placeholder);
	opacity: 1;
}
