
@import "bourbon/bourbon";

// Reset (on top of standard normalize.css)

html, body {
  margin: 0px;
  padding: 0px;
  height: 100%;
}

body {
  font-family: Verdana, Arial, Helvetica;
  font-size: 12px;
}

* { @include box-sizing(border-box); }
.introjs-helperNumberLayer { @include box-sizing(content-box); }

h1, h2, h3, h4, p, form, ul {
  margin: 0px;
  padding: 0px;
}

h1 {
  font-size: 30px;
  margin: 0.5em 0;
}

h2 {
  margin: 1em 0;
}

// Task description

#task_description {
  p {
    margin: 0.75em 0;
  }
  code {
    font-size: 9pt;
  }
}

// Helpers
.two-columns {
  @include clearfix;
  > div {
    float: left;
    width: 50%;
    height: 100%;
    min-height: 1px;
  }
  > div:first-child { text-align: left; }
  > div:first-child + div { text-align: right; }
}

.three-columns {
  @include clearfix;
  > div {
    float: left;
    width: 33.3%;
    height: 100%;
    min-height: 1px;
  }
  > div:first-child { text-align: left; }
  > div:first-child + div { text-align: center; }
  > div:first-child + div + div { text-align: right; }
}

.tab-columns {
  @include clearfix;
  > div {
    float: left;
    height: 100%;
    min-height: 1px;
  }
  > div:first-child {
    text-align: left;
    width: 15%;
    // background: red;
  }
  > div:first-child + div {
    text-align: left;
    width: 57%;
    z-index: 999;
  }
  > div:first-child + div + div {
    text-align: right;
    width: 28%;
    // background: blue;
  }
}

.clr {
  clear: both;
}

// Candidate UI

$grey1: #f5f6f7;
$grey2: #aaa;
$grey3: #777;
$codility-light-blue: #2b9cd9;

#page {
  min-height: 100%;
  position: relative;

  $header-height: 53px;
  // Standard padding used throughout the interface
  $padding: 10px;

  #header {
    padding: 0px;
    text-align: center;
    height: $header-height;
    background: $grey1;

    .logos {
      position: absolute;
      top: 10px;
      line-height: 30px;
      margin: auto;
      left: 0;
      right: 0;
      > img {
        display: inline-block;
        margin-top: 2px;
        vertical-align: middle;
      }
      > span { // "for"
        color: #999;
        font-size: 10px;
        vertical-align: middle;
        margin: 14px;
      }
      > .img-company-logo-small {
        height: 30px;
        margin-right: 10px;
      }
      > .test-logo {
        font-family: Droid Sans Mono, Courier, monospace;
        font-weight: bold;
        font-size: 21px;
        text-decoration: none;
        color: white;
        > span { color: $codility-light-blue; }
      }
    }
    .top-bar {
      height: 27px;
      line-height: 27px;
      vertical-align: middle;
      color: #222;
      > .passcode {
        padding-left: 1em;
        color: #999;
      }
      #clock {
        font-size: 140%;
        padding: 5px $padding;
        &.introjs-showElement{
          color:black
        }
      }
    }

    .settings-bar {
      height: 25px;
      line-height: 25px;
      vertical-align: middle;
      padding: 0 $padding;
      border-bottom: 1px solid $grey2;

      font-size: 80%;
      position: relative;
      z-index: 999;
    }

    .task-list {
      float: left;
      list-style-type: none;
      .task {
        cursor: pointer;
        float: left;
        margin: 0 .2em;
        padding: 0 1em;
         // Width hardcoded to match "Task N"; avoid jump between normal and bold
        width: 6.5em;
        text-align: center;
        // Hackity hack- simple tab look
        border: 1px solid $grey2;
        border-bottom: 0;
        border-radius: 5px 5px 0 0;
        height: 19px; // 2px gap intentional
        margin-top: 3px;
        line-height: 20px;
        background-color: $grey1;
        &.active {
          background: white;
          font-weight: bold;
          // Simple tab look continued
          border-bottom: 1px solid white;
          height: 22px;
        }
        &.inactive {
          cursor: default;
          color: $grey2;
          font-style: italic;
        }
      }
      &.disabled .task {
        cursor: default;
        color: $grey2;
      }
    }
  }

  #content {
    @include position(absolute, $header-height 0px 0px 0px);
    min-height: 500px;

    $left-size: 40%;
    #task {
      @include position(absolute, 0px 100%-$left-size 0px 0px);
      padding: $padding;
      > div {
        height: 100%;
        position: relative;
        #task_description {
          overflow: auto;
          padding-right: $padding;

          position: relative;
          .placeholder {
            @include position(absolute, 0px 0px 0px 0px);
            margin: 75px 50px;
            padding: 10px;

            border: 5px dashed $grey2;
            border-radius: 10px;

            span {
              @include position(absolute, 40% 0px 0 0px);
              display: block;
              text-align: center;

              color: $grey2;
              font-size: 20px;
              font-weight: bold;
            }
          }
        }
        .under-task {
          // stick to bottom
          @include position(absolute, 0 0px 0px 0px);
          padding-top: $padding;
        }
      }
    }

    #rightColumn {
      @include position(absolute, 0px 0px 0px $left-size);
      padding: $padding;
      > div {
        height:100%;
        position: relative;

        #edit {
          #solution {
            width: 100%;
          }

          #solution, .ace {
            border: 1px solid $grey2;
            border-bottom: none;
            margin: 0;
            height: 100%;
          }

          #solution, .ace {
            // Override default Ace styles
            font-family: Droid Sans Mono, Courier, monospace !important;
            font-size: 12px !important;
          }

          //diff engine css
          .highlight-changed-line{
              position:absolute;
              background:rgba(150, 200, 150, 0.2);
              z-index:20
          }
          .diff_widget_wrapper {
              background: inherit;
              color: inherit;
              border:none
          }
          .diff_widget {
              border-top: solid 2px;
              border-bottom: solid 2px;
              margin: 5px 0;
              padding: 1px 0px 1px 50px;
              white-space: pre-wrap;
          }
          .diff_widget.diff_widget_default, .diff_widget_arrow.diff_widget_default{
              border-color: #fff0f0
          }
          .diff_widget_arrow {
              position: absolute;
              border: solid 5px;
              border-top-color: transparent!important;
              border-right-color: transparent!important;
              border-left-color: transparent!important;
              top: -5px;
          }
          //end of diff engine css
        }
        #reset_btn {
          position: absolute;
          top: 0;
          right: 0;
          margin: $padding;
        }

        .under-edit {
          // stick to bottom
          @include position(absolute, 0 0px 0px 0px);
          #editor_bar {
            /* Give enough space to prevent glitches */
            line-height: 15px;
            border: 1px solid $grey2;
            border-top: none;
            padding: 2px 5px;
            color: $grey3;
            background-color: $grey1;
            a, a:visited {
              color: $grey3;
            }
          }

          .buttons-toolbar {
            margin: 10px 0;
            input {
              margin: 0 1em;
            }
          }
          #resize_console_button {
            float: right;
            margin-top: -25px;
          }

          #cui_console {
            height: 200px;
            font-family: Droid Sans Mono, Courier, monospace;
            font-size: 12px;
            overflow: auto;
            padding: 5px;
            border: 1px solid $grey2;
            background: $grey1;
            position: relative;

            .loader {
              @include position(absolute, 1px 1px 1px 1px);
              background-color: rgba(255, 255, 255, 0.7);
              text-align: center;

              font-family: Verdana, Arial, Helvetica;

              $distance: 25px;

              .message {
                font-size: 16px;
                font-weight: bold;
                margin-top: 50px;
                margin-bottom: $distance;
              }
              .comment {
                margin-top: $distance;
              }
            }

            &.maximized{
              height: 400px;
            }

            a, a:visited {
              color: inherit;
            }

            // Easter eggs
            .quote {
              color: blue;
              font-style: italic;
              margin-top:0.75em;
              float:right;
            }
          }
        }
      }
    }
  }
}

// Test cases

$tc-size: 34px;
$tc-padding: 16px;

@mixin fake-button {
  cursor: pointer;
  @include user-select(none);
}

.test-case-row {
  height: $tc-size;
  width: 100%;
  display: table;
  text-align: left;
  padding: 0px;
  padding-right: 15px;

  img { margin-top: 3px; }

  > * {
    display: table-cell;
    height: 100%;
    vertical-align: middle;
  }
  .left, .right {
    min-width: $tc-size;
    width: $tc-size;
    text-align: right;
  }

  .right { text-align: center; }

  .wide {
    width: 100%;
    padding: 0 $tc-padding;
  }
}

#example_test_case { display: none; }

#add_test_case {
  @include fake-button;
  @include linear-gradient($grey1, #ddd);
  &:hover { @include linear-gradient(#eee, #ccc); }
  border: 1px solid $grey3;

  .counter {
    padding-right: $tc-padding;
  }

  .case-format {
    font-family: Droid Sans Mono, Courier, monospace;
    color:#888;
    white-space: nowrap;
  }

  &.limit-reached .plus { visibility: hidden; }
}

#test_cases .test-case:first-child {
  border-top:1px solid #777777;
  border-radius: 2px 2px 0 0;
}

.test-case {
  margin-top: -1px;
  border: 1px solid $grey3;
  border-width: 0px 1px;
  box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.2);

  .remove {
    font-size:18px;
    color: rgb(188,188,188);
    @include fake-button;
    &:hover{
      color: #dd5500;
    }
  }

  .edit {
    font-size: 14px;
    line-height: 18px;
    color: rgb(188,188,188);
    @include fake-button;
    &:hover{
      color: #188ed4;
    }

    .hide-edit & { display: none; }
  }

  &:hover {
    box-shadow: inset 1px 1px 5px rgba(24, 142, 212, 0.5);
    border-color: #188ed4;
  }

  .wide {
    input {
      border: none;

      width: 100%;
      height: 100%;

      background: transparent;
      font-family: Droid Sans Mono, Courier, monospace;
      outline: none;
    }
  }
}


// Modals

.jqmWindow {
  position: absolute !important;
  // default is fixed, but that prevents modals from scrolling on tiny screens

  padding: 40px !important;
  text-align: center;

  @include box-sizing(content-box);
  * { @include box-sizing(content-box); }
  button, input, select { @include box-sizing(border-box); }

  h2 {
    margin-top: 0px;
    font-weight: normal;
  }

  .message {
    padding-bottom: 20px;
    font-size: 120%;
    background: none;
    border: none;
  }

  .bugfix_msg {
    font-size: 20px;
    padding-bottom:4px;
    display:inline-block;
    font-weight: bold;
  }

  .verify-details {
    font-family: Droid Sans Mono, Courier, monospace;
    border: 1px solid black;
    padding: 5px;
    overflow: auto;
    max-height: 160px;
    font-size: 12px;
  }

  .dialog_buttons {
    text-align: center;
    input {
      border: 1px solid #bbb;
      border-radius: 2px;
      min-width: 120px;
      padding: .6em 1.2em;
      margin-left: 10px;
      margin-right: 10px;
      font-size: 120%;

      background: #eee;

      &:hover {
        background: #f7f7f7;
      }

      &:disabled:hover {
        background: #eee;
      }

      &:disabled {
        color: #bbb;
      }
    }
  }

  // Forms

  form th {
    text-align: right;
  }

  form th, form td {
    padding: 4px 0;
  }

  form ul {
    margin: 0;
    padding: 0;
    list-style-type: none;
  }

  form li {
    list-style-type: none;
  }

  div.errmsg {
    color: red;
    background: pink;
    border: 1px solid red;
    font-weight: bold;
    padding: 5px;
    margin-top: 1em;
    margin-bottom: 1em;
  }

  .errorlist {
    color: #f00;
    font-weight: bold;
  }

  .errorlist li {
    list-style: none;
  }

}

// Survey form

#survey {
  .choice_answer_label_left {
    max-width: 120px;
    text-align: right;
  }
  .choice_answer_label_right {
    max-width: 120px;
    text-align: left;
  }
  .choice_answer_radio {
    min-width: 30px;
    max-width: 40px;
    text-align: center;
  }
  .hidden_part {
    display: none;
  }
  .question_spacer {
    height: 2em;
  }

  .dialog_buttons {
    text-align: right;
  }
  #survey_skip_button {
    font-size: 120%;
    float: left;
    margin-top: 5px;
  }

  h4 {
    margin: 1em 0 0.5em 0;
  }

  input[type=radio] {
    vertical-align: middle;
  }

  .field.prefix_suffix > div {
    @include clearfix;
    .prefix {
      float: left;
      width: 22%;
      margin-right: 3%;
      text-align: right;
    }
    .suffix {
      float: left;
      width: 22%;
      margin-left: 3%;
    }
    ul {
      float: left;
      width: 50%;
      li {
        display: inline;
      }
      text-align: justify;
      &:after {
        content: '';
        display: inline-block;
        width: 100%;
      }
    }
  }

  textarea {
    width: 100%;
    height: 75px;
  }

}

// Anti-cheating

@media print {
    #brinza-task-description { display: none; }
}

.transparent {
    /* Theoretically for IE 8 & 9 (more valid) */
    /* ...but not required as filter works too */
    /* should come BEFORE filter */
    -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";

    /* This works in IE 8 & 9 too */
    /* ... but also 5, 6, 7 */
    filter: alpha(opacity=0.55);

    /* Older than Firefox 0.9 */
    -moz-opacity:0.99;

    /* Safari 1.x (pre WebKit!) */
    -khtml-opacity: 0.99;

    /* Modern!
    /* Firefox 0.9+, Safari 2?, Chrome any?
    /* Opera 9+, IE 9+ */
    opacity: 0.99;
}

#t_overlay {
    position:absolute;
    top:0;
    left:0;
    right:0;
    bottom:0;
    z-index:9900;
    display:block;
    background-color:#f0f0f0;
}

.protected {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.protected tt, .protected span.number {
    -webkit-touch-callout: text;
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}
.num { z-index:9998;position:absolute;top:0px;left:0px;margin:0px;}

// Keyboard shortcuts

#keyboard_help {
  font-size: 12px;
  width: 750px;
  margin-left: -375px;
  top: 12%;
  padding: 20px !important;

  h2 {
    text-align: left;
    margin: 20px 0px 15px 22px;
  }

  section {
    display: inline-block;
    width: 350px;
    margin-left: 20px;
    h3 {
      font-size: 16px;
      font-weight: normal;
      margin-bottom: 0.3em;
      text-align: left;
    }
    hr {
      background-color: #999;
      border: 0;
      height: 1px;
      width: 300px;
      margin: 0px;
      margin-bottom: 10px;
    }
    margin-bottom: 1em;
  }

  section > div {
    display: table-row;
    .shortcut, .explanation {
      display: table-cell;
      padding: 10px 0px;
      text-align: left;
    }
    .shortcut {
      code {
        border-radius: 5px;
        padding: 4px 8px;
        margin: 4px 2px;
        background: white;
        border: solid 1px #999;
        box-shadow: 1px 1px 2px #ddd;
      }
    }
    .shortcut {
      width: 150px;
      white-space: nowrap;
    }
  }

  .dialog_close {
    color: #999;
    font-size: 15px;
    font-style: italic;
    margin-top: 10px;
  }
}

// Tree editor

$tree-background: #eee;

@mixin tree-editor-input {
  border: 2px solid #999;
  &.error { border-color: red; }

  box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.2);

  // override Chrome default
  &:focus { outline: none; }
}

// the modal
#modal_editor {
  width: 800px;
  margin-left: -400px;

  &.narrow {
    width: 500px;
    margin-left: -250px;
  }

  .multiline {
    width: 100%;
    height: 200px;
    font-family: Droid Sans Mono, Courier, monospace;
    font-size: 12px;
    resize: none;
  }

  .tree-area {
    background: $tree-background;
    width: 100%;
    height: 400px;
    border: 1px dashed #ccc;
    overflow: auto;
    .tree-editor {
      margin: 0 auto;
    }
  }

  .warnings {
    margin-top: 5px;
  }

  .params {
    margin: 0 auto;
    margin-top: 10px;
    .param {
      display: inline-block;
      margin: 0px 15px;
    }
    input {
      @include tree-editor-input;

      width: 70px;
      padding: 3px;

      border-radius: 2px;
    }
  }

  .dialog_buttons {
    margin-top: 20px;
  }
}

.tree-editor {
  position: relative;
  input {
    @include tree-editor-input;

    // width, margin-left are determined on creation
    height: 32px;
    margin-top: -16px;
    text-align: center;

    border-radius: 15px;
  }
}

// Tree editor SVG

g.tree-editor-main {
  .empty {
    fill: black;
  }

  .empty:hover {
    cursor: pointer;
    fill: #070;
  }

  .empty-edge {
    stroke: black;
  }

  .edge .thin {
    stroke: black;
  }

  .root > .edge .thin {
    stroke: $tree-background;
  }

  .edge .thick {
    stroke: $tree-background;
    stroke-width: 30px;
    // HACK: we want the area not to obscure anything,
    // but it cannot be completely transparent because Opera
    // doesn't do :hover then.
    opacity: 0.01;
  }

  .edge:hover {
    cursor: pointer;
    .thin {
      stroke: #a00;
      stroke-width: 8px;
    }

    // '+' doesn't work here, see:
    // http://stackoverflow.com/questions/8320530/webkit-bug-with-hover-and-multiple-adjacent-sibling-selectors
    & ~ .children, & ~ .node
    {
      line, rect { stroke: #ccc; }
      .bst-warning { fill: #fdd; }
      text { fill: #ccc; }
      .edge .thick { stroke: $tree-background; }
      .empty { fill: #ccc; }
    }
  }


  .node {
    rect {
      stroke: black;
      fill: white;
    }

    text {
      text-anchor: middle;
    }

    &.bst-warning rect {
      stroke: #a00;
      stroke-width: 2px;
    }

  }

  .node:hover {
    cursor: pointer;
  }

  .node:hover rect {
    stroke-width: 3px;
  }
}
