@use 'mixins/mixins' as *;
@use 'mixins/var' as *;
@use 'common/var' as *;

:root,
:host {
  --xzx-sidebar-width: 103px;
  --xzx-sidebar-active-background: transparent;
}

@include b(sidebar) {
  width: var(--xzx-sidebar-width);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background-color: var(--xzx-sidebar-active-background);
}

:root,
:host {
  --xzx-sidebar-font-size: var(--xzx-text-base);
  --xzx-sidebar-line-height: 24px;
  --xzx-sidebar-text-color: var(--xzx-text-gray-1);
  --xzx-sidebar-disabled-text-color: var(--xzx-text-gray-4);
  --xzx-sidebar-padding: 16px;
  //--xzx-sidebar-active-color: var(--xzx-color-primary);
  --xzx-sidebar-background: var(--xzx-gray-1);
  --xzx-sidebar-selected-font-weight: bold;
  --xzx-sidebar-selected-text-color: var(--xzx-color-primary);
  --xzx-sidebar-selected-border-width: 3px;
  --xzx-sidebar-selected-border-height: 14px;
  --xzx-sidebar-selected-border-color: var(--xzx-color-primary);
  --xzx-sidebar-selected-background: transparentize();
  --xzx-sidebar-selected-border-radius: var(--xzx-br-md);
}

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

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

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

  @include e(text) {
    // https://github.com/vant-ui/vant/issues/7455
    word-break: break-all;
  }

  @include m(front) {
    border-radius: 0 0 var(--xzx-sidebar-selected-border-radius) 0;
  }
  @include m(back) {
    border-radius: 0 var(--xzx-sidebar-selected-border-radius) 0 0;
  }

  @include m(select) {
    color: var(--xzx-sidebar-selected-text-color);
    font-weight: var(--xzx-sidebar-selected-font-weight);

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

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

  @include m(disabled) {
    color: var(--xzx-sidebar-disabled-text-color);
    cursor: not-allowed;

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