/**
 * Feuerwehr Intern – Kontext-Hilfe (Icons + Popover).
 *
 * Eigenständiges Stylesheet, NICHT Teil des Tailwind-Builds – dadurch kann das
 * Hilfe-Modul ohne `npm run build` ausgeliefert/aktualisiert werden.
 * Nutzt die TailAdmin-Designtokens (--fw-color-*) mit Fallbacks.
 * Alle Klassen sind mit `fi-help` präfixiert, um Kollisionen zu vermeiden.
 */

.fi-help {
	display: inline-flex;
	align-items: center;
	vertical-align: middle;
	line-height: 0;
	margin-left: 4px;
}

/* Fragezeichen-Button */
.fi-help__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	padding: 0;
	margin: 0;
	border: 1px solid var(--fw-color-border, #e5e7eb);
	border-radius: 9999px;
	background: var(--fw-color-card, #fff);
	color: var(--fw-color-text-muted, #6b7280);
	font-size: 12px;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	transition: background-color .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.fi-help__btn:hover,
.fi-help__btn[aria-expanded="true"] {
	background: var(--fw-color-primary, #c8102e);
	border-color: var(--fw-color-primary, #c8102e);
	color: #fff;
}

/* Deutlich sichtbarer Fokuszustand (Barrierefreiheit) */
.fi-help__btn:focus-visible,
.fi-help__btn:focus {
	outline: 2px solid var(--fw-color-primary, #c8102e);
	outline-offset: 2px;
	color: var(--fw-color-primary, #c8102e);
}
.fi-help__btn:focus:not(:focus-visible) {
	outline: none;
}

/* Popover */
.fi-help__pop {
	position: fixed;
	z-index: 60;
	display: block;
	box-sizing: border-box;
	max-width: 288px;
	width: max-content;
	padding: 10px 12px;
	border: 1px solid var(--fw-color-border, #e5e7eb);
	border-radius: 10px;
	background: var(--fw-color-card, #fff);
	color: var(--fw-color-text, #1f2937);
	box-shadow: 0 8px 24px -6px rgba(0, 0, 0, .18), 0 2px 6px rgba(0, 0, 0, .08);
	text-align: left;
	white-space: normal;
}

/* Sicheres Verstecken – auch falls Theme-CSS [hidden] überschreibt */
.fi-help__pop[hidden] {
	display: none !important;
}

.fi-help__pop-title {
	display: block;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.3;
	color: var(--fw-color-text, #1f2937);
	margin-bottom: 4px;
}

.fi-help__pop-text {
	display: block;
	font-size: 13px;
	line-height: 1.45;
	color: var(--fw-color-text, #1f2937);
}

.fi-help__pop-long {
	display: block;
	font-size: 12px;
	line-height: 1.45;
	color: var(--fw-color-text-muted, #6b7280);
	margin-top: 6px;
	padding-top: 6px;
	border-top: 1px solid var(--fw-color-border, #e5e7eb);
}

/* Kleiner Pfeil oben (Standardposition unterhalb des Icons) */
.fi-help__pop::before {
	content: "";
	position: absolute;
	top: -5px;
	left: var(--fi-help-arrow-left, 12px);
	width: 9px;
	height: 9px;
	background: var(--fw-color-card, #fff);
	border-left: 1px solid var(--fw-color-border, #e5e7eb);
	border-top: 1px solid var(--fw-color-border, #e5e7eb);
	transform: rotate(45deg);
}
/* Wenn nach oben geklappt: Pfeil unten */
.fi-help__pop.fi-help__pop--above::before {
	top: auto;
	bottom: -5px;
	border-left: 0;
	border-top: 0;
	border-right: 1px solid var(--fw-color-border, #e5e7eb);
	border-bottom: 1px solid var(--fw-color-border, #e5e7eb);
}

/* Mobil: Popover als zentriertes Karten-Overlay (kein Abschneiden) */
@media (max-width: 480px) {
	.fi-help__pop.fi-help__pop--sheet {
		position: fixed;
		left: 12px !important;
		right: 12px;
		top: auto !important;
		bottom: 12px;
		max-width: none;
		width: auto;
	}
	.fi-help__pop.fi-help__pop--sheet::before {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.fi-help__btn {
		transition: none;
	}
}
