.file-tree-wrapper {
  border: 1px solid fixit-var(global-border-color);
  padding: 0.5rem;
  font-size: 0.8rem;
  line-height: 1;
  margin-block: 0.5rem;
  @include border-radius;
  transition: box-shadow 0.2s ease;

  &:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);

    [data-theme=dark] & {
      box-shadow: 0 2px 8px rgba(255, 255, 255, 0.1);
    }
  }

  ul.file-tree {
    list-style: none;
    margin: 0;
    padding: 0;

    .file-tree-item {
      position: relative;

      &.file-tree-folder {
        > .file-tree-toggle {
          cursor: pointer;
          font-weight: bold;

          [data-theme=dark] & {
            color: #ddd;
          }

          &:hover {
            i,
            span {
              opacity: 0.6;
            }
          }
        }
      }

      .file-tree-label {
        display: inline-flex;
        align-items: center;
        position: relative;
        gap: 0.25rem;
        padding: 0.25rem 0.5rem;
        transition: all 0.15s ease;
        @include border-radius;

        .file-tree-icon {
          width: 1rem;
          text-align: center;
          flex-shrink: 0;
        }

        .file-tree-label__inner {
          word-break: break-all;
        }

        &.is-highlighted {
          color: fixit-var(global-link-hover-color);
        }
      }
    }

    &:not([data-level='0']) {
      .file-tree-item {
        margin: 0.25rem 0;
        padding-left: 0.25rem;

        .file-tree-label::before {
          content: "";
          position: absolute;
          top: 50%;
          left: -0.5rem;
          translate: 0 -50%;
          width: 0.75rem;
          height: 1px;
          background-color: fixit-var(secondary);
        }
      }
    }
  }

  .file-tree .file-tree {
    padding-left: 1.25rem;
    position: relative;

    &::before {
      content: "";
      position: absolute;
      top: -0.25rem;
      bottom: 0.625rem;
      left: calc(1rem - 0.5px);
      width: 1px;
      background-color: fixit-var(secondary);
      height: fixit-var(file-tree-line-height);
    }
  }

  .file-tree-item.is-collapsed {
    > .file-tree {
      display: none;
    }

    > .file-tree-label .file-tree-icon::before {
      --fa: '\f07b';
    }
  }
}
