/**
 * ModuleTreeNode styles - matches StandardLibraryPanel tree styling
 */

.module-tree {
  font-size: var(--font-size-xs);
}

.module-tree-node {
  /* Container for a single node and its children */
}

.module-tree-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 4px;
  border-radius: var(--radius-sm);
  cursor: default;
  transition: background var(--transition-fast);
}

.module-tree-row.expandable {
  cursor: pointer;
}

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

.module-tree-row:focus {
  outline: none;
  background: var(--bg-hover);
  box-shadow: inset 0 0 0 1px var(--ctp-blue);
}

.module-tree-row:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--ctp-blue);
}

.module-tree-row.root {
  padding: 4px;
  margin-bottom: 2px;
}

.module-tree-expand-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
}

.module-tree-expand-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.module-tree-expand-spacer {
  width: 16px;
  flex-shrink: 0;
}

.module-tree-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.module-tree-name {
  color: var(--text-primary);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.module-tree-name.root-name {
  font-weight: 400;
}

.module-tree-type {
  margin-left: auto;
  font-size: var(--font-size-xs);
  opacity: 0.7;
  white-space: nowrap;
}

.module-tree-type.unconstrained {
  opacity: 0.4;
  font-style: italic;
}

/* Truncated indicator - subtle underline on hover to show full value available */
.module-tree-name.truncated,
.module-tree-type.truncated {
  cursor: help;
}

.module-tree-name.truncated:hover,
.module-tree-type.truncated:hover {
  text-decoration: underline dotted;
  text-decoration-color: var(--text-muted);
  text-underline-offset: 2px;
}

.module-tree-count {
  margin-left: auto;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 0 6px;
  border-radius: var(--radius-sm);
}

/* Type group header styling */
.module-tree-type-group {
  /* Container for a type group */
}

.module-tree-group-header {
  font-weight: 400;
}

.module-tree-group-header:hover {
  background: var(--bg-hover);
}

.module-tree-group-label {
  font-weight: 400;
  font-size: var(--font-size-sm);
}

.module-tree-group-count {
  margin-left: auto;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 0 6px;
  border-radius: var(--radius-sm);
}

.module-tree-group-items {
  /* Items within a group */
}

.module-tree-children {
  /* Nested children container */
}

.module-tree-empty {
  padding: 8px 12px;
  color: var(--text-muted);
  font-size: var(--font-size-xs);
  font-style: italic;
}

/* Connecting lines (optional visual) */
.module-tree-node .module-tree-children {
  position: relative;
}

.module-tree-node .module-tree-children::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 8px;
  width: 1px;
  background: var(--border-subtle);
  opacity: 0.5;
}

/* Depth-based line positioning (6px per level) */
.module-tree-children .module-tree-children::before {
  left: 14px;
}

.module-tree-children .module-tree-children .module-tree-children::before {
  left: 20px;
}

.module-tree-children .module-tree-children .module-tree-children .module-tree-children::before {
  left: 26px;
}

.module-tree-children .module-tree-children .module-tree-children .module-tree-children .module-tree-children::before {
  left: 32px;
}
