@use 'mixins/mixins' as *;

@include b(edit-bar) {
  height: 100%;
  background-color: var(--el-bg-color);
  border-radius: var(--el-border-radius-base);
  overflow: hidden;
  box-shadow: 0 1px 4px 0 #ccc;

  @include e(list) {
    &.el-scrollbar {
      height: calc(100% - 48px);
    }
  }

  .el-scrollbar__view {
    padding: 0;
    margin: 0;
  }

  @include e(item) {
    height: 36px;
    border-bottom: 1px solid getCssVar('border-color');
    color: var(--el-text-color-regular);
    font-size: var(--el-font-size-base);
    position: relative;
    transition: color 0.15s;
    list-style: none;
  }

  @include e(tree-item) {
    height: 100%;
  }

  @each $e in (tree-item, item) {
    @include e($e) {
      display: flex;
      align-items: center;
      align-content: center;
      justify-content: space-between;

      &:hover {
        color: var(--el-color-primary);

        .el-edit-bar__action {
          opacity: 1;
        }
      }

      &.el-edit-bar__item--active {
        color: var(--el-color-primary);
      }
    }
  }

  @include e(item-content) {
    height: 100%;
    display: flex;
    align-content: center;
    align-items: center;
    flex-grow: 1;
    cursor: default;
    padding-left: 4px;

    & > *:not(:first-child) {
      vertical-align: middle;
      display: inline-block;
      margin-left: 6px;
    }
  }

  @include e(action) {
    opacity: 0;
    transition: opacity 0.15s;
    width: 60px;

    & > * {
      vertical-align: middle;
      cursor: pointer;
    }
  }

  @include e(title) {
    font-size: 16px;
    flex-grow: 1;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #666;
  }

  @include e(tools) {
    height: 40px;
    padding: 0 8px;
    margin-bottom: 4px;
    box-sizing: border-box;
    font-size: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    align-content: center;
    background-color: getCssVar(bg-color, page);


    &-icon {
      display: inline-flex;
      height: 24px;
      width: 24px;
      justify-content: center;
      align-items: center;
      cursor: pointer;

      &:hover {
        background-color: #eee;
        border-radius: 4px;
      }
    }
  }

  @include e(handle) {
    height: 100%;
    width: 12px;
    cursor: move;
    position: relative;
    display: inline-block;
    background-color: #f3f3f3;

    &::before,
    &::after {
      content: '';
      position: absolute;
      height: 60%;
      top: 20%;
      width: 1px;
      background-color: #ddd;
    }

    &::before {
      left: 2px;
    }
    &::after {
      right: 2px;
    }
  }

  @include e(ghost) {
    opacity: 0;
  }
}
