/* ── Split-Pane Plugin ─────────────────────────────────────────────
 * Two-pane layout: two tabs side-by-side, each with own tab bar and
 * code+preview content. Activated via toolbar button or palette.
 */

#workspace.view-split-pane {
  display: flex !important;
  flex-direction: row;
  /* Override the default grid */
  grid-template-columns: none !important;
}

#pane-left,
#pane-right {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  position: relative;
}

#pane-right {
  border-left: 1px solid var(--border);
}

#split-handle {
  flex: 0 0 4px;
  background: var(--border);
  cursor: col-resize;
  transition: background 0.15s;
  position: relative;
  z-index: 10;
}

#split-handle:hover,
#split-handle.dragging {
  background: var(--accent);
}

/* Per-pane tab bar — used in split mode */
.tab-bar-pane {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--bg1);
  border-bottom: 1px solid var(--border);
  height: var(--tabbar-h);
  flex-shrink: 0;
}

.tab-bar-pane .file-tab {
  flex: 0 0 auto;
  padding: 6px 12px;
  background: var(--bg1);
  color: var(--text1);
  border: none;
  border-right: 1px solid var(--border);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tab-bar-pane .file-tab.active {
  background: var(--bg0);
  color: var(--text0);
  border-bottom: 2px solid var(--accent);
}

.tab-bar-pane .file-tab.dirty .tab-name {
  font-style: italic;
}

/* Per-pane focus indicator */
#pane-left.pane-focused {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

#pane-right.pane-focused {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* Toolbar split button group */
#split-view-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  padding-left: 8px;
  border-left: 1px solid var(--border);
  height: 30px;
}

#btn-split-view,
#btn-close-split {
  height: 30px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg2);
  color: var(--text1);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--font-ui);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

#btn-split-view:hover,
#btn-close-split:hover {
  background: var(--bg3);
  color: var(--accent);
  border-color: var(--accent);
}

#btn-split-view[hidden],
#btn-close-split[hidden] {
  display: none;
}

/* Hide the global #tab-bar in split mode (per-pane bars are used) */
#workspace.view-split-pane ~ #tab-bar,
body.view-split-pane #tab-bar {
  display: none;
}

/* Each pane's content fills its column */
#pane-left .pane-content,
#pane-right .pane-content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

/* Read-only mirror rendered in the right pane. */
#pane-mirror-right {
  flex: 1 1 auto;
  overflow: auto;
  padding: 12px 16px;
  background: var(--bg0);
  color: var(--text0);
  min-height: 0;
}

#pane-mirror-content-right {
  font-family: var(--font-mono);
  font-size: var(--font-mono-size, 13px);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  user-select: text;
}

/* Placeholder for tab types that can't be mirrored (api, mermaid,
   hex, terminal). */
#pane-right-placeholder {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: var(--text1);
  text-align: center;
}

#pane-right-placeholder .placeholder-line {
  font-size: 14px;
  margin-bottom: 8px;
}

#pane-right-placeholder .placeholder-sub {
  font-size: 12px;
  color: var(--text2);
  margin: 0;
  line-height: 1.5;
}