//
//= Layout
//

//
// Generic styles

.no-padding {
  padding: 0 !important;
}

.no-margin {
  margin: 0 !important;
}

button:focus {
  outline: none;
}

.default-label {
  @include small-label($secondary-color);
}

//
// Topbar layout

// .top-bar {
//   padding: 0.5rem;
//   height: $topbar-height;
//   color: $white;
//
//   // Make it fixed
//   position: fixed;
//   left: 0;
//   right: 0;
//   top: 0;
//   z-index: 1;
// }
//

#logo {
  text-align: center;
  padding-right: 0.5rem;
  padding-top: 1rem;
  padding-bottom: 0.25rem;

  img {
    max-height: 75px;
  }
}

// Include the Foundation grid (the only required component)
@include foundation-grid();

//
// Sidebar layout

#sidebar {
  padding-top: 1.5rem;
  padding-left: 1.5rem;
  padding-right: 1rem;
  padding-bottom: 2rem;
  border-right: 1px solid #eee;
  background-color: #f6f6f6;
  height: 100vh;
  overflow: auto;
  position: fixed;
  bottom: 0;
  left: 0;
  top: 0;
  width: $drawer-size;

  h5 {
    margin: 1.5rem 0 0.65rem;
    text-transform: uppercase;
    color: scale-color($medium-gray, $lightness: -10%);
    // color: $accent-color;
    font-size: 0.9rem;
  }

  a {
    display: block;
    // font-size: 0.95rem;
    margin: 0 0 0.25rem;
    color: scale-color($black, $lightness: 15%);
    white-space: nowrap;
    overflow: hidden;
    -o-text-overflow: ellipsis;
    text-overflow: ellipsis;

    &.active {
      color: $primary-color;
    }
  }

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

  section {
    > ul {
      display: none;
    }

    &.expand {
      > ul {
        display: block;
      }
    }
  }

  .close-button {
    opacity: 0.5;
  }
}

//
// Documentation layout

.doc-content {
  @extend .large-6;
  padding-left: $column-padding !important;
  padding-right: $column-padding !important;
}

.doc-separator {
  margin-top: 2em;
  padding-top: 2em;
  padding-bottom: 2em;
  border-top: 1px solid #e2e2e2;
}

#docs {
  background: $white;
  overflow: hidden;
  position: relative;

  .example-box {
    display: none;
  }

  @include breakpoint(large) {
    .example-box {
      // width: 50%;
      display: block;
      // background-color: #2E2F28;
      background-color: $black;
      position: absolute;
      right: 0;
      top: 0;
      bottom: 0;
    }
  }
}

article {
  position: relative;

  .no-description {
    color: $dark-gray;
  }

  dt {
    color: $black;
  }

  table.table {
    width: 100%;
  }

  code {
    font-size: 0.9em;
    border-radius: 3px;
  }

  p:last-child:first-child {
    margin-bottom: 0;
  }

  .tag-description {
    // margin-bottom: 0 !important;
  }

  //
  // Titles

  h1 {
    margin: 2.5rem 0 0;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    padding-left: $column-padding;
    padding-right: $column-padding;
    border-top: 1px solid #e8e8e8;
    border-bottom: 1px solid #e2e2e2;
    background-color: #f6f6f6;
    // border-top: 1px solid #ddd;
    // border-bottom: 1px solid #ccc;
    // background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgi…pZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA==');
    // background-size: 100%;
    // background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #fff), color-stop(100%, #f9f9f9));
    // background-image: -moz-linear-gradient(top, #fff, #f9f9f9);
    // background-image: -webkit-linear-gradient(top, #fff, #f9f9f9);
    // background-image: linear-gradient(to bottom, #fff, #f9f9f9);
  }

  h1.doc-title {
    @extend .doc-content;
    margin: 0;
    padding-top: 2.15rem;
    padding-bottom: 0;
    font-weight: bold;
    background: transparent;
    border: none;
    color: scale-color($black, $lightness: 20%);

    span {
      display: none;
      opacity: 0.65;
      margin-left: 5px;
      font-weight: normal;
    }
  }

  h2 {
    @extend .doc-separator;
    margin-bottom: 0;
    padding-left: $column-padding;
    padding-right: $column-padding;
    padding-bottom: 0.25rem;
    background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgi…gd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idXJsKCNncmFkKSIgLz48L3N2Zz4g');
    background-size: 100%;
    background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, rgba(255, 255, 255, 0.4)), color-stop(100%, rgba(255, 255, 255, 0)));
    background-image: -moz-linear-gradient(top, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0));
    background-image: -webkit-linear-gradient(top, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0));
    background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0));
  }

  h3 {
    margin: 0rem 0 0.75rem;
  }

  > h1, > h2 {
    @extend .doc-content;
  }

  h1 + .panel > h2 {
    margin-top: 0;
    border-top: none;
  }

  h1 + .tag-description + .panel > h2 {
    margin-top: 2rem;
  }

  h1 + .panel h3 {
    margin-top: 1rem;
  }

  //
  // Panels

  .panel {
    position: relative;

    > h2, > h3 {
      @extend .doc-content;
    }
  }

  //
  // Property grid

  .prop-row {
    // @extend .doc-row;
    @extend .row;
    @extend .collapse;

    padding-top: 0.75em;
    padding-bottom: 0.75em;
    border-top: 1px solid #eee;

    &:first-child, &.prop-group {
      border-top: 1px solid #ddd;
    }

    .prop-title {
      font-weight: bold;
    }

    .prop-type {
      font-weight: 400;
    }

    .prop-subtitle {
      font-weight: 400;
      font-size: 80%;
    }

    .prop-name {
      @extend .columns;
      @extend .small-5;
      // @extend .text-right;
      text-align: right;
      padding-right: 0.85rem !important;
      word-break: break-word;
    }
    .prop-value {
      @extend .columns;
      @extend .small-7;
      padding-left: 0.85rem !important;
      word-wrap: break-word;
    }

    &.prop-inner {
      // @extend small;
      padding-top: 0.5em;
      padding-bottom: 0.5em;
      font-size: $small-font-size;

      .prop-name {
        color: $dark-gray;
      }

      .prop-value {
        > span {
          display: block;

          &:before {
            color: $dark-gray;
          }
          &:after {
            color: $dark-gray;
          }

          &.json-property-type, &.json-property-format {
            display: inline-block;

          }
        }
      }
    }
  }

  //
  // Default grid

  .doc-row {
    @extend .row;
    @extend .collapse;
    margin: 2rem 0 20px;
  }

  .doc-copy {
    @extend .doc-content;
    @extend .columns;

    // > h2 {
    //   width: 100%;
    //   margin-left: -$column-padding;
    //   margin-right: -$column-padding;
    // }
  }

  .doc-examples {
    @extend .doc-content;
    @extend .columns;
    padding-left: $column-padding !important;
    padding-right: $column-padding !important;

    //color: $dark-gray;
    color: $white;
    background-color: $dark-background-color;

    h5 {
      color: $white;
      //color: $medium-gray;
      font-size: 1rem;
      opacity: 0.8;

      span {
        opacity: 0.5;
        //color: $dark-gray;
      }
    }

    @include breakpoint(medium down) {
      &:not(:empty) {
        margin-top: 1.5rem;
        padding-top: 1.5rem;
        padding-bottom: 0.5rem;
      }
    }

    code {
      display: block;
      margin-bottom: 1.5rem;
      padding: 1.5rem;
      font-family: Consolas, "Liberation Mono", Courier, monospace;
      font-weight: inherit;
      color: inherit;
      @include inset-panel();
      word-spacing: normal;
      white-space: pre-wrap;
      word-break: normal;
    }

    tbody tr:nth-child(even) {
      border-bottom: 0;
      background-color: $light-black;
    }

    tbody, tfoot, thead {
      color: #FFFFFF;
      background-color: $black;
      border: 0px;
    }

    thead {
      background-color: $black;
    }

    .swagger-response-headers {

      @include inset-panel()
      margin-bottom: 1.5rem;

      thead {
        color: $white;
        font-size: 1rem;
        opacity: 0.8;
        background-color: transparent;
        border: none;
      }

      tbody {
        border: none;
        background-color: transparent;

        tr {
          background-color: transparent;
          border-top: 1px solid #404040;
        }

      }

    }

  }

  //
  // Powered by link

  .powered-by {
    // @extend small;
    font-size: $small-font-size;
    color: $medium-gray;

    span {
      color: $accent-color;
    }
  }

  //
  // Operation panel

  .operation {
    .operation-tags {
      position: absolute;
      top: 0;
      text-align: right;
      right: 0;

      .label {
        cursor: pointer;
        &:hover {
          color: $light-gray;
        }
      }
    }

    @include breakpoint(large) {
      // @media screen and (min-width: $large-width) { // large and up
      .operation-tags {
        right: 50%;
      }
    }
    .operation-path {
      word-break: break-all;
    }
  }

  //
  // Security definition panel

  .security-definition-description {
    margin-top: 1.5rem;
    margin-bottom: .5rem;
  }

  .security-definition-scope-description {
    color: $dark-gray;
    margin-bottom: .5rem;
  }

  //
  // Definition panel

  .definition {
    .doc-examples h5 {
      margin-top: -1rem;
    }

    .doc-copy > section {
      margin-bottom: 1rem;

      > .json-property-type {
        display: none;
      }
    }

    dl dt {
      font-weight: normal;
    }

    dl dd {
      font-style: italic;
    }

    .json-property-name {
      font-weight: bold;
    }
  }

  //
  // Code highlighting

  .hljs {
    line-height: 1.25;
    overflow-x: auto;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: none;
  }
}
