@import '../../shared/styles/variables';

:host {
  display: block;
  box-sizing: border-box;

  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  -moz-tap-highlight-color: rgba(0, 0, 0, 0);
  -ms-tap-highlight-color: rgba(0, 0, 0, 0);
  -o-tap-highlight-color: rgba(0, 0, 0, 0);
  tap-highlight-color: rgba(0, 0, 0, 0);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-smoothing: antialiased;
  -webkit-osx-font-smoothing: grayscale;
  -moz-osx-font-smoothing: grayscale;
  osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.004);
  -ms-text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.004);
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.004);
  text-rendering: optimizeSpeed !important;
  font-smooth: always;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.redoc-wrap {
  z-index: 0;
  position: relative;
  overflow: hidden;
  font-family: $base-font, $base-font-family;
  font-size: $em-size;
  line-height: $base-line-height;
  color: $text-color;
}

.menu-content {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

side-menu {
  overflow: hidden;
}

[sticky-sidebar] {
  width: $side-bar-width;
  background-color: $side-bar-bg-color;
  overflow-x: hidden;
  transform: translateZ(0);
  z-index: 75;

  @media (max-width: $side-menu-mobile-breakpoint) {
    width: 100%;
    bottom: auto !important;
  }
}

.api-content {
  margin-left: $side-bar-width;
  z-index: 50;
  position: relative;
  // height: 100vh;
  // overflow: scroll;
  top: 0;
  @media (max-width: $side-menu-mobile-breakpoint) {
    padding-top: 3em;
    margin-left: 0;
  }
}

.background {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  left: $side-bar-width;
  z-index: 1;

  &-actual {
    background: $samples-panel-bg-color;
    left: 100% - $samples-panel-width;
    right: 0;
    top: 0;
    bottom: 0;
    position: absolute;
  }

  @media (max-width: $right-panel-squash-breakpoint) {
    display: none;
  }
}

.redoc-error {
  padding: 20px;
  text-align: center;
  color: $red;
  > h2 {
    color: $red;
    font-size: 40px;
  }
}

.redoc-error-details {
  max-width: 750px;
  margin: 0 auto;
  font-size: 18px;
}

/* global menu items styles (search results + menu) */
:host /deep/ {
  .menu-item-header > span {
    display: inline-block;
    vertical-align: middle;
  }

  .menu-item-header > .operation-type + .menu-item-title {
    width: calc(100% - 32px); // 32 = 26px image width + 6px margin left
  }

  .menu-item-header > .operation-type {
    width: 26px;
    display: inline-block;
    height: 13px;
    background-color: #333;
    border-radius: 3px;
    vertical-align: top;
    background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAACgCAMAAADZ0KclAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRF////////VXz1bAAAAAJ0Uk5T/wDltzBKAAAA80lEQVR42uSWSwLCIAxEX+5/aa2QZBJw5UIt9QMdRqSPEAAw/TyvqzZf150NzdXL49qreXwXjeqz9bqN1tgJl/KLyaVrrL7K7gx+1vlNMqy+helOO4rfBGYZiEkq1ubQ3DeKvc97Et+d+e01vIZlLZZqb1WNJFd8ZKYsmv4Hh3H2fDgjMUI5WSExjiEZs7rEZ5T+/jQn9lhgsw53j/e9MQtxqPsbZY54M5fNl/MY/f1s7NbRSkYlYjc0KPsWMrmhIU9933ywxDiSE+upYNH8TdusUotllNvcAUzfnE/NC4OSYyklQhpdl9E4Tw0Cm4/G9xBgAO7VCkjWLOMfAAAAAElFTkSuQmCC');
    background-repeat: no-repeat;
    background-position: 6px 4px;
    text-indent: -9000px;
    margin-right: 6px;
    margin-top: 2px;

    &.get {
      background-position: 8px -12px;
      background-color: $get-color;
    }

    &.post {
      background-position: 6px 4px;
      background-color: $post-color;
    }

    &.put {
      background-position: 8px -28px;
      background-color: $put-color;
    }

    &.options {
      background-position: 4px -148px;
      background-color: $options-color;
    }

    &.patch {
      background-position: 4px -114px;
      background-color: $patch-color;
    }

    &.delete {
      background-position: 4px -44px;
      background-color: $delete-color;
    }

    &.basic {
      background-position: 5px -79px;
      background-color: $basic-color;
    }

    &.link {
      background-position: 4px -131px;
      background-color: $link-color;
    }

    &.head {
      background-position: 6px -102px;
      background-color: $head-color;
    }
  }
}

/* global redoc styles */

@for $index from 1 through 5 {
  :host /deep/ h#{$index} {
    margin-top: 0;
    font-family: $headers-font, $headers-font-family;
    color: $secondary-color;
    font-weight: $headers-font-weight;
    line-height: 1.5;
    margin-bottom: 0.5em;
  }
}

:host /deep/ {
  h1 {
    font-size: $h1;
    color: $headers-color;
  }
  h2 {
    font-size: $h2;
  }
  h3 {
    font-size: $h3;
  }
  h4 {
    font-size: $h4;
  }
  h5 {
    font-size: $h5;
    line-height: 20px;
  }

  p {
    font-family: $base-font, $base-font-family;
    font-weight: $base-font-weight;
    margin: 0;
    margin-bottom: 1em;
    line-height: $base-line-height;
  }

  a {
    text-decoration: none;
    color: $primary-color;
  }

  p > code {
    color: $red;
    border: 1px solid rgba(38, 50, 56, 0.1);
  }

  .hint--inversed {
    &:before {
      border-top-color: #fff;
    }

    &:after {
      background: #fff;
      color: #383838;
    }
  }

  @import '../../shared/styles/share-link';
}

footer {
  position: relative;
  text-align: right;
  padding: 10px $section-spacing;
  font-size: 15px;
  margin-top: -35px;
  color: white;
  a {
    color: white;
  }
  strong {
    font-size: 18px;
  }
}

/* markdown elements */

:host /deep/ .redoc-markdown-block {
  pre {
    font-family: Courier, monospace;
    white-space: pre-wrap;
    background-color: #263238;
    color: white;
    padding: 12px 14px 15px 14px;
    overflow-x: auto;
    line-height: normal;
    border-radius: $border-radius;
    border: 1px solid rgba(38, 50, 56, 0.1);

    code {
      background-color: transparent;
      color: white;

      &:before,
      &:after {
        content: none;
      }
    }
  }

  code {
    font-family: Courier, monospace;
    background-color: rgba(38, 50, 56, 0.04);
    padding: 0.1em 0.2em 0.2em;
    font-size: 1em;
    border-radius: $border-radius;
    color: $red;
    border: 1px solid rgba(38, 50, 56, 0.1);
  }

  p:last-of-type {
    margin-bottom: 0;
  }

  blockquote {
    margin: 0;
    margin-bottom: 1em;
    padding: 0 15px;
    color: #777;
    border-left: 4px solid #ddd;
  }

  img {
    max-width: 100%;
    box-sizing: content-box;
  }

  ul,
  ol {
    padding-left: 2em;
    margin: 0;
    margin-bottom: 1em;
    font-family: $base-font, $base-font-family;
    font-weight: $base-font-weight;
    line-height: $base-line-height;
    > li {
      margin: 1em 0;
    }
  }

  table {
    display: block;
    width: 100%;
    overflow: auto;
    word-break: normal;
    word-break: keep-all;
    border-collapse: collapse;
    border-spacing: 0;
    margin-top: 0.5em;
    margin-bottom: 0.5em;
  }

  table tr {
    background-color: #fff;
    border-top: 1px solid #ccc;

    &:nth-child(2n) {
      background-color: #f8f8f8;
    }
  }

  table th,
  table td {
    padding: 6px 13px;
    border: 1px solid #ddd;
  }

  table th {
    text-align: left;
    font-weight: bold;
  }
}
