/* Styles for the template tree, made consistent with view-tree.css */

.template-panel-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0; /* allow template tree to shrink inside tab */
    height: 100%;
}

.template-source-banner {
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border-light);
    background: var(--color-bg-primary);
}

.template-source-banner-main {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.template-source-banner-label {
    font-size: 12px;
    color: var(--color-text-secondary);
}

.template-source-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    color: var(--color-text-primary);
    background: var(--color-bg-light);
}

.template-source-badge.is-metamodel {
    color: #0f6b46;
    background: rgba(15, 107, 70, 0.14);
}

.template-source-hint {
    font-size: 12px;
    line-height: 1.5;
    color: var(--color-text-secondary);
}

#template-tree-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.view-tree {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tree-node {
    padding: 4px 8px;
    cursor: pointer;
    color: var(--color-text-secondary);
    border-radius: var(--radius-base);
    transition: background-color 0.2s ease;
    font-size: var(--font-size-xs);
    font-family: var(--app-font-family);
    line-height: var(--line-height-normal);
}

.tree-node:hover {
    background-color: var(--color-bg-hover);
}

.tree-node .node-content {
    display: flex;
    align-items: center;
    width: 100%;
    position: relative; /* For positioning action buttons */
}

.tree-node .toggle {
    margin-right: 8px;
    user-select: none;
    width: 10px;
    display: inline-block;
    cursor: pointer;
}

.tree-node .toggle.collapsed::before {
    content: '\25B6'; /* Right-pointing triangle */
    font-size: var(--font-size-xs);
}

.tree-node .toggle.expanded::before {
    content: '\25BC'; /* Down-pointing triangle */
    font-size: var(--font-size-xs);
}

.children-nodes {
    list-style: none;
    padding-left: 8px;
    margin-left: 4px;
}

.tree-node.collapsed > .children-nodes {
    display: none;
}

/* Action buttons for editable nodes */
.node-name {
    flex-grow: 1; /* Allow name to take up space */
}

.node-actions {
    display: none; /* Hide by default */
    align-items: center;
    gap: 4px;
    margin-left: auto; /* Push to the right */
    padding-left: 8px;
}

.tree-node .node-content:hover .node-actions {
    display: flex; /* Show on hover */
}

.node-actions .action-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 2px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.node-actions .action-btn:hover {
    background-color: var(--color-bg-light);
    color: var(--color-text-primary);
}

/* 模板节点样式 */

.template-node .node-content:hover {
    background: rgba(0, 255, 65, 0.1);
    cursor: pointer;
}

.template-icon {
    margin-right: 6px;
    font-size: 12px;
    opacity: 0.8;
}

/* 亮色主题适配 */


[data-theme="light"] .template-node .node-content:hover {
    background: rgba(53, 198, 255, 0.1);
}


/* 拖拽样式 */
.template-node .node-content[draggable="true"] {
    cursor: grab;
}

.template-node .node-content.dragging {
    opacity: 0.5;
    cursor: grabbing;
    background: rgba(0, 255, 65, 0.2);
}

/* 亮色主题拖拽样式 */
body.light-theme .template-node .node-content.dragging {
    background: rgba(53, 208, 255, 0.2);
}

[data-theme="light"] .template-node .node-content.dragging {
    background: rgba(53, 215, 255, 0.2);
}

/* 画布拖拽样式 */
#opm-canvas.drag-over {
    background: rgba(0, 255, 65, 0.05);
    border: 2px dashed var(--color-secondary);
    transition: all 0.2s ease;
}

/* 亮色主题画布拖拽样式 */
[data-theme="light"] #opm-canvas.drag-over {
    background: rgba(53, 208, 255, 0.05);
}

.canvas-drag-preview {
    position: absolute;
    z-index: 30;
    transform: translate(-50%, -50%);
    min-width: 120px;
    max-width: 220px;
    padding: 8px 14px;
    border: 1px dashed rgba(0, 255, 65, 0.7);
    border-radius: 12px;
    background: rgba(8, 18, 10, 0.72);
    color: #dfffe8;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.24);
    backdrop-filter: blur(6px);
    opacity: 0.96;
}

.canvas-drag-preview[hidden] {
    display: none;
}

.canvas-drag-preview.is-process {
    border-radius: 999px;
}

.canvas-drag-preview-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    line-height: 1.2;
    color: rgba(223, 255, 232, 0.88);
    background: rgba(0, 255, 65, 0.14);
}

.canvas-drag-preview-title {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
    text-align: center;
    word-break: break-word;
}

[data-theme="light"] .canvas-drag-preview {
    border-color: rgba(53, 208, 255, 0.72);
    background: rgba(255, 255, 255, 0.9);
    color: #124b5c;
}

[data-theme="light"] .canvas-drag-preview-badge {
    color: #14657b;
    background: rgba(53, 208, 255, 0.14);
}

.tree-node .node-icon {
  margin-right: 5px;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}
.node-icon svg {
    width: 1em;
    height: 1em;
    vertical-align: -0.15em;
    fill: none;
    stroke: currentColor;
    overflow: hidden;
}
