/* project_detail 좌측 "Workspace" 탭 (js/workspace_explorer.js) — 2026-10-19
 *
 * VSCode 탐색기처럼: 22px 행, 폴더 우선, 들여쓰기 안내선, 행에 올리면 동작 버튼.
 * dist/tailwind.css 재빌드 없이 동작하도록 이 파일의 .ws-* 만 쓴다. 기본 라이트, html.dark 다크.
 */

.ws-root {
    --ws-fg: #3f3f46;
    --ws-muted: #71717a;
    --ws-hover: rgba(15, 23, 42, 0.05);
    --ws-sel: rgba(99, 102, 241, 0.12);
    --ws-sel-border: rgba(99, 102, 241, 0.55);
    --ws-guide: rgba(15, 23, 42, 0.12);
    --ws-head: #71717a;
    --ws-drop: rgba(99, 102, 241, 0.16);
    --ws-head-bg: rgba(250, 250, 250, 0.92);
    display: flex;
    flex-direction: column;
    font-size: 13px;
    color: var(--ws-fg);
    user-select: none;
}
html.dark .ws-root {
    --ws-fg: #cbd5e1;
    --ws-muted: #8b95a7;
    --ws-hover: rgba(255, 255, 255, 0.05);
    --ws-sel: rgba(99, 102, 241, 0.22);
    --ws-sel-border: rgba(129, 140, 248, 0.7);
    --ws-guide: rgba(255, 255, 255, 0.1);
    --ws-head: #8b95a7;
    --ws-drop: rgba(99, 102, 241, 0.25);
    --ws-head-bg: rgb(var(--ark-bg-base-rgb) / 0.9);   /* 패널 면(#panel-left, dark:bg-ark-base)과 같은 색 — css/ark_tokens.css */
}
.ws-root.hidden { display: none; }

/* 상단: WORKSPACE 제목 + 툴바 */
.ws-head {
    position: sticky; top: 0; z-index: 2;
    display: flex; align-items: center; justify-content: space-between;
    height: 32px; padding: 0 6px 0 12px;
    background: var(--ws-head-bg);
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.ws-head-title { font-size: 11px; font-weight: 600; letter-spacing: .06em; color: var(--ws-head); }
.ws-head-actions { display: flex; align-items: center; gap: 1px; }
.ws-tb, .ws-row-act {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; padding: 0; border: 0; border-radius: 5px;
    background: transparent; color: var(--ws-muted); cursor: pointer;
}
.ws-tb:hover, .ws-row-act:hover { background: var(--ws-hover); color: var(--ws-fg); }
.ws-tb:focus-visible, .ws-row-act:focus-visible { outline: 1px solid var(--ws-sel-border); }

/* 프로젝트(루트 폴더) 줄 */
.ws-project {
    display: flex; align-items: baseline; gap: 8px;
    padding: 2px 12px 4px;
    font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
    color: var(--ws-fg);
}
.ws-project-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ws-project-meta { flex: none; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--ws-muted); }

/* 트리 */
.ws-tree { outline: none; padding-bottom: 6px; min-height: 40px; }
.ws-tree.is-drop-root { background: var(--ws-drop); }
.ws-group { position: relative; }
.ws-group::before {        /* 들여쓰기 안내선 — VSCode 처럼 부모 폴더 아이콘 아래로 */
    content: ''; position: absolute; top: 0; bottom: 0;
    left: calc(var(--ws-depth, 0) * 12px + 15px);
    border-left: 1px solid var(--ws-guide);
    pointer-events: none;
}
.ws-tree:not(:hover):not(:focus-within) .ws-group::before { border-left-color: transparent; }

.ws-row {
    position: relative;
    display: flex; align-items: center; gap: 4px;
    height: 22px; padding-right: 6px;
    cursor: pointer; white-space: nowrap;
    border: 1px solid transparent;
}
.ws-row:hover { background: var(--ws-hover); }
.ws-row.is-selected { background: var(--ws-sel); }
.ws-tree:focus .ws-row.is-selected { border-color: var(--ws-sel-border); }
.ws-row.is-drop { background: var(--ws-drop); border-color: var(--ws-sel-border); }
.ws-row-empty { color: var(--ws-muted); font-style: italic; font-size: 12px; cursor: default; }
.ws-row-empty:hover { background: transparent; }

.ws-twisty { flex: none; width: 16px; height: 16px; display: inline-flex; color: var(--ws-muted); transition: transform .1s; }
.ws-twisty.is-open { transform: rotate(90deg); }
.ws-icon { flex: none; width: 16px; height: 16px; display: inline-flex; }
.ws-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ws-row.is-main .ws-name { font-weight: 600; }
.ws-hint { flex: none; margin-left: 4px; font-size: 11px; color: var(--ws-muted); }
.ws-badge {
    flex: none; margin-left: 4px; padding: 0 5px; height: 15px; line-height: 15px;
    border-radius: 4px; font-size: 10px; font-weight: 600;
    color: #4f46e5; background: rgba(99, 102, 241, 0.12);
}
html.dark .ws-badge { color: #c7d2fe; background: rgba(99, 102, 241, 0.25); }

.ws-row-acts { margin-left: auto; padding-left: 6px; display: none; align-items: center; gap: 1px; }
.ws-row:hover .ws-row-acts, .ws-row.is-selected .ws-row-acts { display: inline-flex; }
@media (hover: none) {        /* 터치 기기 — 마우스 올리기가 없으니 '⋯' 는 늘 보이게 */
    .ws-row .ws-row-acts { display: inline-flex; }
    .ws-row .ws-row-act:not([data-act="menu"]) { display: none; }
}

/* 아이콘 색 — VSCode 기본 아이콘 테마 계열 */
.ws-ic-folder { color: #dcb67a; }
.ws-ic-folder-ref { color: #7c9cf5; }
.ws-ic-folder-notes { color: #4ab37a; }
.ws-ic-md { color: #519aba; }
.ws-ic-html { color: #e44d26; }
.ws-ic-xml { color: #f97316; }
.ws-ic-pdf { color: #ef4444; }
.ws-ic-image { color: #a074c4; }
.ws-ic-audio { color: #e05297; }
.ws-ic-video { color: #e7a33e; }
.ws-ic-json { color: #cbcb41; }
.ws-ic-csv { color: #3fae6b; }
.ws-ic-txt, .ws-ic-file, .ws-ic-archive { color: #8b95a7; }
.ws-ic-link { color: #38bdf8; }
html:not(.dark) .ws-ic-json { color: #a3a31a; }
html:not(.dark) .ws-ic-folder { color: #c99a4b; }

/* 인라인 이름 입력 (새 파일 / 새 폴더) */
.ws-inline { cursor: default; height: auto; min-height: 24px; flex-wrap: wrap; }
.ws-inline:hover { background: transparent; }
.ws-inline input {
    flex: 1 1 120px; min-width: 0; height: 20px; padding: 0 4px;
    font: inherit; color: var(--ws-fg);
    background: #fff; border: 1px solid #6366f1; border-radius: 2px; outline: none;
}
html.dark .ws-inline input { background: #0b1020; }
.ws-inline-err {
    flex-basis: 100%; margin: 2px 0 4px 20px; padding: 3px 6px;
    font-size: 11.5px; white-space: normal; line-height: 1.4;
    color: #b91c1c; background: #fef2f2; border: 1px solid #fca5a5; border-radius: 3px;
}
html.dark .ws-inline-err { color: #fecaca; background: rgba(127, 29, 29, 0.5); border-color: rgba(248, 113, 113, 0.5); }

/* LINKS 섹션 */
.ws-links { border-top: 1px solid var(--ws-guide); margin-top: 4px; }
.ws-sec-head {
    display: flex; align-items: center; gap: 2px; width: 100%; height: 26px; padding: 0 6px;
    border: 0; background: transparent; cursor: pointer;
    font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--ws-fg); text-align: left;
}
.ws-sec-head:hover { background: var(--ws-hover); }
.ws-sec-count { font-weight: 400; color: var(--ws-muted); margin-left: 4px; }
.ws-links.is-collapsed .ws-links-body { display: none; }
.ws-link { text-decoration: none; color: inherit; }

.ws-empty { padding: 10px 14px; font-size: 12px; color: var(--ws-muted); }
.ws-empty-sm { padding: 4px 26px 8px; }
.ws-error { color: #dc2626; white-space: normal; }
html.dark .ws-error { color: #f87171; }
.ws-status { padding: 4px 12px 8px; font-size: 11px; color: var(--ws-muted); min-height: 0; }
.ws-status:empty { display: none; }

/* 우클릭 메뉴 — body 에 붙는다 */
.ws-menu {
    position: fixed; z-index: 10050; min-width: 190px; padding: 4px;
    background: #ffffff; color: #27272a;
    border: 1px solid #e4e4e7; border-radius: 8px;
    box-shadow: 0 10px 28px -6px rgba(15, 23, 42, 0.28);
    font-size: 13px;
}
html.dark .ws-menu { background: #1b1f2e; color: #e2e8f0; border-color: rgba(255, 255, 255, 0.1); }
.ws-menu-item {
    display: block; width: 100%; padding: 5px 12px; text-align: left;
    border: 0; border-radius: 5px; background: transparent; color: inherit; cursor: pointer; font: inherit;
}
.ws-menu-item:hover, .ws-menu-item:focus { background: #6366f1; color: #fff; outline: none; }
.ws-menu-item.is-danger { color: #dc2626; }
.ws-menu-item.is-danger:hover, .ws-menu-item.is-danger:focus { background: #dc2626; color: #fff; }
html.dark .ws-menu-item.is-danger { color: #f87171; }
.ws-menu-sep { height: 1px; margin: 4px 6px; background: rgba(148, 163, 184, 0.3); }
