/* Tree Viewer Styling */
.tree-container {
  padding: var(--spacing-md);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-main);
  background-color: var(--bg-input);
  box-shadow: var(--inset-shadow);
  border-radius: var(--radius-lg);
  height: 100%;
  overflow: auto;
}

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

.tree-node {
  margin: 2px 0;
  position: relative;
}

.tree-item {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  padding: 1px 4px;
  border-radius: var(--radius-sm);
  transition: background-color var(--transition-fast);
}

.tree-item:hover {
  background-color: var(--editor-line-active);
}

/* Collapsible toggle arrow */
.tree-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-right: 4px;
  cursor: pointer;
  color: var(--text-muted);
  user-select: none;
  transition: transform var(--transition-fast), color var(--transition-fast);
}

.tree-toggle:hover {
  color: var(--text-main);
}

.tree-toggle svg {
  width: 12px;
  height: 12px;
  transform: rotate(90deg);
  transition: transform var(--transition-fast);
}

.tree-node.collapsed > .tree-item .tree-toggle svg {
  transform: rotate(0deg);
}

/* Indent guides */
.tree-children {
  padding-left: 20px;
  border-left: 1px dashed rgba(0, 0, 0, 0.08);
  margin-left: 8px;
  display: block;
}


.tree-node.collapsed > .tree-children {
  display: none;
}

/* Key & Value Styling */
.tree-key {
  color: var(--syn-key);
  font-weight: 600;
  cursor: pointer;
  margin-right: var(--spacing-xs);
  transition: color var(--transition-fast), text-decoration var(--transition-fast);
}

.tree-key:hover {
  text-decoration: underline;
  color: var(--brand-primary);
}

.tree-separator {
  color: var(--text-muted);
  margin-right: var(--spacing-sm);
}

.tree-value {
  display: inline-block;
  word-break: break-all;
}

.tree-value.string {
  color: var(--syn-string);
}

.tree-value.number {
  color: var(--syn-number);
}

.tree-value.boolean {
  color: var(--syn-boolean);
  font-weight: bold;
}

.tree-value.null {
  color: var(--syn-null);
  font-style: italic;
}

/* Array & Object meta counters */
.tree-meta {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-style: italic;
  user-select: none;
}

/* Highlighting searched items */
.tree-highlight {
  background-color: var(--editor-selection);
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 2px var(--editor-selection);
}

/* Highlighted node for JSONPath Finder matching */
.tree-node.path-matched > .tree-item {
  background-color: var(--brand-primary-light) !important;
  border: 1px dashed var(--brand-primary);
  box-shadow: var(--shadow-sm);
}
