$project-name-height: 30px;
$normal-icon-size: 16px;

:host {
  --mat-tree-node-min-height: 22px;
  --mat-tree-container-background-color: var(--sb-page-background);
  height: calc(100% - $project-name-height);
  width: 100%;
  user-select: none;
  font-size: 16px;
  cursor: pointer;
  position: absolute;
  overflow-y: auto;

  .mat-tree-node {
    position: relative;

    display: flex;
    align-items: center;
    border-radius: 4px;
    transition: background-color 0.3s;
    overflow: hidden;
    .node-wrapper {
      flex: 1;
      position: relative;
      height: var(--mat-tree-node-min-height);
      display: flex;
      align-items: center;
      flex-wrap: nowrap;
      .file-icon {
      }
      .file-text {
        white-space: nowrap; /* 防止文字换行 */
        overflow: hidden; /* 隐藏超出容器的内容 */
        text-overflow: ellipsis; /* 超出部分显示省略号 */
        flex: 1;
        // display: inline-block; /* 确保文本在一个水平线上 */
        // max-width: 100%; /* 设置最大宽度，确保文本不会超出容器 */
      }
    }
    &.editing {
      .editing-box {
        flex: 0;
        display: flex;
        align-items: center;
      }
      &.creatingFile,
      &.creatingFolder {
        padding-bottom: 22px;
        .editing-box {
          top: 22px;
        }
      }
      &.renaming {
        .editing-box {
          top: 0;
        }
      }
    }

    &.drop-above {
      border-top: 2px solid #007acc;
      background-color: rgba(0, 122, 204, 0.2);
      margin-top: -1px;
    }

    &.drop-below {
      border-bottom: 2px solid #007acc;
      background-color: rgba(0, 122, 204, 0.2);
      margin-bottom: -1px;
    }

    &.drop-center {
      background-color: rgba(0, 122, 204, 0.4);
    }

    .mat-tree-node-content {
      display: flex;
      align-items: center;
    }
    .editing-box {
      position: absolute;
      display: none;
      height: 22px;
      z-index: 2;
      left: 20px; // icon-size
      overflow: hidden;
      .edit-icon {
        flex-shrink: 0;
        width: 20px;
        height: 20px;
      }
      .edit-input {
        flex-grow: 1;
        outline: 0;
        border: 0;
        height: 100%;
        padding: 2px 4px;
        background: var(--sb-page-background);
        border: 1px solid var(--inputValidation-infoBorder);
        color: #fff;
      }
    }
    &:hover {
      opacity: 0.8;
    }

    &.active {
      color: var(--sb-foreground);
      --textColor: currentColor !important;
      background-color: var(--list-inactiveSelectionBackground);
      .node-actions {
        background-color: var(--list-inactiveSelectionBackground);
      }
    }

    .toggle-icon {
      position: absolute;
      left: -20px;
      width: 20px;
      height: 20px;
      font-size: 20px;
      top: 0;
      bottom: 0;
      margin: auto 0;
    }

    &:hover .node-actions {
      visibility: visible;
    }
  }
  .mat-icon {
    width: 16px;
    height: 16px;
    font-size: 16px;
    margin-right: 3px;
  }

  .node-actions {
    z-index: 1;
    visibility: hidden;
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 2px;
    .mat-icon {
      margin-right: 3px;
      &:hover {
        opacity: 0.7;
      }
    }
  }
}
