/* ===== 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: #cbd5e1;
    user-select: none;
}
.ws-node[draggable='true'] { cursor: grab; }
.ws-node[draggable='true']:active { cursor: grabbing; }

/* Подсветка целевой папки при drag&drop */
.ws-node.ws-drop-target {
    background: rgba(139, 92, 246, 0.18);
    box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.5);
}
/* Подсветка корневой области при дропе на пустое место */
.ws-tree-area.ws-drop-root > div > template + * { outline: none; }
.ws-tree-area.ws-drop-root {
    box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.5);
    border-radius: 8px;
}

.ws-node-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex: 1;
    min-width: 0;
    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: rgba(148, 163, 184, 0.1); }
.ws-node-btn.active { background: rgba(139, 92, 246, 0.22); color: #ddd6fe; }
.ws-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ws-dir > .ws-node-btn { color: #e2e8f0; font-weight: 500; }
.ws-dir > .ws-node-btn:hover { background: rgba(148, 163, 184, 0.08); }

/* Chevron: плавный поворот при раскрытии папки */
.ws-chevron {
    flex-shrink: 0;
    width: 11px;
    height: 11px;
    color: #475569;
    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: #94a3b8; }
.ws-fi-bsl    { color: #fbbf24; }
.ws-fi-canvas { color: #c4b5fd; }
.ws-fi-md     { color: #60a5fa; }
.ws-fi-json   { color: #fbbf24; }
.ws-fi-xml,
.ws-fi-html   { color: #f87171; }
.ws-fi-yml    { color: #a78bfa; }
.ws-fi-css    { color: #38bdf8; }
.ws-fi-js     { color: #fde047; }
.ws-fi-ts     { color: #38bdf8; }
.ws-fi-py     { color: #4ade80; }
.ws-fi-sql    { color: #22d3ee; }
.ws-fi-txt    { color: #cbd5e1; }
.ws-fi-log    { color: #94a3b8; }
.ws-fi-csv    { color: #4ade80; }
.ws-fi-cfg    { color: #fbbf24; }
.ws-fi-shell  { color: #a3e635; }
.ws-fi-docker { color: #38bdf8; }
.ws-fi-git    { color: #f97316; }
.ws-fi-img    { color: #a78bfa; }
.ws-fi-pdf    { color: #f87171; }
.ws-fi-zip    { color: #fbbf24; }
.ws-fi-epf    { color: #fbbf24; }
.ws-fi-erf    { color: #fbbf24; }
.ws-fi-default,
.ws-fi-file   { color: #94a3b8; }

/* Маркер изменённого файла (admin: workspace-tree.is_modified). */
.ws-node-modified .ws-name::after {
    content: '●';
    margin-left: 0.35rem;
    color: #fbbf24;
    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: #94a3b8;
    transition: background 0.1s, color 0.1s;
    cursor: pointer;
    background: transparent;
    border: none;
}
.tb-icon:hover { background: rgba(148, 163, 184, 0.12); color: #e2e8f0; }
.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: #cbd5e1;
    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: rgba(148, 163, 184, 0.12); color: #f1f5f9; }
.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: rgba(255, 255, 255, 0.05);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.4rem center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.375rem;
    color: #e2e8f0;
    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: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.18); }
.ws-diff-select:focus { outline: none; border-color: rgba(34, 211, 238, 0.45); }
.ws-diff-select option { background: #0f172a; color: #e2e8f0; }

/* Стрелка выпадающего меню: вниз → вверх при раскрытии */
.ext-dd-chevron {
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    color: #64748b;
    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: rgba(139, 92, 246, 0.18); color: #ddd6fe; }
.workspace-node:hover { background: rgba(148, 163, 184, 0.08); }
