/**
 * IDF Wissens-Graph - Frontend-Styles.
 * Farben aus der IDF-Token-Palette (idf-tokens.css): kühle Neutraltöne plus
 * IDF-Akzente. Knoten werden je Geschäftsfeld eingefärbt (Fill/Stroke setzt das
 * JS), das CSS steuert Zustände, Rahmen und die UI-Elemente.
 */

.idf-wissens-graph {
	--idfwg-height: 680px;
	--idfwg-bg: #ffffff;
	--idfwg-grid: #ececef;
	--idfwg-line: #e5e5e5;
	--idfwg-ink: #111111;
	--idfwg-muted: #6b7280;
	--idfwg-ring: #111827;
	--idfwg-hit: #e8710a;
	--idfwg-link: #167ea0;
	font-family: inherit;
	color: var( --idfwg-ink );
	margin: 0 0 1.5em;
}

.idf-wissens-graph__status {
	padding: 2em 1em;
	text-align: center;
	color: var( --idfwg-muted );
	font-size: 0.95em;
}

/* ---- Toolbar ------------------------------------------------------------ */

.idfwg-toolbar {
	display: flex;
	align-items: center;
	gap: 0.5em;
	flex-wrap: wrap;
	margin-bottom: 0.6em;
}

.idfwg-spacer { flex: 1 1 auto; }

.idfwg-search {
	flex: 0 1 260px;
	min-width: 160px;
	padding: 0.5em 0.75em;
	border: 1px solid var( --idfwg-line );
	border-radius: 8px;
	background: #fff;
	font-size: 0.9em;
	color: var( --idfwg-ink );
}

.idfwg-search:focus {
	outline: none;
	border-color: var( --idfwg-muted );
}

.idfwg-btn {
	padding: 0.5em 0.85em;
	border: 1px solid var( --idfwg-line );
	border-radius: 8px;
	background: #fff;
	color: var( --idfwg-ink );
	font-size: 0.85em;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s;
}

.idfwg-btn:hover {
	background: #f0f1f3;
	border-color: var( --idfwg-muted );
}

/* ---- Geschäftsfeld-Chips ------------------------------------------------ */

.idfwg-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4em;
	margin-bottom: 0.6em;
}

.idfwg-chip {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	padding: 0.32em 0.7em;
	border: 1px solid var( --idfwg-line );
	border-radius: 999px;
	background: #fff;
	color: var( --idfwg-muted );
	font-size: 0.8em;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
}

.idfwg-chip:not( .is-active ) {
	opacity: 0.55;
}

.idfwg-chip.is-active {
	color: var( --idfwg-ink );
	border-color: #d1d5db;
	background: #f0f1f3;
}

.idfwg-chip__dot {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: #9ca3af;
	flex: 0 0 auto;
}

.idfwg-chip__n {
	color: var( --idfwg-muted );
	font-variant-numeric: tabular-nums;
}

/* ---- Bühne -------------------------------------------------------------- */

.idfwg-stage {
	position: relative;
	width: 100%;
	height: var( --idfwg-height );
	min-height: 320px;
	border: 1px solid var( --idfwg-line );
	border-radius: 12px;
	background-color: var( --idfwg-bg );
	background-image: radial-gradient( var( --idfwg-grid ) 1px, transparent 1px );
	background-size: 24px 24px;
	overflow: hidden;
}

.idfwg-svg {
	display: block;
	width: 100%;
	height: 100%;
	cursor: grab;
}

.idfwg-svg:active { cursor: grabbing; }

/* ---- Kanten ------------------------------------------------------------- */

.idfwg-link {
	transition: opacity 0.2s;
}

.idfwg-link.is-active {
	stroke-width: 2.8px;
}

.idfwg-link.is-dim {
	opacity: 0.08;
}

/* ---- Knoten ------------------------------------------------------------- */
/* Fill/Stroke setzt das JS je Geschäftsfeld; hier nur Zustände. */

.idfwg-node {
	cursor: pointer;
}

.idfwg-node circle {
	transition: stroke 0.15s, stroke-width 0.15s;
}

.idfwg-node:hover circle {
	stroke: var( --idfwg-ring );
	stroke-width: 2.4px;
}

.idfwg-node__label {
	font-size: 11px;
	pointer-events: none;
	paint-order: stroke;
	stroke: var( --idfwg-bg );
	stroke-width: 3px;
	stroke-linejoin: round;
}

.idfwg-node__label--draft {
	font-style: italic;
	opacity: 0.7;
}

.idfwg-node.is-selected circle {
	stroke: var( --idfwg-ring );
	stroke-width: 2.8px;
}

.idfwg-node.is-pinned circle {
	stroke-dasharray: 2.5 2.5;
}

.idfwg-node.is-dim {
	opacity: 0.14;
}

.idfwg-node.is-search-off {
	opacity: 0.1;
}

.idfwg-node.is-search-hit circle {
	stroke: var( --idfwg-hit );
	stroke-width: 2.8px;
}

/* ---- Tooltip ------------------------------------------------------------ */

.idfwg-tip {
	position: absolute;
	z-index: 6;
	max-width: 240px;
	padding: 0.5em 0.7em;
	border-radius: 8px;
	background: rgba( 17, 17, 17, 0.94 );
	color: #fff;
	font-size: 0.8em;
	line-height: 1.4;
	pointer-events: none;
	box-shadow: 0 4px 14px rgba( 0, 0, 0, 0.18 );
}

.idfwg-tip__gf { color: #d1d5db; }
.idfwg-tip__deg { color: #9ca3af; }

/* ---- Detail-Panel ------------------------------------------------------- */

.idfwg-panel {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 7;
	width: 280px;
	max-width: calc( 100% - 24px );
	max-height: calc( 100% - 24px );
	overflow-y: auto;
	padding: 1em 1.1em 1.2em;
	border-radius: 12px;
	background: #fff;
	border: 1px solid var( --idfwg-line );
	box-shadow: 0 8px 28px rgba( 0, 0, 0, 0.14 );
	font-size: 0.9em;
}

.idfwg-panel__close {
	position: absolute;
	top: 0.4em;
	right: 0.5em;
	border: none;
	background: none;
	font-size: 1.4em;
	line-height: 1;
	color: var( --idfwg-muted );
	cursor: pointer;
}

.idfwg-panel__close:hover { color: var( --idfwg-ink ); }

.idfwg-panel__head {
	display: flex;
	align-items: center;
	gap: 0.55em;
	margin: 0 1.4em 0.4em 0;
}

.idfwg-panel__title {
	margin: 0;
	font-size: 1.05em;
	line-height: 1.25;
	color: var( --idfwg-ink );
}

.idfwg-panel__gf {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	color: var( --idfwg-muted );
	font-size: 0.82em;
	margin-bottom: 0.6em;
}

.idfwg-panel__gf-dot {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	flex: 0 0 auto;
}

.idfwg-panel__excerpt {
	margin: 0 0 0.8em;
	font-size: 0.85em;
	line-height: 1.5;
	color: #374151;
}

.idfwg-panel__rel { margin-bottom: 0.7em; }

.idfwg-panel__rel-h {
	display: block;
	font-size: 0.72em;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	margin-bottom: 0.2em;
}

.idfwg-panel__rel ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.idfwg-panel__rel li { margin: 0.1em 0; }

.idfwg-panel__jump {
	border: none;
	background: none;
	padding: 0.1em 0;
	color: var( --idfwg-ink );
	font-size: 0.9em;
	text-align: left;
	cursor: pointer;
	border-bottom: 1px dashed transparent;
}

.idfwg-panel__jump:hover {
	border-bottom-color: var( --idfwg-muted );
}

.idfwg-panel__link {
	display: inline-block;
	margin-top: 0.4em;
	font-size: 0.88em;
	font-weight: 600;
	color: var( --idfwg-link );
	text-decoration: none;
}

.idfwg-panel__link:hover { text-decoration: underline; }

/* ---- Legende ------------------------------------------------------------ */

.idfwg-legend {
	position: absolute;
	left: 12px;
	bottom: 12px;
	z-index: 5;
	display: flex;
	flex-wrap: wrap;
	gap: 0.9em;
	padding: 0.5em 0.75em;
	border-radius: 8px;
	background: rgba( 255, 255, 255, 0.92 );
	border: 1px solid var( --idfwg-line );
	font-size: 0.78em;
	color: var( --idfwg-muted );
	box-shadow: 0 2px 10px rgba( 0, 0, 0, 0.06 );
}

.idfwg-legend__item {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
}

.idfwg-legend__line {
	width: 22px;
	height: 3px;
	border-radius: 2px;
	display: inline-block;
}

.idfwg-legend__line--dash {
	background-image: none;
	-webkit-mask-image: repeating-linear-gradient( to right, #000 0 5px, transparent 5px 9px );
	mask-image: repeating-linear-gradient( to right, #000 0 5px, transparent 5px 9px );
}

/* ---- Responsiv ---------------------------------------------------------- */

@media ( max-width: 640px ) {
	.idf-wissens-graph { --idfwg-height: 520px; }

	.idfwg-panel {
		width: auto;
		left: 12px;
		right: 12px;
	}

	.idfwg-legend { font-size: 0.72em; }
}
