/**
 * EkoBox Konfigurationsfragebogen – Premium-Styles (mobile-first).
 *
 * Vollständig unter .ekobox-kf gekapselt (kein Theme-Konflikt).
 * Farben/Abstände über CSS-Custom-Properties anpassbar.
 */

.ekobox-kf {
	/* Markenfarben */
	--ekobox-primary: #1b5e20;
	--ekobox-primary-dark: #11451a;
	--ekobox-primary-600: #2e7d32;
	--ekobox-primary-light: #eaf4ec;
	--ekobox-primary-tint: #f3f9f4;
	--ekobox-accent: #f0a500;

	/* Neutrale Töne */
	--ekobox-ink: #16201b;
	--ekobox-text: #2c3a32;
	--ekobox-muted: #6b7a71;
	--ekobox-line: #e4ebe6;
	--ekobox-line-strong: #d2ded6;
	--ekobox-surface: #ffffff;
	--ekobox-surface-2: #f7faf8;
	--ekobox-error: #c62828;
	--ekobox-error-bg: #fdecec;

	/* Form & Rhythmus – kantiges, architektonisches Premium-Design */
	--ekobox-radius: 0;
	--ekobox-radius-lg: 0;
	--ekobox-tip-radius: 2px;
	--ekobox-gap: 28px;
	--ekobox-shadow: none;
	--ekobox-shadow-sm: none;

	box-sizing: border-box;
	max-width: 780px;
	margin: 0 auto;
	padding: clamp(22px, 4vw, 44px);
	background: var(--ekobox-surface);
	border: 1px solid var(--ekobox-line);
	border-top: 3px solid var(--ekobox-primary);
	border-radius: var(--ekobox-radius-lg);
	box-shadow: var(--ekobox-shadow);
	color: var(--ekobox-text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 16px;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

.ekobox-kf *,
.ekobox-kf *::before,
.ekobox-kf *::after {
	box-sizing: border-box;
}

/* Sicherstellen, dass das hidden-Attribut wirkt – manche Themes setzen
   für button/div ein eigenes display und überschreiben sonst [hidden]. */
.ekobox-kf [hidden] {
	display: none !important;
}

/* --- Kopf --- */
.ekobox-kf-header {
	text-align: center;
	margin-bottom: 28px;
}

.ekobox-kf-title {
	margin: 0 0 12px;
	font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem);
	line-height: 1.18;
	font-weight: 750;
	letter-spacing: -0.02em;
	color: var(--ekobox-ink);
}

.ekobox-kf-subtitle {
	margin: 0 auto;
	max-width: 60ch;
	color: var(--ekobox-muted);
	font-size: 1rem;
}

/* --- Fortschritt --- */
.ekobox-kf-progress {
	margin-bottom: 8px;
}

.ekobox-kf-progress-bar {
	position: relative;
	height: 6px;
	background: var(--ekobox-line);
	overflow: hidden;
}

.ekobox-kf-progress-fill {
	display: block;
	height: 100%;
	width: 0;
	background: var(--ekobox-primary);
	transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Schritt-Dot-Navigation ausgeblendet (zu viele Schritte) – Balken + Zähler genügen. */
.ekobox-kf-steps-nav {
	display: none;
}

.ekobox-kf-step-counter {
	margin: 14px 0 26px;
	text-align: center;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--ekobox-primary-600);
}

/* --- Schritte --- */
.ekobox-kf-step[hidden] {
	display: none;
}

.ekobox-kf-step.is-active {
	animation: ekobox-fade 0.45s cubic-bezier(0.2, 0.7, 0.2, 1);
}

@keyframes ekobox-fade {
	from { opacity: 0; transform: translateY(10px); }
	to   { opacity: 1; transform: translateY(0); }
}

.ekobox-kf-step-header {
	margin-bottom: 26px;
	padding-bottom: 18px;
	border-bottom: 1px solid var(--ekobox-line);
}

.ekobox-kf-step-title {
	margin: 0 0 6px;
	font-size: 1.3rem;
	font-weight: 700;
	letter-spacing: -0.01em;
	color: var(--ekobox-ink);
}

/* Kein sichtbarer Rahmen beim programmatischen Fokus des Schritt-Titels
   (der Fokus dient nur Screenreadern). */
.ekobox-kf-step-title:focus {
	outline: none;
}

.ekobox-kf-step-desc {
	margin: 0;
	color: var(--ekobox-muted);
	font-size: 0.97rem;
}

/* --- Felder --- */
.ekobox-kf-field,
.ekobox-kf-fieldset {
	margin: 0 0 var(--ekobox-gap);
	padding: 0;
	border: 0;
}

.ekobox-kf-field:last-child,
.ekobox-kf-fieldset:last-child {
	margin-bottom: 4px;
}

.ekobox-kf-label,
.ekobox-kf-fieldset legend {
	display: block;
	margin-bottom: 10px;
	padding: 0;
	font-weight: 650;
	font-size: 0.98rem;
	line-height: 1.5;
	color: var(--ekobox-ink);
}

.ekobox-kf-req {
	color: var(--ekobox-accent);
	font-weight: 700;
}

.ekobox-kf-help {
	display: block;
	margin: -4px 0 12px;
	color: var(--ekobox-muted);
	font-size: 0.86rem;
	line-height: 1.5;
}

.ekobox-kf input[type="text"],
.ekobox-kf input[type="email"],
.ekobox-kf input[type="tel"],
.ekobox-kf input[type="number"],
.ekobox-kf input[type="date"],
.ekobox-kf input[type="url"],
.ekobox-kf select,
.ekobox-kf textarea {
	width: 100%;
	padding: 14px 16px;
	font-size: 16px; /* verhindert iOS-Auto-Zoom */
	font-family: inherit;
	color: var(--ekobox-ink);
	background: var(--ekobox-surface-2);
	border: 1px solid var(--ekobox-line-strong);
	border-radius: var(--ekobox-radius);
	transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
	-webkit-appearance: none;
	appearance: none;
}

.ekobox-kf input::placeholder,
.ekobox-kf textarea::placeholder {
	color: #9aa8a0;
}

.ekobox-kf textarea {
	resize: vertical;
	min-height: 116px;
	line-height: 1.6;
}

.ekobox-kf select {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7a71' d='M6 8 0 0h12z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 16px center;
	padding-right: 40px;
	cursor: pointer;
}

.ekobox-kf input:focus,
.ekobox-kf select:focus,
.ekobox-kf textarea:focus {
	outline: none;
	background: var(--ekobox-surface);
	border-color: var(--ekobox-primary);
	box-shadow: inset 0 0 0 1px var(--ekobox-primary);
}

.ekobox-kf input.ekobox-kf-invalid,
.ekobox-kf select.ekobox-kf-invalid,
.ekobox-kf textarea.ekobox-kf-invalid {
	border-color: var(--ekobox-error);
	background: var(--ekobox-error-bg);
}

.ekobox-kf-fieldset.ekobox-kf-invalid legend {
	color: var(--ekobox-error);
}

/* --- Datei-Upload --- */
.ekobox-kf input[type="file"] {
	width: 100%;
	padding: 16px;
	font-size: 0.92rem;
	color: var(--ekobox-text);
	background:
		repeating-linear-gradient(0deg, transparent, transparent) ,
		var(--ekobox-surface-2);
	border: 1.5px dashed var(--ekobox-line-strong);
	border-radius: var(--ekobox-radius);
	cursor: pointer;
	transition: border-color 0.18s ease, background 0.18s ease;
}

.ekobox-kf input[type="file"]:hover {
	border-color: var(--ekobox-primary);
	background: var(--ekobox-primary-tint);
}

.ekobox-kf input[type="file"]::file-selector-button {
	margin-right: 14px;
	padding: 9px 16px;
	font-family: inherit;
	font-weight: 650;
	font-size: 0.9rem;
	color: #fff;
	background: var(--ekobox-primary);
	border: 0;
	border-radius: 10px;
	cursor: pointer;
	transition: background 0.18s ease;
}

.ekobox-kf input[type="file"]::file-selector-button:hover {
	background: var(--ekobox-primary-dark);
}

/* Liste der ausgewählten Dateien */
.ekobox-kf-filelist {
	list-style: none;
	margin: 12px 0 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.ekobox-kf-filelist li {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 9px 12px;
	background: var(--ekobox-surface-2);
	border: 1px solid var(--ekobox-line-strong);
	font-size: 0.88rem;
}

.ekobox-kf-filelist-name {
	overflow-wrap: anywhere;
	color: var(--ekobox-text);
}

.ekobox-kf-filelist-remove {
	flex: none;
	width: 26px;
	height: 26px;
	padding: 0;
	border: 1px solid var(--ekobox-line-strong);
	background: var(--ekobox-surface);
	color: var(--ekobox-error);
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	transition: background 0.16s ease, border-color 0.16s ease;
}

.ekobox-kf-filelist-remove:hover {
	background: var(--ekobox-error-bg);
	border-color: var(--ekobox-error);
}

/* --- Auswahlkarten (radio_cards) --- */
.ekobox-kf-cards {
	display: grid;
	grid-template-columns: 1fr;
	gap: 14px;
}

.ekobox-kf-card {
	position: relative;
	display: block;
	cursor: pointer;
}

.ekobox-kf-card input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
}

.ekobox-kf-card-inner {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 18px;
	height: 100%;
	background: var(--ekobox-surface);
	border: 1.5px solid var(--ekobox-line-strong);
	border-radius: var(--ekobox-radius);
	transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.ekobox-kf-card:hover .ekobox-kf-card-inner {
	border-color: var(--ekobox-primary);
}

.ekobox-kf-card input:checked + .ekobox-kf-card-inner {
	border-color: var(--ekobox-primary);
	background: var(--ekobox-primary-tint);
	box-shadow: inset 0 0 0 1px var(--ekobox-primary);
}

.ekobox-kf-card input:focus-visible + .ekobox-kf-card-inner {
	outline: 2px solid var(--ekobox-primary);
	outline-offset: 2px;
}

/* Bildkarten */
.ekobox-kf-cards--image {
	grid-template-columns: repeat(2, 1fr);
}

.ekobox-kf-card--image .ekobox-kf-card-inner {
	position: relative;
	flex-direction: column;
	gap: 0;
	padding: 0;
	/* Kein overflow:hidden – sonst würden Tooltips in den Karten abgeschnitten. */
}

.ekobox-kf-card-media {
	display: block;
	background: var(--ekobox-surface-2);
	border-bottom: 1px solid var(--ekobox-line);
	border-top-left-radius: calc(var(--ekobox-radius) - 2px);
	border-top-right-radius: calc(var(--ekobox-radius) - 2px);
	padding: 12px;
	text-align: center;
}

.ekobox-kf-card-media img {
	display: block;
	width: 100%;
	height: auto;
	max-height: 116px;
	object-fit: contain;
	margin: 0 auto;
}

.ekobox-kf-card--image .ekobox-kf-card-text {
	display: block;
	padding: 14px 16px;
}

.ekobox-kf-card--image .ekobox-kf-card-label {
	display: flex;
	align-items: flex-start;
	gap: 6px;
	font-weight: 700;
	font-size: 0.96rem;
	color: var(--ekobox-ink);
}

.ekobox-kf-card--image .ekobox-kf-card-label .ekobox-kf-tip {
	margin-left: 0;
	flex: none;
}

.ekobox-kf-card--image .ekobox-kf-card-hint {
	display: block;
	margin-top: 5px;
	font-size: 0.82rem;
	line-height: 1.45;
	color: var(--ekobox-muted);
}

/* Auswahlhaken auf Bildkarten */
.ekobox-kf-card-check {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: var(--ekobox-surface);
	border: 2px solid var(--ekobox-line-strong);
	transition: all 0.18s ease;
}

.ekobox-kf-card--image input:checked + .ekobox-kf-card-inner .ekobox-kf-card-check {
	background: var(--ekobox-primary);
	border-color: var(--ekobox-primary);
}

.ekobox-kf-card--image input:checked + .ekobox-kf-card-inner .ekobox-kf-card-check::after {
	content: "";
	position: absolute;
	left: 8px;
	top: 4px;
	width: 6px;
	height: 11px;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

/* --- Radios / Checkboxen als Optionszeilen --- */
.ekobox-kf-radios,
.ekobox-kf-checks {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.ekobox-kf-radio,
.ekobox-kf-check {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 14px 16px;
	background: var(--ekobox-surface);
	border: 1.5px solid var(--ekobox-line-strong);
	border-radius: var(--ekobox-radius);
	cursor: pointer;
	transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.ekobox-kf-radio:hover,
.ekobox-kf-check:hover {
	border-color: var(--ekobox-primary-600);
	background: var(--ekobox-primary-tint);
}

.ekobox-kf-radio:has(input:checked),
.ekobox-kf-check:has(input:checked) {
	border-color: var(--ekobox-primary);
	background: var(--ekobox-primary-tint);
	box-shadow: inset 0 0 0 1px var(--ekobox-primary);
}

.ekobox-kf-radio:focus-within,
.ekobox-kf-check:focus-within {
	outline: 2px solid var(--ekobox-primary);
	outline-offset: 2px;
}

.ekobox-kf-radio input,
.ekobox-kf-check input {
	margin-top: 2px;
	width: 20px;
	height: 20px;
	accent-color: var(--ekobox-primary);
	flex-shrink: 0;
}

.ekobox-kf-radio span,
.ekobox-kf-check span {
	line-height: 1.5;
}

/* Einwilligung */
.ekobox-kf-consent {
	background: var(--ekobox-primary-tint);
	border: 1px solid var(--ekobox-line);
	border-radius: var(--ekobox-radius);
	padding: 18px;
}

.ekobox-kf-consent .ekobox-kf-check {
	border: 0;
	padding: 0;
	background: transparent;
}

.ekobox-kf-consent .ekobox-kf-check:hover {
	background: transparent;
}

.ekobox-kf-consent a {
	color: var(--ekobox-primary-dark);
	font-weight: 600;
}

/* --- Hinweis-/Note-Box --- */
.ekobox-kf-note {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	margin: 4px 0 var(--ekobox-gap);
	padding: 14px 16px;
	background: var(--ekobox-primary-tint);
	border: 1px solid var(--ekobox-line);
	border-left: 4px solid var(--ekobox-primary);
	border-radius: var(--ekobox-radius);
	font-size: 0.9rem;
	line-height: 1.55;
	color: var(--ekobox-text);
}

.ekobox-kf-note-icon {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: var(--ekobox-primary);
	color: #fff;
	font-style: italic;
	font-weight: 700;
	font-family: Georgia, "Times New Roman", serif;
	font-size: 0.85rem;
	line-height: 1;
}

/* --- Info-Tooltip --- */
.ekobox-kf-tip {
	position: relative;
	display: inline-flex;
	align-items: center;
	vertical-align: -3px;
	margin-left: 8px;
	flex: none;
}

.ekobox-kf-tip-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	padding: 0;
	border: 1.5px solid var(--ekobox-primary);
	border-radius: 50%;
	background: var(--ekobox-surface);
	color: var(--ekobox-primary-dark);
	font-style: italic;
	font-weight: 700;
	font-family: Georgia, "Times New Roman", serif;
	font-size: 0.8rem;
	line-height: 1;
	cursor: pointer;
	transition: background 0.18s ease, color 0.18s ease;
}

.ekobox-kf-tip-btn:hover,
.ekobox-kf-tip-btn:focus-visible {
	background: var(--ekobox-primary);
	color: #fff;
	outline: none;
}

.ekobox-kf-tip-btn:focus-visible {
	box-shadow: 0 0 0 4px var(--ekobox-primary-light);
}

.ekobox-kf-tip-bubble {
	position: absolute;
	bottom: calc(100% + 10px);
	left: 50%;
	transform: translateX(-50%);
	z-index: 30;
	width: max-content;
	max-width: 280px;
	padding: 11px 14px;
	background: var(--ekobox-ink);
	color: #fff;
	font-size: 0.82rem;
	font-weight: 400;
	line-height: 1.5;
	text-align: left;
	letter-spacing: 0;
	border-radius: var(--ekobox-tip-radius);
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.16s ease, visibility 0.16s ease;
}

.ekobox-kf-tip-bubble::after {
	content: "";
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	border: 6px solid transparent;
	border-top-color: var(--ekobox-ink);
}

.ekobox-kf-tip:hover .ekobox-kf-tip-bubble,
.ekobox-kf-tip-btn:focus-visible + .ekobox-kf-tip-bubble,
.ekobox-kf-tip.is-open .ekobox-kf-tip-bubble {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

@media (max-width: 480px) {
	.ekobox-kf-tip-bubble {
		max-width: 220px;
	}
}

/* --- Fehlermeldungen --- */
.ekobox-kf-error {
	display: none;
	margin-top: 8px;
	color: var(--ekobox-error);
	font-size: 0.85rem;
	font-weight: 600;
}

.ekobox-kf-error.is-visible {
	display: block;
}

.ekobox-kf-message {
	margin: 18px 0;
	padding: 14px 18px;
	border-radius: var(--ekobox-radius);
	background: var(--ekobox-error-bg);
	color: var(--ekobox-error);
	border: 1px solid #f3c4c4;
	font-weight: 600;
}

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

/* --- Aktionen --- */
.ekobox-kf-actions {
	display: flex;
	gap: 14px;
	margin-top: 32px;
	padding-top: 24px;
	border-top: 1px solid var(--ekobox-line);
	flex-wrap: wrap;
}

.ekobox-kf-btn {
	flex: 1 1 auto;
	min-height: 54px;
	padding: 14px 26px;
	font-size: 1rem;
	font-weight: 700;
	font-family: inherit;
	letter-spacing: 0.01em;
	border: 1.5px solid transparent;
	border-radius: var(--ekobox-radius);
	cursor: pointer;
	transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
	-webkit-appearance: none;
	appearance: none;
}

.ekobox-kf-next,
.ekobox-kf-submit {
	color: #fff;
	background: var(--ekobox-primary);
	border-color: var(--ekobox-primary);
}

.ekobox-kf-next:hover,
.ekobox-kf-submit:hover {
	background: var(--ekobox-primary-dark);
	border-color: var(--ekobox-primary-dark);
}

.ekobox-kf-prev {
	flex: 0 0 auto;
	background: var(--ekobox-surface);
	color: var(--ekobox-primary-dark);
	border-color: var(--ekobox-line-strong);
}

.ekobox-kf-prev:hover {
	background: var(--ekobox-primary-tint);
	border-color: var(--ekobox-primary-600);
}

.ekobox-kf-btn:disabled {
	opacity: 0.65;
	cursor: progress;
	transform: none;
}

.ekobox-kf-btn:focus-visible {
	outline: 3px solid var(--ekobox-accent);
	outline-offset: 2px;
}

/* --- Erfolg --- */
.ekobox-kf-success {
	text-align: center;
	padding: 48px 20px;
	animation: ekobox-fade 0.5s ease;
}

.ekobox-kf-success-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 84px;
	height: 84px;
	margin: 0 auto 20px;
	border-radius: 50%;
	background: var(--ekobox-primary);
	color: #fff;
	font-size: 2.6rem;
	line-height: 1;
}

.ekobox-kf-success-title {
	margin: 0 0 10px;
	font-size: 1.5rem;
	font-weight: 700;
	color: var(--ekobox-ink);
}

.ekobox-kf-success-text {
	margin: 0 auto;
	max-width: 52ch;
	color: var(--ekobox-muted);
	font-size: 1.02rem;
}

/* --- Ladezustand --- */
.ekobox-kf.is-loading {
	opacity: 0.75;
	pointer-events: none;
}

/* --- Tablet / Desktop --- */
@media (min-width: 600px) {
	.ekobox-kf-cards {
		grid-template-columns: repeat(2, 1fr);
	}

	.ekobox-kf-cards--image {
		grid-template-columns: repeat(3, 1fr);
	}

	.ekobox-kf-radios,
	.ekobox-kf-checks {
		flex-direction: row;
		flex-wrap: wrap;
	}

	.ekobox-kf-radio,
	.ekobox-kf-check {
		flex: 1 1 calc(50% - 12px);
	}

	.ekobox-kf-actions {
		flex-wrap: nowrap;
		justify-content: space-between;
		align-items: center;
	}

	.ekobox-kf-next,
	.ekobox-kf-submit {
		flex: 0 1 auto;
		min-width: 230px;
		margin-left: auto;
	}
}

@media (min-width: 880px) {
	.ekobox-kf-cards--image {
		grid-template-columns: repeat(4, 1fr);
	}
}

/* --- Reduzierte Bewegung --- */
@media (prefers-reduced-motion: reduce) {
	.ekobox-kf *,
	.ekobox-kf *::before,
	.ekobox-kf *::after {
		transition: none !important;
		animation: none !important;
	}
}
