@import './var.less';

:root {
  --van-sidebar-font-size: @sidebar-font-size;
  --van-sidebar-line-height: @sidebar-line-height;
  --van-sidebar-text-color: @sidebar-text-color;
  --van-sidebar-disabled-text-color: @sidebar-disabled-text-color;
  --van-sidebar-padding: @sidebar-padding;
  --van-sidebar-active-color: @sidebar-active-color;
  --van-sidebar-background-color: @sidebar-background-color;
  --van-sidebar-selected-font-weight: @sidebar-selected-font-weight;
  --van-sidebar-selected-text-color: @sidebar-selected-text-color;
  --van-sidebar-selected-border-width: @sidebar-selected-border-width;
  --van-sidebar-selected-border-height: @sidebar-selected-border-height;
  --van-sidebar-selected-border-color: @sidebar-selected-border-color;
  --van-sidebar-selected-background-color: @sidebar-selected-background-color;
}

.van-sidebar-item {
  position: relative;
  display: flex;
  box-sizing: border-box;
  min-height: 60px;
  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);
  text-align: center;
  background: var(--van-sidebar-background-color);
  cursor: pointer;
  user-select: none;

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

  &__text {
    position: static;
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

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

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

    .van-sidebar-item__text {
      min-height: 52px;
      padding: 0 4px;
      background-color: var(--van-sidebar-selected-background-color);
      border-radius: var(--van-border-radius-lg);
    }

    &::before {
      position: absolute;
      top: 24px;
      left: 8px;
      width: var(--van-sidebar-selected-border-width);
      height: var(--van-sidebar-selected-border-height);
      background-color: var(--van-sidebar-selected-border-color);
      border-radius: var(--van-border-radius-md);
      content: '';
    }
  }

  .van-badge--fixed {
    top: 10px;
    right: 10px;
    transform: none;
  }

  .van-badge--dot {
    top: 20px;
    right: 14px;
    width: 6px;
    height: 6px;
    background-color: var(--van-red);
  }

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

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