@import 'colors';
@import 'variables';
@import 'mixins';
@import 'icons';
@import 'forms';

[class*='titip']
{
  cursor: inherit;
}

#documentPane {
  float: left;
  width: 100%;
  font-family: $monospace_font_family;
  line-height: 1.5em;
  margin-bottom: 75px;
  padding-bottom: 15px;

  .button-secondary {
    margin-right: 10px;
  }

  input[type='text'],
  input[type='radio'],
  select {
    font-family: $monospace_font_family;
    font-size: 1em;
  }

  #newServiceBlockBtn {
    margin-top: 20px;
    margin-left: 76px;
    .button-primary, .button-secondary {
      font-family: $base_font_family;
      line-height: 1em;
    }

    a {
      &[disabled=disabled] {
        cursor: not-allowed !important;
        &:hover {
          cursor: not-allowed !important;
        }
      }
    }

  }
}

.loading {
  margin: 50px auto 0 auto;
  width: 64px;
  height: 64px;
}

#documentActionsPane {
  overflow: hidden;
  position: relative;
  margin: 15px;
}

#documentResetPane {
  float: right;
}

#documentImportPane {
  margin-right: 210px;

  .button-primary {
    margin-right: 15px;
  }
}

#documentAlertsPane {
  margin-right: 210px;

  &.fatal {
    padding: 12px;
    background-color: $dark_red;
    color: $white;
  }

  &.error {
    padding: 12px;
    background-color: $dark_red;
    color: $white;
  }

  &.valid {
    padding: 12px;
    background-color: $ctl_light_green;
    color: $white;
  }

  .dismiss-alerts {
    float: right;
    margin-left: 20px;

    a {
      color: $white;
    }
  }
}

.service-definition {
  position: relative;
  width: 100%;
  border-bottom: 1px solid $darkest_grey;

  div[class^="icon-"] {
    @include icon-grey;
    margin: 10px auto;
  }

  &.disabled {

    &:hover {
      cursor: not-allowed;

      div[class^="icon-"] {
        @include icon-light-grey;
        pointer-events: none; // http://caniuse.com/#search=pointer-events
      }
    }
  }

  &.highlightable {

    &:hover {
      background-color: $darkest_grey;

      div[class^="icon-"] {
        @include icon-light-grey;

        &:hover {
          @include icon-white;
          cursor: pointer;
        }
      }

      .special-instr {
        background-color: $darker_grey;
      }

      .line:not(.error),
      .action-menu {
        background-color: $darker_grey;
      }

      .line:not(.error) .line-text {
        background-color: $darkest_grey;
      }
    }
  }

  .line:nth-of-type(2) .line-text .service-key {
    color: $white;
  }

  .action-menu {
    position: absolute;
    top: 0;
    right: 0;
    width: 50px;
    height: 100%;
    background-color: $dark_grey;
  }
}

.section-edit {
  position: relative;
  width: 100%;
  border-bottom: 1px solid $darkest_grey;
  background-color: $darkest_grey;

  .button-primary, .button-secondary, .button-primary:hover, .button-secondary:hover {
    font-family: $base_font_family;
    font-size: 1.1em;
    line-height: 1em;
  }

  .gutter {
    position: absolute;
    top: 0;
    bottom: 0;
    display: inline-block;
    background-color: $darker_grey;
    color: $light_grey;
    width: 40px;
    margin-right: 15px;
    padding-right: 15px;
    text-align: right
  }

  .section {
    min-width: 1115px;
    font-family: $monospace_font_family;
    font-size: 0.85em;
    display: inline-block;
    margin-bottom: 10px;
    margin-left: 70px;

    > .info-tip {
      margin-bottom: -6px;
    }

    .section-name {
      margin-top: 10px;
      margin-bottom: 5px;
      width: 210px;
      @include border-box;
    }

    .add-new-line {

      select {
        width: 210px;
        height: 39px;
        margin-top: 10px;
        margin-bottom: 10px;
      }

      input[type='text'] {
        margin-left: 20px;
        width: 800px;
        margin-top: 5px;
        margin-bottom: 5px;
      }
    }

    .action-area {
      float: right;
      margin-top: 10px;
      margin-right: 65px;
    }
  }
}

.info-tip {
  display: inline-block;
  background-image: url('../images/icon_info.svg');
  background-repeat: no-repeat;
  @include background-size(40px, 60px);
  background-position: 0 0;
  width: 30px;
  height: 20px;
  color: $lighter_grey;
  margin-top: 14px;
  margin-left: 1px;
  margin-right: 5px;
  cursor: pointer;

  &:hover {
    background-position: 0px -20px;
  }

  .error, .warning {
    display: block;
  }
  .error {
    color: $dark_red;
  }
  .warning {
    color: $orange;
  }
}

.line-edit {
  &.warning,
  .warning {
    input, select {
      @extend input.warning;
    }
  }

  .label.error {
    color: $dark_red;
  }

  &.error,
  .error {
    input,
    select,
    input:focus {
      @extend input.error;
    }
  }

  .radio-edit-group {
    display: inline-block;
    height: 14px;
    width: 150px;
    padding-left: 0;
    padding-right: 0;
  }

  .label {
    display: inline-block;
    width: 150px;
  }

  .fatal {
    color: red;
  }

  .mark-for-deletion {
    color: $light_grey;
    background-color: $lighter_grey;
  }

  input[type='text'] {
    margin-left: 70px;
    width: 800px;
    margin-top: 5px;
    margin-bottom: 5px;
  }

  input[type='text'].build-image-text {
    width: 640px;
  }

  input[type='text'].link-alias-text {
    margin-left: 10px;
    width: 260px;
  }


  .extends-key {

    .extends-label.label {
      width: 193px;
    }

    .subkey-label {
      margin-left: 26px;
      width: auto;
      margin-right: 10px;
    }

    input[type='text'].extends-file-text {
      margin-left: 5px;
      width: 360px;
    }

    input[type='text'].extends-service-text {
      margin-left: 5px;
      width: 274px;
    }
  }

  select {
    width: 522px;
    height: 39px;
    margin-left: 70px;
    margin-top: 5px;
    margin-bottom: 5px;
  }

  .add-link {
    display: inline-block;
    margin-left: 240px;
    margin-top: 10px;
    margin-bottom: 3px;

    a {
      color: $lighter_grey;
    }
  }

  .separator {
    clear: both;
    border-bottom: solid 1px $dark_grey;
    margin-top: 5px;
    margin-bottom: 5px;
  }

  .search-link {
    display: inline-block;
    float: right;
    text-align: center;
    line-height: 50px;
    margin-left: 10px;

    a.active {
      color: $lighter_grey;
      cursor: pointer;
    }

    a.not-active {
      text-decoration: none;
      color: $light_grey;
      pointer-events: none;
      cursor: default;
    }
  }

  .info {
    @extend .info-tip;
    float: right;
  }

  .delete {
    display: inline-block;
    float: right;
    @extend .icon-x-medium;
    width: 20px;
    height: 20px;
    margin-left: 2px;
    margin-right: 5px;
    margin-top: 16px;
    cursor: pointer;

    &:hover {
      @include icon-red;
    }

    &.marked {
      @include icon-white;
    }
  }

  .spacer {
    display: inline-block;
    float: right;
    width: 20px;
    height: 20px;
    margin-left: 5px;
    margin-right: 5px;
    margin-top: 20px;
  }

}

.special-instr {
  background-color: $dark_grey;

  .instr-text {
    margin-left: 55px;
    margin-right: 50px;
    padding: 10px 10px 10px 20px;
    background-color: $darkest_grey;
    line-height: 1.5em;
  }
}

.line {
  font-family: $monospace_font_family;
  position: relative;
  margin-right: 50px;
  background-color: $dark_grey;
  line-height: 1.5em;

  .gutter {
    font-size: 1em;
    float:left;
    color: $light_grey;
    display: inline-block;
    width: 40px;
    margin-right: 15px;
    padding-right: 15px;
    text-align: right
  }

  &.warning {
    .gutter {
      color: $orange;
    }

    .line-text .service-value {
      display: inline-block;
      background-image: url('../images/icon_checkmark.svg');
      background-repeat: repeat-x;
      background-position: 0 20px;
      @include background-size(4px, 10px);
    }
  }

  .imagelayers {
    width: 40px;
    height: 20px;
    background-image: url('../images/icon_image_layers.svg');
    background-repeat: no-repeat;
    @include background-size(40px, 40px);
    background-position: 7px -17px;
    position: absolute;
    display: inline-block;
    left: 60px;
    top: 0;
    &:hover {
      cursor: pointer;
      background-position: 7px 3px;
    }
  }

  .line-text {
    background-image: image-url('document_line_bg.png');
    background-position-x: 20px;
    background-color: $darker_grey;
    margin-left: 55px;
    padding-left: 20px;
    font-size: .85em;

    .service-key {
      color: #04C6FF;
    }

    &:after {
      content: "";
      display: table;
      clear: both;
    }
  }

  &.error {
    background-color: $dark_red;
    color: $white;

    .gutter{
      background-color: $dark_red;
      color: $white;
    }


    .line-text {
      background-image: image-url('document_line_error_bg.png');
      background-color: $dark_red;
      .service-key {
        color: $white;
      }
    }

    .line-info {
      width: 50px;
      height: 20px;
      background-image: url('../images/icon_info.svg');
      background-repeat: no-repeat;
      @include background-size(40px, 60px);
      background-position: 0 -20px;
      position: absolute;
      display: inline-block;
      right: 0;
      top: 2px;
      &:hover {
        cursor: pointer;
        background-position: 0 -40px;
      }
    }
  }

}

main footer {
  position: fixed;
  z-index: 2;
  bottom: 0;
  width: 100%;
  height: 75px;
  background-color: $white;
}

#documentExportPane {
  overflow: hidden;
  position: relative;
  padding: 15px;

  .export-buttons {
    float: right;
    padding-left: 30px;
    margin-top: 3px;

    a.footer-link {
      display: block;
      float: right;
      line-height: 45px;
      color: $dark_grey;

      &:hover {
        text-decoration: none;
      }

      &[disabled=disabled] {
        opacity: .3;
        &:hover {
          text-decoration: underline;
          cursor: not-allowed !important;
        }
      }

      &.copy {
        cursor: pointer;
        position: relative;
        line-height: 16px;
        margin-top: 13px;
        outline: none;

        &:before, &:after {
          content: '';
          width: 20px;
          height: 20px;
          border-radius: 10px;
          position: absolute;
          display: block;
          left: -28px;
          top: -2px;
        }
        &:before {
          background: #AAAAAA;
        }
        &:after {
          top: 2px;
          left: -24px;
          height: 13px;
          width: 13px;
          background-size: 13px 1300px;
          background-position: 0 -130px;
          @extend .icon-checkmark;
          @include icon-white;
        }
        &.copied:before {
          background: #91B748;
        }
      }
    }

    .button-negative {
      &[disabled] {
        background-color: $dark_red;
        color: $white;

        &:hover {
          @include box-shadow(0, 0, 5px, rgba( $dark_red, 0.0 ));
          cursor: not-allowed;
        }
      }
    }

    .button-primary,
    .button-error,
    .button-negative {
      float: right;
      margin-left: 15px;
    }

    .button-secondary {
      float: right;
      margin-left: 15px;
    }
  }

  .addthis-icons {
    float: right;
    > span, > span + div {
      display: inline-block !important;
    }
    > span {
      color: #666;
      position: relative;
      top: -9px;
    }
    padding: 8px 15px 8px 8px;
    border-right: 1px solid #ccc;
    margin: 0 20px 0 0;
    a[class*=at-svc] {
      float: left;
      position: relative;
      &:after {
        height: 25px;
        width: 25px;
        content: '';
        display: block;
        top: 5px;
        left: 5px;
        position: absolute;
        cursor: pointer;
      }
    }

    $sharing-icons: (facebook, twitter, linkedin, google_plus);
    @each $icon in $sharing-icons {
      a[class*=#{$icon}]:after {
        @extend .icon-#{$icon}-xlarge;
        @include icon-light-grey;
      }
      a[class*=#{$icon}]:hover:after {
        @include icon-grey;
      }
    }
    .at-circular {
      background-color: transparent;
    }

    span[class*=aticon] {
      display: none;
    }
  }
}

#homeAdventurePane {

  .separator {
    border-bottom: solid 1px $dark_grey;
    margin-top: 60px;
    margin-bottom: 5px;
  }

  .horz-centered {
    margin-left: auto;
    margin-right: auto;
  }

  #homeWrapper {
    width: 870px;
    background: url('../images/bg_lorry_blank.png') no-repeat center 10px;
    margin-top: 30px;

    h3 {
      font-weight: normal;
      text-align: center;
      margin-bottom: 40px;
    }

    #buttonWrapper {
      text-align: center;
      overflow: auto;
      width: 660px;
      margin-right: auto;
      margin-left: auto;

      p {
        font-size: .8em;
        color: $lightest_grey;
        padding: 15px 5px;
        font-weight: normal;
        line-height: 1.3em;
      }

      a.button-primary {
        display: block;
        height: 60px;
        font-size: 1.1em;
        font-weight: normal;
        line-height: 1.5em;
        @include border-box;
      }

      #homeImportPane, #homeScratchPane {
        float: left;
        margin: 0 20px;
        text-align: left;
        width: 290px;
      }
    }

    #divider {
      margin: 50px auto 60px;
      width: 740px;
      overflow: auto;
      color: $lighter_grey;
      font-size: 0.8em;
      font-weight: bold;

      div:first-child,
      div:last-child {
        float: left;
        width: 300px;
      }
      div:nth-child(2) {
        float: left;
        width: 140px;
      }

      hr {
        border: 0;
        border-bottom: 1px solid $light_grey;
      }
    }
  }

  #samples {
    width: 855px;
    margin: 0 auto;
    @include clearfix;

    .button-secondary {
      float: left;
      font-size: 0.8em;
      line-height: 3em;
      height: 60px;
      font-weight: normal;
      width: 155px;
      margin-right: 20px;
      @include border-box;

      .titip-content {
        margin-bottom: 20px;
      }
    }

    .button-secondary:last-child {
      line-height: 1.4em;
      margin-right: 0;
      padding-left: 40px;
      text-align: left;
      color: $medium_grey;
      background-color: $lightest_grey;
      position: relative;
      overflow: visible;

      &:hover {
        @include box-shadow(0, 0, 0px, rgba( $lightest_grey, 0.6 ));
        background-color: lighten( $lightest_grey, 15% );
      }

      &:before {
        position: absolute;
        display: block;
        content: '';
        height: 54px;
        width: 60px;
        top: -20px;
        left: -10px;
        background-image: image-url('chaos_monkey.png');
      }
    }
  }
}

