/*!
 * Facility Management – Globale Suche (Topbar-Lightbox). Ergänzt fm-app.css; nur .fm-search-*.
 */

/* Topbar-Auslöser (Lupe) */
.fm-search-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 0;
	border-radius: 9px;
	background: transparent;
	color: var( --fm-muted, #64748b );
	cursor: pointer;
}

.fm-search-toggle:hover {
	background: var( --fm-muted-bg, #f1f5f9 );
	color: var( --fm-text, #0f172a );
}

.fm-search-toggle .fm-icon {
	width: 20px;
	height: 20px;
}

/* Lock des Hintergrund-Scrollens, solange das Fenster offen ist */
body.fm-search-lock {
	overflow: hidden;
}

/* Overlay + Panel */
.fm-search-overlay {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 10vh 16px 16px;
	background: rgba( 15, 23, 42, 0.55 );
	overflow-y: auto;
}

.fm-search-panel {
	position: relative;
	width: 100%;
	max-width: 640px;
	background: var( --fm-card-bg, #fff );
	color: var( --fm-text, #0f172a );
	border-radius: 14px;
	box-shadow: 0 24px 60px rgba( 15, 23, 42, 0.4 );
	overflow: hidden;
}

/* Kopf mit Eingabefeld */
.fm-search-head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 14px;
	border-bottom: 1px solid var( --fm-border, #e5e7eb );
}

.fm-search-head-icon {
	display: inline-flex;
	color: var( --fm-muted, #64748b );
	flex: 0 0 auto;
}

.fm-search-head-icon .fm-icon {
	width: 20px;
	height: 20px;
}

.fm-search-input {
	flex: 1 1 auto;
	min-width: 0;
	border: 0;
	outline: none;
	background: transparent;
	color: var( --fm-text, #0f172a );
	font-size: 16px;
	line-height: 1.4;
	padding: 6px 0;
}

.fm-search-input::placeholder {
	color: var( --fm-muted, #94a3b8 );
}

.fm-search-close {
	flex: 0 0 auto;
	width: 30px;
	height: 30px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var( --fm-muted, #64748b );
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
}

.fm-search-close:hover {
	background: var( --fm-muted-bg, #f1f5f9 );
}

/* Statuszeile (Hinweis / Ladeanzeige / Leerzustand) */
.fm-search-status {
	padding: 14px 16px;
	font-size: 14px;
}

.fm-search-status[hidden] {
	display: none;
}

/* Ergebnisliste */
.fm-search-results {
	max-height: 60vh;
	overflow-y: auto;
	padding: 4px 0 8px;
}

.fm-search-cluster {
	padding: 6px 0;
	border-top: 1px solid var( --fm-border, #e5e7eb );
}

.fm-search-cluster:first-child {
	border-top: 0;
}

/* Cluster-Überschrift = Link in die modul­eigene Suche */
.fm-search-cluster-head {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 16px;
	text-decoration: none;
	color: var( --fm-muted, #475569 );
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.fm-search-cluster-head:hover {
	color: var( --fm-primary, #2563eb );
}

.fm-search-cluster-icon {
	display: inline-flex;
	color: currentColor;
}

.fm-search-cluster-icon .fm-icon {
	width: 16px;
	height: 16px;
}

.fm-search-cluster-label {
	flex: 1 1 auto;
}

.fm-search-cluster-count {
	flex: 0 0 auto;
	min-width: 20px;
	padding: 1px 7px;
	border-radius: 999px;
	background: var( --fm-muted-bg, #f1f5f9 );
	color: var( --fm-muted, #64748b );
	font-size: 11px;
	font-variant-numeric: tabular-nums;
	text-align: center;
}

/* Treffer */
.fm-search-hits {
	display: block;
}

.fm-search-hit {
	display: flex;
	flex-direction: column;
	gap: 1px;
	padding: 8px 16px;
	text-decoration: none;
	color: var( --fm-text, #0f172a );
	border-left: 3px solid transparent;
}

.fm-search-hit:hover,
.fm-search-hit.is-active {
	background: var( --fm-muted-bg, #f1f5f9 );
	border-left-color: var( --fm-primary, #2563eb );
}

.fm-search-hit-title {
	font-size: 14px;
	font-weight: 500;
	word-break: break-word;
}

.fm-search-hit-sub {
	font-size: 12px;
}

/* „Alle N anzeigen" */
.fm-search-more {
	display: inline-block;
	padding: 4px 16px 8px;
	font-size: 13px;
	font-weight: 500;
	text-decoration: none;
	color: var( --fm-primary, #2563eb );
}

.fm-search-more:hover {
	text-decoration: underline;
}

/* Kleine Helfer */
.fm-search-panel .fm-muted {
	color: var( --fm-muted, #64748b );
}

@media ( max-width: 520px ) {
	.fm-search-overlay {
		padding: 0;
		align-items: stretch;
	}

	.fm-search-panel {
		max-width: none;
		border-radius: 0;
		min-height: 100%;
		display: flex;
		flex-direction: column;
	}

	.fm-search-results {
		max-height: none;
		flex: 1 1 auto;
	}
}
