/* Container for the custom editor */
.blurfactor-spn-editor-container {
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 8px;
  margin-top: 6px;
  background: #ffffff;
}

/* Root element of your SPN editor */
.spn-editor-root {
  display: flex;
  flex-direction: row;
  width: 100%;
  min-height: 200px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 3px;
  overflow: hidden;
}

/* Example styling for dual-pane */
.spn-editor-root .pane {
  flex: 1;
  padding: 10px;
  box-sizing: border-box;
}

.spn-editor-root .pane + .pane {
  border-left: 1px solid #eee;
}

/* Basic text area / code area styling */
.spn-editor-root textarea,
.spn-editor-root pre,
.spn-editor-root code {
  font-family: monospace;
  font-size: 14px;
  line-height: 1.4em;
}

:root {
  --panel: #ffffff;
  --ink: #1a1a1a;
  --muted: #555555;
  --border: #cccccc;
  --sel: #3b61ff;
  --sel-soft: rgba(59, 97, 255, 0.12);
  --active: #ffb84d;
  --active-bg: rgba(255, 184, 77, 0.15);
  --raw-line-tight: 18px;
  --raw-pad-block: 8px;
  --fold-line: rgba(0, 0, 0, 0.15);
}

.acf-row {
  background: linear-gradient(180deg, #f5f5f5, #eaeaea);
}

.app {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  grid-template-rows: auto 1fr;
  gap: 18px;
  padding: 18px;
  box-sizing: border-box;
  align-items: start;

  background: linear-gradient(180deg, #f5f5f5, #eaeaea);
}

.app[data-view="both"] { grid-template-columns: 1.3fr 1fr; }
.app[data-view="left"] { grid-template-columns: 1fr; }
.app[data-view="right"] { grid-template-columns: 1fr; }
.app[data-view="left"] #panelRight,
.app[data-view="right"] #panelLeft { display: none; }
.app[data-view="both"] #panelLeft,
.app[data-view="both"] #panelRight { display: flex; }

header { grid-column: 1 / -1; display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
button {
  appearance: none;
  border: 1px solid var(--border);
  background: #ffffff;
  color: #222222;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
}
.toolbar .ghost { background: #f4f4f4; color: #333333; }

.seg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #ffffff;
}
.seg button {
  border: none;
  background: transparent;
  color: #333333;
  padding: 8px 12px;
  border-right: 1px solid var(--border);
}
.seg button:last-child { border-right: none; }
.seg button.active { background: #e8ebff; color: #000000; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  align-self: start;
}
.panel h2 { margin: 0 0 12px 4px; font-size: 14px; color: #12175D; font-weight: 700;  }

.tree { list-style: none; margin: 0; padding: 0 0 6px 0; flex: 1; overflow: auto; }
.node { --indent: 0; margin: 4px 0 0 0; padding-left: calc(var(--indent) * 22px); position: relative; }
.node::before { content: ""; position: absolute; left: calc(var(--indent) * 22px - 12px); top: 16px; width: 10px; height: 2px; background: #cccccc; border-radius: 2px; }
.level-0::before { display: none; }
.node.collapsed > ul.tree { display: none; }
.item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid #cccccc;
  border-radius: 12px;
  padding: 8px 10px;
  min-height: 34px;
}
.item.active { box-shadow: 0 0 0 2px var(--active) inset, 0 0 0 6px rgba(255, 184, 77, 0.14) inset; }
.text { flex: 1; outline: none; color: #000000; }
.icon-btn {
  border: none;
  background: #f4f4f4;
  border: 1px solid #cccccc;
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  color: #333333;
}
.icon-btn.small { padding: 4px 6px; font-size: 13px; }
.hint { margin-top: 10px; color: var(--muted); font-size: 13px; }
.spn-editor-host .selected { outline: 2px solid var(--sel); box-shadow: 0 0 0 4px var(--sel-soft) inset; }
.in-selected-block { background: linear-gradient(0deg, rgba(59, 97, 255, 0.08), rgba(59, 97, 255, 0.08)), #ffffff; }
.kbd {
  font: 11px/1 monospace;
  background: #f9f9f9;
  border: 1px solid #cccccc;
  border-bottom-width: 2px;
  color: #333333;
  padding: 2px 6px;
  border-radius: 6px;
}

.level-chip { font: 11px/1 monospace; padding: 2px 8px; border-radius: 999px; min-width: 34px; text-align: center; border: 1px solid; }
.chip-l0 { background: #e6e6ff; border-color: #a0a0ff; color: #000; }
.chip-l1 { background: #d6ebff; border-color: #3d8bfd; color: #003366; }
.chip-l2 { background: #d6ffff; border-color: #2fb3b3; color: #004d4d; }
.chip-l3 { background: #e7ffe9; border-color: #3bd162; color: #003300; }
.chip-l4 { background: #fff1d6; border-color: #ffa94d; color: #663300; }
.chip-l5 { background: #ffe3e3; border-color: #ff6b6b; color: #660000; }
.chip-l6 { background: #ffe0ef; border-color: #f06595; color: #660033; }
.chip-l7 { background: #efe9ff; border-color: #9c8cff; color: #1a0033; }

.drag-handle {
  user-select: none;
  cursor: grab;
  padding: 2px 6px;
  border-radius: 6px;
  background: #f4f4f4;
  border: 1px solid #cccccc;
  font-size: 14px;
  line-height: 1;
  color: #333333;
}
.drag-handle:active { cursor: grabbing; }

.item.drop-before { box-shadow: 0 -2px 0 0 var(--sel), inset 0 0 0 2px transparent; }
.item.drop-after { box-shadow: 0  2px 0 0 var(--sel), inset 0 0 0 2px transparent; }
.item.drop-child { box-shadow: inset 4px 0 0 0 var(--sel); }
.item.drop-illegal { outline: 2px dashed #ff6b7b; }

.raw-wrap { position: relative; flex: 1; min-height: 0; }
#rawEditor {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  color: #222222;
  font: 13px ui-monospace, Menlo, Consolas, monospace;
  height: 100%;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  outline: none;
  caret-color: #ff9800;
}
.raw-line {
  position: relative;
  padding-top: var(--raw-pad-block);
  padding-bottom: var(--raw-pad-block);
  line-height: var(--raw-line-tight);
  border-radius: 8px;
}
.raw-line.active { background: var(--active-bg); box-shadow: inset 0 0 0 1px rgba(255, 184, 77, 0.35); }
.raw-line.violation { color: #cc0000; border-left: 3px solid #cc0000; padding-left: 9px; }

.twisty {
  position: absolute;
  left: -18px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  border-radius: 4px;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555555;
  opacity: .7;
  cursor: pointer;
  user-select: none;
}
.twisty:hover { opacity: 1; }
.twisty[contenteditable="false"] { pointer-events: auto; }

.raw-line::after {
  content: "";
  display: block;
  margin-top: 4px;
  border-bottom: 1px dotted var(--fold-line);
  opacity: 0;
  transform: scaleX(.98);
  transition: opacity .18s ease, transform .18s ease;
}
.raw-line.folded::after { opacity: 1; transform: scaleX(1); }

.raw-line.l0 { color: #000000; }
.raw-line.l1 { color: #003366; }
.raw-line.l2 { color: #004d4d; }
.raw-line.l3 { color: #003300; }
.raw-line.l4 { color: #663300; }
.raw-line.l5 { color: #660000; }
.raw-line.l6 { color: #660033; }
.raw-line.l7 { color: #1a0033; }
