@import "variables";

html {
  background-color: $colorDefaultBackground;
}

body {
  font-family: $fontMain;
  color: $colorFontAlmostWhite;
  font-size: 15px;
}

a {
  color: $colorAnotherDark;
}

a:active {
  outline: none
}

a.blue {
  color: $colorPastelBlue;
  text-decoration: underline
}

a.blue:hover {
  text-decoration: none
}

a.white {
  color: #e0e0e0;
  text-decoration: none
}

a.white:hover {
  color: white;
}

small {
  font-size: 12px
}

hr {
  border: none;
  height: 1px;
  margin: 20px 0;
  background-color: $colorFontLightGray
}

#navbar {
  position: fixed;
  text-align: left;
  width: 100%;
  z-index: 100;
  background-color: $colorNavBar;
  margin: 0;
  padding: 0 10px;
  height: $topNav;
  vertical-align: top;
  display: flex;
  & > .nav {
    width:130px;
  }
  & > .middle {
    width: 100%;
    text-align: left;
    margin-left: 40px;
    .nav {
      display: inline-block;
    }
  }
}

.nav {
  margin: 0;
  vertical-align: top;
//  display: inline-block;
  height: 100%;
  border-bottom: 2px solid $colorNavBar;
  box-sizing: border-box;
  padding: 10px 0 0;
  &.tab {
    padding: 0;
    margin-left: 10px;
    margin-right: 10px;
    line-height: calc(50px - 2px);
    &.selected {
      border-bottom-color: $colorPastelBlue;
    }
    &:hover {
      border-bottom-color: $colorPastelBlue;
    }
    a {
      display: inline-block;
      height: 100%;
    }
  }
}

#json-navbar {
  .nav {
    display: inline-block;
  }
}

#content {
  padding-top: $topNav;
  #left {
    height: 100%;
    color: $colorFontAlmostWhite;
    text-align: left;
    background-color: $colorDark;
    border-top: 1px solid $colorBorderDark;
    overflow-y: auto;
    header {
      padding-top: 30px;
      padding-bottom: 20px;
      margin-bottom: 15px;
      margin-left: 10px;
      margin-right: 10px;
      padding-left: 10px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.1);
      h1 {
        font-size: 22px
      }
    }
    nav {
      padding-bottom: 70px;
      hr {
        border: none;
        height: 1px;
        background-color: rgba(255, 255, 255, 0.1);
        margin-left: 10px;
        margin-right: 10px;
      }
      li {
        list-style-type: none;
        border-bottom: 1px solid #333;
        position: relative;
        &:last-of-type {
          border-bottom: none
        }
        &.root {
          font-size: 22px;
          & > a {
            color: $colorFontAlmostWhite;
          }
          margin-top: 20px;
        }
        & > a {
          display: block;
          line-height: 25px;
          margin-top: 1px;
          width: 100%;
          padding: 10px 15px;
          color: $colorFontLightGray;
          border-left: 3px solid transparent;
          &:hover {
            color: $colorFontSelectedWhite;
            background-color: rgba(255, 255, 255, 0.1);
            border-color: rgba(255, 255, 255, 0.1);
            .actions {
              display: inline-block;
            }
          }
          &.selected {
            color: $colorFontSelectedWhite;
            border-color: $colorPastelRed;
            background-color: $colorSelectedDark;
          }
          .actions {
            display: none;
            position: absolute;
            right: 5px;
            .fa {
              color: lighten($colorDefaultBackground, 30%);
              font-size: 14px;
              margin-left: 5px;
              &:hover {
                color: lighten($colorDefaultBackground, 50%);
              }
            }
          }
        }
      }
    }
    .node-type {
      display: inline-block;
      padding-left: 5px;
      color: rgba(255, 255, 255, 0.3);
    }
  }
  #right {
    height: 100%;
    & > div:last-child {
      padding-bottom: 40px;
    }
    padding: $topNav 40px 80px;
    overflow-y: auto;
    .buttons {
      text-align: left;
    }
  }
  #json-panel {
    height: 100%;
    padding-bottom: 80px;
    #json-navbar {
      text-align: left;
      background-color: $colorDark;
    }
    #json-pretty {
      padding: 10px 0 60px;
      overflow: auto;
      height: 100%;
      white-space: nowrap;
    }
  }
}

#content.author #right {
  background-color: #ddd;
  form .fields {
    background-color: white;
    border: 1px solid lighten(#61636f, 30%);
    .field {
      &:not(:last-child) {
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
      }
      label {
        color: #555555;
      }
      &:hover {
        background-color: rgba(0, 0, 0, 0.01);
      }
    }
  }
  input[type="text"], textarea {
    background-color: #fafafa;
    color: black;
    border-color: #c0c0c0;
  }
  table {
    border: 1px solid lighten(#61636f, 30%);
    tr {
      background-color: white;
      border-color: lighten(#61636f, 30%);
      td:not(.delete) {
        a {
          color: black;
        }
      }
    }
  }
}

#message {
  background-color: #eeeeee;
  padding: 5px 5px 18px 20px;
  text-align: left;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  border-top: 1px solid #dddddd;
  font-size: 12px;
  font-weight: 600;
  font-family: "Courier New", "Helvetica", sans-serif;
  color: #202020;
  z-index: 1000;
  height: $bottomNav;
}

.modal {
  form {
    .fields {
      margin-bottom: 30px;
    }
  }
}

#right {
  form {
    .fields {
      margin-bottom: 30px;
    }
  }
}

form {
  .fields {
    //    max-width: 700px;
    font-size: 16px;
    padding-bottom: 20px;
    border: 1px solid $colorBorderInput;
    -moz-border-radius: 2px;
    -webkit-border-radius: 2px;
    border-radius: 2px;
    .field {
      &:hover {
        background-color: rgba(0, 0, 0, 0.03);
        label .right-block .actions a .fa {
          color: lighten($colorDefaultBackground, 30%);
        }
      }
      label {
        color: $colorFontLightGray;
        display: block;
        margin: 10px 10px 8px 0;
        position: relative;
        .name {
          i {
            padding-left: 5px;
            font-size: 14px;
          }
        }
        .right-block {
          position: absolute;
          top: 0;
          right: -10px;
          .type {
            display: inline-block;
            font-size: 12px;
            a {
              text-decoration: none;
            }
          }
          .actions {
            display: inline-block;
            margin-left: 15px;
            a {
              .fa {
                color: transparent;
                font-size: 14px;
                margin-left: 5px;
                &:hover {
                  color: lighten($colorDefaultBackground, 50%);
                }
              }
            }
          }
        }
      }
      display: block;
      margin-left: 2px;
      margin-right: 2px;
      text-align: left;
      padding: 10px 23px 20px;
      &:not(:last-child) {
        border-bottom: 1px solid lighten($colorDefaultBackground, 4%);
      }
      .description {
        margin-bottom: 4px;
      }
    }
  }
}

input[type="text"], textarea {
  background-color: $colorInputBackground;
  color: $colorFontAlmostWhite;
  font-family: $fontMain;
  font-size: 16px;
  width: 100%;
  padding: 5px;
  border: 1px solid $colorBorderInput;
  &:focus {
    border-color: $colorBorderFocusedInput;
    outline: none
  }
  &.error {
    border: 1px solid $colorPastelRed;
  }
}

textarea {
  height: 200px;
  resize: vertical;
  color: $colorFontInput;
  background-color: $colorInputBackground;
  &.short {
    height: 60px
  }
}

[contenteditable]:focus {
  outline: none
}

.checkbox {
  position: relative;
  input {
    position: absolute; // take it out of document flow
    opacity: 0; // hide it

    & + label {
      position: relative;
      cursor: pointer;
      padding: 0;
    }

    // Box.
    & + label:before {
      content: '';
      margin-right: 10px;
      display: inline-block;
      vertical-align: text-top;
      width: 20px;
      height: 20px;
      background: $colorInputBackground;
      border: 1px solid $colorBorderInput;
    }

    // Box hover
    &:hover + label:before {
      //      background: #f35429;
    }

    // Box focus
    &:focus + label:before {
      box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.12);
    }

    // Box checked
    &[value=true] + label:before {
      background: $colorInputBackground;
    }

    // Disabled state label.
    &:disabled + label {
      color: #b8b8b8;
      cursor: auto;
    }

    // Disabled box.
    &:disabled + label:before {
      box-shadow: none;
      background: #ddd;
    }

    // Checkmark. Could be replaced with an image
    &[value=true] + label:after {
      content: '';
      position: absolute;
      left: 5px;
      top: 9px;
      background: $colorFontInput;
      width: 2px;
      height: 2px;
      box-shadow: 2px 0 0 $colorFontInput,
      4px 0 0 $colorFontInput,
      4px -2px 0 $colorFontInput,
      4px -4px 0 $colorFontInput,
      4px -6px 0 $colorFontInput,
      4px -8px 0 $colorFontInput;
      transform: rotate(45deg);
    }
  }
}

.btn {
  display: inline-block;
  cursor: pointer;
  vertical-align: middle;
  *zoom: 1;
  *display: inline;
  padding: 10px 25px;
  background-color: #fff;
  font-size: 13px;
  border: 1px solid #bbb;
  -moz-border-radius: 4px;
  -webkit-border-radius: 4px;
  border-radius: 4px;
  -moz-box-shadow: rgba(0, 0, 0, 0.06) 0 1px 2px, inset rgba(0, 0, 0, 0.05) 0 -1px 1px;
  -webkit-box-shadow: rgba(0, 0, 0, 0.06) 0 1px 2px, inset rgba(0, 0, 0, 0.05) 0 -1px 1px;
  box-shadow: rgba(0, 0, 0, 0.06) 0 1px 2px, inset rgba(0, 0, 0, 0.05) 0 -1px 1px;
  &:active {
    background-color: #f4f4f4;
    -moz-box-shadow: none;
    -webkit-box-shadow: none;
    box-shadow: none
  }
  &:hover {
    opacity: 0.9;
  }
  &.cmd {
    text-decoration: none;
    margin-left: 10px;
    margin-right: 10px;
    &:first-of-type {
      margin-left: 0;
    }
    border-radius: 4px;
    box-sizing: border-box;
    box-shadow: 0 3px 3px rgba(0, 0, 0, 0.5);
    border: none;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    min-width: 6rem;
    text-align: center;
    &.blue {
      color: white;
      background-color: $colorPastelBlue;
      border-radius: 4px;
      box-sizing: border-box;
      box-shadow: 0 3px 3px rgba(0, 0, 0, 0.5);
      border: none;
      padding: 0.5rem 0.75rem;
      font-size: 0.875rem;
    }
    &.disabled {
      background-color: $colorDark;
      box-shadow: none;
      color: $colorFontDisabledDark;
      &.blue {
        background-color: $colorDark;
        box-shadow: none;
        color: $colorFontDisabledDark;
      }
      cursor: default;
    }
  }
}

table {
  margin: 0 0 30px 0;
  width: 100%;
  border: 1px solid $colorFontLightGray;
  border-top: none;
  tr {
    width: 100%;
    border: 1px solid $colorBorderInput;
    background-color: $colorInputBackground;
    //  border: 1px dashed gray;
    padding: 0.5rem 1rem;
    margin-bottom: .5rem;
    cursor: move;
    .ui-sortable-placeholder {
      height: 60px
    }
    td {
      position: relative;
      a {
        color: $colorFontAlmostWhite;
        display: block;
        padding: 20px 10px
      }
      &.delete {
        width: 40px;
        background-color: $colorDark;
        text-align: center;
        font-weight: bold;
        font-size: 20px;
        a {
          color: $colorFontLightGray;
          &:hover {
            background-color: $colorErrorRed;
            color: $colorFontSelectedWhite;
          }
        }
      }
      &.first {
        width: 25%
      }
    }
    &:hover td {
      background-color: rgba(0, 0, 0, 0.04);
      &.delete {
        background-color: $colorDark;
      }
    }
  }
}

/* The Modal (background) */
.modal {
  display: none; /* Hidden by default */
  position: fixed; /* Stay in place */
  z-index: 1; /* Sit on top */
  left: 0;
  top: 0;
  width: 100%; /* Full width */
  height: 100%; /* Full height */
  overflow: auto; /* Enable scroll if needed */
  background-color: rgb(0, 0, 0); /* Fallback color */
  background-color: rgba(0, 0, 0, 0.5); /* Black w/ opacity */
  .title {
    font-size: 24px;
    position: relative;
    .close {
      position: absolute;
      right: 0;
      top: -7px;
      color: $colorFontLightGray;
      float: right;
      font-size: 32px;
      &:hover, &:focus {
        color: darken($colorFontLightGray, 20%);
        text-decoration: none;
        cursor: pointer;
      }
    }
  }
  .modal-content {
    background-color: $colorDefaultBackground;
    margin: 120px auto auto auto; /* 15% from the top and centered */
    padding: 20px;
    border-radius: 5px;
    width: 800px;
    text-align: left;
    form {
      margin-top: 20px;
      .fields {
        max-width: inherit;
      }
    }
    .modal-body {
      font-size: 18px;
      margin-top: 30px;
      margin-bottom: 30px;
    }
  }
}

.styled-select {
  display: inline-block;
  position: relative;
  vertical-align: middle;
  &:before, &:after {
    content: "";
    position: absolute;
  }
  &:after {
    color: $colorFontAlmostWhite;
    font-family: "Fontawesome", serif;
    font-size: inherit;
    content: "\f107";
    padding: 5px;
    pointer-events: none;
    right: 5px;
    top: 7px;
    vertical-align: middle;
  }
  select {
    color: $colorFontAlmostWhite;
    cursor: pointer;
    // Sass specific RGBA mixin
    background: $colorInputBackground;
    //    background: rgba(white,0.3);
    border: 1px solid $colorBorderInput;
    font-size: 16px;
    //    padding: 0.5em 2em 0.5em 0.5em;
    padding: 8px;
    padding-right: 30px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border-radius: 0;
    &:focus {
      border-color: $colorBorderFocusedInput;
      outline: none;
    }
  }
}

.Resizer {
  background: #000;
  opacity: .2;
  z-index: 1;
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  -moz-background-clip: padding;
  -webkit-background-clip: padding;
  background-clip: padding-box;
}

.Resizer:hover {
  -webkit-transition: all 2s ease;
  transition: all 2s ease;
}

.Resizer.horizontal {
  height: 11px;
  margin: -5px 0;
  border-top: 5px solid rgba(255, 255, 255, 0);
  border-bottom: 5px solid rgba(255, 255, 255, 0);
  cursor: row-resize;
  width: 100%;
}

.Resizer.horizontal:hover {
  border-top: 5px solid rgba(0, 0, 0, 0.5);
  border-bottom: 5px solid rgba(0, 0, 0, 0.5);
}

.Resizer.vertical {
  width: 11px;
  margin: 0 -5px;
  border-left: 5px solid rgba(255, 255, 255, 0);
  border-right: 5px solid rgba(255, 255, 255, 0);
  cursor: col-resize;
}

.Resizer.vertical:hover {
  border-left: 5px solid rgba(0, 0, 0, 0.5);
  border-right: 5px solid rgba(0, 0, 0, 0.5);
}

.Resizer.disabled {
  cursor: not-allowed;
}

.Resizer.disabled:hover {
  border-color: transparent;
}
