/* Basic ARIA tree visuals */

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

.tree__item {
  display: block;
  line-height: 1.4;
  padding: 2px 0px;
  border-radius: 4px;
  cursor: default;
  user-select: none;
}

.tree__item:focus {
  outline: none;
  /* box-shadow: inset 0 0 0 2px rgba(66, 133, 244, 0.6); */
}

/* Hover and selection visuals (consistent with inline variable list) */
/* Apply visuals to the row only, so parents don't highlight when hovering children */
.tree__row {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.tree__row::before {
  content: '';
  position: absolute;
  /* start highlight to the right of the disclosure arrow */
  left: 12px;
  right: 0;
  /* shared vertical extent for hover/selection highlights */
  top: -4px;
  bottom: 1px;
  background: transparent;
}

.tree__row:hover::before {
  background: var(--hover-color, #afd5bf);
}

.tree__item.is-selected > .tree__row::before {
  background: var(--active-color, #7ab094);
}

.tree__group {
  list-style: none;
  margin: 0;
  padding-left: 16px; /* indentation */
  position: relative;
}

.tree__group > .tree__item:first-child,
.tree > .tree__item:first-child {
  margin-top: 3px;
}

/* Connector lines (dashed) to visualize tree hierarchy */
.tree__group > .tree__item {
  position: relative;
  padding-left: 16px;
}

.tree__group > .tree__item::before {
  /* horizontal connector from parent to this node */
  content: '';
  position: absolute;
  top: 11px;
  left: -8px;
  width: 30px;
  border-top: 1.5px dashed rgba(0, 0, 0, 0.35);
}

.tree__group > .tree__item::after {
  /* vertical connector continuing to children/siblings */
  content: '';
  position: absolute;
  top: -13px;
  bottom: 14px;
  left: -10px;
  border-left: 1.5px dashed rgba(0, 0, 0, 0.35);
}

.tree__group > .tree__item:last-child::after {
  /* stop at this row for the last sibling */
  height: calc(1.1em + 8px);
}

.tree__disclosure {
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  color: #555;
  cursor: pointer;
  flex: 0 0 14px; /* keep indentation width stable even when tree shrinks */
  position: relative;
  top: -2px; /* visually center with text */
}

.tree__disclosure::before {
  content: '\25B6'; /* ▶ */
  font-size: 0.6rem;
  line-height: 1;
}

[aria-expanded="true"] > .tree__row > .tree__disclosure::before {
  content: '\25BC'; /* ▼ */
}

/* Leaves have no disclosure icon */
.tree__disclosure.is-leaf::before {
  content: '';
}

.tree__label {
  cursor: pointer;
  min-width: 0;
  flex: 1 1 auto; /* allow label text to shrink/ellipsis instead of shifting indentation */
  font-size: 0.9rem;
  position: relative; /* anchor for superscript badge */
}

.tree__label-text {
  display: inline-block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.tree__label[data-repeatable="true"]::before {
  content: 'R';
  position: absolute;
  left: -0.6em;
  top: -0.25em;
  font-size: 0.75em;
  line-height: 1;
  color: #e0615c;
  font-weight: 700;
  pointer-events: none;
}
