@import '@opensumi/ide-core-browser/lib/style/variable.less';

.file_tree_node {
  height: 22px;
  line-height: 22px;
  display: flex;
  flex-direction: column;
  position: relative;
  cursor: pointer;
  color: var(--foreground);

  &:hover {
    color: var(--kt-tree-hoverForeground);
    background: var(--kt-tree-hoverBackground);
  }

  .file_tree_node_prompt_box {
    :global(input) {
      &.validate-error {
        color: var(--inputValidation-errorForeground);
        background-color: var(--inputValidation-errorBackground);
        border: 1px solid var(--inputValidation-errorBorder);
      }

      &.validate-info {
        background-color: var(--inputValidation-infoBackground);
        border: 1px solid var(--inputValidation-infoBorder);
        color: var(--inputValidation-infoForeground);
      }

      &.validate-warning {
        background-color: var(--inputValidation-warningBackground);
        border: 1px solid var(--inputValidation-warningBorder);
        color: var(--inputValidation-warningForeground);
      }
    }
  }

  &.mod_selected {
    color: var(--kt-tree-inactiveSelectionForeground) !important;
    background: var(--kt-tree-inactiveSelectionBackground);
  }

  &.mod_focused {
    outline: 1px solid var(--list-focusOutline);
    outline-offset: -1px;
    .file_tree_node_displayname {
      .compact_name {
        &.active {
          text-decoration: underline;
        }
      }
    }
  }

  &.mod_actived {
    outline: 1px solid var(--list-focusOutline);
    outline-offset: -1px;
    .file_tree_node_displayname {
      .compact_name {
        &.active {
          text-decoration: underline;
        }
      }
    }
  }

  &.mod_invalid {
    color: var(--kt-tree-invalidItemForeground);
  }

  &.mod_dragging {
    background: var(--list-dropBackground);
  }

  &.mod_dragover {
    background: var(--list-dropBackground);
  }

  &.mod_loading {
    opacity: 0.8 !important;
  }

  &.mod_cut {
    opacity: 0.5 !important;
  }
}

.file_tree_node_content {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;

  match {
    background-color: var(--editor-findMatchHighlightBackground);
  }
}

.file_tree_node_status {
  opacity: 0.75;
  text-align: center;
  font-size: 12px;
  padding-right: 0;
  line-height: 1;
}

.file_tree_node_segment {
  flex-grow: 0;
  white-space: nowrap;
  color: inherit;
}

.file_tree_node_displayname {
  margin-right: 6px;
  display: inline;
  white-space: pre;
  .compact_name {
    color: inherit;
    &:focus,
    &:hover {
      text-decoration: underline;
    }
    &.active {
      text-decoration: underline;
    }
  }
  .compact_name_separator {
    margin: 0 2px;
    opacity: 0.5;
  }
}

.file_tree_node_inputbox {
  display: inline-block;
  width: 100%;
  input {
    font-size: @base-font-size;
  }
}

.file_tree_node_description {
  display: inline;
  transform: scale(0.96);
  color: var(--descriptionForeground);
}

.file_tree_node_overflow_wrap {
  flex: 1;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  color: inherit;
}

.file_tree_node_prompt_wrap {
  flex: 1;
}

.file_tree_node_flex_wrap {
  display: flex;
  flex-direction: row;
}

.file_tree_node_edit_wrap {
  display: flex;
  width: calc(100% - 50px);
  .file_tree_node_displayname {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

.file_tree_node_segment_grow {
  flex-grow: 1 !important;
  text-align: left;
  z-index: 10;
  padding-right: 5px;

  &.overflow_visible {
    overflow: visible !important;
  }
}

.expansion_toggle {
  min-width: 20px;
  display: flex;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
  color: var(--foreground);
  &.mod_collapsed {
    &:before {
      display: block;
    }
  }

  &:not(.mod_collapsed) {
    &:before {
      display: block;
      transform: rotate(90deg);
    }
  }
}

.file_icon {
  position: relative;
  color: var(--icon-foreground);
  margin-right: 4px;
  &:before {
    font-size: 16px;
    text-align: center;
  }
}

.file_icon:global(&.fileIcon:before) {
  font-size: 18px;
}

.file_tree_node_tail {
  text-align: center;
  margin-right: 10px;
  position: relative;
  height: 22px;
  display: flex;
  align-items: center;
}

.input_wrapper {
  height: 100%;
  width: 100%;
  line-height: normal;
  color: rgb(204, 204, 204);
  position: relative;
}
