@import '../../common/style/var';

@top-nav-height: 60px;
@footer-height: 72px;
@border-color: #eaeefb;
@toggle-color: #ccd6e5;
@bg-color: #f8f8f8;
@code-bg-color: #f2f2f2;
@link-color: #155bd4;
@menu-hover-bg: #3773da;
@code-font-family: Dosis, Source Sans Pro, PingFang SC, Helvetica Neue, Arial, sans-serif; // sass-lint:disable-line indentation

.wgoo-doc-header {
  width: 100%;
  background-color: #001938;
  //background-color: #FFF;
  user-select: none;
  //box-shadow: 0 8px 20px 0 rgb(218 224 235 / 60%);

  &__top {
    display: flex;
    align-items: center;
    height: @wgoo-doc-header-top-height;
    padding: 0 @wgoo-doc-padding;

    &-nav {
      flex: 1;
      font-size: 0;
      text-align: right;

      > li {
        position: relative;
        display: inline-block;
        vertical-align: middle;
      }

      &-item {
        margin-left: 16px;
      }

      &-title {
        display: block;
        font-size: 15px;
      }
    }
  }

  &__cube {
    position: relative;
    display: block;
    padding: 0 12px;
    color: #001938;
    background: #f7f8fa;
    font-size: 14px;
    line-height: 30px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 20px;
    cursor: pointer;
    transition: 0.3s ease-in-out;
  }

  &__version {
    padding-right: 20px;

    &::after {
      position: absolute;
      top: 10px;
      right: 9px;
      width: 5px;
      height: 5px;
      color: #001938;
      border: 1px solid;
      border-color: transparent transparent currentColor currentColor;
      transform: rotate(-45deg);
      content: '';
    }

    &-pop {
      position: absolute;
      top: 34px;
      left: 0;
      width: 100px;
      z-index: 99;
      color: #333;
      line-height: 36px;
      text-align: left;
      overflow: hidden;
      background-color: #fff;
      border-radius: 8px;
      box-shadow: 0 4px 12px #ebedf0;
      transform-origin: top;
      transition: 0.2s cubic-bezier(0.215, 0.61, 0.355, 1);

      &-item {
        padding-left: 12px;
        transition: 0.2s;

        &:hover {
          color: @wgoo-doc-blue;
          background-color: #f7f8fa;
        }
      }
    }
  }

  &__logo {
    display: block;

    img,
    span {
      display: inline-block;
      vertical-align: middle;
    }

    img {
      width: 28px;
      margin-right: 12px;
    }

    span {
      color: #fff;
      font-size: 22px;
    }
  }

  &__link {
    span {
      color: #fff;
      font-size: 16px;
    }

    img {
      display: block;
      width: 30px;
      height: 30px;
      transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);

      &:hover {
        transform: scale(1.2);
      }
    }
  }
}

.wgoo-doc-nav {
  position: fixed;
  left: 0;
  z-index: 1;
  min-width: @wgoo-doc-nav-width;
  max-width: @wgoo-doc-nav-width;
  padding: @wgoo-doc-padding 0;
  overflow-y: scroll;
  background-color: #fff;
  box-shadow: 0 8px 12px #ebedf0;

  @media (min-width: @wgoo-doc-row-max-width) {
    left: 50%;
    margin-left: -(@wgoo-doc-row-max-width / 2);
  }

  &::-webkit-scrollbar {
    width: 6px;
    height: 6px;
    background-color: transparent;
  }

  &::-webkit-scrollbar-thumb {
    background-color: transparent;
    border-radius: 6px;
  }

  &:hover::-webkit-scrollbar-thumb {
    background-color: rgba(69, 90, 100, 0.2);
  }

  &__group {
    margin-bottom: 16px;
    padding-left: 6px;
  }

  &__title {
    padding: 8px 0 8px @wgoo-doc-padding;
    color: #455a64;
    font-weight: 600;
    font-size: 15px;
    line-height: 28px;
  }

  &__item {
    a {
      display: block;
      margin: 8px 0;
      padding: 8px 0 8px @wgoo-doc-padding;
      color: #455a64;
      font-size: 14px;
      line-height: 20px;
      transition: color 0.2s;
      cursor: pointer;

      &:hover,
      &.active {
        color: @wgoo-doc-green;
      }

      &.active {
        font-weight: 600;
        background-color: #ebfff0;
        // border-radius: 999px;
      }

      span {
        font-size: 13px;
      }
    }
  }

  @media (max-width: 1300px) {
    &__item {
      a {
        font-size: 13px;
      }

      &:active {
        font-size: 14px;
      }
    }
  }
}

.wgoo-doc-dropdown {
  &-enter,
  &-leave-active {
    transform: scaleY(0);
    opacity: 0;
  }
}

.wgoo-doc-container {
  box-sizing: border-box;
  padding-left: @wgoo-doc-nav-width;
  overflow: hidden;
  background-color: #fff;

  &--with-simulator {
    padding-right: @wgoo-doc-simulator-width + @wgoo-doc-padding;
  }
}

a {
  color: @link-color;
}

code[class*='language-'] {
  display: block;
  font-size: 13px;
  overflow-x: auto;
  font-weight: 400;
  line-height: 22px;
  border-radius: 3px;
  margin-bottom: 25px;
  position: relative;
  word-break: break-all;
  white-space: pre-wrap;
  background-color: #f5f7fa;
  color: #455a64;
  padding: 18px 10px 18px 20px;
  font-family: Source Code Pro, Monaco, Inconsolata, monospace;
}

.clearfix {
  &::before {
    display: table;
    content: '';
  }

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

.main-content {
  min-height: calc(100vh - @top-nav-height - @footer-height - 20px);

  @media (min-width: 1440px) {
    width: 1440px;
    margin: 0 auto;
  }
}

.page-container {
  background-color: #fff;
  position: relative;
  width: 100%;
  display: flex;
  border-radius: 4px;
}

.page-content {
  box-sizing: border-box;
  flex-grow: 1;

  section {
    padding: 0 40px;

    > h1,
    > h2,
    > h3,
    > h4,
    > h5,
    > h6 {
      line-height: 1.5;
      font-weight: normal;
      position: relative;
      margin: 20px 0 10px;
      color: rgba(51, 51, 51, 0.9);
      font-family: @code-font-family;

      &:hover a:first-child {
        opacity: 0.4;
      }

      a:first-child {
        float: left;
        margin-left: -20px;
        opacity: 0;
        cursor: pointer;
      }
    }

    > h1 {
      font-size: 36px;
      line-height: 45px;
    }

    > h2 {
      font-size: 30px;
    }

    > h3 {
      font-size: 22px;
    }

    > h4 {
      font-size: 20px;
    }

    > h3,
    > h4 {
      margin-top: 40px;

      + h3,
      + h4 {
        margin-top: 15px;
      }
    }

    > h5 {
      font-size: 14px;
    }

    > h6 {
      font-size: 14px;
      color: #666;
    }

    > p {
      font-size: 14px;
      line-height: 20px;
      color: #666;
      margin: 14px 0;
    }

    > ul li,
    > ol li {
      color: #666;
      font-size: 14px;
      line-height: 20px;
      margin: 10px 0 10px 20px;
      padding-left: 20px;
      position: relative;

      &::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 6px;
        height: 6px;
        margin-top: 8px;
        border-radius: 50%;
        box-sizing: border-box;
        border: 1px solid #666;
      }

      li {
        margin-left: 0;
      }
    }

    .anchor-point {
      visibility: hidden;
      position: absolute;
      top: 0;
    }
  }

  p > code,
  .table code,
  li > code {
    margin: 0;
    font-size: 13px;
    overflow-x: auto;
    font-weight: 400;
    line-height: 22px;
    border-radius: 3px;
    position: relative;
    word-break: break-all;
    white-space: pre-wrap;
    background-color: #f5f7fa;
    color: #455a64;
    font-family: Source Code Pro, Monaco, Inconsolata, monospace;
    padding: 4px 7px;
    display: inline;
  }

  blockquote {
    padding: 0 1em;
    color: #6a737d;
    border-left: 0.25em solid #dfe2e5;
  }
}

.table {
  border-collapse: collapse;
  width: 100%;
  background-color: #fff;
  color: #333;
  font-size: 14px;
  margin-bottom: 45px;

  th {
    padding: 10px;
    text-align: left;
    font-weight: normal;
    background-color: #f5f7fa;
    border: 1px solid @border-color;

    &:first-child {
      padding-left: 10px;
    }
  }

  td {
    padding: 10px;
    border: 1px solid @border-color;
  }
}

.token.atrule,
.token.attr-value,
.token.keyword {
  color: #1976d2;
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
  color: #32a973;
}

.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
  color: #1976d2;
}

.page-content {
  overflow-x: auto;
  position: relative;
}

.react-doc-page-content {
  min-height: 100%;
  padding: 0 0 62px;
  box-sizing: border-box;
  overflow: hidden;
  position: relative;
}

.wgoodoc-react-container {
  padding: 20px;
  .wgoodoc-react-demo {
    border-radius: 4px;
    border: 1px solid @border-color;
    margin: 0 40px;

    & + .wgoodoc-react-demo {
      margin-top: 40px;
    }

    &__preview {
      padding: 40px;
    }

    &__bottom {
      padding: 20px;
      border-top: 1px solid @border-color;
      display: flex;
      justify-content: space-between;
      align-items: center;
      cursor: pointer;
      user-select: none;
      transition: background-color 0.3s ease;
      background-color: #f5f7fa;

      &:hover {
        background-color: #ebeff5;
      }
    }

    &__toggle {
      display: inline-block;
      width: 20px;
      height: 20px;
      color: @toggle-color;
      font-size: 12px;
      line-height: 20px;
      flex: 0 0 auto;
      transition: 0.2s ease;

      &-off {
        transform: rotate(180deg);
      }
    }

    &__title {
      flex: 1;
      color: #666;
      font-size: 14px;
      min-height: 20px;
      margin-right: 20px;
    }

    &__code {
      code[class*='language-'] {
        margin: 0;
        border-top: 1px solid @border-color;
      }
    }
  }
}

.wgoodoc-react-color-row {
  margin-bottom: 10px;

  .wgoodoc-react-color-cell {
    margin-right: 10px;

    &:last-child {
      margin-right: 0;
    }
  }
}

.wgoodoc-react-color-cell {
  display: inline-block;
  width: 250px;
  height: 80px;
  border-radius: 4px;
  padding: 5px 15px;
  box-sizing: border-box;
  font-family: Dosis, Source Sans Pro, Helvetica Neue, Arial, sans-serif;

  .wgoodoc-react-color-cell__name {
    margin-top: 8px;
    font-size: 20px;
  }

  .wgoodoc-react-color-cell__color {
    margin-top: 8px;
    font-size: 14px;
  }

  &--light {
    .wgoodoc-react-color-cell__name {
      color: #fff;
    }

    .wgoodoc-react-color-cell__color {
      color: #e5e5e5;
    }
  }

  &--dark {
    .wgoodoc-react-color-cell__name {
      color: #333;
    }

    .wgoodoc-react-color-cell__color {
      color: #999;
    }
  }

  &__mask-white {
    border: 1px solid #e5e5e5;
  }
}

.wgoo-doc-simulator {
  position: absolute;
  top: @wgoo-doc-padding + @wgoo-doc-header-top-height;
  right: @wgoo-doc-padding;
  z-index: 1;
  box-sizing: border-box;
  width: @wgoo-doc-simulator-width;
  min-width: @wgoo-doc-simulator-width;
  overflow: hidden;
  background: #fafafa;
  border-radius: @wgoo-doc-border-radius;
  box-shadow: 0 8px 10px #ebedf0;

  @media (max-width: 1100px) {
    right: auto;
    left: 750px;
  }

  @media (min-width: @wgoo-doc-row-max-width) {
    right: 50%;
    margin-right: -(@wgoo-doc-row-max-width / 2) + 24px;
  }

  &-fixed {
    position: fixed;
    top: @wgoo-doc-padding;
  }

  iframe {
    display: block;
    width: 100%;
  }
}
