:root {
  --evaluation-hex-color: #5bb498;
}

.EvaluationViewer {
  background: var(--stack-vis-background-color);
  line-height: 14px;
  overflow-x: auto;
  overflow-y: auto;
  display: flex;

  .evaluation {
    margin-top: 18px;
  }

  .content {
    height: 100%;
    white-space: nowrap;
    flex: 1;
  }

  .cached .state {
    opacity: 0.5;
  }

  .compilation-error-without-cache {
    width: 100%;
    white-space: normal;
    overflow-y: scroll;
    height: 100%;
    .header-bar-content {
      margin-left: 1em;
    }
    .list {
      font-family: var(--monospace-font-family);
      padding: 1em;
      margin: 0;
      & > li {
        padding: 0.25em 0.5em;
        list-style: none;
        animation: error-animation 1s ease;
        .error-message {
          color: #fff;
          padding: 1px 2px;
          line-height: 18px;
        }
        .line-and-column {
          margin-left: 2px;
          opacity: 0.5;
        }
      }

      .assistance-popover-target .bp5-popover-target {
        display: inline;
      }

      .bp5-popover-target .error-message {
        background-color: var(--editor-background-color);
        border-radius: 3px;
      }
    }
  }

  .header-bar {
    height: 30px;
    box-sizing: initial;
    display: flex;
    align-items: center;
    &:before,
    & > .header-bar-content-fade {
      position: fixed;
      height: 30px;
      width: 100%;
    }
    &:before {
      content: '';
      background: var(--editor-background-color);
      z-index: 5;
    }
    & > .header-bar-content {
      z-index: 10;
      position: relative;
    }
    & > .header-bar-content-fade {
      z-index: 15;
      box-shadow: 0px 3px 7px 5px inset var(--editor-background-color);
      pointer-events: none;
    }
  }

  .controls {
    display: flex;
    align-content: center;
    justify-content: space-between;
    height: 30px;
    align-items: center;

    .viewing-stack {
      margin-left: 10px;
      position: fixed;
    }

    .toggles {
      margin-right: 10px;
      position: fixed;
      right: 0;
    }

    .scenario-switcher {
      & > select {
        background: var(--editor-background-color);
        color: #fffc;
        font-size: 12px;
        border-radius: 0;
        box-shadow: none;
        border-left: 1px solid #fff;
        border-right: 1px solid;
        border-color: var(--stack-vis-background-color);
        width: initial;

        &:hover,
        &:focus {
          background: var(--interface-background-color);
          border-color: var(--editor-background-color);
          outline: none;
        }
      }
      .bp5-icon {
        top: 9px;
      }
    }

    .scenario-detail-icon {
      width: 30px;
      display: inline-flex;
      flex-direction: row;
      align-items: center;
      justify-content: center;
      height: 16px;
      color: var(--toolbar-icon-color);

      &.scenario-generation-error {
        color: #ffd700;
      }
      &-error {
        color: #ff2600;
      }
    }

    & svg {
      width: 14px;
      height: 14px;
    }
    .shrink svg {
      width: 12px;
      height: 12px;
    }

    .bp5-icon:focus,
    .bp5-icon:hover,
    .bp5-button:focus,
    .bp5-button:hover {
      outline: none;
      color: #fff;
    }

    .bp5-button {
      background: none;
      border: none;
      box-shadow: none;
      min-height: inherit;
      height: 16px;
      padding: 0;
      font-size: 12px;
      color: var(--toolbar-icon-color);

      .bp5-icon {
        color: inherit;
      }

      &.stack,
      &.alt-stack {
        padding: 0 4px;
      }
      &.alt-stack {
        color: #ffd700cc;
        &:hover {
          color: #ffd700ff;
        }
      }

      &:focus,
      &:hover {
        outline: none;
        background-color: var(--interface-background-color);
        box-shadow: none;
      }
    }
  }

  &.header-scroll-decoration .header-bar:after {
    content: '';
    display: block;
    width: 100%;
    height: 6px;
    position: absolute;
    top: 30px;
    box-shadow: var(--scrolled-under-shadow);
  }

  .state {
    height: 18px;
    padding-left: 12px;
    align-items: center;
    display: flex;

    &.highlight {
      padding-left: 10px;
      height: 16px;

      .stack-item {
        background-color: transparent;
      }
    }

    &.success {
      background-color: #14691e33;
      border-left: 2px solid #14691e;
    }

    &.active-cursor {
      background-color: var(--editor-background-color);
      .stack-item {
        background-color: var(--interface-background-color);
      }
      &.success {
        background-color: #14691e44;
      }
    }
  }

  .stack-item {
    display: inline-block;
    padding: 0 2px;
    margin: 0 2px;
    background-color: var(--editor-background-color);
    border-radius: 2px;
    font-size: 12px;
    font-family: var(--monospace-font-family);
    cursor: default;
    animation: evaluation-line-animation 1s ease;

    &.named {
      color: #8addff;
    }
    &.number {
      color: #b5cea8;
    }
    &.binary {
      color: #a8bcce;
    }
    &.hex {
      color: var(--evaluation-hex-color);
    }
    &.error {
      background-color: transparent;
      color: #b3675a;
      &:before {
        content: 'ⓧ';
        font-size: 8px;
        margin-right: 6px;
        vertical-align: middle;
      }
      &.error-with-help {
        background-color: #b3675a11;
      }
    }
  }

  .spacer {
    display: inline-block;
    width: 8px;
    height: 100%;
    margin-right: 4px;

    &.spacer-conditional-executed {
      border-right: 1px solid #7d584b;
    }
    &.spacer-conditional-skipped {
      border-right: 1px solid #322a29;
    }
    &.spacer-evaluation {
      border-right: 1px solid #b2980a;
    }
  }
}

.stack-popover,
.control-tooltip,
.control-popover,
.help-popover {
  .bp5-popover-content {
    background: var(--interface-background-color) !important;
  }
  .bp5-popover-arrow-fill {
    fill: var(--interface-background-color) !important;
  }
}

.control-popover {
  .bp5-popover-content {
    max-width: 500px !important;
  }
}

.help-popover {
  .bp5-popover-content {
    color: #fff !important;
    padding: 4px 12px;
    max-width: 600px !important;
    padding: 14px;
    line-height: 20px;
  }
  .help-popover-scroll {
    max-height: 500px;
    overflow-y: auto;
  }
  & em {
    font-weight: bold;
    font-style: normal;
  }
  & code {
    background-color: var(--editor-background-color);
    padding: 0 4px;
    border-radius: 3px;
  }
  & summary,
  & ol,
  & ul {
    margin-bottom: 8px;
  }

  .assistance-section {
    margin: 14px 0;
    & + .assistance-section {
      padding-top: 14px;
      border-top: 1px dashed var(--editor-background-color);
    }
    &:first-child {
      margin-top: 0;
    }
    &:last-child {
      margin-bottom: 0;
    }
  }

  .error-signed-message-hex {
    font-family: var(--monospace-font-family);
    color: var(--evaluation-hex-color) !important;
    background-color: var(--editor-background-color);
    border-radius: 3px;
    padding: 0px 4px;
  }
}

.generated-scenario {
  overflow: auto;
  background-color: var(--editor-background-color);
  display: block;
  border-radius: 3px;
  padding: 1em;
  max-height: 100px;
  & pre {
    margin: 0;
  }
}

.scenario-logging-options {
  margin: 1em 0;
}

.scenario-logging-options > button {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: 0 none;
  line-height: inherit;
  color: inherit;
  opacity: 0.9;
  display: inline-block;
  padding: 0;
  text-decoration: underline;
  cursor: pointer;
  &:hover {
    opacity: 1;
  }
  &:active {
    transform: translateY(1px);
  }
}

.control-tooltip,
.control-popover {
  .bp5-popover-content {
    color: #fff !important;
    padding: 4px 12px;
  }
}

.stack-popover {
  .bp5-popover-content {
    max-width: 400px !important;
    overflow-wrap: break-word;
    font-family: var(--monospace-font-family);
    color: var(--evaluation-hex-color) !important;
    padding: 12px;
  }
}

@keyframes evaluation-line-animation {
  0% {
    background-color: rgba(255, 255, 255, 0.2);
  }
  100% {
    background-color: rgba(0, 0, 0, 0);
  }
}

@keyframes error-animation {
  0% {
    background-color: rgba(255, 0, 0, 0.2);
  }
  100% {
    background-color: rgba(0, 0, 0, 0);
  }
}
