/* ==== DocForge — structure editor ==== */

.pill-tabs {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  margin-bottom: 12px;
}
.pill-tab {
  border: 0;
  background: transparent;
  padding: 5px 15px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 550;
  color: var(--txt-muted);
  transition: background var(--transition), color var(--transition);
}
.pill-tab:hover { color: var(--txt); }
.pill-tab.active { background: var(--surface); color: var(--pri); box-shadow: var(--shadow); }

/* Sits inline with a card heading rather than leading a page. */
.pill-tabs-sm { margin-bottom: 0; }
.pill-tabs-sm .pill-tab { padding: 3px 11px; font-size: 12px; }

.struct-banner {
  background: #FBF1DA;
  border: 1px solid #EBD9AE;
  color: var(--warn);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 12.5px;
  margin-bottom: 11px;
}

.struct-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  padding-bottom: 9px;
  margin-bottom: 5px;
  border-bottom: 1px solid var(--border);
}
.struct-toolbar .spacer { flex: 1; }

.struct-list { list-style: none; margin: 0; padding: 0; }

.struct-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 4px;
  border-radius: var(--radius-sm);
  cursor: default;
  border: 1px solid transparent;
}
.struct-row:hover { background: var(--surface-2); }
.struct-row:focus-visible { border-color: var(--pri); background: var(--pri-soft); }

/* Indent conveys depth; the tree itself stays flat so dragging behaves. */
.struct-row.lvl-2 { padding-left: 18px; }
.struct-row.lvl-3 { padding-left: 34px; }
.struct-row.lvl-4 { padding-left: 50px; }
.struct-row.lvl-5, .struct-row.lvl-6 { padding-left: 66px; }

/* Hidden sections stay listed at reduced weight rather than disappearing —
   otherwise there is no way to find one again and bring it back. */
.struct-row.is-hidden .struct-text,
.struct-row.is-hidden .struct-stats { opacity: .45; text-decoration: line-through; }
.struct-child.is-hidden .child-text { opacity: .45; text-decoration: line-through; }

.drag-handle {
  cursor: grab;
  color: var(--txt-muted);
  opacity: .45;
  font-size: 11px;
  letter-spacing: -3px;
  padding: 0 2px;
  flex: 0 0 auto;
}
.struct-row:hover .drag-handle { opacity: .9; }
.drag-ghost { opacity: .4; background: var(--pri-soft); }

.struct-expand {
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--txt-muted);
  padding: 0 2px;
  font-size: 11px;
  flex: 0 0 auto;
}

.struct-level {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--pri);
  background: var(--pri-soft);
  border-radius: 3px;
  padding: 1px 4px;
  flex: 0 0 auto;
}

.struct-text {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.struct-text .pill { margin-left: 5px; padding: 0 6px; }

.struct-stats {
  font-size: 11.5px;
  flex: 0 0 auto;
  white-space: nowrap;
}

.struct-actions {
  display: flex;
  gap: 1px;
  flex: 0 0 auto;
  opacity: 0;
  transition: opacity var(--transition);
}
.struct-row:hover .struct-actions,
.struct-row:focus-within .struct-actions,
.struct-child:hover .struct-actions { opacity: 1; }

.icon-btn {
  border: 0;
  background: none;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--txt-muted);
  line-height: 1;
}
.icon-btn:hover:not(:disabled) { background: var(--border); color: var(--txt); }
.icon-btn:disabled { opacity: .3; cursor: not-allowed; }

.struct-child {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 4px 3px 54px;
  font-size: 12px;
  color: var(--txt-muted);
  border-radius: var(--radius-sm);
}
.struct-child:hover { background: var(--surface-2); }
.child-type {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0 4px;
  flex: 0 0 auto;
}
.child-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
