/* ═══════════════════════════════════════
   工作台（Desk）CSS Module
   从 styles.css 迁移的 desk 专属样式
   ═══════════════════════════════════════ */

/* ── 工作台区：延伸到底 ── */
.section {
    align-self: stretch;
    flex: 1 1 0;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.sectionTitle {
    padding: var(--space-xs) var(--space-sm) var(--space-xs);
    flex: 0 0 auto;
    font-family: "Songti SC", "Noto Serif CJK SC", serif;
    justify-content: flex-start;
    padding-left: var(--space-md);
}

/* 工作台未设置 overlay */
.emptyOverlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: var(--space-lg);
    padding-top: 45%;
    background: var(--bg-card);
}

.emptyText {
    font-size: 0.9rem;
    color: var(--text);
    margin: 0 0 0.5rem;
}

.emptyHint {
    font-size: 0.78rem;
    line-height: 1.7;
    color: var(--text-muted);
    text-align: center;
    margin: 0 0 1rem;
    max-width: 240px;
}

.emptyBtn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-family: inherit;
    font-size: 0.8rem;
    color: var(--accent);
    background: var(--accent-light);
    border: none;
    border-radius: var(--radius-md);
    padding: 0.4rem 1rem;
    cursor: default;
    transition: opacity var(--duration-fast);
}

.emptyBtn:hover {
    opacity: 0.8;
}

/* 工作台标题行 */
.header {
    position: relative;
}

.headerCwdBtn {
    position: absolute;
    right: var(--space-sm);
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
}

/* 打开文件夹按钮 */
.openBtn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin: 2px var(--space-sm) var(--space-xs);
    padding: 5px 0;
    background: none;
    border: 1px solid var(--overlay-light);
    border-radius: var(--radius-sm);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-family: inherit;
    cursor: default;
    transition: color var(--duration-fast), border-color var(--duration-fast), box-shadow var(--duration-fast);
    flex-shrink: 0;
}

.openBtn:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.openBtn svg {
    opacity: 0.7;
}

.openBtn:hover svg {
    opacity: 1;
}

/* 文件列表 */
.list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    font-family: inherit;
    display: grid;
    grid-template-columns: repeat(var(--jian-columns, 1), minmax(0, 1fr));
    gap: 1px;
    align-content: start;
    padding-bottom: 72px;
}

.list:empty {
    display: flex;
    align-items: center;
    justify-content: center;
}

.list:empty::after {
    content: attr(data-empty-text);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-family: inherit;
}

/* Obsidian-like workspace tree */
.tree {
    flex: 1 1 0;
    height: 0;
    min-height: 0;
    overflow-y: auto;
    display: block;
    padding: 4px 2px calc(var(--right-workspace-jian-reserved, 56px) + var(--panel-edge-gap));
    scroll-padding-bottom: calc(var(--right-workspace-jian-reserved, 56px) + var(--panel-edge-gap));
}

.tree:empty {
    display: flex;
    align-items: center;
    justify-content: center;
}

.tree:empty::after {
    content: attr(data-empty-text);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-family: inherit;
}

.treeGroup {
    display: block;
}

.rightWorkspaceSection {
    --right-workspace-list-toolbar-height: 25px;
    --right-workspace-search-height: 30px;
    position: relative;
    flex: 1 1 0;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    display: block;
    overflow: hidden;
}

.rightWorkspaceSection .toolbar {
    position: absolute;
    top: var(--right-workspace-search-height);
    left: 0;
    right: 0;
    z-index: 1;
    height: var(--right-workspace-list-toolbar-height);
    min-height: 0;
    margin: 0 var(--space-sm);
}

.rightWorkspaceSection .tree {
    position: absolute;
    top: calc(var(--right-workspace-search-height) + var(--right-workspace-list-toolbar-height));
    right: 0;
    bottom: 0;
    left: 0;
    flex: none;
    height: auto;
    max-height: none;
}

.rightWorkspaceSection .searchWrap {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2;
}

.rightWorkspaceSection .tree:empty {
    display: flex;
}

.treeItem {
    --tree-leading-inset: 0px;
    --tree-indent-step: 16px;
    box-sizing: border-box;
    width: calc(100% - 4px);
    display: grid;
    grid-template-columns:
        calc(var(--tree-leading-inset) + (var(--tree-depth, 0) * var(--tree-indent-step)))
        14px
        22px
        minmax(0, 1fr);
    align-items: center;
    column-gap: 0;
    min-width: 0;
    height: 28px;
    padding: 0 8px 0 2px;
    margin: 0 2px;
    border-radius: 4px;
    color: var(--text);
    font-size: 0.74rem;
    line-height: 1.4;
    cursor: default;
    user-select: none;
    transition: background var(--duration-instant) var(--ease-out), color var(--duration-instant) var(--ease-out);
}

.treeItem:hover {
    background: var(--overlay-subtle);
}

.treeItemSelected {
    background: rgba(var(--accent-rgb), 0.10);
}

.treeItemDropTarget {
    background: rgba(var(--accent-rgb), 0.12);
}

.treeDisclosure {
    width: 14px;
    min-width: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    line-height: 1;
}

.treeDisclosure svg {
    display: block;
    width: 12px;
    height: 12px;
}

.treeIndent {
    display: block;
    width: calc(var(--tree-leading-inset) + (var(--tree-depth, 0) * var(--tree-indent-step)));
    min-width: 0;
    height: 100%;
    pointer-events: none;
}

/* 文件条目 */
.item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px var(--space-sm);
    cursor: default;
    font-size: 0.72rem;
    line-height: 1.5;
    transition: background var(--duration-instant);
    border-radius: 3px;
    margin: 0 4px;
    min-width: 0;
    user-select: none;
}

.item:hover {
    background: var(--overlay-subtle);
}

.selected {
    background: rgba(var(--accent-rgb), 0.10);
}

.rubberBand {
    background: rgba(var(--accent-rgb), 0.08);
    border: 1px solid rgba(var(--accent-rgb), 0.3);
    pointer-events: none;
    z-index: 10;
}

.itemIcon {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    color: var(--text-muted);
}

.itemIcon svg {
    display: block;
}

.itemName {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
}

.section.dragOver {
    background: rgba(var(--accent-rgb), 0.04);
}

/* 工具栏（面包屑 + 排序） */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 3px var(--space-sm) 2px;
    flex-shrink: 0;
    min-height: 20px;
}

.toolbarActions {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
}

.sortBtn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    min-height: 20px;
    padding: 2px 7px;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.65rem;
    font-family: inherit;
    line-height: 1;
    cursor: default;
    transition: background var(--duration-fast), color var(--duration-fast);
    white-space: nowrap;
}

.sortBtn:hover {
    background: var(--overlay-subtle);
    color: var(--text);
}

.filterBtnActive {
    color: var(--accent);
    background: rgba(var(--accent-rgb), 0.08);
}

.sortBtn:disabled {
    opacity: 0.45;
    cursor: default;
}

.sortBtn:disabled:hover {
    background: none;
    color: var(--text-muted);
}

.sortBtn svg {
    display: block;
    flex: 0 0 auto;
    opacity: 0.6;
}

.sortBtn > span {
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

.sortBtn > span:first-child {
    width: 14px;
    height: 14px;
    justify-content: center;
}

.iconBtn {
    padding: 2px 5px;
}

/* 工作区搜索 */
.searchWrap {
    position: relative;
    flex: 0 0 auto;
    margin: 2px var(--space-sm) 0;
}

.searchInput {
    box-sizing: border-box;
    width: 100%;
    height: 24px;
    padding: 2px 8px;
    border: 1px solid var(--overlay-light);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text);
    font-family: inherit;
    font-size: 0.65rem;
    line-height: 1;
    outline: none;
}

.searchInput::placeholder {
    color: var(--text-muted);
    opacity: 0.55;
}

.searchInput:focus {
    border-color: rgba(var(--accent-rgb), 0.42);
}

.searchResults {
    position: absolute;
    top: calc(100% + 3px);
    left: 0;
    right: 0;
    z-index: 30;
    max-height: 220px;
    overflow-y: auto;
    padding: 4px 0;
    border: 1px solid var(--overlay-light);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.searchResult {
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1px;
    padding: 5px 8px;
    border: none;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    text-align: left;
    cursor: default;
}

.searchResult:hover {
    background: var(--overlay-subtle);
}

.searchResultName,
.searchResultPath {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.searchResultName {
    font-size: 0.7rem;
    line-height: 1.25;
}

.searchResultPath,
.searchEmpty {
    color: var(--text-muted);
    font-size: 0.58rem;
    line-height: 1.35;
}

.searchEmpty {
    padding: 6px 8px;
}

/* 项目技能按钮（卡片式） */
.cwdBtn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: none;
    border: 1px solid var(--overlay-light);
    border-radius: var(--radius-sm);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    color: var(--text-muted);
    font-size: 0.65rem;
    font-family: inherit;
    cursor: default;
    white-space: nowrap;
    flex-shrink: 0;
    transition: color var(--duration-fast), border-color var(--duration-fast), box-shadow var(--duration-fast);
}

.cwdBtn:hover {
    color: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
}

.cwdBtn.active {
    color: var(--accent);
    border-color: var(--accent);
}

.cwdBtn svg {
    opacity: 0.6;
}

.cwdBtn:hover svg,
.cwdBtn.active svg {
    opacity: 1;
}

/* 项目技能面板（悬浮卡片） */
.cwdPanelWrap {
    position: relative;
    z-index: 20;
    margin: 0 var(--space-sm);
}

.cwdPanel {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--overlay-light);
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    padding: 0.5rem 0.75rem 0.6rem;
    min-height: 260px;
    max-height: 400px;
    overflow-y: auto;
    animation: hana-slide-in-top var(--duration-fast) ease-out;
    transform-origin: top right;
    transition: border-color var(--duration-fast);
}

.cwdPanel.dragOver {
    border-color: var(--accent);
    border-style: dashed;
}

/* 说明文案 + 装饰线 */
.cwdDescLine {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.cwdDescDeco {
    flex: 1;
    height: 1px;
    background: var(--overlay-light);
}

.cwdCtxMenu {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 12px var(--shadow);
    padding: 4px 0;
    min-width: 140px;
}

.cwdCtxMenu button {
    display: block;
    width: 100%;
    padding: 6px 12px;
    font-family: inherit;
    font-size: 0.78rem;
    color: var(--text);
    background: none;
    border: none;
    cursor: default;
    text-align: left;
}

.cwdCtxMenu button:hover {
    background: var(--accent-light);
}

.cwdCtxDanger {
    color: var(--danger, #c55);
}

.cwdCtxMenu button.cwdCtxDanger:hover {
    background: rgba(200, 80, 80, 0.08);
}

.cwdDescText {
    font-size: 0.6rem;
    color: var(--text-muted);
    opacity: 0.6;
    white-space: nowrap;
}

.cwdPanelWrap.closing .cwdPanel {
    animation: hana-slide-out-top var(--duration-instant) ease-in forwards;
}

.cwdEmpty {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: center;
    padding: 0.4rem 0 0.1rem;
}

.cwdHint {
    font-size: 0.62rem;
    color: var(--text-muted);
    opacity: 0.5;
    text-align: center;
    padding-bottom: 0.2rem;
}

.cwdGroupLabel {
    font-size: 0.62rem;
    color: var(--text-muted);
    font-weight: 600;
    padding: 0.25rem 0 0.1rem;
}

.cwdSkillItem {
    user-select: none;
    display: flex;
    flex-direction: column;
    padding: 0.2rem 0.3rem;
    border-radius: var(--radius-sm);
    cursor: default;
    transition: background var(--duration-instant);
}

.cwdSkillItem:hover {
    background: var(--overlay-light);
}

.cwdSkillName {
    font-size: 0.72rem;
    color: var(--text);
}

.cwdSkillDesc {
    font-size: 0.6rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 子目录导航 */
.nav {
    flex-shrink: 0;
}

.navHidden {
    display: none;
}

.backBtn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: var(--overlay-subtle);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-size: 0.68rem;
    font-family: inherit;
    cursor: default;
    transition: background var(--duration-fast);
    max-width: 100%;
    overflow: hidden;
}

.backBtn span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.backBtn:hover {
    background: var(--overlay-light);
}

.backBtn svg {
    flex-shrink: 0;
    opacity: 0.7;
}

/* 可点击的文件夹样式 */
.isDir {
    cursor: default;
}

.isDir:hover {
    background: rgba(var(--accent-rgb), 0.06);
}

.isDir .itemIcon {
    color: var(--accent);
}

.dropTarget {
    background: rgba(var(--accent-rgb), 0.12);
    outline: 1.5px dashed rgba(var(--accent-rgb), 0.4);
    outline-offset: -1.5px;
}

/* 内联重命名输入框 */
.renameInput {
    flex: 1;
    min-width: 0;
    font-size: 0.72rem;
    font-family: inherit;
    line-height: 1.4;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--accent);
    border-radius: 2px;
    outline: none;
    padding: 0 2px;
}

/* ── 笺编辑器 ── */
.editor {
    position: relative;
    flex-shrink: 0;
    margin: 0 6px 6px;
    border-radius: var(--radius-md);
    border: 1px solid var(--jian-note-border, rgba(200, 160, 110, 0.2));
    background: var(--jian-note-bg, #FAF0E2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    height: 300px;
}

.editorHeader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6em;
    padding: var(--space-sm) var(--space-sm);
    border-bottom: 1px solid var(--jian-note-border, rgba(200, 160, 110, 0.2));
    flex-shrink: 0;
}

.editorHeader::before,
.editorHeader::after {
    content: "";
    flex: 1;
    max-width: 48px;
    height: 1px;
    background: var(--jian-note-border, rgba(200, 160, 110, 0.25));
}

.editorLabel {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-light);
    letter-spacing: 0.05em;
}

.editorStatus {
    position: absolute;
    right: var(--space-sm);
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.58rem;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity var(--duration-slow) ease;
}

.editorStatusVisible {
    opacity: 1;
}

.editorInput {
    flex: 1;
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    font-size: 0.72rem;
    line-height: 1.55;
    color: var(--text);
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    font-family: inherit;
    overflow-y: auto;
}

.editorInput::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}
