/* VDI Contact – Frontend */
.vdic-wrap {
	--vdic-primary: #2563eb;
	--vdic-text: inherit;
	--vdic-muted: #6b7280;
	--vdic-border: #d1d5db;
	--vdic-bg: #fff;
	--vdic-error: #dc2626;
	--vdic-success: #059669;
	--vdic-radius: 8px;
	--vdic-border-width: 1px;
	--vdic-border-focus: var(--vdic-primary);
	--vdic-input-text: inherit;
	--vdic-label: var(--vdic-text);
	--vdic-btn-bg: var(--vdic-primary);
	--vdic-btn-text: #fff;
	--vdic-check-bg: var(--vdic-bg);
	--vdic-check-border: var(--vdic-border);
	--vdic-check-border-width: max(var(--vdic-border-width), 1px);
	--vdic-check-checked-bg: var(--vdic-primary);
	--vdic-check-mark: #fff;
	--vdic-option-text: inherit;
	--vdic-gap: 1.25rem;
	max-width: 100%;
}

.vdic-form { margin: 0; }
.vdic-fields {
	display: grid;
	grid-template-columns: repeat(6, minmax(0, 1fr));
	gap: var(--vdic-gap);
}
.vdic-field { grid-column: span 6; min-width: 0; position: relative; }
.vdic-w-half { grid-column: span 3; }
.vdic-w-third { grid-column: span 2; }
.vdic-w-two-thirds { grid-column: span 4; }
/* Spalten richten sich nach der Breite des Formulars (nicht des Bildschirms) – passt auch in Sidebars/Popups. */
.vdic-wrap { container-type: inline-size; container-name: vdic; }
@container vdic (max-width: 520px) {
	.vdic-w-half, .vdic-w-third, .vdic-w-two-thirds { grid-column: span 6; }
}
@supports not (container-type: inline-size) {
	@media (max-width: 640px) {
		.vdic-w-half, .vdic-w-third, .vdic-w-two-thirds { grid-column: span 6; }
	}
}
.vdic-field[hidden] { display: none !important; }

.vdic-label {
	display: block;
	font-weight: 600;
	font-size: .95em;
	margin: 0 0 .4rem;
	color: var(--vdic-label) !important;
}
.vdic-req { color: var(--vdic-error); margin-left: 2px; }

/*
 * Eingabefelder. Die Design-Eigenschaften sind mit !important abgesichert, weil viele Themes
 * und Page-Builder (z. B. Elementor-Kits) Formularfelder mit sehr spezifischen Selektoren stylen.
 * Eigene Anpassungen am besten über die CSS-Variablen (--vdic-bg, --vdic-border …) vornehmen.
 */
.vdic-wrap .vdic-form .vdic-input,
.vdic-wrap .vdic-form input[type="text"],
.vdic-wrap .vdic-form input[type="email"],
.vdic-wrap .vdic-form input[type="tel"],
.vdic-wrap .vdic-form input[type="url"],
.vdic-wrap .vdic-form input[type="number"],
.vdic-wrap .vdic-form input[type="date"],
.vdic-wrap .vdic-form select,
.vdic-wrap .vdic-form textarea {
	display: block;
	width: 100% !important;
	max-width: 100%;
	height: auto;
	box-sizing: border-box !important;
	padding: .7rem .85rem !important;
	font: inherit;
	font-size: 1rem;
	line-height: 1.4;
	color: var(--vdic-input-text) !important;
	background: var(--vdic-bg) !important;
	border: var(--vdic-border-width) solid var(--vdic-border) !important;
	border-radius: var(--vdic-radius) !important;
	box-shadow: none !important;
	outline: none;
	transition: border-color .15s ease, box-shadow .15s ease;
	margin: 0;
}
.vdic-wrap .vdic-form textarea { resize: vertical; min-height: 6rem; }
.vdic-wrap .vdic-form select[multiple] { min-height: 8rem; }
.vdic-wrap .vdic-form .vdic-input::placeholder { color: currentColor; opacity: .5; }
.vdic-wrap .vdic-form .vdic-input:focus,
.vdic-wrap .vdic-form input:focus,
.vdic-wrap .vdic-form select:focus,
.vdic-wrap .vdic-form textarea:focus {
	outline: none !important;
	border-color: var(--vdic-border-focus) !important;
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--vdic-border-focus) 20%, transparent) !important;
}
.vdic-wrap .vdic-field.has-error .vdic-input,
.vdic-wrap .vdic-field.has-error input,
.vdic-wrap .vdic-field.has-error select,
.vdic-wrap .vdic-field.has-error textarea { border-color: var(--vdic-error) !important; }
.vdic-wrap .vdic-form .vdic-file-input { padding: .6rem !important; border-style: dashed !important; }

.vdic-help { margin: .35rem 0 0; font-size: .85em; color: var(--vdic-muted); }
.vdic-error { margin: .35rem 0 0; font-size: .85em; color: var(--vdic-error); font-weight: 500; }
.vdic-error[hidden] { display: none; }

/* Gruppen */
.vdic-group { border: 0; padding: 0; margin: 0; min-width: 0; }
.vdic-group legend { padding: 0; }
.vdic-options { display: flex; flex-direction: column; gap: .45rem; }
.vdic-option { display: flex; align-items: flex-start; gap: .55rem; cursor: pointer; font-weight: normal; line-height: 1.45; }
.vdic-option-label { color: var(--vdic-option-text); }

/*
 * Eigene Checkboxen / Radio-Buttons (Farben über --vdic-check-*).
 * Alle Maße in px und mit !important, damit Themes/Page-Builder (die Checkboxen oft
 * verkleinern, ausblenden oder mit eigenen Pseudo-Elementen versehen) nichts verschieben.
 */
.vdic-wrap .vdic-option { align-items: flex-start !important; }
.vdic-wrap .vdic-option input.vdic-choice,
.vdic-wrap .vdic-option input[type="checkbox"],
.vdic-wrap .vdic-option input[type="radio"] {
	-webkit-appearance: none !important;
	-moz-appearance: none !important;
	appearance: none !important;
	position: relative !important;
	top: auto !important;
	left: auto !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	flex: 0 0 20px !important;
	box-sizing: border-box !important;
	width: 20px !important;
	min-width: 20px !important;
	max-width: 20px !important;
	height: 20px !important;
	min-height: 20px !important;
	max-height: 20px !important;
	margin: 2px 0 0 !important;
	padding: 0 !important;
	font-size: 16px !important;
	line-height: 1 !important;
	opacity: 1 !important;
	visibility: visible !important;
	clip: auto !important;
	clip-path: none !important;
	transform: none !important;
	pointer-events: auto !important;
	background: var(--vdic-check-bg) !important;
	border-style: solid !important;
	border-width: var(--vdic-check-border-width) !important;
	border-color: var(--vdic-check-border) !important;
	border-radius: 4px !important;
	box-shadow: none !important;
	outline: none;
	cursor: pointer;
	transition: background-color .15s ease, border-color .15s ease;
}
.vdic-wrap .vdic-option input[type="radio"] { border-radius: 50% !important; }
.vdic-wrap .vdic-option input.vdic-choice::after,
.vdic-wrap .vdic-option input[type="checkbox"]::after,
.vdic-wrap .vdic-option input[type="radio"]::after { content: none !important; display: none !important; }
.vdic-wrap .vdic-option input[type="checkbox"]::before,
.vdic-wrap .vdic-option input[type="radio"]::before {
	content: "" !important;
	display: block !important;
	position: static !important;
	margin: 0 !important;
	border: 0 !important;
	box-shadow: none !important;
	opacity: 1 !important;
	transform: scale(0);
	transition: transform .12s ease-in-out;
	background: var(--vdic-check-mark) !important;
}
.vdic-wrap .vdic-option input[type="checkbox"]::before {
	width: 12px !important;
	height: 12px !important;
	border-radius: 0 !important;
	clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%) !important;
}
.vdic-wrap .vdic-option input[type="radio"]::before {
	width: 10px !important;
	height: 10px !important;
	border-radius: 50% !important;
	clip-path: none !important;
}
.vdic-wrap .vdic-option input:checked {
	background: var(--vdic-check-checked-bg) !important;
	border-color: var(--vdic-check-checked-bg) !important;
}
.vdic-wrap .vdic-option input:checked::before { transform: scale(1); }
.vdic-wrap .vdic-option input:focus-visible {
	outline: 2px solid var(--vdic-border-focus) !important;
	outline-offset: 2px;
}
.vdic-wrap .vdic-field.has-error .vdic-option input:not(:checked) { border-color: var(--vdic-error) !important; }
.vdic-acceptance { font-size: .95em; }
.vdic-acceptance a { color: var(--vdic-primary); }

/* Datei */
.vdic-file input[type="file"] {
	width: 100%;
	padding: .6rem;
	border: var(--vdic-border-width) dashed var(--vdic-border);
	border-radius: var(--vdic-radius);
	background: color-mix(in srgb, var(--vdic-primary) 3%, var(--vdic-bg));
	box-sizing: border-box;
	font: inherit;
	font-size: .95em;
}
.vdic-file input[type="file"]::file-selector-button {
	margin-right: .8rem;
	padding: .45rem .9rem;
	border: 0;
	border-radius: calc(var(--vdic-radius) - 2px);
	background: var(--vdic-primary);
	color: #fff;
	cursor: pointer;
	font: inherit;
}

/* Layout-Elemente */
.vdic-heading { margin: .5rem 0 0; font-size: 1.25em; }
.vdic-subheading { margin: .35rem 0 0; color: var(--vdic-muted); }
.vdic-html > :first-child { margin-top: 0; }
.vdic-html > :last-child { margin-bottom: 0; }

/* Floating Labels */
.vdic-field.is-floating { position: relative; }
.vdic-field.is-floating .vdic-label {
	position: absolute;
	left: .85rem;
	top: .78rem;
	margin: 0;
	font-weight: 500;
	color: var(--vdic-muted);
	pointer-events: none;
	transform-origin: left top;
	transition: transform .15s ease, color .15s ease, top .15s ease;
	background: var(--vdic-bg);
	padding: 0 .25rem;
	margin-left: -.25rem;
}
.vdic-field.is-floating input:focus + .vdic-label,
.vdic-field.is-floating input:not(:placeholder-shown) + .vdic-label,
.vdic-field.is-floating textarea:focus + .vdic-label,
.vdic-field.is-floating textarea:not(:placeholder-shown) + .vdic-label,
.vdic-field.is-floating input[type="date"] + .vdic-label {
	top: 0;
	transform: translateY(-55%) scale(.82);
	color: var(--vdic-primary);
}

.vdic-sr {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0, 0, 0, 0);
	white-space: nowrap; border: 0;
}

/* Honeypot */
.vdic-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

/* Captcha / Aktionen */
.vdic-captcha { margin-top: var(--vdic-gap); }
.vdic-actions { margin-top: var(--vdic-gap); }
.vdic-submit {
	display: inline-flex;
	align-items: center;
	gap: .6rem;
	padding: .8rem 1.6rem;
	font: inherit;
	font-weight: 600;
	font-size: 1rem;
	color: var(--vdic-btn-text) !important;
	background: var(--vdic-btn-bg) !important;
	border: 0 !important;
	border-radius: var(--vdic-radius) !important;
	cursor: pointer;
	transition: filter .15s ease, transform .05s ease;
}
.vdic-wrap .vdic-submit:hover,
.vdic-wrap .vdic-submit:focus { color: var(--vdic-btn-text) !important; background: var(--vdic-btn-bg) !important; filter: brightness(1.08); }
.vdic-submit:active { transform: translateY(1px); }
.vdic-submit:focus-visible { outline: 3px solid color-mix(in srgb, var(--vdic-primary) 40%, transparent); outline-offset: 2px; }
.vdic-submit[disabled] { opacity: .75; cursor: progress; }

.vdic-spinner {
	display: none;
	width: 1em; height: 1em;
	border: 2px solid rgba(255,255,255,.45);
	border-top-color: var(--vdic-btn-text);
	border-radius: 50%;
	animation: vdic-spin .7s linear infinite;
}
.vdic-form.is-submitting .vdic-spinner { display: inline-block; }
@keyframes vdic-spin { to { transform: rotate(360deg); } }

/* Antwort */
.vdic-response {
	margin-top: var(--vdic-gap);
	padding: .9rem 1.1rem;
	border-radius: var(--vdic-radius);
	border-left: 4px solid currentColor;
	font-weight: 500;
}
.vdic-response[hidden] { display: none; }
.vdic-response.is-success { color: var(--vdic-success); background: color-mix(in srgb, var(--vdic-success) 9%, transparent); }
.vdic-response.is-error { color: var(--vdic-error); background: color-mix(in srgb, var(--vdic-error) 8%, transparent); }
.vdic-wrap.vdic-is-done > form { display: none; }

@media (prefers-reduced-motion: reduce) {
	.vdic-spinner { animation-duration: 2s; }
	.vdic-form * { transition: none !important; }
}

/* Fehlerübersicht & Zeichenzähler */
.vdic-error-summary { margin: .5rem 0 0; padding: 0 0 0 1.1rem; font-weight: 400; }
.vdic-error-summary li { margin: .15rem 0; }
.vdic-wrap .vdic-error-link { all: unset; cursor: pointer; text-decoration: underline; color: inherit; }
.vdic-wrap .vdic-error-link:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.vdic-counter { display: block; margin-top: .3rem; font-size: .8em; color: var(--vdic-muted); text-align: right; }
.vdic-counter.is-near { color: var(--vdic-error); }
.vdic-wrap .vdic-form .vdic-input:focus-visible { outline: 2px solid var(--vdic-border-focus) !important; outline-offset: 1px; }
