/**
 * Fluent Forms — gemeinsames FC-Design
 * Aktivierung: Form CSS Class „fc-form“ in Fluent Forms
 * Farbvariante: Section-Hintergrund (ACF contact_background → bg-main | bg-dark | bg-main-light)
 */

.fluentform:has(form.fc-form) {
	color: inherit;
	font-family: inherit;
	--fc-form-line: rgba(0, 0, 0, 0.85);
	--fc-form-muted: rgba(0, 0, 0, 0.55);
	--fc-form-danger: #c42b2b;
	--fc-form-text: #000;
	--fc-form-focus-line: #000;
	--fc-form-btn-border: #000;
	--fc-form-btn-color: #000;
	--fc-form-btn-fill: #000;
	--fc-form-btn-hover-color: #fff;
	--fc-form-success-bg: rgba(0, 0, 0, 0.06);
	--fc-form-success-text: #000;
}

/* Hell (weiß) — Formularelemente auf blauem / dunklem Hintergrund */
section.kontakt.bg-main .fluentform:has(form.fc-form),
section.kontakt.bg-dark .fluentform:has(form.fc-form),
section.kontakt.bg-main-light .fluentform:has(form.fc-form),
.termin-anmeldung-band.bg-main .fluentform:has(form.fc-form) {
	--fc-form-line: rgba(255, 255, 255, 0.92);
	--fc-form-muted: rgba(255, 255, 255, 0.75);
	--fc-form-danger: #ffb4b4;
	--fc-form-text: #fff;
	--fc-form-focus-line: #fff;
	--fc-form-btn-border: #fff;
	--fc-form-btn-color: #fff;
	--fc-form-btn-fill: #fff;
	--fc-form-btn-hover-color: #000;
	--fc-form-success-bg: rgba(255, 255, 255, 0.12);
	--fc-form-success-text: #fff;
}

.fluentform:has(form.fc-form) .ff-el-group {
	margin-bottom: 1.35rem;
}

.fluentform:has(form.fc-form) .ff-t-container {
	gap: clamp(1rem, 3vw, 2rem);
}

/* --- Text / E-Mail: Unterlinie, Label unten --- */

.fluentform:has(form.fc-form) .ff-el-form-bottom {
	display: flex;
	flex-direction: column-reverse;
}

.fluentform:has(form.fc-form) .ff-el-form-bottom .ff-el-input--label {
	margin-top: 0.35rem;
	margin-bottom: 0;
}

.fluentform:has(form.fc-form) .ff-el-input--label label {
	color: var(--fc-form-line);
	font-size: 0.95rem;
	font-weight: 400;
	line-height: 1.35;
}

.fluentform:has(form.fc-form) .ff-el-form-control {
	background: transparent;
	border: 0;
	border-bottom: 1px solid var(--fc-form-line);
	border-radius: 0;
	box-shadow: none;
	color: var(--fc-form-text);
	font-size: 1rem;
	line-height: 1.4;
	padding: 0.55rem 0 0.65rem;
	transition: border-color 0.2s ease;
}

.fluentform:has(form.fc-form) .ff-el-form-control:focus {
	background: transparent;
	border-bottom-color: var(--fc-form-focus-line);
	box-shadow: none;
	color: var(--fc-form-text);
	outline: none;
}

.fluentform:has(form.fc-form) .ff-el-form-control::placeholder {
	color: var(--fc-form-muted);
	opacity: 1;
}

/* --- Textarea (Kontakt „Nachricht“): voller Rahmen --- */

.fluentform:has(form.fc-form) textarea.ff-el-form-control {
	border: 1px solid var(--fc-form-line);
	border-radius: 5px;
	min-height: clamp(220px, 32vw, 320px);
	padding: 0.85rem 1rem;
	resize: vertical;
}

.fluentform:has(form.fc-form) textarea.ff-el-form-control:focus {
	border-color: var(--fc-form-focus-line);
}

.fluentform:has(form.fc-form) .ff-el-is-error textarea.ff-el-form-control {
	border-color: var(--fc-form-danger);
}

/* --- Select „Titel“: Rahmen --- */

.fluentform:has(form.fc-form) select.ff-el-form-control {
	appearance: none;
	background-color: transparent;
	border: 1px solid var(--fc-form-line);
	border-radius: 5px;
	color: var(--fc-form-text);
	padding: 0.65rem 2.25rem 0.65rem 0.85rem;
}

.fluentform:has(form.fc-form) .ff-el-group:has(select.ff-el-form-control) .ff-el-input--content {
	position: relative;
}

.fluentform:has(form.fc-form) .ff-el-group:has(select.ff-el-form-control) .ff-el-input--content::after {
	border-left: 5px solid transparent;
	border-right: 5px solid transparent;
	border-top: 6px solid var(--fc-form-line);
	content: "";
	pointer-events: none;
	position: absolute;
	right: 0.85rem;
	top: 50%;
	transform: translateY(-50%);
}

/* --- Radio Anrede: immer nebeneinander --- */

.fluentform:has(form.fc-form) .ff-el-group:has(input[type="radio"]) .ff-el-input--content,
.fluentform:has(form.fc-form) .ff-el-group.ff_list_inline .ff-el-input--content {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 0.75rem 1.25rem;
}

.fluentform:has(form.fc-form) .ff-el-group:has(input[type="radio"]) .ff-el-form-check,
.fluentform:has(form.fc-form) .ff-el-group.ff_list_inline .ff-el-form-check {
	display: inline-flex;
	flex: 0 0 auto;
	float: none !important;
	margin: 0 !important;
	width: auto !important;
	white-space: nowrap;
}

.fluentform:has(form.fc-form) .ff-el-form-check {
	margin: 0;
}

.fluentform:has(form.fc-form) .ff-el-form-check-label:not(.ff_tc_label) {
	align-items: center;
	color: var(--fc-form-line);
	cursor: pointer;
	display: inline-flex;
	font-size: 1rem;
	gap: 0.55rem;
	margin: 0;
}

/* DSGVO: Fluent table-layout beibehalten, Kreis an erster Textzeile */
.fluentform:has(form.fc-form) .ff-el-tc label.ff_tc_label {
	display: table-row;
}

.fluentform:has(form.fc-form) .ff-el-tc label.ff_tc_label > span.ff_tc_checkbox {
	display: table-cell;
	padding: calc((0.95rem * 1.45 - 18px) / 2 - 2px) 0.55rem 0 0 !important;
	vertical-align: top;
	width: 18px;
}

.fluentform:has(form.fc-form) .ff-el-tc label.ff_tc_label > .ff_t_c {
	display: table-cell;
	padding: 0;
	vertical-align: top;
}

.fluentform:has(form.fc-form) input[type="radio"],
.fluentform:has(form.fc-form) input[type="checkbox"] {
	appearance: none;
	background: transparent;
	border: 1px solid var(--fc-form-line);
	border-radius: 50%;
	flex: 0 0 auto;
	height: 18px;
	margin: 0;
	position: relative;
	width: 18px;
}

.fluentform:has(form.fc-form) input[type="radio"]:checked::after {
	background: var(--fc-form-line);
	border-radius: 50%;
	content: "";
	height: 8px;
	left: 50%;
	position: absolute;
	top: 50%;
	transform: translate(-50%, -50%);
	width: 8px;
}

/* Checkboxen (z. B. Rechnungsanschrift): Häkchen */
.fluentform:has(form.fc-form) input[type="checkbox"]:checked::after {
	border-bottom: 2px solid var(--fc-form-line);
	border-left: 2px solid var(--fc-form-line);
	content: "";
	height: 5px;
	left: 4px;
	position: absolute;
	top: 5px;
	transform: rotate(-45deg);
	width: 8px;
}

/* DSGVO / Terms: Kreis mit Punkt (wie Radio), kein Häkchen */
.fluentform:has(form.fc-form) .ff-el-tc input[type="checkbox"]:checked::after,
.fluentform:has(form.fc-form) input.ff_gdpr_field:checked::after {
	background: var(--fc-form-line);
	border: 0;
	border-radius: 50%;
	content: "";
	height: 8px;
	left: 50%;
	position: absolute;
	top: 50%;
	transform: translate(-50%, -50%);
	width: 8px;
}

/* --- Custom HTML: Pflichtfelder-Hinweis --- */

.fc-form-required-note {
	font-size: 10px;
}

.fluentform:has(form.fc-form) .fc-form-required-note {
	color: var(--fc-form-muted);
	margin: 0;
	text-align: right;
}

/* Anmeldung: Checkbox „Rechnungsanschrift“ rechts in der Zeile */
.fluentform:has(form.fc-form.fc-form--anmeldung) .ff-t-cell:last-child .ff-el-form-check-label {
	justify-content: flex-end;
}

/* --- DSGVO --- */

.fluentform:has(form.fc-form) .ff-el-tc,
.fluentform:has(form.fc-form) .ff_gdpr_field {
	color: var(--fc-form-line);
	font-size: 0.95rem;
	line-height: 1.45;
}

.fluentform:has(form.fc-form) .ff-el-tc label.ff_tc_label,
.fluentform:has(form.fc-form) .ff-el-tc .ff_t_c {
	color: var(--fc-form-line);
}

.fluentform:has(form.fc-form) .ff-el-tc a,
.fluentform:has(form.fc-form) .ff_gdpr_field a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* --- Submit (Outline + Pfeil wie btn-more) --- */

.fluentform:has(form.fc-form) .ff_submit_btn_wrapper {
	margin-top: 0.5rem;
	text-align: right;
}

.fluentform:has(form.fc-form) .ff-btn-submit,
.fluentform:has(form.fc-form) .ff_btn_style.ff-btn-submit {
	background: transparent !important;
	background-color: transparent !important;
	background-image: none !important;
	border: 1px solid var(--fc-form-btn-border);
	border-radius: 5px;
	box-shadow: none !important;
	box-sizing: border-box;
	color: var(--fc-form-btn-color) !important;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	font-family: inherit;
	font-size: 1rem;
	font-weight: 400;
	height: 45px;
	line-height: 1.25;
	min-width: 210px;
	overflow: hidden;
	padding: 0 3rem 0 1.25rem;
	position: relative;
	text-align: left;
	transition: border-color 0.3s ease, color 0.3s ease;
	vertical-align: middle;
	z-index: 0;
}

.fluentform:has(form.fc-form) .ff-btn-submit::before {
	background-color: var(--fc-form-btn-fill);
	content: "";
	inset: 0;
	position: absolute;
	transform: translate3d(0, 100%, 0);
	transition: transform 0.3s ease;
	z-index: -1;
}

.fluentform:has(form.fc-form) .ff-btn-submit::after {
	--fc-form-arrow-mask: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28.97 22.9"><path fill="none" stroke="%23000000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17.94 1.41l10.04 10.04-10.04 10.04"/><line fill="none" stroke="%23000000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" x1="27.98" y1="11.45" x2="1" y2="11.45"/></svg>');
	background-color: var(--fc-form-btn-color);
	-webkit-mask-image: var(--fc-form-arrow-mask);
	mask-image: var(--fc-form-arrow-mask);
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-position: center;
	mask-position: center;
	-webkit-mask-size: contain;
	mask-size: contain;
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
	content: "";
	height: 17px;
	pointer-events: none;
	position: absolute;
	right: 1.25rem;
	top: 50%;
	transform: translate3d(0, -50%, 0);
	transform-origin: center center;
	transition: transform 0.3s ease, background-color 0.3s ease;
	width: 17px;
	z-index: 1;
}

.fluentform:has(form.fc-form) .ff-btn-submit:hover,
.fluentform:has(form.fc-form) .ff-btn-submit:focus-visible,
.fluentform:has(form.fc-form) .ff_btn_style.ff-btn-submit:hover,
.fluentform:has(form.fc-form) .ff_btn_style.ff-btn-submit:focus-visible {
	background: transparent !important;
	background-color: transparent !important;
	background-image: none !important;
	border-color: var(--fc-form-btn-border) !important;
	box-shadow: none !important;
	color: var(--fc-form-btn-hover-color) !important;
	opacity: 1 !important;
}

.fluentform:has(form.fc-form) .ff-btn-submit:hover::before,
.fluentform:has(form.fc-form) .ff-btn-submit:focus-visible::before {
	transform: translate3d(0, 0, 0);
}

.fluentform:has(form.fc-form) .ff-btn-submit:hover::after,
.fluentform:has(form.fc-form) .ff-btn-submit:focus-visible::after {
	background-color: var(--fc-form-btn-hover-color);
	transform: translate3d(0, -50%, 0) rotate(-45deg);
}

/* --- Fehler / Erfolg --- */

.fluentform:has(form.fc-form) .ff-el-is-error input.ff-el-form-control,
.fluentform:has(form.fc-form) .ff-el-is-error input[type="email"].ff-el-form-control {
	border-bottom-color: var(--fc-form-danger);
}

.fluentform:has(form.fc-form) .ff-el-is-error select.ff-el-form-control {
	border-color: var(--fc-form-danger);
}

.fluentform:has(form.fc-form) .text-danger {
	color: var(--fc-form-danger);
	font-size: 0.85rem;
}

.fluentform:has(form.fc-form) .ff-message-success {
	background: var(--fc-form-success-bg);
	border: 1px solid var(--fc-form-line);
	border-radius: 5px;
	color: var(--fc-form-success-text);
}

/* --- Kontakt: Formular unter Intro-Zeile --- */

section.kontakt .kontakt__form-wrap {
	margin-top: clamp(1.5rem, 3vw, 2.5rem);
	min-width: 0;
}

/* Fluent-Container-Klassen (z. B. „container cols“) nicht mit Theme-.container padden */
section.kontakt .kontakt__form-wrap .container {
	padding-left: 0;
	padding-right: 0;
}

section.kontakt .kontakt__form-wrap .fluentform,
section.textblock .fluentform:has(form.fc-form) {
	margin-top: 0;
}

/* Shortcode direkt in main (z. B. Kontakt-Unterseite ohne Kontakt-Block) */
main > .fluentform.fc-form-wrap {
	box-sizing: border-box;
	width: 100%;
	padding-left: 60px;
	padding-right: 60px;
}

main > .fluentform.fc-form-wrap:last-child {
	padding-bottom: 140px;
}

@media (min-width: 1280px) {
	main > .fluentform.fc-form-wrap {
		padding-left: 140px;
		padding-right: 140px;
	}

	main > .fluentform.fc-form-wrap:last-child {
		padding-bottom: 100px;
	}
}

section.newsletter-page .newsletter-page__form-wrap .fluentform {
	margin-top: 0;
}

@media (max-width: 767px) {
	.fluentform:has(form.fc-form) .ff-t-container.mobile:not(.ff_excluded) {
		display: flex !important;
		flex-direction: column;
	}

	.fluentform:has(form.fc-form) .ff_submit_btn_wrapper {
		text-align: left;
	}

	section.kontakt .fluentform:has(form.fc-form) .ff_submit_btn_wrapper {
		text-align: right;
	}

	.fluentform:has(form.fc-form) .fc-form-required-note {
		text-align: left;
	}

	/* Startseite Kontakt: Fluent-Standard-Padding an Zellen entfernen */
	body.page-template-start-php section.kontakt .kontakt__form-wrap .ff-t-cell {
		padding-left: 0;
		padding-right: 0;
	}
}
