/* Miorița IDE — interfață cu 3 panouri (fișiere · editor · chat). Temă proprie,
   emerald Miorița, inspirată de un IDE modern dar cu identitate separată. */
:root {
  --ide-bg: #0b1220;
  --ide-panel: #0f1729;
  --ide-panel-2: #131d30;
  --ide-elev: #182235;
  --ide-ink: #e5e9f0;
  --ide-ink-soft: #aeb9c9;
  --ide-ink-faint: #6b7688;
  --ide-line: #26324a;
  --ide-emerald: #10b981;
  --ide-emerald-deep: #34d399;
  --ide-accent-soft: #10321f;
  --ide-amber: #f59e0b;
  --ide-red: #ef4444;
  --ide-font: 'Inter', system-ui, sans-serif;
  --ide-display: 'Plus Jakarta Sans', var(--ide-font);
  --ide-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
}
[data-theme="light"] {
  --ide-bg: #eef1f5;
  --ide-panel: #ffffff;
  --ide-panel-2: #f6f8fa;
  --ide-elev: #eef2f6;
  --ide-ink: #111827;
  --ide-ink-soft: #4b5563;
  --ide-ink-faint: #9ca3af;
  --ide-line: #e5e7eb;
  --ide-accent-soft: #ecfdf5;
  --ide-emerald-deep: #059669;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* atributul hidden bate display-ul din clase */
html, body { height: 100%; margin: 0; }
.ide-body {
  display: flex; flex-direction: column;
  height: 100vh; overflow: hidden;
  font-family: var(--ide-font);
  background: var(--ide-bg); color: var(--ide-ink);
  font-size: 14px;
}

/* ---------- Bara de sus ---------- */
.ide-top {
  display: flex; align-items: center; gap: 14px;
  height: 52px; flex-shrink: 0;
  padding: 0 14px;
  background: var(--ide-panel); border-bottom: 1px solid var(--ide-line);
}
.ide-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ide-ink); }
.ide-brand-ic { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; background: var(--ide-accent-soft); color: var(--ide-emerald-deep); }
.ide-brand-ic svg { width: 19px; height: 19px; }
.ide-brand-txt { font: 700 16px/1 var(--ide-display); letter-spacing: -.01em; }
.ide-brand-txt b { color: var(--ide-emerald); font-weight: 800; }
.ide-session { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 8px; background: var(--ide-panel-2); color: var(--ide-ink-soft); font-size: 13px; border: 1px solid var(--ide-line); }
.ide-session .ide-folder-ic { color: var(--ide-amber); display: inline-flex; }
.ide-top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.ide-chip-model { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ide-ink-soft); padding: 5px 10px; border-radius: 999px; background: var(--ide-panel-2); border: 1px solid var(--ide-line); }
.ide-vision { color: var(--ide-ink-faint); }
.ide-container { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ide-ink-faint); }
.ide-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ide-ink-faint); }
.ide-dot.ok { background: var(--ide-emerald); box-shadow: 0 0 8px var(--ide-emerald); }
.ide-dot.idle { background: var(--ide-ink-faint); }
.ide-dot.run { background: var(--ide-amber); box-shadow: 0 0 8px var(--ide-amber); animation: ide-pulse 1.4s ease-in-out infinite; }
@keyframes ide-pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
.ide-icon-btn { background: transparent; border: 0; color: var(--ide-ink-faint); cursor: pointer; padding: 7px; border-radius: 8px; display: grid; place-items: center; }
.ide-icon-btn:hover { color: var(--ide-emerald); background: var(--ide-panel-2); }
.ide-theme .th-sun { display: none; } .th-sun { display: none; } .th-moon { display: block; }
[data-theme="dark"] .th-sun { display: block; } [data-theme="dark"] .th-moon { display: none; }
.ide-back { font-size: 13px; font-weight: 600; color: var(--ide-ink-soft); text-decoration: none; padding: 7px 13px; border-radius: 8px; border: 1px solid var(--ide-line); }
.ide-back:hover { color: var(--ide-emerald-deep); border-color: var(--ide-emerald); }
.ide-save-toggle { display: inline-flex; align-items: center; gap: 7px; font: 600 12.5px/1 var(--ide-font); color: var(--ide-ink-faint); background: var(--ide-panel-2); border: 1px solid var(--ide-line); padding: 7px 12px; border-radius: 8px; cursor: pointer; }
.ide-save-toggle:hover { color: var(--ide-ink-soft); }
.ide-save-toggle[aria-pressed="true"] { color: var(--ide-emerald-deep); border-color: var(--ide-emerald); background: var(--ide-accent-soft); }
.ide-save-toggle[aria-pressed="true"] svg { color: var(--ide-emerald); }

/* ---------- Grid ---------- */
.ide-grid {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: var(--files-w, 260px) 5px 1fr 5px var(--chat-w, 380px);
}
.ide-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--ide-panel); overflow: hidden; }
.ide-files { border-right: 1px solid var(--ide-line); }
.ide-chat { border-left: 1px solid var(--ide-line); }
.ide-editor { background: var(--ide-bg); }
.ide-resizer { background: var(--ide-line); cursor: col-resize; transition: background .15s; }
.ide-resizer:hover { background: var(--ide-emerald); }
.ide-pane-head { display: flex; align-items: center; justify-content: space-between; height: 38px; flex-shrink: 0; padding: 0 12px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ide-ink-faint); border-bottom: 1px solid var(--ide-line); }
.ide-pane-actions { display: flex; gap: 2px; }
.ide-mini { background: transparent; border: 0; color: var(--ide-ink-faint); cursor: pointer; padding: 4px; border-radius: 6px; display: grid; place-items: center; }
.ide-mini:hover:not(:disabled) { color: var(--ide-emerald); background: var(--ide-panel-2); }
.ide-mini:disabled { opacity: .4; cursor: default; }
.ide-chat-status { text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--ide-emerald-deep); }

/* ---------- Dropzone ---------- */
.ide-dropzone { margin: 12px; padding: 20px 14px; border: 1.5px dashed var(--ide-line); border-radius: 12px; text-align: center; color: var(--ide-ink-faint); cursor: pointer; transition: border-color .15s, background .15s, color .15s; }
.ide-dropzone:hover, .ide-dropzone.drag { border-color: var(--ide-emerald); background: var(--ide-accent-soft); color: var(--ide-emerald-deep); }
.ide-dropzone svg { opacity: .8; }
.ide-drop-title { margin: 8px 0 2px; font-weight: 700; font-size: 13.5px; color: var(--ide-ink-soft); }
.ide-drop-sub { margin: 0; font-size: 11.5px; }
.ide-dropzone.compact { padding: 10px; margin: 10px 12px; }
.ide-dropzone.compact svg, .ide-dropzone.compact .ide-drop-sub { display: none; }
.ide-dropzone.compact .ide-drop-title { margin: 0; }

/* ---------- Arbore de fișiere ---------- */
.ide-tree { flex: 1; overflow: auto; padding: 4px 6px 16px; }
.ide-node { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 7px; cursor: pointer; font-size: 13px; color: var(--ide-ink-soft); white-space: nowrap; user-select: none; }
.ide-node:hover { background: var(--ide-panel-2); }
.ide-node.active { background: var(--ide-accent-soft); color: var(--ide-emerald-deep); }
.ide-node .ide-caret { width: 14px; display: inline-flex; color: var(--ide-ink-faint); transition: transform .12s; }
.ide-node.open .ide-caret { transform: rotate(90deg); }
.ide-node .ide-fic { width: 15px; height: 15px; flex-shrink: 0; }
.ide-node .ide-fic.folder { color: var(--ide-amber); }
.ide-node .ide-name { overflow: hidden; text-overflow: ellipsis; }
.ide-node .ide-flag { margin-left: auto; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px; }
.ide-flag.add { background: rgba(16,185,129,.16); color: var(--ide-emerald-deep); }
.ide-flag.mod { background: rgba(245,158,11,.16); color: var(--ide-amber); }
.ide-flag.del { background: rgba(239,68,68,.16); color: var(--ide-red); }
.ide-children { padding-left: 14px; }

/* ---------- Editor ---------- */
.ide-tabs { display: flex; height: 38px; flex-shrink: 0; background: var(--ide-panel); border-bottom: 1px solid var(--ide-line); overflow-x: auto; }
.ide-tab { display: inline-flex; align-items: center; gap: 8px; padding: 0 14px; font-size: 13px; color: var(--ide-ink-faint); border-right: 1px solid var(--ide-line); cursor: pointer; white-space: nowrap; background: transparent; border-top: 0; border-bottom: 0; border-left: 0; }
.ide-tab.active { color: var(--ide-ink); background: var(--ide-bg); box-shadow: inset 0 -2px 0 var(--ide-emerald); }
.ide-tab .ide-tab-x { color: var(--ide-ink-faint); border-radius: 5px; padding: 1px; display: inline-flex; }
.ide-tab .ide-tab-x:hover { background: var(--ide-elev); color: var(--ide-ink); }
.ide-edit-body { flex: 1; min-height: 0; position: relative; overflow: hidden; }
.ide-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; color: var(--ide-ink-faint); padding: 30px; }
.ide-empty svg { opacity: .5; margin-bottom: 8px; }
.ide-empty h2 { font: 700 18px/1.2 var(--ide-display); color: var(--ide-ink-soft); margin: 0; }
.ide-empty p { margin: 0; max-width: 42ch; line-height: 1.6; font-size: 13.5px; }
.ide-code-wrap { position: absolute; inset: 0; overflow: auto; }
.ide-pre { margin: 0; padding: 14px 16px 60px; min-height: 100%; }
.ide-pre code { font-family: var(--ide-mono); font-size: 13px; line-height: 1.6; background: transparent !important; counter-reset: ln; }
.ide-live { position: sticky; top: 10px; margin: 0 0 10px 10px; display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; background: rgba(16,185,129,.14); color: var(--ide-emerald-deep); font-size: 12px; font-weight: 600; width: fit-content; z-index: 2; }
.ide-live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ide-emerald); animation: ide-pulse 1s ease-in-out infinite; }

/* ---------- Chat ---------- */
.ide-messages { flex: 1; min-height: 0; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.ide-msg { display: flex; gap: 10px; }
.ide-msg .ide-who { flex-shrink: 0; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; }
.ide-msg.user .ide-who { background: var(--ide-ink); color: var(--ide-bg); }
.ide-msg.bot .ide-who { background: var(--ide-emerald); }
.ide-bubble { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.6; color: var(--ide-ink); }
.ide-bubble .ide-name { font-size: 11.5px; font-weight: 700; color: var(--ide-ink-faint); margin-bottom: 3px; }
.ide-msg.user .ide-bubble > .ide-text { background: var(--ide-panel-2); border-radius: 12px; padding: 9px 13px; }

/* Blocuri de „gândire" + tool calls */
.ide-think { border: 1px dashed var(--ide-line); border-radius: 10px; background: var(--ide-panel-2); color: var(--ide-ink-soft); font-size: 12.5px; margin: 2px 0; overflow: hidden; }
.ide-think summary { cursor: pointer; padding: 7px 11px; font-weight: 600; color: var(--ide-ink-faint); list-style: none; display: flex; align-items: center; gap: 7px; }
.ide-think summary::-webkit-details-marker { display: none; }
.ide-think summary::before { content: "✦"; color: #818cf8; }
.ide-think .ide-think-body { padding: 0 12px 10px 30px; line-height: 1.6; white-space: pre-wrap; }
.ide-tool { display: flex; align-items: center; gap: 9px; padding: 8px 11px; margin: 6px 0; border-radius: 10px; background: var(--ide-panel-2); border: 1px solid var(--ide-line); font-size: 13px; }
.ide-tool .ide-tool-ic { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; flex-shrink: 0; }
.ide-tool.add .ide-tool-ic { background: rgba(16,185,129,.16); color: var(--ide-emerald-deep); }
.ide-tool.mod .ide-tool-ic { background: rgba(245,158,11,.16); color: var(--ide-amber); }
.ide-tool.del .ide-tool-ic { background: rgba(239,68,68,.16); color: var(--ide-red); }
.ide-tool.run .ide-tool-ic { background: var(--ide-elev); color: var(--ide-ink-soft); }
.ide-tool .ide-tool-path { font-family: var(--ide-mono); font-size: 12px; color: var(--ide-ink); }
.ide-tool .ide-tool-label { color: var(--ide-ink-faint); font-size: 11.5px; }
.ide-tool .ide-tool-spin { margin-left: auto; width: 13px; height: 13px; border: 2px solid var(--ide-line); border-top-color: var(--ide-emerald); border-radius: 50%; animation: ide-spin .7s linear infinite; }
.ide-tool .ide-tool-check { margin-left: auto; color: var(--ide-emerald); }
@keyframes ide-spin { to { transform: rotate(360deg); } }

/* ---------- Grup de tool-calls (stil IDE: „Running N tools") ---------- */
.ide-toolgroup { margin: 8px 0; border: 1px solid var(--ide-line); border-radius: 12px; background: var(--ide-panel-2); overflow: hidden; }
.ide-tg-head { width: 100%; display: flex; align-items: center; gap: 9px; padding: 9px 12px; background: transparent; border: 0; cursor: pointer; color: var(--ide-ink-soft); font: 600 13px/1 var(--ide-font); text-align: left; }
.ide-tg-head .ide-tg-caret { display: inline-flex; color: var(--ide-ink-faint); transition: transform .15s; }
.ide-toolgroup.collapsed .ide-tg-caret { transform: rotate(-90deg); }
.ide-tg-head .ide-tg-title { color: var(--ide-ink); }
.ide-tg-head .ide-tg-spin { margin-left: auto; width: 14px; height: 14px; border: 2px solid var(--ide-line); border-top-color: var(--ide-emerald); border-radius: 50%; animation: ide-spin .7s linear infinite; }
.ide-tg-head .ide-tg-done { margin-left: auto; color: var(--ide-emerald); display: inline-flex; }
.ide-tg-body { padding: 0 10px 8px; display: flex; flex-direction: column; gap: 6px; }
.ide-toolgroup.collapsed .ide-tg-body, .ide-toolgroup.collapsed .ide-tg-foot { display: none; }
.ide-trow { border: 1px solid var(--ide-line); border-radius: 10px; background: var(--ide-panel); overflow: hidden; }
.ide-trow-main { display: flex; align-items: center; gap: 9px; padding: 9px 11px; }
.ide-trow-ic { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; flex-shrink: 0; }
.ide-trow.add .ide-trow-ic { background: rgba(16,185,129,.16); color: var(--ide-emerald-deep); }
.ide-trow.mod .ide-trow-ic { background: rgba(245,158,11,.16); color: var(--ide-amber); }
.ide-trow.del .ide-trow-ic { background: rgba(239,68,68,.16); color: var(--ide-red); }
.ide-trow.read .ide-trow-ic, .ide-trow.run .ide-trow-ic { background: var(--ide-elev); color: var(--ide-ink-soft); }
.ide-trow-verb { font-weight: 600; font-size: 13px; color: var(--ide-ink); }
.ide-badge-lang { font: 700 9.5px/1 var(--ide-mono); letter-spacing: .04em; padding: 3px 6px; border-radius: 5px; background: var(--ide-elev); color: var(--ide-ink-soft); text-transform: uppercase; }
.ide-trow-path { font-family: var(--ide-mono); font-size: 12px; color: var(--ide-emerald-deep); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ide-trow-state { margin-left: auto; flex-shrink: 0; display: inline-flex; }
.ide-trow-state .ide-tool-spin { width: 13px; height: 13px; border: 2px solid var(--ide-line); border-top-color: var(--ide-emerald); border-radius: 50%; animation: ide-spin .7s linear infinite; }
.ide-trow-state .ide-tool-check { color: var(--ide-emerald); }
.ide-details { border-top: 1px solid var(--ide-line); }
.ide-details summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; padding: 7px 11px; font-size: 12px; color: var(--ide-ink-faint); }
.ide-details summary::-webkit-details-marker { display: none; }
.ide-details summary .ide-tg-caret { display: inline-flex; transition: transform .15s; }
.ide-details[open] summary .ide-tg-caret { transform: rotate(90deg); }
.ide-details pre { margin: 0; padding: 10px 12px; max-height: 240px; overflow: auto; background: var(--ide-bg); font-family: var(--ide-mono); font-size: 11.5px; line-height: 1.55; }
.ide-diff-add { color: var(--ide-emerald-deep); background: rgba(16,185,129,.08); display: block; }
.ide-diff-del { color: var(--ide-red); background: rgba(239,68,68,.08); display: block; }
.ide-tg-foot { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-top: 1px solid var(--ide-line); font-size: 12.5px; }
.ide-tg-working { display: inline-flex; align-items: center; gap: 8px; color: var(--ide-ink-soft); font-weight: 600; }
.ide-tg-working .ide-tool-spin { width: 13px; height: 13px; border: 2px solid var(--ide-line); border-top-color: var(--ide-emerald); border-radius: 50%; animation: ide-spin .7s linear infinite; }
.ide-tg-foot .ide-tg-view { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; background: transparent; border: 0; color: var(--ide-ink-soft); cursor: pointer; font: 600 12.5px/1 var(--ide-font); padding: 5px 8px; border-radius: 7px; }
.ide-tg-foot .ide-tg-view:hover { background: var(--ide-elev); color: var(--ide-ink); }
.ide-tg-foot .ide-tg-cancel { background: transparent; border: 0; color: var(--ide-red); cursor: pointer; font: 600 12.5px/1 var(--ide-font); padding: 5px 8px; border-radius: 7px; }
.ide-tg-foot .ide-tg-cancel:hover { background: rgba(239,68,68,.12); }

.ide-composer { flex-shrink: 0; border-top: 1px solid var(--ide-line); padding: 10px; }
.ide-attach-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.ide-thumb { position: relative; width: 52px; height: 52px; border-radius: 8px; overflow: hidden; border: 1px solid var(--ide-line); }
.ide-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ide-thumb button { position: absolute; top: 2px; right: 2px; width: 16px; height: 16px; border: 0; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; line-height: 1; cursor: pointer; }
.ide-filechip { display: inline-flex; align-items: center; gap: 6px; max-width: 220px; padding: 5px 8px; border: 1px solid var(--ide-line); border-radius: 8px; background: var(--ide-panel-2); font-size: 12px; color: var(--ide-ink-soft); }
.ide-filechip svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--ide-ink-faint); }
.ide-filechip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ide-filechip button { border: 0; background: transparent; color: var(--ide-ink-faint); cursor: pointer; font-size: 13px; line-height: 1; padding: 0 2px; }
.ide-filechip button:hover { color: var(--ide-red); }
.ide-chat.ide-drag { outline: 2px dashed var(--ide-emerald); outline-offset: -6px; background: var(--ide-accent-soft); }
.ide-input-row { display: flex; align-items: flex-end; gap: 8px; background: var(--ide-panel-2); border: 1px solid var(--ide-line); border-radius: 12px; padding: 6px 6px 6px 8px; }
.ide-input-row:focus-within { border-color: var(--ide-emerald); }
.ide-input-row textarea { flex: 1; resize: none; border: 0; background: transparent; color: var(--ide-ink); font: inherit; font-size: 13.5px; line-height: 1.5; max-height: 160px; padding: 6px 2px; outline: none; }
.ide-send { flex-shrink: 0; width: 34px; height: 34px; border: 0; border-radius: 9px; background: var(--ide-emerald); color: #fff; cursor: pointer; display: grid; place-items: center; }
.ide-send:hover { background: var(--ide-emerald-deep); }
.ide-send:disabled { opacity: .5; cursor: default; }
.ide-foot-note { margin: 8px 2px 0; font-size: 11px; color: var(--ide-ink-faint); line-height: 1.5; }

/* ---------- Status bar ---------- */
.ide-statusbar { display: flex; align-items: center; justify-content: space-between; height: 24px; flex-shrink: 0; padding: 0 12px; background: var(--ide-emerald); color: #04231a; font-size: 11.5px; font-weight: 600; }
[data-theme="light"] .ide-statusbar { color: #04231a; }
.ide-sb-left, .ide-sb-right { display: flex; align-items: center; gap: 7px; }
.ide-sb-sep { opacity: .5; }

/* ---------- Toast ---------- */
.ide-toast-host { position: fixed; bottom: 36px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.ide-toast { pointer-events: auto; background: var(--ide-elev); color: var(--ide-ink); border: 1px solid var(--ide-line); padding: 10px 16px; border-radius: 10px; font-size: 13px; box-shadow: 0 12px 30px rgba(0,0,0,.4); animation: ide-fade .18s ease-out; }
@keyframes ide-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (max-width: 900px) {
  .ide-grid { grid-template-columns: 1fr; grid-template-rows: auto; overflow: auto; }
  .ide-resizer { display: none; }
  .ide-pane { height: 60vh; }
  .ide-files { height: 40vh; }
}
