/* Tree View */
.tree-view-container {
  padding: 4px 0;
  font-size: 0.82rem;
  user-select: none;
  overflow-y: auto;
  max-height: calc(100vh - 340px);
}
.tree-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 6px;
}
.tree-view-header-actions {
  display: flex;
  gap: 2px;
}
.tree-view-header-actions button {
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
}
.tree-view-header-actions button:hover {
  background: var(--gray-100);
  color: var(--gray-800);
}

.tree-item {
  display: flex;
  align-items: center;
  padding: 3px 8px;
  cursor: pointer;
  border-radius: var(--radius-xs);
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
}
.tree-item:hover {
  background: var(--gray-100);
}
.tree-item.active {
  background: var(--brand);
  color: #fff;
}
.tree-item.drag-over {
  background: var(--brand-50);
  outline: 1px dashed var(--brand);
}

.tree-chevron {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s ease;
  color: var(--gray-400);
}
.tree-chevron.expanded {
  transform: rotate(90deg);
}
.tree-chevron.hidden {
  visibility: hidden;
}

.tree-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tree-icon.folder-icon { color: var(--yellow); }
.tree-icon.file-icon { color: var(--gray-400); }

.tree-label {
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  color: var(--gray-700);
}
.tree-item:hover .tree-label {
  color: var(--gray-800);
}
.tree-children {
  display: none;
}
.tree-children.expanded {
  display: block;
}

/* Context Menu */
.context-menu {
  position: fixed;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 4px 0;
  min-width: 180px;
  z-index: 9999;
  font-size: 0.82rem;
}
.context-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  cursor: pointer;
  color: var(--gray-700);
}
.context-menu-item:hover {
  background: var(--gray-100);
}
.context-menu-item.danger {
  color: var(--red);
}
.context-menu-divider {
  height: 1px;
  background: var(--gray-200);
  margin: 4px 0;
}

/* Editor — main padding override */
.main.editor-active {
  padding: 0;
  overflow: hidden;
}

/* Editor */
.editor-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--gray-200);
  background: white;
  flex-shrink: 0;
}
.editor-toolbar .editor-filename {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  flex: 1;
  color: var(--gray-800);
}
.editor-toolbar .editor-dirty {
  color: var(--yellow);
  font-size: 0.75rem;
}
.editor-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}
.editor-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.editor-pane textarea {
  flex: 1;
  width: 100%;
  min-height: 200px;
  border: none;
  outline: none;
  resize: none;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  padding: 16px;
  background: var(--gray-50);
  color: var(--gray-800);
  tab-size: 2;
}
.editor-preview {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  border-left: 1px solid var(--gray-200);
  background: white;
}
.editor-preview .md-render {
  max-width: 100%;
}

/* Move modal folder tree */
.move-tree {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 8px;
  margin-top: 8px;
}
.move-tree-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: var(--radius-xs);
  color: var(--gray-700);
}
.move-tree-item:hover {
  background: var(--gray-100);
}
.move-tree-item.selected {
  background: var(--brand);
  color: #fff;
}

/* Breadcrumb */
.folder-breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--gray-400);
  padding: 4px 0;
}
.folder-breadcrumb span {
  cursor: pointer;
}
.folder-breadcrumb span:hover {
  color: var(--gray-800);
}
.folder-breadcrumb .separator {
  cursor: default;
}
