/* ==================== Graph View Overlay ==================== */

.graph-overlay {
	position: fixed;
	inset: 0;
	z-index: 3000;
	background: #07090f;
	display: flex;
	flex-direction: column;
}

/* ==================== Toolbar ==================== */

.graph-toolbar {
	height: 52px;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 0 20px;
	background: rgba(14, 16, 23, 0.96);
	border-bottom: 1px solid #1f2439;
}

.graph-back-btn {
	background: transparent;
	border: 1px solid #2c3350;
	border-radius: 7px;
	color: #94a3b8;
	font-size: 0.82rem;
	font-family: inherit;
	padding: 6px 12px;
	cursor: pointer;
	transition:
		background 0.12s,
		border-color 0.12s,
		color 0.12s;
	white-space: nowrap;
}

.graph-back-btn:hover {
	background: #131729;
	border-color: #3d4872;
	color: #f1f5f9;
}

.graph-title {
	font-size: 0.9rem;
	font-weight: 600;
	color: #e2e8f0;
	white-space: nowrap;
}

/* ==================== Bus Tabs ==================== */

.graph-bus-tabs {
	display: flex;
	gap: 4px;
	margin: 0 auto;
}

.graph-bus-tab {
	background: transparent;
	border: 1px solid #2c3350;
	border-radius: 7px;
	color: #67728b;
	font-size: 0.8rem;
	font-family: inherit;
	font-weight: 500;
	padding: 5px 14px;
	cursor: pointer;
	transition:
		background 0.12s,
		border-color 0.12s,
		color 0.12s;
}

.graph-bus-tab:hover {
	background: #131729;
	border-color: #3d4872;
	color: #b8c3d8;
}

.graph-bus-tab.active {
	background: rgba(14, 165, 233, 0.14);
	border-color: #0ea5e9;
	color: #7dd3fc;
}

/* ==================== Focus Pill ==================== */

.graph-focus-pill {
	display: flex;
	align-items: center;
	gap: 6px;
	background: rgba(14, 165, 233, 0.15);
	border: 1px solid #0ea5e9;
	border-radius: 20px;
	padding: 4px 10px 4px 14px;
	font-size: 0.78rem;
	color: #7dd3fc;
	white-space: nowrap;
}

.graph-pill-label {
	font-weight: 600;
}

.graph-pill-close {
	background: transparent;
	border: none;
	color: #7dd3fc;
	font-size: 1rem;
	line-height: 1;
	cursor: pointer;
	padding: 0 2px;
	opacity: 0.7;
	font-family: inherit;
	transition: opacity 0.1s;
}

.graph-pill-close:hover {
	opacity: 1;
}

/* ==================== Fit Button ==================== */

.graph-fit-btn {
	background: transparent;
	border: 1px solid #2c3350;
	border-radius: 7px;
	color: #67728b;
	font-size: 0.8rem;
	font-family: inherit;
	padding: 5px 12px;
	cursor: pointer;
	transition:
		background 0.12s,
		border-color 0.12s,
		color 0.12s;
}

.graph-fit-btn:hover {
	background: #131729;
	border-color: #3d4872;
	color: #b8c3d8;
}

/* ==================== Canvas Area ==================== */

.graph-canvas-area {
	flex: 1;
	position: relative;
	overflow: hidden;
}

#graph-svg-host {
	width: 100%;
	height: 100%;
	overflow: hidden;
}

/* ==================== SVG Physical-Bus Renderer ==================== */

.gv-svg {
	display: block;
	width: 100%;
	height: 100%;
	background: transparent;
	cursor: grab;
	user-select: none;
}

.gv-svg.grabbing {
	cursor: grabbing;
}

.gv-bus-rail {
	stroke: #6b7a9c;
	stroke-width: 3;
	fill: none;
}

.gv-bus-rail-label {
	font-size: 10px;
	fill: #67728b;
	font-family: monospace;
	letter-spacing: 0.08em;
	font-weight: 600;
}

.gv-bus-terminator {
	stroke: #4b5568;
	stroke-width: 3;
	stroke-linecap: round;
}

.gv-bus-speed {
	font-size: 10px;
	fill: #67728b;
	font-family: monospace;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	font-weight: 700;
}

.gv-stub {
	stroke: #3d4872;
	stroke-width: 1.5;
	fill: none;
}

.gv-stub-drop {
	fill: #6b7a9c;
	stroke: #1f2439;
	stroke-width: 0.5;
}

.gv-node {
	cursor: pointer;
}

.gv-node-rect {
	fill: #13172a;
	stroke: #2c3350;
	stroke-width: 1.5;
	transition:
		stroke 0.12s,
		fill 0.12s;
}

.gv-node:hover .gv-node-rect {
	stroke: #3d4872;
	fill: #181d30;
}

.gv-node-label {
	fill: #e2e8f0;
	font-size: 12px;
	font-family: monospace;
	font-weight: 600;
	pointer-events: none;
}

.gv-node-grid {
	fill: #94a3b8;
	font-size: 11px;
	font-family: monospace;
	pointer-events: none;
}

.gv-node-bus .gv-node-rect {
	fill: #0f2a35;
	stroke: #0ea5e9;
	stroke-width: 2;
}

.gv-node-bus .gv-node-label {
	fill: #7dd3fc;
}

.gv-node-bus .gv-node-grid {
	fill: #67728b;
}

/* Focus-mode dimming of bus furniture + unrelated nodes. */
.gv-svg.gv-focused .gv-bus-rail,
.gv-svg.gv-focused .gv-stub,
.gv-svg.gv-focused .gv-stub-drop,
.gv-svg.gv-focused .gv-bus-rail-label,
.gv-svg.gv-focused .gv-bus-speed,
.gv-svg.gv-focused .gv-bus-terminator {
	opacity: 0.35;
}

.gv-node-dim {
	opacity: 0.28;
	transition: opacity 0.15s;
}

.gv-node-active {
	opacity: 1;
	transition: opacity 0.15s;
}

.gv-node-focused .gv-node-rect {
	stroke: #0ea5e9;
	stroke-width: 2.5;
	fill: #0f2a35;
}

.gv-node-focused .gv-node-label {
	fill: #bae6fd;
}

.gv-edge {
	fill: none;
	pointer-events: none;
}

.gv-edge-label {
	font-size: 11px;
	font-family: monospace;
	font-weight: 600;
	pointer-events: none;
}

.gv-empty {
	fill: #4b5568;
	font-family: inherit;
	font-size: 14px;
}

/* ==================== Node Detail Panel ==================== */

.graph-node-panel {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: 280px;
	background: rgba(11, 13, 20, 0.97);
	border-left: 1px solid #1f2439;
	overflow-y: auto;
	padding: 20px 18px;
	transform: translateX(100%);
	transition: transform 0.18s ease-out;
	display: flex;
	flex-direction: column;
	gap: 0;
}

.graph-node-panel.open {
	transform: translateX(0);
}

.graph-panel-title {
	font-size: 1rem;
	font-weight: 700;
	color: #e2e8f0;
	margin: 0 0 4px 0;
}

.graph-panel-grid {
	font-size: 0.78rem;
	color: #67728b;
	margin-bottom: 16px;
}

.graph-panel-divider {
	height: 1px;
	background: #1f2439;
	margin: 12px 0;
}

.graph-panel-section-label {
	font-size: 0.7rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #4b5568;
	margin-bottom: 8px;
}

.graph-panel-peer {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 0.82rem;
	font-weight: 600;
	color: #7dd3fc;
	cursor: pointer;
	padding: 4px 0;
	border-radius: 4px;
	transition: color 0.1s;
	background: transparent;
	border: none;
	font-family: inherit;
	text-align: left;
	width: 100%;
}

.graph-panel-peer:hover {
	color: #bae6fd;
}

.graph-panel-peer-arrow {
	font-size: 0.75rem;
	color: #4b5568;
	flex-shrink: 0;
}

.graph-panel-msgs {
	padding-left: 18px;
	margin: 2px 0 8px;
}

.graph-panel-msg {
	font-size: 0.75rem;
	color: #94a3b8;
	padding: 1px 0;
}

.graph-panel-empty {
	font-size: 0.8rem;
	color: #4b5568;
	font-style: italic;
}

/* ── Mobile: wrap toolbar, slide panel up from bottom ── */
@media (max-width: 768px) {
	.graph-toolbar {
		height: auto;
		flex-wrap: wrap;
		padding: 8px 12px;
		gap: 8px;
		row-gap: 6px;
	}

	.graph-title {
		flex: 1;
	}

	.graph-bus-tabs {
		order: 3;
		width: 100%;
		margin: 0;
		overflow-x: auto;
		padding-bottom: 2px;
		-webkit-overflow-scrolling: touch;
	}

	.graph-focus-pill {
		order: 4;
		width: 100%;
	}

	.graph-node-panel {
		width: 100%;
		height: 55vh;
		top: auto;
		right: 0;
		left: 0;
		bottom: 0;
		border-left: none;
		border-top: 1px solid #1f2439;
		transform: translateY(100%);
	}

	.graph-node-panel.open {
		transform: translateY(0);
	}
}
