/* chat-ide.css — IDE Workbench (Phase 1). Только классы (CSP-safe). */
.ide-workbench { position: fixed; inset: 0; z-index: 10001; background: #0d0d14; display: none; flex-direction: column; }
.ide-workbench.ide-open { display: flex; }
.ide-head { display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: #15151f; border-bottom: 1px solid rgba(255,255,255,0.08); flex-shrink: 0; }
.ide-title { color: #fff; font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.ide-active { color: #9aa3b2; font-size: 12px; font-family: var(--font-code, monospace); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ide-head-actions { display: flex; gap: 8px; flex-shrink: 0; }
.ide-btn { background: #23232f; color: #cbd5e1; border: 1px solid rgba(255,255,255,0.1); border-radius: 6px; padding: 5px 11px; cursor: pointer; font-size: 12px; display: inline-flex; align-items: center; gap: 5px; }
.ide-ic { display: inline-block; vertical-align: middle; flex-shrink: 0; }
.ide-btn:hover { background: #2e2e40; }
.ide-btn:disabled { opacity: 0.45; cursor: default; }
.ide-btn.ide-close { background: #ef4444; color: #fff; border: none; font-weight: 600; }
.ide-body { flex: 1; display: grid; min-height: 0; }
.ide-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: #0d0d14; }
.ide-pane-head { padding: 6px 10px; font-size: 11px; color: #888; background: #12121a; border-bottom: 1px solid rgba(255,255,255,0.06); text-transform: uppercase; letter-spacing: 0.04em; flex-shrink: 0; }
/* тулбар дерева (Phase 5) */
.ide-tree-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.ide-tree-actions { display: flex; gap: 2px; }
.ide-tree-act { background: none; border: none; color: #9aa3b2; cursor: pointer; font-size: 12px; padding: 3px 5px; border-radius: 4px; line-height: 1; display: inline-flex; align-items: center; }
.ide-tree-act:hover { background: rgba(255,255,255,0.12); color: #fff; }
/* контекст-меню дерева (Phase 5) */
.ide-ctx-menu { position: fixed; z-index: 40; min-width: 184px; background: #1b1b27; border: 1px solid rgba(255,255,255,0.14); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); padding: 4px; }
.ide-ctx-item { display: flex; align-items: center; gap: 9px; padding: 7px 12px; font-size: 13px; color: #cbd5e1; cursor: pointer; border-radius: 6px; white-space: nowrap; }
.ide-ctx-ico { display: inline-flex; color: #9aa3b2; flex-shrink: 0; }
.ide-ctx-item:hover { background: rgba(124,137,246,0.2); color: #fff; }
.ide-ctx-item:hover .ide-ctx-ico { color: #fff; }
.ide-ctx-item.ide-ctx-danger { color: #f87171; }
.ide-ctx-item.ide-ctx-danger .ide-ctx-ico { color: #f87171; }
.ide-ctx-item.ide-ctx-danger:hover { background: rgba(239,68,68,0.22); color: #fff; }
.ide-ctx-item.ide-ctx-danger:hover .ide-ctx-ico { color: #fff; }
.ide-tree { overflow: auto; flex: 1; padding: 4px 0; font-size: 13px; }
.ide-tree-row { display: flex; align-items: center; gap: 6px; padding: 3px 10px; cursor: pointer; color: #cbd5e1; white-space: nowrap; }
.ide-tree-row:hover { background: rgba(124,137,246,0.12); }
.ide-tree-row.ide-active-file { background: rgba(124,137,246,0.2); color: #fff; }
.ide-tree-ico { flex-shrink: 0; display: inline-flex; color: #8b94a6; }
.ide-tree-row.ide-active-file .ide-tree-ico, .ide-tree-row:hover .ide-tree-ico { color: #c7cedd; }
.ide-tree-name { overflow: hidden; text-overflow: ellipsis; }
.ide-tree-kids { padding-left: 14px; }
.ide-tree-empty { padding: 10px; color: #666; font-size: 12px; }
/* «показать ещё» при батчевом рендере большого каталога */
.ide-tree-more { padding: 4px 10px; margin: 2px 0; color: #8b94a6; font-size: 11px; cursor: pointer; border-radius: 4px; }
.ide-tree-more:hover { background: rgba(124,137,246,0.12); color: #c7cedd; }
.ide-tree-trunc, .ide-tree-trunc:hover { cursor: default; color: #6b7280; background: none; }
.ide-tree-row.ide-dirty .ide-tree-name::after { content: ' ●'; color: #fbbf24; }
/* Phase 2: drag-and-drop в дереве */
.ide-tree-row[draggable="true"] { cursor: grab; }
.ide-tree-row.ide-dragging { opacity: 0.4; }
.ide-tree-row.ide-tree-dir.ide-drop-target { background: rgba(110,168,254,0.20); outline: 1px dashed rgba(110,168,254,0.7); outline-offset: -1px; border-radius: 4px; }
.ide-tree.ide-drop-root { box-shadow: inset 0 0 0 2px rgba(110,168,254,0.35); border-radius: 6px; }
.ide-splitter { background: rgba(255,255,255,0.06); cursor: col-resize; }
.ide-splitter:hover { background: rgba(124,137,246,0.4); }
body.ide-resizing { cursor: col-resize; user-select: none; }
.ide-editor-pane { background: #0a0a12; }
/* табы (Phase 3) */
.ide-tabs { display: flex; align-items: stretch; background: #12121a; border-bottom: 1px solid rgba(255,255,255,0.06); overflow-x: auto; overflow-y: hidden; flex-shrink: 0; min-height: 32px; scrollbar-width: thin; }
.ide-tabs-empty { padding: 8px 12px; font-size: 11px; color: #666; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.ide-tab { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 12px; font-size: 12px; color: #9aa3b2; cursor: pointer; border-right: 1px solid rgba(255,255,255,0.06); white-space: nowrap; max-width: 220px; flex-shrink: 0; }
.ide-tab:hover { background: rgba(255,255,255,0.04); color: #cbd5e1; }
.ide-tab.ide-tab-active { background: #0a0a12; color: #fff; box-shadow: inset 0 -2px 0 #06b6d4; }
.ide-tab-ico { flex-shrink: 0; display: inline-flex; color: #8b94a6; }
.ide-tab.ide-tab-active .ide-tab-ico { color: #c7cedd; }
.ide-tab-name { overflow: hidden; text-overflow: ellipsis; }
.ide-tab-close { flex-shrink: 0; background: none; border: none; color: #8a93a2; cursor: pointer; line-height: 1; padding: 3px 4px; border-radius: 4px; display: inline-flex; align-items: center; }
.ide-tab-close:hover { background: rgba(255,255,255,0.14); color: #fff; }
.ide-tab-dot { color: #fbbf24; font-size: 12px; line-height: 1; }
.ide-tab.ide-tab-armed .ide-tab-close { background: #ef4444; color: #fff; }
.ide-editor-wrap { flex: 1; display: flex; min-height: 0; overflow: hidden; }
/* ── Ace editor mount (заменил textarea+pre). Чистый тёмный фон БЕЗ серого:
   тема one_dark по умолчанию #282c34 (серый) — форсим фон редактора/гаттера в
   тёмный проекта (#0a0a12 / #0d0d16), цвета синтаксиса от темы оставляем. ── */
.ide-ace { flex: 1 1 auto; min-width: 0; height: 100%; position: relative; }
.ide-ace.ace_editor { background: #0a0a12 !important; color: #e6e8ef; }
.ide-ace .ace_scroller { background: #0a0a12 !important; }
.ide-ace .ace_gutter { background: #0d0d16 !important; color: #4a5060 !important; }
.ide-ace .ace_gutter-active-line { background: rgba(255,255,255,0.05) !important; color: #aeb6c6 !important; }
.ide-ace .ace_active-line { background: rgba(255,255,255,0.028) !important; }
.ide-ace .ace_cursor { color: #6ea8fe !important; }
.ide-ace .ace_marker-layer .ace_selection { background: rgba(124,137,246,0.30) !important; }
.ide-ace .ace_indent-guide { opacity: 0.25; }
/* тонкие тёмные скроллбары Ace (вместо жирных нативных «без css») */
.ide-ace .ace_scrollbar::-webkit-scrollbar { width: 11px; height: 11px; }
.ide-ace .ace_scrollbar::-webkit-scrollbar-track { background: #0a0a12; }
.ide-ace .ace_scrollbar::-webkit-scrollbar-thumb { background: #2b2b3a; border-radius: 6px; border: 2px solid #0a0a12; }
.ide-ace .ace_scrollbar::-webkit-scrollbar-thumb:hover { background: #3a3a4e; }
.ide-ace .ace_scrollbar-corner { background: #0a0a12; }
/* индикатор ошибок (линтер) в шапке IDE */
.ide-diag { display: inline-flex; align-items: center; gap: 9px; margin-left: 10px; font-size: 11.5px; cursor: pointer; padding: 2px 9px; border-radius: 6px; background: rgba(255,255,255,0.05); white-space: nowrap; }
.ide-diag.is-hidden { display: none; }
.ide-diag:hover { background: rgba(255,255,255,0.1); }
.ide-diag-e { color: #f87171; font-weight: 600; }
.ide-diag-w { color: #fbbf24; font-weight: 600; }
.ide-gutter { width: 48px; flex-shrink: 0; padding: 10px 6px; text-align: right; color: #5a6072; font-family: ui-monospace, 'SFMono-Regular', 'Cascadia Code', 'JetBrains Mono', Consolas, Menlo, monospace; font-size: 13px; line-height: 1.55; background: #0d0d16; overflow: hidden; white-space: pre; user-select: none; }
/* Подсветка синтаксиса: прозрачный textarea поверх <pre><code> с Prism (как editor.js). */
.ide-edit-stack { position: relative; flex: 1; min-width: 0; overflow: hidden; background: #0a0a12; }
/* ВАЖНО: textarea и слой подсветки ДОЛЖНЫ иметь идентичные метрики шрифта,
   иначе каретка и видимый текст разъезжаются. Явный monospace-стек (не полагаемся
   на --font-code, который может оказаться не-моно/вебшрифтом), letter-spacing 0,
   одинаковый tab-size/line-height/padding, и нейтрализация Prism-tomorrow на <code>. */
.ide-hl, .ide-editor { font-family: ui-monospace, 'SFMono-Regular', 'Cascadia Code', 'JetBrains Mono', Consolas, 'Liberation Mono', Menlo, monospace; font-size: 13px; line-height: 1.55; letter-spacing: 0; tab-size: 4; -moz-tab-size: 4; font-variant-ligatures: none; font-feature-settings: normal; box-sizing: border-box; }
/* Слой подсветки НЕ скроллится сам (overflow:hidden) — его scrollTop/Left
   синхронизирует JS с textarea. Иначе второй скроллбар + каретка разъезжается. */
.ide-hl { position: absolute; inset: 0; margin: 0; padding: 10px 12px; color: #eaecf2; pointer-events: none; overflow: hidden; white-space: pre; background: transparent; z-index: 1; }
.ide-hl code, .ide-hl code[class*="language-"] { background: none !important; padding: 0 !important; margin: 0 !important; font-family: inherit !important; font-size: inherit !important; line-height: inherit !important; letter-spacing: 0 !important; tab-size: inherit !important; word-spacing: normal !important; text-shadow: none !important; color: inherit !important; white-space: pre !important; }
/* Prism-тема вешает на operator/entity/url полупрозрачный фон → «серый фон за
   буквами» (=, *, /). Гасим фон у ВСЕХ токенов, оставляем только цвет текста. */
.ide-hl .token { background: none !important; background-color: transparent !important; }
.ide-editor { position: absolute; inset: 0; margin: 0; border: none; resize: none; background: transparent; color: transparent; caret-color: #6ea8fe; padding: 10px 12px; outline: none; white-space: pre; overflow: auto; z-index: 2; }
.ide-editor::selection { background: rgba(124,137,246,0.32); }
.ide-editor::-moz-selection { background: rgba(124,137,246,0.32); }
.ide-preview-pane { background: #0d0d14; }
.ide-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ide-live-badge { color: #22c55e; font-size: 9px; font-weight: 700; letter-spacing: 0.06em; display: inline-flex; align-items: center; animation: ide-live-pulse 1.6s ease-in-out infinite; }
.ide-live-badge.is-hidden { display: none; }
@keyframes ide-live-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.ide-preview-mount { flex: 1; overflow: auto; display: flex; }
.ide-preview-frame { width: 100%; height: 100%; border: none; background: #fff; }
.ide-preview-empty { margin: auto; color: #666; font-size: 13px; padding: 20px; text-align: center; }
.ide-btn-ai { color: #c4b5fd; border-color: rgba(167,139,250,0.35); }
.ide-btn-ai:hover { background: rgba(167,139,250,0.16); color: #ddd6fe; }
.ide-btn-run { background: #16a34a; color: #fff; border-color: transparent; }
.ide-btn-run:hover { background: #15803d; }
/* run-консоль Python (Phase 6) — переиспользует .py-runtime-output/.py-log из chat.css */
.ide-run-console { display: flex; flex-direction: column; width: 100%; height: 100%; min-height: 0; }
.ide-run-head { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: #12121a; border-bottom: 1px solid rgba(255,255,255,0.06); font-size: 12px; color: #cbd5e1; flex-shrink: 0; }
.ide-run-title { font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.ide-run-status { margin-left: auto; color: #9aa3b2; font-size: 11px; }
.ide-run-console .py-runtime-plots { flex-shrink: 0; overflow: auto; }
.ide-run-console .py-runtime-output { flex: 1; overflow: auto; padding: 8px 10px; font-family: var(--font-code, monospace); font-size: 12px; line-height: 1.5; }
/* quick-open finder (Phase 4, Ctrl+P) */
.ide-finder { position: absolute; top: 50px; left: 50%; transform: translateX(-50%); width: min(560px, 92%); background: #1b1b27; border: 1px solid rgba(255,255,255,0.14); border-radius: 10px; box-shadow: 0 16px 48px rgba(0,0,0,0.55); z-index: 30; display: none; flex-direction: column; overflow: hidden; }
.ide-finder.ide-finder-open { display: flex; }
.ide-finder-input { background: #11111a; border: none; border-bottom: 1px solid rgba(255,255,255,0.08); color: #fff; padding: 11px 14px; font-size: 14px; outline: none; font-family: var(--font-code, monospace); }
.ide-finder-results { max-height: 320px; overflow-y: auto; padding: 4px 0; }
.ide-finder-row { display: flex; align-items: baseline; gap: 8px; padding: 7px 14px; cursor: pointer; font-size: 13px; color: #cbd5e1; white-space: nowrap; }
.ide-finder-row:hover, .ide-finder-row.ide-finder-active { background: rgba(124,137,246,0.18); }
.ide-finder-ico { flex-shrink: 0; display: inline-flex; align-items: center; color: #8b94a6; }
.ide-finder-name { color: #fff; flex-shrink: 0; }
.ide-finder-path { color: #7a8396; font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.ide-finder-empty { padding: 14px; color: #666; font-size: 12px; }
/* topbar launcher */
#ide-open-btn svg { display: block; }
/* кастомные плашки confirm/prompt (внутри openPrettyPanel .pp-body/.pp-footer) */
.ide-dlg-body { padding: 2px 0; }
.ide-dlg-msg { font-size: 13.5px; line-height: 1.55; color: var(--text, #e6e6e6); white-space: pre-wrap; word-break: break-word; }
.ide-dlg-input { width: 100%; margin-top: 12px; padding: 9px 12px; background: var(--bg-input, #14141d); border: 1px solid var(--border, rgba(255,255,255,0.14)); border-radius: 9px; color: var(--text, #fff); font-size: 13px; outline: none; box-sizing: border-box; font-family: ui-monospace, 'SFMono-Regular', Consolas, Menlo, monospace; }
.ide-dlg-input:focus { border-color: #6ea8fe; }
.ide-dlg-actions { display: flex; gap: 8px; justify-content: flex-end; }
.ide-dlg-actions .ide-btn { padding: 7px 16px; font-size: 13px; }
.ide-dlg-ok { background: #2563eb !important; color: #fff !important; border-color: transparent !important; }
.ide-dlg-ok:hover { background: #1d4ed8 !important; }
.ide-dlg-danger { background: #ef4444 !important; color: #fff !important; border-color: transparent !important; }
.ide-dlg-danger:hover { background: #dc2626 !important; }
@media (max-width: 760px) {
    .ide-body { grid-template-columns: 1fr !important; }
    .ide-tree-pane, .ide-preview-pane, .ide-splitter { display: none; }
}
