/* ═══════════════════════════════════════════════════════
   Report Editor — Toolbar & Writing Environment
   Theme-aware (ADR 0001): chrome AND the CodeMirror surface
   resolve from the data-theme token custom properties.
   ═══════════════════════════════════════════════════════ */

/* ── Formatting Toolbar ── */

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 12px;
  border-bottom: 1px solid var(--border-default, #e3e3e3);
  background: var(--surface-card, #ffffff);
  user-select: none;
  flex-shrink: 0;
}

.editor-toolbar__group {
  display: flex;
  align-items: center;
  gap: 1px;
}

.editor-toolbar__sep {
  width: 1px;
  height: 20px;
  margin: 0 6px;
  background: var(--border-subtle, #ebebeb);
}

.editor-toolbar__spacer {
  flex: 1;
}

.editor-toolbar__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 28px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-tertiary, #8c8c8c);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.1s, background 0.1s;
}

.editor-toolbar__btn:hover {
  color: var(--text-primary, #1a1a1a);
  background: rgba(0, 0, 0, 0.04);
}

.editor-toolbar__btn:active {
  color: var(--accent);
  background: var(--accent-bg);
}

.editor-toolbar__btn--mono {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: -0.5px;
}

.editor-toolbar__btn svg {
  width: 16px;
  height: 16px;
}

.editor-toolbar__btn strong {
  font-weight: 700;
  font-size: 13px;
}

.editor-toolbar__btn em {
  font-style: italic;
  font-size: 13px;
  font-family: Georgia, serif;
}

.editor-toolbar__hint {
  font-size: 10px;
  color: var(--text-muted, #b0b0b0);
  white-space: nowrap;
}

.editor-toolbar__hint kbd {
  display: inline-block;
  padding: 1px 4px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 9px;
  color: var(--text-tertiary, #8c8c8c);
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border-subtle, #ebebeb);
  border-radius: 3px;
  line-height: 1.4;
}


/* ── Panel Toggle Buttons ── */

.editor-panel-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 11px;
  font-family: inherit;
  color: var(--text-tertiary, #8c8c8c);
  background: transparent;
  border: 1px solid var(--border-default, #e3e3e3);
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.editor-panel-toggle:hover {
  color: var(--text-primary, #1a1a1a);
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.editor-panel-toggle svg {
  width: 14px;
  height: 14px;
  opacity: 0.6;
}

.editor-panel-toggle:hover svg {
  opacity: 1;
}


/* ── Editor Content Area (theme-aware — colours come from
      codemirror/yozu_theme.js via the --editor-* tokens) ── */

/* Native widget chrome (scrollbars, caret) follows the active theme. */
.cm-editor {
  color-scheme: light;
}

[data-theme="dark"] .cm-editor {
  color-scheme: dark;
}

/* The editing surface fills its pane — no max-width column cap
   (UAT 2026-06-09: editor must fill the horizontal space). */
.cm-editor .cm-content {
  padding: 24px 32px;
}

.cm-editor .cm-line {
  padding: 0;
}

/* Make the cursor slightly thicker for visibility */
.cm-editor .cm-cursor {
  border-left-width: 2.5px;
}

/* Softer active line highlight */
.cm-editor .cm-activeLine {
  background: var(--editor-active-line);
}

/* Subtle indentation guides for nested content */
.cm-editor .cm-line:has(> .cm-list) {
  padding-left: 2px;
}


/* ── Editor Scrollbar Refinement ── */

.cm-editor .cm-scroller::-webkit-scrollbar {
  width: 8px;
}

.cm-editor .cm-scroller::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.cm-editor .cm-scroller::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
  background-clip: padding-box;
}


/* ── Autosave Status ── */

.autosave-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  letter-spacing: 0.02em;
  transition: color 0.3s ease;
}

.autosave-status--saved  { color: var(--status-success); }
.autosave-status--saving { color: var(--status-warning); }
.autosave-status--unsaved { color: var(--text-muted, #b0b0b0); }
.autosave-status--failed  { color: var(--status-danger); }

/* Dot indicator before status text */
.autosave-status::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
