/* =============================================================================
   All-In-One für CF7 — Frontend Styles

   Bewusst zurückhaltend gehalten: Farben und Schriften werden vom Theme
   geerbt, damit sich Gruppen und Wiederholungsfelder ins Formular einfügen.
   ============================================================================= */

/* Die Werte aus „Formular-Stil“ gehen vor, wenn dort eine Stilrichtung gewählt
   ist (--aiocf7-fs-*). Ohne Auswahl bleibt es bei den Rückfallwerten hier —
   so fügen sich die Bausteine wie bisher ins Theme ein. */
.aiocf7-repeater,
.aiocf7-group,
.aiocf7-dropzone,
.aiocf7-has-steps {
	--aiocf7-border: var( --aiocf7-fs-border, rgba( 0, 0, 0, 0.12 ) );
	--aiocf7-surface: var( --aiocf7-fs-fill, rgba( 0, 0, 0, 0.02 ) );
	--aiocf7-muted: var( --aiocf7-fs-muted, rgba( 0, 0, 0, 0.55 ) );
	--aiocf7-danger: var( --aiocf7-fs-error, #b32d2e );
	--aiocf7-radius: var( --aiocf7-fs-radius, 8px );
}

/* -----------------------------------------------------------------------------
   Bedingungsfelder — Gruppen
   ----------------------------------------------------------------------------- */

.aiocf7-hidden {
	display: none !important;
}

/* -----------------------------------------------------------------------------
   Wiederholungsfelder — Repeater
   ----------------------------------------------------------------------------- */

.aiocf7-repeater {
	margin: 0 0 16px;
}

.aiocf7-repeater-items {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

/* Nummer und Entfernen-Button liegen in einer Kopfzeile INNERHALB der Karte —
   ausserhalb positioniert wuerden sie von Themes mit overflow:hidden
   abgeschnitten. */
.aiocf7-repeater-item {
	position: relative;
	padding: 48px 20px 4px;
	border: 1px solid var( --aiocf7-border );
	border-radius: var( --aiocf7-radius );
	background: var( --aiocf7-surface );
}

.aiocf7-repeater-item__body > *:last-child {
	margin-bottom: 20px;
}

/* Nummerierung */
.aiocf7-repeater-item__num {
	position: absolute;
	top: 14px;
	left: 20px;
	padding: 2px 10px;
	border: 1px solid var( --aiocf7-border );
	border-radius: 999px;
	color: var( --aiocf7-muted );
	font-size: 0.75rem;
	line-height: 1.5;
	white-space: nowrap;
}

.aiocf7-repeater-item__num:empty {
	display: none;
}

/* Entfernen-Button */
.aiocf7-repeater-remove {
	position: absolute;
	top: 12px;
	right: 16px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	min-height: 0;
	padding: 0;
	border: 1px solid var( --aiocf7-border );
	border-radius: 50%;
	background: transparent;
	color: var( --aiocf7-muted );
	font-size: 1.125rem;
	line-height: 1;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.aiocf7-repeater-remove:hover,
.aiocf7-repeater-remove:focus-visible {
	background: var( --aiocf7-danger );
	border-color: var( --aiocf7-danger );
	color: #fff;
}

.aiocf7-repeater-remove:focus-visible {
	outline: 2px solid var( --aiocf7-danger );
	outline-offset: 2px;
}

.aiocf7-repeater-remove[hidden] {
	display: none;
}

/* Hinzufügen-Button */
.aiocf7-repeater-controls {
	margin-top: 16px;
}

.aiocf7-repeater-add {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 16px;
	border: 1px dashed var( --aiocf7-border );
	border-radius: var( --aiocf7-radius );
	background: transparent;
	color: inherit;
	font: inherit;
	font-size: 0.875rem;
	cursor: pointer;
	transition: border-color 0.15s ease, background 0.15s ease;
}

.aiocf7-repeater-add:hover:not( :disabled ),
.aiocf7-repeater-add:focus-visible:not( :disabled ) {
	border-style: solid;
	background: var( --aiocf7-surface );
}

.aiocf7-repeater-add:disabled,
.aiocf7-repeater-add.is-disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

/* Felder im Eintrag sollen nicht aus der Karte laufen */
.aiocf7-repeater-item input:not( [type="checkbox"] ):not( [type="radio"] ),
.aiocf7-repeater-item select,
.aiocf7-repeater-item textarea {
	max-width: 100%;
	box-sizing: border-box;
}

/* -----------------------------------------------------------------------------
   Individuelle Felder
   ----------------------------------------------------------------------------- */

.aiocf7-no-items {
	display: inline-block;
	padding: 8px 12px;
	border: 1px dashed var( --aiocf7-border, rgba( 0, 0, 0, 0.12 ) );
	border-radius: 4px;
	color: rgba( 0, 0, 0, 0.55 );
	font-size: 0.875rem;
}

/* -----------------------------------------------------------------------------
   Bewegung reduzieren
   ----------------------------------------------------------------------------- */

@media ( prefers-reduced-motion: reduce ) {

	.aiocf7-repeater-remove,
	.aiocf7-repeater-add {
		transition: none;
	}
}

/* -----------------------------------------------------------------------------
   Datei-Upload mit Ablagefläche
   ----------------------------------------------------------------------------- */

.aiocf7-dropzone {
	display: block;
}

/* Das Eingabefeld selbst bleibt bedienbar und fokussierbar — es wird nur
   unsichtbar über die Fläche gelegt. display:none würde es aus der
   Tastaturbedienung nehmen. */
.aiocf7-dropzone__input {
	position: absolute;
	width: 100%;
	height: 100%;
	inset: 0;
	opacity: 0;
	cursor: pointer;
}

.aiocf7-dropzone__area {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	padding: 24px 16px;
	border: 2px dashed var( --aiocf7-border );
	border-radius: var( --aiocf7-radius );
	background: var( --aiocf7-surface );
	text-align: center;
	cursor: pointer;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.aiocf7-dropzone__area:hover {
	border-color: currentColor;
}

/* Das Eingabefeld ist unsichtbar, sein Fokus muss darum an der Fläche
   sichtbar werden — sonst weiss man bei Tastaturbedienung nicht, wo man ist. */
.aiocf7-dropzone__area:focus-within {
	border-color: currentColor;
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.aiocf7-dropzone.is-dragover .aiocf7-dropzone__area {
	border-color: currentColor;
	background: rgba( 0, 0, 0, 0.05 );
}

.aiocf7-dropzone.is-invalid .aiocf7-dropzone__area {
	border-color: var( --aiocf7-danger );
}

.aiocf7-dropzone__icon {
	color: var( --aiocf7-muted );
	line-height: 0;
}

.aiocf7-dropzone__text {
	font-size: 0.95em;
}

.aiocf7-dropzone__hint {
	color: var( --aiocf7-muted );
	font-size: 0.8em;
}

.aiocf7-dropzone__hint:empty {
	display: none;
}

/* Dateiliste */
.aiocf7-dropzone__list {
	margin: 10px 0 0;
	padding: 0;
	list-style: none;
}

.aiocf7-dropzone__list:empty {
	display: none;
}

.aiocf7-dropzone__item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 10px;
	border: 1px solid var( --aiocf7-border );
	border-radius: var( --aiocf7-radius );
	background: var( --aiocf7-surface );
}

.aiocf7-dropzone__item + .aiocf7-dropzone__item {
	margin-top: 6px;
}

.aiocf7-dropzone__thumb,
.aiocf7-dropzone__filetype {
	flex: 0 0 auto;
	width: 34px;
	height: 34px;
	border-radius: 4px;
	object-fit: cover;
	background: var( --aiocf7-border );
}

.aiocf7-dropzone__name {
	/* min-width:0 ist nötig, damit ein langer Dateiname im Flex-Element
	   umbrechen darf statt die Zeile zu sprengen */
	flex: 1 1 auto;
	min-width: 0;
	overflow-wrap: anywhere;
	font-size: 0.9em;
}

.aiocf7-dropzone__size {
	flex: 0 0 auto;
	color: var( --aiocf7-muted );
	font-size: 0.8em;
	white-space: nowrap;
}

.aiocf7-dropzone__remove {
	flex: 0 0 auto;
	width: 26px;
	height: 26px;
	padding: 0;
	border: 1px solid var( --aiocf7-border );
	border-radius: 50%;
	background: transparent;
	color: var( --aiocf7-muted );
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
	transition: color 0.15s ease, border-color 0.15s ease;
}

.aiocf7-dropzone__remove:hover,
.aiocf7-dropzone__remove:focus-visible {
	border-color: var( --aiocf7-danger );
	color: var( --aiocf7-danger );
}

.aiocf7-dropzone__error {
	margin: 8px 0 0;
	color: var( --aiocf7-danger );
	font-size: 0.85em;
}

/* -----------------------------------------------------------------------------
   Mehrstufige Formulare

   Ausgeblendet wird erst, wenn das Skript die Navigation gebaut hat
   (.aiocf7-has-steps). Ohne JavaScript bleiben alle Schritte sichtbar und das
   Formular ist weiterhin vollständig ausfüllbar.
   ----------------------------------------------------------------------------- */

.aiocf7-has-steps .aiocf7-step:not( .is-active ) {
	display: none;
}

/* Absenden-Button außerhalb der Schritte: erst im letzten Schritt zeigen */
.wpcf7-submit.aiocf7-step-away {
	display: none;
}

.aiocf7-steps__progress {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 20px;
	margin: 0 0 24px;
	padding: 0;
	list-style: none;
}

.aiocf7-steps__item {
	margin: 0;
	padding: 0;
}

.aiocf7-steps__item::before,
.aiocf7-steps__item::marker {
	content: none;
}

.aiocf7-steps__crumb {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 0;
	border: 0;
	background: transparent;
	color: var( --aiocf7-muted );
	font: inherit;
	font-size: 0.875rem;
	text-align: left;
	cursor: pointer;
}

.aiocf7-steps__crumb:disabled {
	cursor: default;
}

.aiocf7-steps__num {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 26px;
	height: 26px;
	border: 1px solid var( --aiocf7-border );
	border-radius: 50%;
	font-size: 0.8125em;
	line-height: 1;
}

.aiocf7-steps__crumb.is-current {
	color: inherit;
	font-weight: 600;
}

.aiocf7-steps__crumb.is-current .aiocf7-steps__num {
	border-color: currentColor;
}

/* Erledigte Schritte tragen ein Häkchen statt der Ziffer. Die Ziffer bleibt im
   Markup, damit die Reihenfolge auch ohne diese Regel lesbar ist. */
.aiocf7-steps__crumb.is-done .aiocf7-steps__num {
	position: relative;
	border-color: currentColor;
	background: var( --aiocf7-surface );
	color: transparent;
}

.aiocf7-steps__crumb.is-done .aiocf7-steps__num::after {
	content: "\2713";
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var( --aiocf7-muted );
}

.aiocf7-steps__nav {
	display: flex;
	align-items: center;
	gap: 16px;
	margin: 24px 0 0;
	padding-top: 16px;
	border-top: 1px solid var( --aiocf7-border );
}

.aiocf7-steps__count {
	color: var( --aiocf7-muted );
	font-size: 0.8125rem;
}

.aiocf7-step-next {
	margin-left: auto;
}

.aiocf7-step-prev,
.aiocf7-step-next {
	padding: 8px 20px;
	border: 1px solid var( --aiocf7-border );
	border-radius: var( --aiocf7-radius );
	background: transparent;
	color: inherit;
	font: inherit;
	font-size: 0.875rem;
	cursor: pointer;
	transition: border-color 0.15s ease, background 0.15s ease;
}

.aiocf7-step-prev:hover,
.aiocf7-step-prev:focus-visible,
.aiocf7-step-next:hover,
.aiocf7-step-next:focus-visible {
	border-color: currentColor;
	background: var( --aiocf7-surface );
}

.aiocf7-step-prev[hidden],
.aiocf7-step-next[hidden] {
	display: none;
}

/* -----------------------------------------------------------------------------
   Spalten — [row] / [col]

   Bewusst ohne Media Query: gemessen wird die Reihe selbst, nicht der
   Bildschirm. Ein Formular in einer schmalen Seitenleiste bricht damit genauso
   um wie auf einem Telefon — davon weiss eine Media Query nichts.

   Umgebrochen wird die ganze Reihe auf einmal. Wuerde stattdessen jede Spalte
   fuer sich eine Mindestbreite haben, faellt bei [col 2/3][col 1/3] das
   Drittel schon auf dem Tablet nach unten, waehrend zwei Haelften noch
   nebeneinander stehen — dieselbe Reihe verhaelt sich dann je nach Aufteilung
   anders.

   Die Rechnung: flex-basis ist der Anteil minus Abstand, flex-grow verteilt den
   Rest gleichmaessig. Bei zwei Haelften ergibt das je 50 % minus halber Abstand.
   ----------------------------------------------------------------------------- */

.aiocf7-row {
	--aiocf7-row-gap: 24px;

	/* Nur noch die aeusserste Notbremse und der Rueckfall fuer Browser ohne
	   Container-Abfragen. Pro Reihe mit min:280 o.ae. aenderbar. */
	--aiocf7-col-min: 180px;

	display: flex;
	flex-wrap: wrap;
	gap: var( --aiocf7-row-gap );
	margin-bottom: var( --aiocf7-row-gap );
	container-type: inline-size;
}

.aiocf7-col {
	/* Ohne min-width: 0 sprengt ein langes Wort oder ein breites Feld die
	   Spalte — flex-Elemente schrumpfen sonst nicht unter ihren Inhalt. */
	min-width: min( 100%, var( --aiocf7-col-min ) );
	flex: 1 1 calc( 100% - var( --aiocf7-row-gap ) );
}

.aiocf7-col > :first-child {
	margin-top: 0;
}

.aiocf7-col > :last-child {
	margin-bottom: 0;
}

/* Zwoelftel — 1/2 ist span 6, 1/3 ist span 4, 1/4 ist span 3 */
.aiocf7-col--1 { flex-basis: calc( 8.3333% - var( --aiocf7-row-gap ) ); }
.aiocf7-col--2 { flex-basis: calc( 16.6666% - var( --aiocf7-row-gap ) ); }
.aiocf7-col--3 { flex-basis: calc( 25% - var( --aiocf7-row-gap ) ); }
.aiocf7-col--4 { flex-basis: calc( 33.3333% - var( --aiocf7-row-gap ) ); }
.aiocf7-col--5 { flex-basis: calc( 41.6666% - var( --aiocf7-row-gap ) ); }
.aiocf7-col--6 { flex-basis: calc( 50% - var( --aiocf7-row-gap ) ); }
.aiocf7-col--7 { flex-basis: calc( 58.3333% - var( --aiocf7-row-gap ) ); }
.aiocf7-col--8 { flex-basis: calc( 66.6666% - var( --aiocf7-row-gap ) ); }
.aiocf7-col--9 { flex-basis: calc( 75% - var( --aiocf7-row-gap ) ); }
.aiocf7-col--10 { flex-basis: calc( 83.3333% - var( --aiocf7-row-gap ) ); }
.aiocf7-col--11 { flex-basis: calc( 91.6666% - var( --aiocf7-row-gap ) ); }

.aiocf7-col--12 {
	flex-basis: 100%;
	/* Die ganze Breite darf nicht umbrechen, auch nicht auf 280px. */
	min-width: 0;
}

/* Wird die Reihe schmaler als 640px, steht alles untereinander. Ein
   Eingabefeld mit Beschriftung braucht rund 300px, um nicht gedraengt zu
   wirken — bei zwei Spalten ist das die Grenze.

   Muss NACH den Zwoelftel-Klassen stehen: die sind gleich spezifisch, und bei
   gleicher Spezifitaet gewinnt die spaetere Regel. */
@container ( max-width: 640px ) {

	.aiocf7-col {
		flex-basis: 100% !important;
	}
}

@media ( prefers-reduced-motion: reduce ) {

	.aiocf7-dropzone__area,
	.aiocf7-dropzone__remove,
	.aiocf7-step-prev,
	.aiocf7-step-next {
		transition: none;
	}
}
