/* =============================================================
   editor.css
   MicroPython text editor pane: top toolbar, line-number gutter,
   textarea, bottom status bar with compile badge, and the
   inline error bar shown under the toolbar on compile failure.
   ============================================================= */

/* ---------------------------------------------------------------
   Text editor pane container
   Hidden by default; shown when the user switches to text mode.
   --------------------------------------------------------------- */
#text-editor-pane {
  flex: 1;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

/* ---------------------------------------------------------------
   Top toolbar (Run, Format, Comment, Undo, snippet buttons)
   --------------------------------------------------------------- */
#editor-top-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: #0f1e3a;
  border-bottom: 1px solid #21262d;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* Small editor action buttons */
.ed-btn {
  padding: 3px 9px;
  border: none;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
  color: #fff;
}
.ed-btn:hover { opacity: .82; }
.ed-btn-run  { background: #1d9e75; }
.ed-btn-fmt  { background: #534AB7; }
.ed-btn-cmt  { background: #444; }
.ed-btn-undo { background: #2a2a3a; border: 1px solid #30363d; }

/* Language badge on the far right of the toolbar */
#editor-lang-badge { font-size: 10px; color: #8b949e; margin-left: auto; font-family: monospace; }

/* ---------------------------------------------------------------
   Inline error bar
   Shown between the toolbar and the editor area when the live
   compile detects an error while typing.
   --------------------------------------------------------------- */
#editor-error-bar {
  display: none;
  background: #2a0a0a;
  border-top: 1px solid #f85149;
  padding: 4px 12px;
  font-size: 11px;
  color: #f85149;
  font-family: monospace;
  flex-shrink: 0;
}

/* ---------------------------------------------------------------
   Editor area: line-number gutter + textarea side by side
   --------------------------------------------------------------- */
#editor-area { display: flex; flex: 1; overflow: hidden; position: relative; }

/* Line number gutter - non-interactive, syncs scroll with the textarea */
#line-numbers {
  width: 42px;
  background: #0a0f1a;
  color: #444;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.7;
  padding: 14px 6px 14px 0;
  text-align: right;
  overflow: hidden;
  flex-shrink: 0;
  border-right: 1px solid #1e2a3a;
  user-select: none;
  pointer-events: none;
}

/* Textarea - must share the same font family and size as the gutter
   so that line numbers align correctly with the text rows. */
#mcu-editor {
  flex: 1;
  background: #0d1117;
  color: #c9d1d9;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  padding: 14px 14px 14px 10px;
  border: none;
  outline: none;
  resize: none;
  line-height: 1.7;
  tab-size: 4;
  white-space: pre;
  overflow: auto;
}
#mcu-editor::selection { background: #264f78; }

/* ---------------------------------------------------------------
   Bottom status bar (cursor position left, compile badge right)
   --------------------------------------------------------------- */
#editor-toolbar {
  padding: 5px 12px;
  background: #161b22;
  border-top: 1px solid #30363d;
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 11px;
  color: #8b949e;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* Compile status pill badge */
#compile-status-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 700;
  margin-left: auto;
}
.csb-ok   { background: #1a3a1a; color: #3fb950; }
.csb-err  { background: #3a1a1a; color: #f85149; }
.csb-idle { background: #1a1a2a; color: #555; }
