/**
 * Anamnesebogen Kinder – Frontend-Stil.
 * Mitte zwischen PDF-Optik und modernem Web-Formular:
 *  – Struktur 1:1 wie das PDF (Ja/Nein-Zeilen mit immer sichtbaren Nachfragefeldern)
 *  – Moderne, ruhige Oberfläche: weiße Karte, klare Eingabefelder, Teal-Akzente #88AFB5
 *  – Checkboxen mit ✓ (Ja / Auswahl) und ✕ (Nein) wie im ausgefüllten Formular
 */

.ab-wrap {
	--ab-teal: #88AFB5;
	--ab-teal-dark: #6E99A0;
	--ab-teal-ring: rgba(136, 175, 181, 0.25);
	--ab-text: #3E4244;
	--ab-muted: #72787A;
	--ab-border: #CDD5DA;
	--ab-bar-gray: #EEF0F3;
	--ab-danger: #C0392B;

	max-width: 1100px;
	background: #fff;
	border: 1px solid #E7EBED;
	border-radius: 12px;
	box-shadow: 0 4px 20px rgba(30, 45, 50, 0.07);
	padding: 32px 36px 40px;
	color: var(--ab-text);
	font-family: Arial, Helvetica, sans-serif;
	font-size: 16px;
	line-height: 1.5;
	box-sizing: border-box;
}
.ab-wrap *,
.ab-wrap *::before,
.ab-wrap *::after { box-sizing: inherit; }

/* ---------- Kopf / Fortschritt ---------- */

.ab-title {
	font-size: 26px;
	font-weight: bold;
	color: var(--ab-text);
	margin: 0 0 14px;
}
.ab-lead { margin: 0 0 12px; }

/* Sprachumschaltung (DE/EN) – Button in Markenfarbe oben im Intro,
   gleiche Ecken wie .ab-btn (6px) */
.ab-langbar {
	display: flex;
	justify-content: flex-start;
	margin: 0 0 10px;
}
.ab-langtoggle {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 9px 18px;
	border: 1.5px solid var(--ab-teal);
	border-radius: 6px;
	background: #fff;
	color: var(--ab-teal-dark);
	font-family: inherit;
	font-size: 14px;
	font-weight: bold;
	line-height: 1;
	text-decoration: none;
	cursor: pointer;
	transition: background .15s ease, color .15s ease, box-shadow .15s ease, transform .15s ease;
}
/* Der Umschalter ist ein <a>, darf aber nie unterstrichen erscheinen – auch nicht
   durch Theme- oder Browser-Erweiterungs-Regeln (diese erzwingen gern !important).
   ID + Klasse, damit die Regel auch gegen starke Fremd-Selektoren gewinnt. */
#anamnesebogen .ab-langtoggle,
#anamnesebogen .ab-langtoggle:hover,
#anamnesebogen .ab-langtoggle:focus,
#anamnesebogen .ab-langtoggle:focus-visible,
#anamnesebogen .ab-langtoggle:visited,
#anamnesebogen .ab-langtoggle span {
	text-decoration: none !important;
}
.ab-langtoggle:hover {
	background: var(--ab-teal);
	color: #fff;
	box-shadow: 0 4px 12px rgba(136, 175, 181, 0.4);
	transform: translateY(-1px);
}
.ab-langtoggle:active { transform: translateY(0); }
.ab-langtoggle:focus-visible { outline: 3px solid var(--ab-teal-ring); outline-offset: 2px; }
.ab-langtoggle .ab-globe { flex: 0 0 auto; display: block; }
.ab-langtoggle.is-loading { opacity: .55; pointer-events: none; }
.ab-switching { opacity: .55; transition: opacity .12s ease; }

.ab-progress {
	position: sticky;
	top: 0;
	z-index: 5;
	background: #fff;
	padding: 10px 0 14px;
	margin-bottom: 10px;
	border-bottom: 1px solid #F0F2F4;
}
.ab-progress-track {
	height: 8px;
	background: #EDF0F2;
	border-radius: 4px;
	overflow: hidden;
}
.ab-progress-fill {
	height: 100%;
	background: var(--ab-teal);
	border-radius: 4px;
	transition: width .25s ease;
}
.ab-progress-text {
	margin-top: 7px;
	font-size: 13px;
	color: var(--ab-muted);
}

/* ---------- Abschnittsbalken ---------- */

.ab-sectionbar {
	border-radius: 6px;
	padding: 12px 16px;
	margin: 6px 0 20px;
}
.ab-sectionbar h2 {
	margin: 0;
	font-size: 17px;
	font-weight: bold;
	line-height: 1.3;
}
.ab-bar-teal { background: var(--ab-teal); }
.ab-bar-teal h2 { color: #fff; }
.ab-bar-gray { background: var(--ab-bar-gray); }
.ab-bar-gray h2 { color: #55595C; }

/* ---------- Grid & Felder ---------- */

.ab-grid {
	display: grid;
	grid-template-columns: repeat(12, 1fr);
	gap: 18px 16px;
}
.ab-field { min-width: 0; }

/* Feldgruppen: aufeinanderfolgende Felder teilen sich die volle Breite gleichmäßig */
.ab-fieldgroup {
	grid-column: 1 / -1;
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 16px;
}

/* ---------- Unterschriftenfeld ---------- */

.ab-sig-canvas {
	display: block;
	width: 100%;
	height: 150px;
	background: #fff;
	border: 1.5px dashed var(--ab-border);
	border-radius: 8px;
	touch-action: none;
	cursor: crosshair;
}
.ab-sig-canvas.ab-ink { border-style: solid; border-color: var(--ab-teal); }
.ab-sig-actions {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 8px;
}
.ab-sig-actions .ab-btn { min-height: 38px; padding: 8px 16px; font-size: 14px; }
.ab-sig-error { color: var(--ab-danger); font-size: 14px; font-weight: bold; }

.ab-label {
	display: block;
	font-size: 14px;
	font-weight: bold;
	color: var(--ab-text);
	margin-bottom: 5px;
	line-height: 1.4;
}
.ab-hint {
	display: block;
	font-size: 12.5px;
	color: var(--ab-muted);
	margin: 2px 0 0;
	font-style: italic;
}
.ab-note {
	grid-column: 1 / -1;
	margin: 0 0 4px;
	font-size: 15px;
	background: var(--ab-bar-gray);
	border-radius: 6px;
	padding: 14px 16px;
}

.ab-wrap input[type="text"],
.ab-wrap input[type="email"],
.ab-wrap input[type="tel"],
.ab-wrap input[type="date"],
.ab-wrap textarea {
	width: 100%;
	min-height: 25px;
	padding: 10px 12px;
	line-height: 1.35;
	font-family: inherit;
	font-size: 16px;
	color: var(--ab-text);
	background: #fff;
	border: 1px solid var(--ab-border);
	border-radius: 6px;
	outline: none;
	-webkit-appearance: none;
	appearance: none;
	transition: border-color .15s ease, box-shadow .15s ease;
}
.ab-wrap textarea { resize: vertical; min-height: 0; }
.ab-wrap input:focus,
.ab-wrap textarea:focus {
	border-color: var(--ab-teal);
	box-shadow: 0 0 0 3px var(--ab-teal-ring);
}

/* ---------- Checkbox / Radio (Kasten mit ✓ bzw. ✕) ---------- */

.ab-check {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	cursor: pointer;
	font-size: 15px;
	color: var(--ab-text);
	-webkit-user-select: none;
	user-select: none;
}
.ab-check input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	pointer-events: none;
}
.ab-box {
	width: 21px;
	height: 21px;
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: #fff;
	border: 1.5px solid #9AA6AC;
	border-radius: 4px;
	transition: background .12s ease, border-color .12s ease, box-shadow .12s ease;
	position: relative;
}
.ab-check:hover .ab-box { border-color: var(--ab-teal); }
.ab-check input:checked + .ab-box {
	background: var(--ab-teal);
	border-color: var(--ab-teal);
}
.ab-check input:focus-visible + .ab-box {
	box-shadow: 0 0 0 3px var(--ab-teal-ring);
}

/* Häkchen (✓) – Standard für Auswahl-Checkboxen und "Ja" */
.ab-check input:checked + .ab-box::after {
	content: "";
	width: 9px;
	height: 5px;
	border-left: 2.5px solid #fff;
	border-bottom: 2.5px solid #fff;
	transform: rotate(-45deg);
	margin-top: -2px;
}
/* Kreuz (✕) – für "Nein", wie im ausgefüllten PDF */
.ab-check.ab-opt-nein input:checked + .ab-box::after {
	content: "×";
	width: auto;
	height: auto;
	border: 0;
	transform: none;
	margin-top: -2px;
	color: #fff;
	font-size: 18px;
	font-weight: bold;
	line-height: 1;
	font-family: Arial, Helvetica, sans-serif;
}

.ab-check-text { line-height: 1.3; }
.ab-check-lg .ab-box { width: 24px; height: 24px; border-radius: 5px; }
.ab-check-lg .ab-check-text { font-size: 16px; }

/* Optionen in einer Zeile (wie im PDF) */
.ab-checkrow {
	display: flex;
	flex-wrap: wrap;
	gap: 12px 26px;
	margin-top: 2px;
}

/* ---------- Ja/Nein-Zeilen (PDF-Layout: Frage | Optionen | Nachfrage) ---------- */

.ab-yn {
	display: grid;
	grid-template-columns: minmax(260px, 1.15fr) max-content minmax(240px, 1fr);
	gap: 6px 22px;
	align-items: center;
	padding: 10px 0;
	border-bottom: 1px solid #F4F6F7;
}
.ab-yn:last-of-type { border-bottom: 0; }
.ab-q { font-size: 15px; font-weight: bold; color: var(--ab-text); }
.ab-yn-opts {
	display: flex;
	gap: 8px 22px;
	justify-content: center;
}
.ab-yn-follow {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 6px 10px;
	align-items: center;
}
.ab-yn-follow .ab-sub {
	font-size: 13px;
	color: var(--ab-muted);
	text-align: right;
	white-space: nowrap;
}
.ab-yn-follow input { min-height: 25px; }

/* Einverständnis */
.ab-consent {
	background: var(--ab-bar-gray);
	border-radius: 6px;
	padding: 16px;
}

/* ---------- Navigation ---------- */

.ab-nav {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	margin-top: 28px;
	padding-top: 20px;
	border-top: 1px solid #EDF0F2;
}
.ab-btn {
	display: inline-block;
	background: var(--ab-teal);
	color: #fff;
	border: 0;
	border-radius: 6px;
	padding: 12px 28px;
	min-height: 46px;
	font-family: inherit;
	font-size: 16px;
	font-weight: bold;
	cursor: pointer;
	text-decoration: none;
	transition: background .15s ease;
}
.ab-btn:hover { background: var(--ab-teal-dark); color: #fff; }
.ab-btn:focus-visible { outline: 3px solid var(--ab-teal-ring); outline-offset: 2px; }
.ab-btn-ghost {
	background: #fff;
	color: var(--ab-text);
	border: 1px solid var(--ab-border);
}
.ab-btn-ghost:hover {
	background: var(--ab-bar-gray);
	color: var(--ab-text);
	border-color: var(--ab-teal);
}

/* ---------- Schritt-Steuerung (mit JS) ---------- */

.ab-js .ab-step { display: none; border: 0; margin: 0; padding: 0; }
.ab-js .ab-step.ab-active { display: block; }

/* Fehlerbanner + Danke */
.ab-error-banner,
.ab-thanks {
	border-radius: 6px;
	padding: 16px 18px;
	margin-bottom: 18px;
}
.ab-error-banner {
	background: #FDF0EE;
	border: 1px solid #E5B4AD;
	color: var(--ab-danger);
}
.ab-thanks {
	background: #F3F7F8;
	border: 1px solid var(--ab-teal);
}
.ab-thanks h2 { color: var(--ab-text); margin-top: 0; }

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

/* ---------- Mobil ---------- */

@media (max-width: 900px) {
	/* Ja/Nein-Zeilen stapeln: Frage, dann Optionen, dann Nachfragefeld */
	.ab-yn {
		grid-template-columns: 1fr;
		gap: 10px;
		padding: 12px 0;
	}
	.ab-yn-opts { justify-content: flex-start; gap: 10px 24px; }
	.ab-yn-follow { grid-template-columns: max-content 1fr; }
}

@media (max-width: 640px) {
	.ab-wrap {
		padding: 20px 16px 30px;
		border-radius: 10px;
	}
	.ab-grid { grid-template-columns: 1fr; gap: 14px; }
	.ab-field { grid-column: 1 / -1 !important; }
	.ab-title { font-size: 22px; }
	.ab-nav { flex-direction: column-reverse; }
	.ab-nav .ab-btn { width: 100%; }
	.ab-progress { top: -1px; }
}
