@charset "UTF-8";

/* © DialogueTrainer */

@use 'base' as *;

$node-z-index: 4;

.w {
  position: absolute;
  z-index: $node-z-index;
  padding: .5em 1em;
  font-size: 11px;
  color: var(--t-fg-default);
  cursor: move;
  background-color: var(--t-bg-highlight);
  border-radius: .5em;
  transition: background-color .15s ease-out, color .15s ease-out, border-bottom-width .1s linear, border-top-width .1s linear;

  ul {
    padding: 0;
    margin: 0;
  }

  &.computer {
    border: 3px solid $col-node-computer;
  }

  &.player {
    border: 3px solid $col-node-player;
  }

  &.situation {
    border: 3px solid $col-node-situation;
  }

  &.editing,
  &.jtk-drag {
    z-index: 5;
  }

  .nodeContent {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    padding: .5em;
    background: transparent;
  }

  @mixin lighterTypeColors($lightenAmount) {
    &.computer {
      color: color-yiq(lighten($col-node-computer, $lightenAmount));
      background-color: lighten($col-node-computer, $lightenAmount);
    }

    &.player {
      color: color-yiq(lighten($col-node-player, $lightenAmount));
      background-color: lighten($col-node-player, $lightenAmount);
    }

    &.situation {
      color: color-yiq(lighten($col-node-situation, $lightenAmount));
      background-color: lighten($col-node-situation, $lightenAmount);
    }
  }

  &.ancestorOfSelected, &.descendantOfSelected {
    @include lighterTypeColors(45%);
  }

  &.parentOfSelected, &.childOfSelected {
    @include lighterTypeColors(35%);
  }

  &.ancestorOfSelected {
    border-bottom-width: 6px;
  }

  &.parentOfSelected {
    border-bottom-width: 8px;
  }

  &.descendantOfSelected {
    border-top-width: 6px;
  }

  &.childOfSelected {
    border-top-width: 8px;
  }

  &:hover,
  &.color-label.jtk-hover,
  &.jtk-source-hover,
  &.jtk-target-hover {
    @include lighterTypeColors(35%);
  }

  &.ui-selecting {
    @include lighterTypeColors(35%);
  }

  &.selected,
  &.ui-selected,
  &.jtk-drag-selected {
    @include lighterTypeColors(15%);

    z-index: $node-z-index + 1;

    &.ui-selecting {
      @include lighterTypeColors(5%);
    }
  }

  &:not(.jtk-drag):not(.jtk-drag-active) {
    > .ep {
      position: absolute;
      top: -10px;
      right: -10px;
      bottom: -10px;
      left: -10px;
      cursor: pointer;
      border-radius: 12px;
      transition: box-shadow .15s ease-in, color .15s ease-in;

      &:hover {
        box-shadow: 0 0 15px 2px rgba(black, .15), 0 1px 3px 0 rgba(black, .15);

        .anchor {
          background-color: black;
          transition: background-color .25s ease;

          &::after {
            opacity: .25;
            transform: scale(5);
          }
        }
      }

      .anchor {
        position: absolute;
        top: 50%;
        right: auto;
        bottom: 50%;
        left: calc(100% - 10px);
        width: 4px;
        height: 4px;
        pointer-events: none;
        background-color: transparent;
        border-radius: 50%;
        transition: background-color .25s ease, left 0s step-end .15s, top 0s step-end .15s, right 0s step-end .15s, bottom 0s step-end .15s;

        &::after {
          content: '';
          position: absolute;
          top: 0;
          right: 0;
          bottom: 0;
          left: 0;
          display: block;
          background-color: black;
          border-radius: 50%;
          opacity: 0;
          transition: opacity .25s ease, transform .25s ease;
        }
      }
    }

    &:not(.jtk-connected) {
      > .ep {
        > .anchor {
          background-color: rgba(black, .75);
          // Only show anchor on not connected nodes
          transition: background-color .25s ease, left .15s linear, top .15s linear, right .15s linear, bottom .15s linear;
        }

        &:hover {
          > .anchor {
            background-color: black;
            transition: background-color .25s ease, left .15s linear, top .15s linear, right .15s linear, bottom .15s linear;
          }
        }
      }
    }
  }

  > .ep::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    width: 100%;
    height: 100%;
    border: 4px solid transparent;
    border-radius: 10px;
    box-sizing: border-box;
  }

  &.highlight-value-positive > .ep::before {
    border-color: rgba($col-positive, .35);
  }

  &.highlight-value-neutral > .ep::before {
    border-color: rgba($col-warning, .35);
  }

  &.highlight-value-negative > .ep::before {
    border-color: rgba($col-negative, .35);
  }

  &.highlight-no-effect > .ep::before {
    border-color: rgba(desaturate($col-editor, 65%), .35);
  }

  &.highlight-operator-addAssign > .ep::before,
  &.highlight-operator-subtractAssign > .ep::before {
    border-style: dashed;
  }

  &.highlight-operator-subtractAssign > .ep::before {
    border-color: rgba($col-negative, .35);
  }
}

.color-label.jtk-hover,
.jtk-source-hover,
.jtk-target-hover {
  color: white;
}

.color-label {
  padding: .3em;
  cursor: pointer;
  background-color: white;
  border: 1px solid rgba(black, .5);
  border-radius: .5em;
  opacity: .8;
  transition: background-color .15s ease-in, color .15s ease-in;
}

.jtk-endpoint {
  z-index: 3;
}

.jtk-connector path {
  cursor: pointer;
}
