@use "sass:math";

$line-height: 14px;
$margin-unit: 14px;

$faint-text-color: #aaa;
$light-text-color: #666;
$text-color: #333;

$page-background-color: #eee;

$passing-color: #007069;
$failing-color: #ca3a11;
$pending-color: #ba9d37;
$empty-color: #eff543;
$neutral-color: #bababa;
$jasmine-color: #8a4182;

$passing-mark: "\02022";
$failing-mark: "\d7";
$pending-mark: "*";
$space: "\0020";

$font-size: 11px;
$large-font-size: 14px;

body {
  overflow-y: scroll;
}

.jasmine_html-reporter {
  width: 100%;
  background-color: $page-background-color;
  padding: 5px;
  margin: -8px;

  font-size: $font-size;
  font-family: Monaco, "Lucida Console", monospace;
  line-height: $line-height;
  color: $text-color;

  a {
    text-decoration: none;

    &:hover {
      text-decoration: underline;
    }
  }

  p, h1, h2, h3, h4, h5, h6 {
    margin: 0;
    line-height: $line-height;
  }

  .jasmine-banner,
  .jasmine-symbol-summary,
  .jasmine-summary,
  .jasmine-result-message,
  .jasmine-spec .jasmine-description,
  .jasmine-spec-detail .jasmine-description,
  .jasmine-alert .jasmine-bar,
  .jasmine-stack-trace {
    padding-left: $margin-unit - 5px;
    padding-right: $margin-unit - 5px;
  }

  .jasmine-banner {
    position: relative;
  }

  .jasmine-banner .jasmine-title {
    background: url('../../images/jasmine-horizontal.png') no-repeat;
    background: url('../../images/jasmine-horizontal.svg') no-repeat, none;
    background-size: 100%;
    display: block;
    float: left;
    width: 90px;
    height: 25px;
  }

  .jasmine-banner .jasmine-version {
    margin-left: $margin-unit;
    position: relative;
    top: 6px;
  }

  // This div is available for testing elements that must be added to the DOM.
  // We position it out of view, so it doesn't obstruct the runner.
  #jasmine_content {
    position: fixed;
    right: 100%;
  }

  .jasmine-version {
    color: $faint-text-color;
  }

  //--- Banner ---//

  .jasmine-banner {
    margin-top: $line-height;
  }

  .jasmine-duration {
    color: #fff;
    float: right;
    line-height: $line-height * 2;
    padding-right: 9px;
  }

  //--- Symbol summary ---//

  .jasmine-symbol-summary {
    overflow: hidden;
    margin: $line-height 0;

    li {
      display: inline-block;
      height: math.div($line-height, 2) + 3;
      width: $line-height;

      font-size: 16px;

      &.jasmine-passed {
        font-size: 14px;

        &:before {
          color: $passing-color;
          content: $passing-mark;
        }
      }

      &.jasmine-failed {
        line-height: math.div($line-height, 2) + 2;

        &:before {
          color: $failing-color;
          content: $failing-mark;
          font-weight: bold;
          margin-left: -1px;
        }
      }

       &.jasmine-excluded {
          font-size: 14px;

          &:before {
            color: $neutral-color;
            content: $passing-mark;
          }
        }

        &.jasmine-excluded-no-display {
          font-size: 14px;
          display: none;
        }

      &.jasmine-pending {
        line-height: 17px;
        &:before {
          color: $pending-color;
          content: $pending-mark;
        }
      }

      &.jasmine-empty {
        font-size: 14px;

        &:before {
          color: $pending-color;
          content: $passing-mark;
        }
      }
    }
  }

  .jasmine-run-options {
    float: right;
    margin-right: 5px;
    border: 1px solid $jasmine-color;
    color: $jasmine-color;
    position: relative;
    line-height: 20px;

    .jasmine-trigger {
      cursor: pointer;
      padding: 8px 16px;
    }

    .jasmine-payload {
      position: absolute;
      display: none;
      right: -1px;
      border: 1px solid $jasmine-color;
      background-color: $page-background-color;
      white-space: nowrap;
      padding: 4px 8px;

      &.jasmine-open {
        display: block;
      }
    }
  }

  //--- Alerts: status bars ---//

  .jasmine-bar {
    line-height: $line-height * 2;
    font-size: $large-font-size;

    display: block;
    color: #eee;

    &.jasmine-failed, &.jasmine-errored {
      background-color: $failing-color;
      border-bottom: 1px solid $page-background-color;
    }

    &.jasmine-passed {
      background-color: $passing-color;
    }

    &.jasmine-incomplete {
      background-color: $neutral-color;
    }


    &.jasmine-skipped {
      background-color: $neutral-color;
    }

    &.jasmine-warning {
      margin-top: $margin-unit;
      margin-bottom: $margin-unit;
      background-color: $pending-color;
      color: $text-color;
    }

    &.jasmine-menu {
      background-color: #fff;
      color: $faint-text-color;

      a {
        color: $text-color;
      }
    }

    a {
      color: white;
    }
  }

  // simplify toggle control between the two menu bars
  &.jasmine-spec-list {
    .jasmine-bar.jasmine-menu.jasmine-failure-list,
    .jasmine-results .jasmine-failures {
      display: none;
    }
  }

  &.jasmine-failure-list {
    .jasmine-bar.jasmine-menu.jasmine-spec-list,
    .jasmine-summary {
      display: none;
    }
  }

  //--- Results ---//

  .jasmine-results {
    margin-top: $line-height;
  }

  //--- Results summary: Suites and Specs names/links ---//

  .jasmine-summary {
    margin-top: $margin-unit;

    ul {
      list-style-type: none;
      margin-left: $margin-unit;
      padding-top: 0;
      padding-left: 0;

      &.jasmine-suite {
        margin-top: math.div($margin-unit, 2);
        margin-bottom: math.div($margin-unit, 2)
      }
    }

    li {
      &.jasmine-passed a {
        color: $passing-color;
      }

      &.jasmine-failed a {
        color: $failing-color;
      }

      &.jasmine-empty a {
        color: $pending-color;
      }

      &.jasmine-pending a {
        color: $pending-color;
      }

      &.jasmine-excluded a {
        color: $neutral-color;
      }
    }
  }

  .jasmine-specs {
    li {
      &.jasmine-passed a:before {
        content: $passing-mark + $space;
      }

      &.jasmine-failed a:before {
        content: $failing-mark + $space;
      }

      &.jasmine-empty a:before {
        content: $pending-mark + $space;
      }

      &.jasmine-pending a:before {
        content: $passing-mark + $space;
      }

      &.jasmine-excluded a:before {
        content: $passing-mark + $space;
      }
    }
  }

  .jasmine-description + .jasmine-suite {
    margin-top: 0;
  }

  .jasmine-suite {
    margin-top: $margin-unit;

    a {
      color: $text-color;
    }
  }

  //--- Failure details ---//

  .jasmine-failures {
    .jasmine-spec-detail {
      margin-bottom: $line-height * 2;

      .jasmine-description {
        background-color: $failing-color;
        color: white;

        a {
          color: white;
        }
      }
    }
  }

  .jasmine-result-message {
    padding-top: $line-height;

    color: $text-color;

    white-space: pre-wrap;
  }

  .jasmine-result-message span.jasmine-result {
    display: block;
  }

  .jasmine-stack-trace {
    margin: 5px 0 0 0;
    max-height: $line-height * 16;
    overflow: auto;
    line-height: 18px;

    color: $light-text-color;
    border: 1px solid #ddd;
    background: white;
    white-space: pre;
  }

  .jasmine-expander {
    a {
      display: block;
      margin-left: $margin-unit;
      color: blue;
      text-decoration: underline;
    }
  }

  .jasmine-expander-contents {
    display: none;
  }

  .jasmine-expanded {
    padding-bottom: 10px;
  }

  .jasmine-expanded .jasmine-expander-contents {
    display: block;
    margin-left: $margin-unit;
    padding: 5px;
  }

  .jasmine-debug-log {
    margin: 5px 0 0 0;
    padding: 5px;
    color: $light-text-color;
    border: 1px solid #ddd;
    background: white;

    table {
      border-spacing: 0;
    }

    table, th, td {
      border: 1px solid #ddd;
    }
  }
}
