/* -----------------------------------------------------------
   OUTLINE EDITOR
   Layout-overrides + panel styles
----------------------------------------------------------- */

/* Left column + textarea in one row; top panel above both */
.editor-area {
  width: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.editor-row {
  display: flex;
  position: relative;
  flex: 1;
  min-height: 0;
}

/* Editor (Textfeld + Farbebene) füllt die restliche Breite */
.editor-input-wrap {
  border-bottom: none;
}

/* ── Top panel (Spalten-Tabs) ──────────────────────────── */

/* Die Spalten einer Tabelle sind waagerechte Reiter über der Fläche — der
   Gutter links führt senkrecht durch das Dokument. Zwei Achsen, zwei Rollen:
   damit sie nicht als eine Leiste gelesen werden, sitzen die Reiter auf einer
   eigenen Grundlinie und tragen keinen Rahmen um sich herum. */
#outlineTop {
  display: flex;
  align-items: stretch;
  background: var(--gutter-bg);
  border: 1px solid rgba(128,128,128,0.15);
  border-bottom: 1px solid var(--border);
  border-radius: 4px 4px 0 0;
  overflow-x: auto;
  flex-shrink: 0;
  min-height: 40px;
  scrollbar-width: none;
}
#outlineTop::-webkit-scrollbar { display: none; }
#outlineTop.hidden { display: none; }

/* Spacer aligns column headers with left-panel width */
.ol-col-spacer {
  width: 44px;
  min-width: 44px;
  flex-shrink: 0;
  border-right: 1px solid rgba(128,128,128,0.15);
}

.ol-col-handle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 8px;
  /* Alle Reiter tragen die Unterkante von Anfang an — nur farblos. Sonst
     sprängen sie um zwei Pixel, sobald der Cursor in die Spalte wandert. */
  border-bottom: 2px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}
.ol-col-handle:hover { background: rgba(128,128,128,0.07); }
.ol-block-handle { cursor: default; }

/* Aktive Spalte: farbige Unterstreichung und dunklerer Text (Anforderung 7).
   Der blaue Anriss links gehört dem Gutter — hier wäre er eine falsche Fährte. */
.ol-col-handle.ol-active {
  background: transparent;
  border-left: none;
  border-bottom-color: var(--accent);
}
.ol-col-handle.ol-active .ol-label {
  color: var(--text);
  font-weight: 700;
}

/* ── Left panel (row handles / info) ───────────────────── */

#outlineLeft {
  width: 44px;
  min-width: 44px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--gutter-bg);
  border: 1px solid rgba(128,128,128,0.15);
  /* Die Trennlinie zur Editorfläche zieht deren eigener linker Rahmen */
  border-right: none;
  border-top-left-radius: 0;
  border-top: none;
  overflow-y: scroll;
  overflow-x: hidden;
  scrollbar-width: none;
}
#outlineLeft::-webkit-scrollbar { display: none; }
#outlineLeft.hidden { display: none; }

/* Row handles */
.ol-row-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid rgba(128,128,128,0.1);
  flex-shrink: 0;
  box-sizing: border-box;
  cursor: pointer;
  transition: background 0.15s;
}
.ol-row-handle:hover { background: rgba(128,128,128,0.07); }
.ol-header {
  background: rgba(128,128,128,0.05);
  cursor: default;
}
.ol-active {
  background: rgba(74, 144, 226, 0.09);
  border-left: 2px solid rgba(74,144,226,0.45);
}
.ol-clickable { cursor: pointer; }

/* ── Drag & drop ───────────────────────────────────────── */

.ol-draggable        { cursor: grab; }
.ol-draggable:active { cursor: grabbing; }
.ol-dragging         { opacity: 0.35; }
/* Row handles: horizontal drop line (top / bottom) */
.ol-drop-before      { box-shadow: inset 0  2px 0 rgba(74,144,226,0.75); }
.ol-drop-after       { box-shadow: inset 0 -2px 0 rgba(74,144,226,0.75); }
/* Column handles: vertical drop line (left / right) */
.ol-col-drop-before  { box-shadow: inset  2px 0 0 rgba(74,144,226,0.75); }
.ol-col-drop-after   { box-shadow: inset -2px 0 0 rgba(74,144,226,0.75); }

/* Info handle (heading / paragraph / image / …) */
.ol-info-handle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 4px 2px;
  box-sizing: border-box;
  flex-shrink: 0;
}

/* ── Shared labels ─────────────────────────────────────── */

.ol-label {
  font-family: monospace;
  font-size: 11px;
  font-weight: 600;
  color: #999;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.ol-info-icon {
  font-size: 12px;
  font-weight: bold;
  font-family: monospace;
  color: #999;
}

.ol-info-stat {
  font-size: 9px;
  color: #bbb;
  text-align: center;
  white-space: nowrap;
}

/* ── Add buttons (+) ───────────────────────────────────── */

.ol-add-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: bold;
  color: rgba(74,144,226,0.6);
  cursor: pointer;
  padding: 6px 0;
  background: transparent;
  border: none;
  flex-shrink: 0;
  user-select: none;
  transition: color 0.15s;
}
.ol-add-handle:hover { color: #4a90e2; }
.ol-add-col { padding: 0 10px; align-self: center; }

/* ── Gutter-Hintergrund je Theme ───────────────────────── */
body.light { --gutter-bg: #f6f8fa; }
body.dark  { --gutter-bg: #1c2128; }

/* ── Context menu (position: fixed, outside panels) ────── */

.ol-menu {
  position: fixed;
  background: var(--preview-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  padding: 4px;
  min-width: 130px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ol-menu.hidden { display: none; }

.ol-menu-title {
  font-size: 11px;
  font-weight: bold;
  color: #888;
  padding: 3px 10px 5px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}

/* Die Ausrichtungs-Leiste (style.css) sitzt als Block über den Einträgen;
   sie ist breiter als hoch und braucht daher etwas Luft nach unten */
.ol-menu-label {
  font-size: 11px;
  color: #888;
  padding: 2px 10px 3px;
}

.ol-menu-align {
  margin-bottom: 4px;
}

.ol-menu-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 10px;
  font-size: 12px;
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text);
}
.ol-menu-btn:hover   { background: var(--tab-active); }
.ol-menu-del         { color: #c0392b; }
.ol-menu-del:hover   { background: rgba(192,57,43,0.1); }
