/* ===== Shared workspace styles ===== */
/* Используются в LK code console и admin dev-task workspace. */

/* ----- Дерево рабочей области ----- */
.ws-node {
    display: flex;
    align-items: center;
    gap: 0;
    width: 100%;
    padding: 0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--app-account-text-body);
    user-select: none;
}
.ws-node[draggable='true'] { cursor: grab; }
.ws-node[draggable='true']:active { cursor: grabbing; }

/* Подсветка целевой папки при drag&drop */
.ws-node.ws-drop-target {
    background: var(--app-console-workspace-drop-surface);
    box-shadow: inset 0 0 0 1px var(--app-console-workspace-drop-border);
}
/* Подсветка корневой области при дропе на пустое место */
.ws-tree-area.ws-drop-root > div > template + * { outline: none; }
.ws-tree-area.ws-drop-root {
    box-shadow: inset 0 0 0 1px var(--app-console-workspace-drop-border);
    border-radius: 8px;
}

.ws-node-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex: 1;
    min-width: 0;
    min-height: 2rem;
    padding: 0.22rem 0.3rem;
    border-radius: 6px;
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    text-align: left;
    transition: background 0.08s;
}
.ws-node-btn:hover { background: var(--app-console-workspace-hover); }
.ws-node-btn:focus-visible {
    outline: 2px solid var(--app-console-workspace-focus-ring);
    outline-offset: -2px;
}
.ws-node-btn.active { background: var(--app-console-workspace-selection-surface); color: var(--app-console-workspace-selection-text); }
.ws-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ws-dir > .ws-node-btn { color: var(--app-console-text-body); font-weight: 500; }
.ws-dir > .ws-node-btn:hover { background: var(--app-console-workspace-folder-hover); }

/* Chevron: плавный поворот при раскрытии папки */
.ws-chevron {
    flex-shrink: 0;
    width: 11px;
    height: 11px;
    color: var(--app-account-text-separator);
    transition: transform 0.15s ease;
}
.ws-chevron.open { transform: rotate(90deg); }

/* Иконка узла: SVG inline, размер 14×14 */
.ws-fi { flex-shrink: 0; width: 14px; height: 14px; }

/* Иконки файлов по типу */
.ws-fi-dir    { color: var(--app-console-file-dir); }
.ws-fi-bsl    { color: var(--app-console-file-bsl); }
.ws-fi-canvas { color: var(--app-console-file-canvas); }
.ws-fi-md     { color: var(--app-console-file-md); }
.ws-fi-json   { color: var(--app-console-file-json); }
.ws-fi-xml,
.ws-fi-html   { color: var(--app-console-file-xml); }
.ws-fi-yml    { color: var(--app-console-file-yml); }
.ws-fi-css    { color: var(--app-console-file-css); }
.ws-fi-js     { color: var(--app-console-file-js); }
.ws-fi-ts     { color: var(--app-console-file-ts); }
.ws-fi-py     { color: var(--app-console-file-py); }
.ws-fi-sql    { color: var(--app-console-file-sql); }
.ws-fi-txt    { color: var(--app-console-file-txt); }
.ws-fi-log    { color: var(--app-console-file-log); }
.ws-fi-csv    { color: var(--app-console-file-csv); }
.ws-fi-cfg    { color: var(--app-console-file-cfg); }
.ws-fi-shell  { color: var(--app-console-file-shell); }
.ws-fi-docker { color: var(--app-console-file-docker); }
.ws-fi-git    { color: var(--app-console-file-git); }
.ws-fi-img    { color: var(--app-console-file-img); }
.ws-fi-pdf    { color: var(--app-console-file-pdf); }
.ws-fi-zip    { color: var(--app-console-file-zip); }
.ws-fi-epf    { color: var(--app-console-file-epf); }
.ws-fi-erf    { color: var(--app-console-file-erf); }
.ws-fi-default,
.ws-fi-file   { color: var(--app-console-file-default); }

/* ===== Мобильная адаптация (< lg): крупнее строки дерева под палец ===== */
@media (max-width: 1023px) {
    .ws-node { font-size: 0.9rem; }
    .ws-node-btn { min-height: 2.75rem; padding: 0.5rem 0.4rem; }
    .ws-chevron { width: 14px; height: 14px; }
    .ws-fi { width: 18px; height: 18px; }
}

/* Маркер изменённого файла (admin: workspace-tree.is_modified). */
.ws-node-modified .ws-name::after {
    content: '●';
    margin-left: 0.35rem;
    color: var(--app-account-warning);
    font-size: 0.6rem;
    line-height: 1;
}

/* ----- Тулбар-кнопки header'а редактора/дерева ----- */
.tb-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    color: var(--app-account-text-secondary);
    transition: background 0.1s, color 0.1s;
    cursor: pointer;
    background: transparent;
    border: none;
}
.tb-icon:hover { background: var(--app-console-toolbar-hover); color: var(--app-console-text-body); }
.tb-icon:disabled { opacity: 0.35; cursor: not-allowed; }
.tb-icon svg { width: 14px; height: 14px; }

.tb-action {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: none;
    background: transparent;
    color: var(--app-account-text-body);
    padding: 0.2rem 0.35rem;
    border-radius: 0.4rem;
    font-size: 0.72rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.1s, color 0.1s;
}
.tb-action:hover { background: var(--app-console-toolbar-hover); color: var(--app-account-text-interface); }
.tb-action:disabled { opacity: 0.45; cursor: not-allowed; }
.tb-action svg { width: 14px; height: 14px; }

/* Компактный тёмный select для переключения базы diff (vs HEAD/HEAD~1/source). */
.ws-diff-select {
    appearance: none;
    -webkit-appearance: none;
    background-color: var(--app-console-surface-subtle);
    background-image: var(--app-console-diff-select-chevron-image);
    background-repeat: no-repeat;
    background-position: right 0.4rem center;
    border: 1px solid var(--app-console-border-default);
    border-radius: 0.375rem;
    color: var(--app-console-text-body);
    font-size: 11px;
    line-height: 1;
    padding: 0.25rem 1.4rem 0.25rem 0.55rem;
    cursor: pointer;
    transition: background-color 0.1s, border-color 0.1s;
}
.ws-diff-select:hover { background-color: var(--app-console-surface-skeleton); border-color: var(--app-console-border-hover); }
.ws-diff-select:focus { outline: none; border-color: var(--app-console-accent-border-hover); }
.ws-diff-select option { background: var(--app-console-surface-raised); color: var(--app-console-text-body); }

/* Стрелка выпадающего меню: вниз → вверх при раскрытии */
.ext-dd-chevron {
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    color: var(--app-account-text-meta);
    transition: transform 0.15s ease;
}
.ext-dd-chevron.open { transform: rotate(180deg); }
.tb-action .ext-dd-chevron { width: 10px; height: 10px; }

/* workspace-node alias для истории файла (LK) */
.workspace-node-active { background: var(--app-console-workspace-drop-surface); color: var(--app-console-workspace-selection-text); }
.workspace-node:hover { background: var(--app-console-workspace-folder-hover); }
