:root {
  --van-sidebar-font-size: var(--van-font-size-md);
  --van-sidebar-line-height: var(--van-line-height-md);
  --van-sidebar-text-color: var(--van-text-color);
  --van-sidebar-disabled-text-color: var(--van-text-color-3);
  --van-sidebar-padding: 20px var(--van-padding-sm);
  --van-sidebar-active-color: var(--van-active-color);
  --van-sidebar-background: var(--van-background);
  --van-sidebar-selected-font-weight: var(--van-font-bold);
  --van-sidebar-selected-text-color: var(--van-text-color);
  --van-sidebar-selected-border-width: 4px;
  --van-sidebar-selected-border-height: 16px;
  --van-sidebar-selected-border-color: var(--van-primary-color);
  --van-sidebar-selected-background: var(--van-background-2);
}

.van-sidebar-item {
  position: relative;
  display: block;
  box-sizing: border-box;
  padding: var(--van-sidebar-padding);
  overflow: hidden;
  color: var(--van-sidebar-text-color);
  font-size: var(--van-sidebar-font-size);
  line-height: var(--van-sidebar-line-height);
  background: var(--van-sidebar-background);
  cursor: pointer;
  user-select: none;

  &:active {
    background-color: var(--van-sidebar-active-color);
  }

  &:not(:last-child)::after {
    border-bottom-width: 1px;
  }

  &__text {
    // https://github.com/vant-ui/vant/issues/7455
    word-break: break-all;
  }

  &--select {
    color: var(--van-sidebar-selected-text-color);
    font-weight: var(--van-sidebar-selected-font-weight);

    &,
    &:active {
      background-color: var(--van-sidebar-selected-background);
    }

    &::before {
      position: absolute;
      top: 50%;
      left: 0;
      width: var(--van-sidebar-selected-border-width);
      height: var(--van-sidebar-selected-border-height);
      background-color: var(--van-sidebar-selected-border-color);
      transform: translateY(-50%);
      content: '';
    }
  }

  &--disabled {
    color: var(--van-sidebar-disabled-text-color);
    cursor: not-allowed;

    &:active {
      background-color: var(--van-sidebar-background);
    }
  }
}
