.bases-canvas-view {
	display: flex;
	height: 100%;
	position: relative;
}

.internal-embed .bases-canvas-view {
	min-height: 400px;
}

.bases-view[data-view-type^="canvas-"] {
	scrollbar-gutter: unset;
	padding: 0;
}

.internal-embed .bases-view {
	min-height: 400px;
	min-width: 100%;
}

.bases-canvas-view.is-sidebar-collapsed {
	gap: 0;
}

.bases-canvas-view.is-sidebar-collapsed .bases-canvas-sidebar {
	transform: translateX(-100%);
}

.bases-canvas-sidebar {
	position: absolute;
	top: 0;
	left: 0;
	bottom: 0;
	width: 240px;
	z-index: 10;
	overflow-y: auto;
	padding: var(--size-4-2) 0;
	border-right: 1px solid var(--background-modifier-border);
	background-color: var(--background-primary);
	box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
	transition: transform 0.3s ease;
}

.bases-canvas-controls {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: var(--size-4-2);
	padding: 0 var(--size-4-2) var(--size-4-2);
}

.bases-canvas-control {
	padding: var(--size-4-1) var(--size-4-2);
	border-radius: var(--radius-s);
	border: 1px solid var(--background-modifier-border);
	background-color: transparent;
	color: var(--text-normal);
	cursor: pointer;
	font-size: var(--font-ui-small);
}

.bases-canvas-control:hover:not([disabled]) {
	background-color: var(--background-modifier-hover);
}

.bases-canvas-control[disabled] {
	opacity: 0.5;
	cursor: not-allowed;
}

.bases-canvas-entry {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--size-4-2);
	padding: var(--size-4-2) var(--size-4-4);
	cursor: pointer;
	border-radius: var(--radius-s);
	min-width: 0; /* 允许 flex 子元素缩小 */
}

.bases-canvas-entry-text {
	flex: 1;
	white-space: nowrap;
	text-overflow: ellipsis;
	overflow: hidden;
	min-width: 0; /* 允许文本缩小 */
}

.bases-canvas-entry:is(:hover, .is-active) {
	background-color: var(--background-modifier-hover);
}

.bases-canvas-entry.is-imported {
	color: var(--text-muted);
}

.bases-canvas-entry-status {
	padding: 0 var(--size-4-1);
	border-radius: var(--radius-s);
	font-size: var(--font-ui-small);
	color: var(--text-muted);
}

.bases-canvas-stage {
	width: 100%;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.bases-canvas-sidebar-toggle {
	position: absolute;
	top: var(--size-4-2);
	left: var(--size-4-2);
	z-index: 15;
	padding: var(--size-4-1) var(--size-4-2);
	border-radius: var(--radius-s);
	color: var(--text-normal);
	cursor: pointer;
	font-size: var(--font-ui-small);
	background-color: var(--background-primary);
	border: 1px solid var(--background-modifier-border);
	transition: left 0.3s ease;
}

.bases-canvas-sidebar-toggle:hover {
	background-color: var(--background-modifier-hover);
}

.bases-canvas-host {
	flex: 1;
	position: relative;
}

.bases-canvas-host.is-hidden {
	display: none;
}

.bases-canvas-message {
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--text-muted);
	font-size: var(--font-ui-medium);
	text-align: center;
	padding: 0 var(--size-4-4);
	width: 100%;
	height: 100%;
}

.bases-canvas-message.is-hidden {
	display: none;
}

.bases-canvas-embed {
	position: absolute;
	inset: 0;
	min-width: 600px;
	min-height: 400px;
}

.bases-canvas-empty {
	color: var(--text-faint);
	font-size: var(--font-ui-small);
	padding: var(--size-4-2) var(--size-4-4);
}

/* 为 Obsidian 嵌入场景添加最小尺寸约束 */
.internal-embed.bases-embed,
.internal-embed .bases-canvas-embed,
.interactive-child .bases-canvas-embed {
	min-width: 600px;
	min-height: 400px;
}

/* ==================== Canvas List View Styles ==================== */

.canvas-list-view-container {
	display: flex;
	flex-direction: column;
	height: 100%;
	overflow: hidden;
}

.canvas-list-view-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 20px;
	border-bottom: 1px solid var(--background-modifier-border);
	flex-shrink: 0;
	background-color: var(--background-secondary);
}

.canvas-list-view-header .search-input-container {
	flex: 1;
}

.canvas-list-view-title-container {
	flex: 1;
}

.canvas-list-view-title {
	margin: 0;
	font-size: 20px;
	font-weight: 600;
	color: var(--text-normal);
}

.canvas-list-view-actions {
	display: flex;
	gap: 8px;
	align-items: center;
}

.canvas-list-view-action-btn {
	padding: 6px 10px;
	border-radius: var(--radius-s);
	border: 1px solid var(--background-modifier-border);
	background-color: transparent;
	color: var(--text-normal);
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.canvas-list-view-action-btn:hover {
	background-color: var(--background-modifier-hover);
}

.canvas-list-view-search {
	padding: 12px 20px;
	border-bottom: 1px solid var(--background-modifier-border);
	flex-shrink: 0;
}

.canvas-list-view-content {
	flex: 1;
	overflow-y: auto;
	overflow-x: hidden;
}

.canvas-list-view-loading,
.canvas-list-view-empty,
.canvas-list-view-error {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 40px 20px;
	color: var(--text-muted);
	text-align: center;
	font-size: 14px;
}

.canvas-list-view-error {
	color: var(--text-error);
}

/* ==================== Canvas Node List View Styles ==================== */

.canvas-node-list-view {
	display: flex;
	flex-direction: column;
	height: 100%;
	overflow: hidden;
	padding: 0;
}

.canvas-node-list-view-header-section {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 4px 16px;
	border-bottom: 1px solid var(--background-modifier-border);
	background-color: var(--background-secondary);
	flex-shrink: 0;
}

.canvas-node-list-view-search-wrapper {
	width: 100%;
}

.canvas-node-list-view-filter-wrapper {
	width: 100%;
}

.canvas-node-list-view-content {
	flex: 1;
	overflow-y: auto;
	overflow-x: hidden;
	min-height: 0;
}

.canvas-node-list-container {
	width: 100%;
	min-height: 100%;
	position: relative;
}

/* ==================== Search Bar Styles ==================== */

.search-bar-container {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	border: 1px solid var(--background-modifier-border);
	border-radius: var(--radius-m);
	background-color: var(--background-primary);
	transition: border-color 0.2s ease;
	width: 100%;
}

.search-bar-container:focus-within {
	border-color: var(--interactive-accent);
	box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
}

.search-bar-icon {
	flex-shrink: 0;
	color: var(--text-muted);
	display: flex;
	align-items: center;
}

.search-bar-input {
	flex: 1;
	border: none;
	background: transparent;
	color: var(--text-normal);
	font-size: 14px;
	outline: none;
}

.search-bar-input::placeholder {
	color: var(--text-muted);
}

.search-bar-clear {
	flex-shrink: 0;
	cursor: pointer;
	color: var(--text-muted);
	display: flex;
	align-items: center;
	transition: color 0.2s ease;
}

.search-bar-clear:hover {
	color: var(--text-normal);
}

.canvas-list-view .search-input-container {
	margin-left: var(--size-4-4);
	margin-right: var(--size-4-4);
}

/* ==================== Filter Bar Styles ==================== */

.filter-bar-container {
	display: flex;
	flex-direction: row;
}

.filter-bar-type-section {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	align-items: center;
	width: 100%;
	flex: 1;
}

.filter-bar-type-section button.filter-button {
	display: flex !important;
	align-items: center;
	gap: 6px;
	padding: 6px 12px !important;
	border-radius: var(--radius-s);
	border: 1px solid var(--background-modifier-border) !important;
	background-color: var(--background-primary) !important;
	color: var(--text-normal) !important;
	cursor: pointer;
	font-size: 13px;
	transition: all 0.2s ease;
	white-space: nowrap;
	box-shadow: none !important;
	margin: 0;
}

.filter-bar-type-section button.filter-button:hover {
	background-color: var(--background-modifier-hover) !important;
	border-color: var(--interactive-accent) !important;
}

.filter-bar-type-section button.filter-button.is-active {
	background-color: var(--interactive-accent) !important;
	color: var(--text-on-accent) !important;
	border-color: var(--interactive-accent) !important;
	font-weight: 500;
	box-shadow: none !important;
}

.filter-button-icon {
	display: flex;
	align-items: center;
	flex-shrink: 0;
}

.filter-button-label {
	font-weight: 500;
}

/* ==================== Color Filter Styles ==================== */

.filter-bar-color-section {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	margin-left: 12px;
	padding-left: 12px;
	border-left: 1px solid var(--background-modifier-border);
}

/* Use Obsidian's native canvas color picker styles */
.filter-bar-color-section .canvas-color-picker-item.is-active {
	outline: 2px solid var(--interactive-accent) !important;
	outline-offset: 2px !important;
}

/* ==================== Canvas Card Styles ==================== */

.canvas-card {
	background-color: var(--background-primary);
	border: 1px solid var(--background-modifier-border);
	border-radius: var(--radius-m);
	overflow: hidden;
	cursor: pointer;
	transition: all 0.2s ease;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.canvas-card:hover {
	border-color: var(--interactive-accent);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	transform: translateY(-2px);
}

.canvas-card.is-pinned {
	border-color: var(--color-accent);
	background-color: var(--background-primary-alt);
}

.canvas-card-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: var(--size-2-3) var(--size-4-3);
	border-bottom: 1px solid var(--background-modifier-border);
	gap: 8px;
}

.canvas-card-title {
	flex: 1;
	font-size: 15px;
	font-weight: 600;
	color: var(--text-normal);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.canvas-card-pin-icon {
	opacity: 0;
	flex-shrink: 0;
	color: var(--text-muted);
	cursor: pointer;
	display: flex;
	align-items: center;
	padding: 4px;
	border-radius: var(--radius-s);
	transition: all 0.2s ease;
}

.canvas-card-pin-icon:hover {
	background-color: var(--background-modifier-hover);
	color: var(--text-normal);
}

.canvas-card:hover .canvas-card-pin-icon {
	opacity: 1;
}

.canvas-card.is-pinned .canvas-card-pin-icon {
	color: var(--color-accent);
	opacity: 1;
}

.canvas-card-preview {
	position: relative;
	width: 100%;
	height: 180px;
	overflow: hidden;
	background-color: var(--background-secondary);

	padding-top: var(--size-4-3);
}

.canvas-preview-container {
	position: relative;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: stretch;
	justify-content: stretch;
	overflow: hidden;
}

.canvas-preview-placeholder,
.canvas-preview-error {
	color: var(--text-muted);
	font-size: 13px;
	text-align: center;
	margin: auto;
}

.canvas-svg-preview {
	width: 100%;
	height: 100%;
	display: block;
	flex: 1 1 auto;
}

.canvas-svg-preview-node rect {
	rx: var(--radius-s);
	ry: var(--radius-s);
	transition: transform 120ms ease, stroke 120ms ease;

	fill: var(--background-modifier-border);
}

.canvas-svg-preview-node.is-interactive {
	cursor: pointer;
}

.canvas-svg-preview-node.is-interactive:hover rect {
	transform: translateY(-1px);
	stroke: var(--interactive-accent);
}

/* Highlighted nodes (matching search query) */
.canvas-svg-preview-node.is-highlighted rect {
	stroke: var(--interactive-accent);
	stroke-width: 3;
	filter: drop-shadow(0 0 4px var(--interactive-accent));
	opacity: 1;
}

.canvas-svg-preview-node-label {
	font-size: 12px;
	fill: var(--text-normal);
	pointer-events: none;
}

.canvas-svg-preview-edge {
	stroke-width: 1.5;
	opacity: 0.65;
}

.canvas-svg-preview-edge-label {
	font-size: 11px;
	fill: var(--text-muted);
	text-anchor: middle;
	pointer-events: none;
}

.canvas-svg-preview-popover {
	max-width: 320px;
	max-height: 260px;
	overflow: auto;
	padding: 8px 10px;
	font-size: 12px;
	line-height: 1.4;
	white-space: normal;
}

.canvas-svg-preview-popover.is-loading {
	opacity: 1;
}

.canvas-svg-preview-popover-content > :first-child {
	margin-top: 0;
}

.canvas-svg-preview-popover-content > :last-child {
	margin-bottom: 0;
}

.canvas-card-footer {
	padding: 10px 16px;
	font-size: 12px;
	color: var(--text-muted);
	background-color: var(--background-secondary);
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.canvas-card-footer-left {
	/* Left side: total node count */
}

.canvas-card-footer-right {
	/* Right side: matched node count */
	color: var(--interactive-accent);
	font-weight: 500;
}

/* ==================== Node Card Styles ==================== */

.node-card {
	background-color: var(--background-primary);
	border: 1px solid var(--background-modifier-border);
	border-radius: var(--radius-m);
	overflow: hidden;
	cursor: pointer;
	transition: all 0.2s ease;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
	display: flex;
	flex-direction: column;
	max-height: 600px;
}

.node-card:hover {
	border-color: var(--interactive-accent);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	transform: translateY(-2px);
}

.node-card.is-pinned {
	border-color: var(--color-accent);
	background-color: var(--background-primary-alt);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.node-card-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: var(--size-2-2) var(--size-4-3);
	border-bottom: 1px solid var(--background-modifier-border);
	background-color: var(--background-secondary);
}

.node-card:hover .node-card-pin-icon {
	opacity: 1;
}

.node-card-type-badge {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 4px 8px;
	border-radius: var(--radius-s);
	font-size: 12px;
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.node-card-type-badge-file {
	background-color: rgba(91, 141, 239, 0.15);
	color: #5b8def;
}

.node-card-type-badge-text {
	background-color: rgba(108, 191, 125, 0.15);
	color: #6cbf7d;
}

.node-card-type-badge-group {
	background-color: rgba(157, 123, 230, 0.15);
	color: #9d7be6;
}

.node-card-type-badge-link {
	background-color: rgba(241, 168, 91, 0.15);
	color: #f1a85b;
}

.node-card-icon {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	width: 16px;
	height: 16px;
}

.node-card-type-label {
	font-size: 11px;
	font-weight: 600;
}

.node-card-pin-icon {
	flex-shrink: 0;
	color: var(--text-muted);
	cursor: pointer;
	display: flex;
	align-items: center;
	padding: 6px;
	border-radius: var(--radius-s);
	transition: all 0.2s ease;

	opacity: 0;
}

.node-card-pin-icon:hover {
	background-color: var(--background-modifier-hover);
	color: var(--text-normal);
}

.node-card.is-pinned .node-card-pin-icon {
	color: var(--color-accent);
}

.node-card-content {
	padding: 16px;
	flex: 1;
	min-height: 60px;
	overflow-y: auto;
}

.node-card-content:has(.special-node) {
	padding: 0;
}

.node-card-content-inner {
	color: var(--text-normal);
	font-size: 14px;
	line-height: 1.6;
	word-wrap: break-word;
}

.node-card-content-inner > * {
	margin: 0;
}

.node-card-content-inner > * + * {
	margin-top: 8px;
}

.node-card-content-inner p {
	margin: 0;
}

.node-card-content-inner ul,
.node-card-content-inner ol {
	margin: 0;
	padding-left: 20px;
}

.node-card-content-inner code {
	font-size: 13px;
	background-color: var(--background-secondary);
	padding: 2px 4px;
	border-radius: var(--radius-s);
}

.node-card-content-inner pre {
	margin: 0;
	padding: 8px;
	background-color: var(--background-secondary);
	border-radius: var(--radius-s);
	overflow-x: auto;
}

.node-card-content-inner pre code {
	background-color: transparent;
	padding: 0;
}

.node-card-file-link {
	color: var(--text-accent);
	font-weight: 500;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.node-card-file-link:hover {
	text-decoration: underline;
}

.node-card-footer {
	padding: 10px 16px;
	font-size: 12px;
	color: var(--text-muted);
	background-color: var(--background-secondary);
	border-top: 1px solid var(--background-modifier-border);
}

.node-card-source {
	display: block;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Node type specific background accents */
.node-card-file .node-card-content {
	background-color: rgba(91, 141, 239, 0.02);
}

.node-card-text .node-card-content {
	background-color: rgba(108, 191, 125, 0.02);
}

.node-card-group .node-card-content {
	background-color: rgba(157, 123, 230, 0.02);
}

.node-card-link .node-card-content {
	background-color: rgba(241, 168, 91, 0.02);
}

.canvas-svg-preview-popover {
	max-height: 500px;
}

/* ==================== Responsive Design ==================== */

@media (max-width: 768px) {
	.canvas-list-view-header,
	.canvas-node-list-view-header {
		flex-direction: column;
		align-items: flex-start;
		gap: 12px;
	}

	.canvas-list-view-title,
	.canvas-node-list-view-title {
		font-size: 18px;
	}

	.canvas-card-preview {
		height: 140px;
	}

	.filter-bar-type-section {
		gap: 6px;
	}

	.filter-bar-type-section button.filter-button {
		padding: 5px 10px !important;
		font-size: 12px;
	}
}
