@use '../../variables' as *;

.item {
  flex: 1;
  color: var(--color-neutral-90);
  background-color: transparent;
  width: 100%;
  cursor: pointer;
}
.item:focus {
  outline: none;
  background-color: var(--color-surface-2);
}
.item:hover {
  background-color: var(--color-surface-2);
  color: var(--color-neutral-100);
}
.item[data-active='true'] {
  background: var(--color-surface-1);
  color: var(--color-neutral-100);
}
.item[data-no-icon='true'] .body {
  padding-left: $space-xs;
}

.item:focus-visible::after {
  border: 1px solid var(--color-neutral-70);
  position: absolute;
  border-radius: var(--border-radius-small);
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  content: '';
  z-index: 20;
}

// Active indicator
.item::before {
  content: '';
  position: absolute;
  display: block;
  height: 16px;
  width: 4px;
  border-radius: var(--border-radius-tiny);
  margin: 8px 0 8px 0;
  pointer-events: none;
  transform: translateX(-20px);
  opacity: 1;
  transition: all 0.2s ease-out;
}
.item[data-active='true']::before {
  background: var(--color-accent-30);
  transform: translateX(-12px);
  opacity: 1;
}

.icon {
  font-size: $font-small;
}

.body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  overflow: hidden;
}

.label,
.subLabel {
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.subLabel {
  color: var(--color-neutral-70);
}

.arrow {
  margin-left: auto;
  font-size: $font-small;
  color: var(--color-neutral-70);
}

.children {
  margin-left: auto;
  opacity: 0;
  transition: opacity 0.2s ease-out;
}
.children:focus {
  opacity: 1;
}

.item:hover .children,
.item:focus-visible .children,
.item[data-always-show-children='true'] .children {
  opacity: 1;
}

@supports selector(.item:has(:focus-visible)) {
  .item:has(:focus-visible) .children {
    opacity: 1;
  }
}

// Modifiers
.item[data-size='s'] .icon {
  font-size: $font-small;
}

.item[data-pad-body-right='true'] .body {
  padding-right: $space-xs;
}

.item[data-has-children='true'] {
  padding-right: $space-xs;
}
