$color-text-secondary-text: #99a1a3;
$color-border-primary: #858c8f;
$color-border-secondary: #282a2f;
$color-error-background: #cc0000;

:global {
  html,
  body {
    height: 100%;
  }

  body {
    font-size: 16px;
    font-family: 'Roboto', sans-serif;
    line-height: 1.5;
    display: flex;
    flex-flow: column;
    flex-shrink: 0;
    flex-grow: 1;
    overflow-x: hidden;
    overflow-y: scroll;

    font-smoothing: grayscale;
    text-rendering: optimizeLegibility;

    background: #151619;

    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    outline: none;
  }

  a {
    text-decoration: none;
    color: inherit;
  }

  button {
    border: none;
  }

  h1,
  h2,
  h3,
  h4,
  h5,
  h5 {
    font-weight: inherit;
    font: inherit;
  }

  li {
    list-style: none;
  }

  table {
    border-spacing: 0;
  }

  p + p {
    margin-top: 5px;
  }

  // @see https://stackoverflow.com/a/23211766/368691
  input {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
  }

  // @see https://stackoverflow.com/a/36043286/368691
  input:not([type="radio"]):not([type="checkbox"]) {
    border-radius: 0;
  }

  #app {
    display: flex;
    flex-flow: column;
    flex-shrink: 0;
    flex-grow: 1;
  }

  #dashboard {
    margin: 20px;
    margin-right: calc(30vw + 20px);
    overflow: hidden;
  }
}

.activity-message {
  border: 1px solid $color-border-secondary;
  color: $color-text-secondary-text;
  padding: 20px;
  text-align: center;
}

.error-message {
  background: $color-error-background;
  color: #fff;
  padding: 21px;
  text-align: center;
}

.tests {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  grid-gap: 20px;

  h2 {
    font-size: 16px;
    font-weight: bold;
  }

  & > li {
    background: #191b1f;
    border: 1px solid $color-border-secondary;
    color: #fff;
    overflow: hidden;
    box-shadow: 0px 3px 1px -2px rgba(0,0,0,0.2), 0px 2px 2px 0px rgba(0,0,0,0.14), 0px 1px 5px 0px rgba(0,0,0,0.12);

    &::before {
      content: '';
      display: block;
      height: 5px;
      background: $color-error-background;
    }
  }
}

.failing-test {
  padding: 10px;

  & > * {
    margin: 10px;
  }

  .error {
    background: $color-error-background;
    overflow: hidden;

    h1 {
      font-weight: bold;
    }

    .stack {
      background: #ffe7e8;
      border-left: 5px solid #e66465;
      font-family: consolas,"Liberation Mono",courier,monospace;
      padding: 10px;
      white-space: pre;
      color: #111;
      overflow: scroll;
    }

    & > * {
      margin: 10px;
    }
  }

  .name {
    dt {
      font-size: 16px;
      color: $color-text-secondary-text;
      margin: 0 0 5px 0;
    }

    dd {
      color: #fff;
      font-weight: bold;
    }
  }

  .labels {
    overflow: hidden;

    & > h1 {
      color: $color-text-secondary-text;
      margin: 0 0 5px 0;
    }

    & > ul {
      li {
        display: block;
        border: 1px solid $color-border-secondary;
        padding: 5px 10px;
        margin: 0 5px 5px 0;
        cursor: pointer;

        dl {
          display: block;

          dt {
            display: inline-block;
            font-weight: bold;
          }
        }

        &:hover {
          background: rgba(0,0,0,0.2);
        }
      }
    }
  }
}

.all-tests-passing-message {
  background: #39aa55;
  color: #fff;
  padding: 20px;
  text-align: center;
}

.text-button {
  display: inline-flex;
  user-select: none;
  cursor: pointer;
  font: inherit;
  padding: 10px 20px;
  border: 1px solid $color-border-primary;
  background: rgba(0,0,0,.2);
  color: $color-text-secondary-text;

  &:hover {
    background: rgba(0,0,0,.5);
    border-color: $color-border-secondary;
    color: #fff;
  }
}

.test-panel {
  border-left: 1px solid $color-border-secondary;
  background: #191b1f;
  position: fixed;
  width: 30vw;
  top: 0;
  bottom: 0;
  right: 0;
  overflow-y: scroll;

  .message {
    border: 1px solid $color-border-secondary;
    text-align: center;
    padding: 20px;
    margin: 20px;
    color: $color-text-secondary-text;
  }

  .explanations {
    margin: 20px;

    li {
      margin-top: 20px;

      &:first-child {
        margin: 0;
      }
    }

    dt {
      display: block;
      color: $color-text-secondary-text;
      margin: 0 0 10px 0;
    }

    dd {
      background: #ffe7e8;
      border-left: 5px solid #e66465;
      font-family: consolas,"Liberation Mono",courier,monospace;
      padding: 10px;
      white-space: pre;
      display: block;
    }
  }
}

.test-filter {
  margin-bottom: 20px;

  input {
    background: #0a0b0c;
    border: 1px solid $color-border-secondary;
    box-shadow: 0px 3px 1px -2px rgba(0,0,0,0.2), 0px 2px 2px 0px rgba(0,0,0,0.14), 0px 1px 5px 0px rgba(0,0,0,0.12);
    display: block;
    position: relative;
    width: 100%;
    height: 40px;
    font: inherit;
    color: $color-text-secondary-text;
    padding: 10px;

    &:focus {
      background: #252e2e;
      border-color: #73c990;
      color: #fff;
    }
  }

  .instructions {
    padding: 10px;
    margin-top: 10px;
    color: $color-text-secondary-text;

    a {
      text-decoration: underline;
    }
  }

  .error-message {
    background: $color-error-background;
    color: #fff;
    padding: 10px;
    margin-top: 10px;
  }
}
