/* ═══════════════════════════════════════════════════════
   JSON Lint — Tree View Styles
   ═══════════════════════════════════════════════════════ */

#view-tree {
  padding: 8px 4px;
  font-family: var(--font-mono);
  font-size: var(--font-sz-editor);
  line-height: 1.5;
  overflow: auto;
}

/* ── Each node wrapper ── */
.tree-node {
  padding-left: 0;
}

/* ── Collapsible (object / array) ── */
.tree-collapsible {
  display: block;
}

.tree-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  list-style: none;
  transition: background var(--transition);
  white-space: nowrap;
}
.tree-summary::-webkit-details-marker { display: none; }
.tree-summary::marker { display: none; }

.tree-summary:hover { background: var(--bg-hover); }

/* Custom collapse triangle */
.tree-summary::before {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 5px 0 5px 7px;
  border-color: transparent transparent transparent var(--text-placeholder);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}
details[open] > .tree-summary::before {
  transform: rotate(90deg);
}

/* ── Tree children (indented) ── */
.tree-children {
  padding-left: 18px;
  border-left: 1px solid var(--border);
  margin-left: 8px;
}

/* ── Leaf node (primitive) ── */
.tree-leaf {
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  cursor: default;
  transition: background var(--transition);
}
.tree-leaf:hover { background: var(--bg-hover); }

/* ── Key / colon ── */
.tree-key {
  color: var(--tok-key);
  font-weight: 600;
}

.tree-summary .tree-key { font-weight: 600; }

.tree-colon {
  color: var(--tok-punct);
  margin: 0 1px;
}

/* ── Type badges on collapsible nodes ── */
.tree-type {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  font-family: var(--font-ui);
  flex-shrink: 0;
}

.tree-object {
  background: rgba(99,102,241,.12);
  color: #6366f1;
}
.tree-array {
  background: rgba(16,185,129,.12);
  color: #059669;
}
[data-theme="dark"] .tree-object {
  background: rgba(99,102,241,.2);
  color: #818cf8;
}
[data-theme="dark"] .tree-array {
  background: rgba(16,185,129,.2);
  color: #34d399;
}

/* ── Value types (leaf) ── */
.tree-value { }

.tree-string  { color: var(--tok-string); }
.tree-number  { color: var(--tok-number); }
.tree-boolean { color: var(--tok-boolean); }
.tree-null    { color: var(--tok-null); font-style: italic; }

/* Long strings truncate with ellipsis */
.tree-string {
  max-width: 400px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  vertical-align: bottom;
  white-space: nowrap;
}

/* ── Path highlight on hover (via data-path) ── */
[data-path]:hover > .tree-summary,
[data-path]:hover > .tree-leaf {
  /* already handled by summary/leaf hover rules */
}

/* ── Mobile: slightly larger text ── */
@media (max-width: 599px) {
  #view-tree { font-size: 14px; }
  .tree-children { padding-left: 14px; }
}
