@debug-console-default-height: 18px;

.debug_console {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.variable_repl_bar {
  display: flex;
  border-top: 1px solid var(--sideBar-border);
  width: 100%;
  overflow: hidden;
  min-height: @debug-console-default-height;
  background-color: var(--editor-background);
  z-index: 1;

  .variable_repl_editor {
    width: 100%;
    z-index: 99;

    :global(.margin) {
      display: none;
    }

    :global(.monaco-editor .lines-content .cigr) {
      box-shadow: none;
    }

    :global(.monaco-editor .lines-content .cigra) {
      box-shadow: none;
    }

    :global(.scroll-decoration) {
      display: none;
    }
  }

  .variable_repl_bar_icon {
    position: relative;
    padding: 0 6px 0 8px;
    min-width: 16px;
    line-height: @debug-console-default-height;
    height: @debug-console-default-height;
    display: flex;
    flex-shrink: 0;
    justify-content: center;
    font-weight: 600;

    :global(.kaitian-icon) {
      font-size: 14px;
      line-height: @debug-console-default-height;
    }
  }
}

.variable_repl_text {
  &.warn {
    color: var(--debugConsole-warningForeground);
  }

  &.error {
    color: var(--debugConsole-errorForeground);
  }

  &.info {
    color: var(--debugConsole-infoForeground);
  }

  &.log {
    color: var(--foreground);
  }

  &.source {
    color: var(--debugConsole-sourceForeground);
  }
}

.debug_console_node {
  display: flex;
  flex-direction: column;
  position: relative;
  user-select: none;

  .debug_console_selection {
    position: absolute;
    top: 0;
    z-index: 1;
    pointer-events: none;

    & .block {
      position: absolute;
      background-color: rgba(225, 255, 255, 0.25);
    }
  }

  a {
    color: currentColor !important;
    cursor: text;

    &.link {
      // 这里 a 标签的父元素的 dispaly 如果是 inline-block 的话，text-decoration 属性会失效，采用 border-bottom 代替
      // text-decoration: underline;
      border-bottom: 1px solid currentColor;
      word-break: break-all;
    }

    &.pointer {
      cursor: pointer;
    }
  }

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

  .debug_console_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);

    .expansion_toggle {
      color: var(--kt-tree-inactiveSelectionForeground) !important;
    }
  }

  &.mod_focused {
    outline: 1px solid var(--list-focusOutline);
    outline-offset: -1px;

    .expansion_toggle {
      color: var(--kt-tree-activeSelectionForeground) !important;
    }
  }

  &.mod_actived {
    outline: 1px solid var(--list-focusOutline);
    outline-offset: -1px;

    .expansion_toggle {
      color: var(--kt-tree-activeSelectionForeground) !important;
    }
  }

  &.mod_loading {
    opacity: 0.8;
  }
}

.debug_console_node_content {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  user-select: text;

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

.debug_console_node_status {
  opacity: 0.75;
  text-align: center;
  font-size: 12px;
  padding-right: 0;
}

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

.debug_console_node_displayname {
  display: inline;
  white-space: inherit;

  &.info {
    color: var(--debugConsole-infoForeground);
  }
}

.debug_console_node_description {
  display: inline;
  white-space: inherit;
  color: var(--descriptionForeground);
}

.debug_console_node_overflow_wrap {
  flex: 1;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  color: var(--foreground);
}

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

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

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

// variable
.debug_console_variable {
  white-space: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow: visible;

  &.name {
    color: var(--debugTokenExpression-name);
  }

  &.value {
    color: var(--debugTokenExpression-value);
  }

  &.error {
    color: var(--debugTokenExpression-error);
  }

  &.number {
    color: var(--debugTokenExpression-number);
  }

  &.boolean {
    color: var(--debugTokenExpression-boolean);
  }

  &.string {
    color: var(--debugTokenExpression-string);
  }
}

// filter
.debug_console_filter {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: flex-end;

  .filter_input {
    width: 300px;
    max-width: 400px;
    margin-right: 8px;
    height: inherit;
    height: 24px;
  }
}

.debug_console_output {
  flex: 1;
  background-color: var(--kt-panelTitle-background);

  :global(.kt-recycle-tree) {
    width: 100% !important;
  }

  .code-bold {
    font-weight: bold;
  }

  .code-italic {
    font-style: italic;
  }

  .code-underline {
    text-decoration: underline;
    text-decoration-style: solid;
  }

  .code-double-underline {
    text-decoration: underline;
    text-decoration-style: double;
  }

  .code-strike-through {
    text-decoration: line-through;
    text-decoration-style: solid;
  }

  .code-overline {
    text-decoration: overline;
    text-decoration-style: solid;
  }

  .code-overline.code-underline.code-strike-through {
    text-decoration: overline underline line-through;
    text-decoration-style: solid;
  }

  .code-overline.code-underline {
    text-decoration: overline underline;
    text-decoration-style: solid;
  }

  .code-overline.code-strike-through {
    text-decoration: overline line-through;
    text-decoration-style: solid;
  }

  .code-underline.code-strike-through {
    text-decoration: underline line-through;
    text-decoration-style: solid;
  }

  .code-overline.code-double-underline.code-strike-through {
    text-decoration: overline underline line-through;
    text-decoration-style: double;
  }

  .code-overline.code-double-underline {
    text-decoration: overline underline;
    text-decoration-style: double;
  }

  .code-double-underline.code-strike-through {
    text-decoration: underline line-through;
    text-decoration-style: double;
  }

  .code-dim {
    opacity: 0.4;
  }

  .code-hidden {
    opacity: 0;
  }

  .code-blink {
    animation: code-blink-key 1s cubic-bezier(1, 0, 0, 1) infinite alternate;
  }

  .code-rapid-blink {
    animation: code-blink-key 0.3s cubic-bezier(1, 0, 0, 1) infinite alternate;
  }

  @keyframes code-blink-key {
    to {
      opacity: 0.4;
    }
  }

  .code-subscript {
    vertical-align: sub;
    font-size: smaller;
    line-height: normal;
  }

  .code-superscript {
    vertical-align: super;
    font-size: smaller;
    line-height: normal;
  }
}
