@import "./common.less";
@image-link-url: "/src/assets/images/editor/icon_link_editor.png";
@image-practice-url: "/assets/images/icon_expand_editor.png";

@font-face {
  font-family: "思源黑体";
  src: url("https://zijing-upload.oss-cn-beijing.aliyuncs.com/siyuan-hei-Bold.ttf") format('truetype');
}

@font-face {
  font-family: "思源宋体";
  src: url("https://zijing-upload.oss-cn-beijing.aliyuncs.com/siyuan-song.ttf") format('truetype');
}

@font-face {
  font-family: "楷体";
  src: url("https://zijing-upload.oss-cn-beijing.aliyuncs.com/sim-kai.ttf") format('truetype');
}

@font-face {
  font-family: "仿宋";
  src: url("https://zijing-upload.oss-cn-beijing.aliyuncs.com/sim-fang.ttf") format('truetype');
}

@font-face {
  font-family: "宋体";
  src: url("https://zijing-upload.oss-cn-beijing.aliyuncs.com/sim-sun.ttf") format('truetype');
}

@font-face {
  font-family: "黑体";
  src: url("https://zijing-upload.oss-cn-beijing.aliyuncs.com/sim-hei.ttf") format('truetype');
}

.chapter-container {
  border: none;
  width: 100vw;
  overflow-x: hidden;
  .load-chapter {
    position: fixed;
    width: 100vw;
    height: .convertCalc(100) [ @rem];
    z-index: -1;
    background-color: #f2f2f2;
    opacity: 0;
    &.next-chapter {
      bottom: 0;
      left: 0;
    }
    &.prev-chapter {
      top: 0;
      left: 0;
    }
    &.side {
      left: 100vw;
      top: 0;
    }
    .chapter-c-title {
      font-size: .convertCalc(28) [ @rem];
      padding: .convertCalc(10) [ @rem] .convertCalc(30) [ @rem];
      box-sizing: border-box;
      line-height: .convertCalc(80) [ @rem];
      strong {
        font-weight: 600;
      }
    }
  }
  .chapter-content-list {
    max-height: 100vh;
    min-height: 100vh;
    overflow: hidden;
    .show {
      -webkit-transform: translateY(0);
      transform: translateY(0);
      position: relative;
      transition-timing-function: cubic-bezier(0.1, 0.57, 0.1, 1);
      transition-duration: 0ms;
      min-height: 100vh;
    }
    .chapter-item {
      width: 100vw;
      box-sizing: border-box;
      overflow-x: hidden;
      padding-bottom: 5vh;

      // 行内扩展
      .chapter-expand-inline {
        vertical-align: text-top !important;
      }

      pre {
        white-space: pre-wrap;
        word-break: break-all;
        word-wrap: break-word;
        line-height: .convertCalc(40) [ @rem];
        font-size: .convertCalc(28) [ @rem];
        padding: .convertCalc(20) [ @rem];
        color: #333;
        background-color: #f5f2f0;
      }

      blockquote {
        padding: .convertCalc(10) [ @rem];
        line-height: .convertCalc(40) [ @rem];
        font-size: .convertCalc(28) [ @rem];
        background-color: #f5f2f0;
        border-left: 5px solid #b4d5ff;
        margin: .convertCalc(20) [ @rem] 0;
      }

      img {
        max-width: 100%;
      }
      table {
        border-collapse: collapse;
      }
      table th {
        font-weight: 700;
        background-color: #f5f2f0;
        font-size: 18px;
      }
      table th,
      table td {
        border: 1px solid #ddd;
        padding: 5px;
      }

      // 画廊
      .chapter-gallery-container {
        cursor: pointer;
        .chapter-gallery-item {
          width: 50%;
          padding: 10px;
          box-sizing: border-box;
          text-align: center;
          &.one {
            width: 100%;
          }
          p {
            white-space: pre-wrap;
            word-wrap: break-word;
            word-break: break-all;
          }
          img {
            height: auto;
            width: 100%;
          }
          &.one {
            img {
              max-width: 100%;
              height: auto;
              width: 100%;
            }
          }
        }

        &.chapter-gallery-inline {
          display: inline-block;
          vertical-align: middle;
          cursor: pointer;
        }
      }

      a:link,
      a:visited,
      a:hover {
        color: #2a9feb;
      }
      h1 {
        line-height: 40px;
        font-size: 26px;
      }
      h2 {
        line-height: 34px;
        font-size: 24px;
      }
      h3 {
        line-height: 30px;
        font-size: 22px;
      }
      h4 {
        line-height: 26px;
        font-size: 20px;
      }
      h5 {
        line-height: 24px;
        font-size: 18px;
      }
      h6 {
        line-height: 20px;
        font-size: 16px;
      }
      video,
      audio {
        width: 100%;
      }
      div[data-w-e-type="video"] {
        padding: 0 10px;
      }
      p {
        font-size: 16px;
        line-height: 1.5;
        font-family: "宋体";
        margin: 15px 10px;
        > img {
          vertical-align: middle;
          margin-top: -3px;
        }
      }

      .chapter-practice,
      .chapter-expand {
        -webkit-user-select: none;
        user-select: none;
        cursor: pointer;
        margin: 0 10px;
      }
      .chapter-practice {
        .chapter-practice-title {
          user-select: none;
          -webkit-user-select: none;
        }
        // 交互练习
        .chapter-practice-close {
          display: none;
          -webkit-user-select: none;
          user-select: none;
        }
        &::after {
          content: "";
          background-size: cover;
          background-image: url(@image-practice-url);
          width: 18px;
          height: 18px;
          display: inline-block;
          margin: 0 5px;
          vertical-align: text-bottom;
        }
        .chapter-item-tooltip {
          cursor: pointer;
        }

        img {
          width: 100%;
          height: auto;
        }
      }
    }
    p {
      font-size: .convertCalc(26) [ @rem];
      line-height: .convertCalc(52) [ @rem];
    }
    
  }

  // 划线高亮设置
  .range-controll {
    .controll-container {
      position: fixed;
      z-index: 900;
      left: 60px;
      top: 60px;
      border-radius: .convertCalc(10) [ @rem];
      width: 72vw;
      height: .convertCalc(102) [ @rem];
      background: #2b2b2b;
      box-shadow: 0px 6px 10px 0px rgba(93, 93, 93, 0.67);
      box-sizing: border-box;
      // opacity: 0;
      .controll-position {
        display: flex;
        overflow: hidden;
        height: .convertCalc(102) [ @rem];
        width: 72vw;
        box-sizing: border-box;
        .com {
          width: 7vw;
          flex: 0 0 7vw;
          height: .convertCalc(102) [ @rem];
          line-height: .convertCalc(102) [ @rem];
          font-size: 18px;
          color: #fff;
          text-align: center;
          cursor: pointer;
        }
        .controll-list-container {
          flex: 1;
          width: 65vw;
          overflow: hidden;
        }
      }
      .controll-list {
        display: flex;
        align-items: center;
        flex-flow: row nowrap;
        height: .convertCalc(102) [ @rem];
        .controll-item {
          cursor: pointer;
          flex: 0 0 .convertCalc(100) [ @rem];
          width: .convertCalc(100) [ @rem];
          &.colorLine {
            width: .convertCalc(112) [ @rem];
            height: .convertCalc(112) [ @rem];
            position: relative;
            span {
              position: absolute;
              display: block;
              left: .convertCalc(15) [ @rem];
              top: .convertCalc(30) [ @rem];
              width: .convertCalc(40) [ @rem];
              height: .convertCalc(40) [ @rem];
              border-radius: 50%;
              &.c-feff00 {
                background-color: #feff00;
                z-index: 100;
              }
              &.c-00ff00 {
                background-color: #0f0;
                z-index: 101;
                left: .convertCalc(20) [ @rem];
              }
              &.c-00ffff {
                background-color: #0ff;
                z-index: 102;
                left: .convertCalc(30) [ @rem];
              }
              &.c-ff00ff {
                background-color: #f0f;
                z-index: 103;
                left: .convertCalc(40) [ @rem];
              }
              &.c-d2b3fa {
                background-color: #d2b3fa;
                z-index: 104;
                left: .convertCalc(50) [ @rem];
              }
              &.c-ff4500 {
                background-color: #ff4500;
                z-index: 105;
                left: .convertCalc(60) [ @rem];
              }
            }
          }
          .opa {
            display: flex;
            justify-content: center;
            &.discuss {
              .ico {
                .background-image-mixin(@base-url, "rang_list_discuss");
              }
            }
            &.note {
              .ico {
                .background-image-mixin(@base-url, "rang_list_note");
              }
            }
            &.line {
              .ico {
                .background-image-mixin(@base-url, "rang_list_line");
              }
            }
            &.light {
              .ico {
                .background-image-mixin(@base-url, "rang_list_highlight");
              }
            }
            &.baike {
              .ico {
                .background-image-mixin(@base-url, "rang_list_baike");
              }
            }
            &.dict {
              .ico {
                .background-image-mixin(@base-url, "rang_list_dict");
              }
            }
            &.read {
              .ico {
                .background-image-mixin(@base-url, "rang_list_read");
              }
            }
            .ico {
              display: block;
              width: .convertCalc(37) [ @rem];
              height: .convertCalc(35) [ @rem];
              background-size: .convertCalc(37) [ @rem] .convertCalc(35) [
                @rem];
            }
          }
          p {
            color: rgba(255, 255, 255, 0.8);
            font-size: .convertCalc(20) [ @rem];
            line-height: .convertCalc(32) [ @rem];
            height: .convertCalc(32) [ @rem];
            text-align: center;
            text-indent: 0;
            &.cancel {
              font-size: .convertCalc(20) [ @rem];
            }
          }
        }
      }
    }
    .controll-light-container {
      position: absolute;
      z-index: 901;
      left: 60px;
      top: 260px;
      border-radius: .convertCalc(10) [ @rem];
      width: .convertCalc(420) [ @rem];
      height: .convertCalc(70) [ @rem];
      background: #2b2b2b;
      box-shadow: 0px 6px 10px 0px rgba(93, 93, 93, 0.67);
      box-sizing: border-box;
      padding: .convertCalc(15) [ @rem];
      .controll-color-list {
        display: flex;
        justify-content: space-around;
        flex-flow: row nowrap;
        .controll-color-item {
          flex: 0 0 .convertCalc(40) [ @rem];
          width: .convertCalc(40) [ @rem];
          height: .convertCalc(40) [ @rem];
          border-radius: 50%;
          box-sizing: border-box;
          // padding: .convertCalc(12)[@rem];
          cursor: pointer;
          &.c-feff00 {
            background-color: #feff00;
            border: 2px solid #feff00;
          }
          &.c-00ff00 {
            background-color: #0f0;
            border: 2px solid #0f0;
          }
          &.c-00ffff {
            background-color: #0ff;
            border: 2px solid #0ff;
          }
          &.c-ff00ff {
            background-color: #f0f;
            border: 2px solid #f0f;
          }
          &.c-d2b3fa {
            background-color: #d2b3fa;
            border: 2px solid #d2b3fa;
          }
          &.c-ff4500 {
            background-color: #ff4500;
            border: 2px solid #ff4500;
          }
          &.active {
            box-shadow: 0px 0px 10px 2px rgba(255, 255, 255, 0.7);
            border: 2px solid #fff;
          }
        }
      }
    }
  }

  .controll-triangle {
    width: 0;
    height: 0;
    border-left: .convertCalc(20) [ @rem] solid transparent;
    border-right: .convertCalc(20) [ @rem] solid transparent;
    border-bottom: .convertCalc(20) [ @rem] solid #2b2b2b; /* 高度为border-left和border-right的一半，形成等边三角形 */
    transform: rotate(180deg); /* 旋转使其方向朝下 */
    position: absolute;
    bottom: .convertCalc(-16) [ @rem]; // (unit(102 / @baseWidth, rem));
    margin-left: .convertCalc(-10) [ @rem]; // (unit(102 / @baseWidth, rem));
    left: 50%;
  }

  // 气泡内容
  .tange-tooptip {
    position: absolute;
    max-width: 70%;
    min-width: 30%;
    top: 10%;
    left: 00%;
    background-color: #fff;
    border: 2px solid #ab1941;
    border-radius: 5px;
    // opacity: 0;
    transition: 0.2s opacity linear;
    z-index: -1;
    box-shadow: 0 0 10px 1px rgba(122, 122, 122, 0.5);
    .square {
      width: 0px;
      height: 0px;
      position: absolute;
      left: 0;
      &::before {
        width: 0px;
        height: 0px;
        position: absolute;
        border: 10px solid transparent;
        content: '';
        padding: 0;
      }
      &::after {
        width: 0px;
        height: 0px;
        position: absolute;
        content: '';
        border: 9px solid transparent;
      }
      &.square_top {
        top: 0px;
        &::before {
          top: -18px;
          left: 1px;
          border-color: transparent transparent #fff transparent;
          z-index: 12;
        }
        &::after {
          top: -20px;
          left: 2px;
          border-color: transparent transparent #ab1941 transparent;
          z-index: 10;
        }
      }
      &.square_bottom {
        bottom: 0px;
        &::before {
          top: -3px;
          left: -19px;
          border-color: #fff transparent transparent transparent;
          z-index: 12;
        }
        &::after {
          top: 0px;
          left: -18px;
          border-color: #ab1941 transparent transparent transparent;
          z-index: 10;
        }
      }
    }
    .tooltip-content-container {
      padding: 5px;
    }
    .tooltip-content {
      .content {
        line-height: 22px;
        min-height: 22px;
        overflow-x: hidden;
        overflow-y: auto;
        max-height: 100px;
        p {
          white-space: pre-wrap;
          word-wrap: break-word;
          word-break: break-all;
          font-size: 16px;
        }
      }
      .content-opa {
        border-top: 1px solid #ebebeb;
        padding-top: 5px;
        display: flex;
        justify-content: flex-end;
        align-items: center;
        .c-link {
          max-width: 60px;
          text-overflow: ellipsis;
          white-space: nowrap;
          overflow: hidden;
          height: 18px;
          line-height: 18px;
        }
        a:link,
        a:visited,
        a:hover {
          font-size: 14px;
          display: inline-block;
          margin-left: 10px;
          color: #aa1941;
        }
        a {
          img {
            width: 18px;
            height: 18px;
          }
        }
      }
    }
  }

  .big-img-scale {
    position: fixed;
    background-color: #000;
    z-index: 20000;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    .ico {
      position: absolute;
      background-color: rgba(0, 0, 0, 0.5);
      z-index: 20050;
      right: 0px;
      top: 0px;
      color: #fff;
      height: 40px;
      width: 100vw;
      line-height: 40px;
      text-align: right;
      box-sizing: border-box;
      padding-right: 10px;
    }
    .img {
      display: flex;
      width: 100Vw;
      margin-top: 40px;
      height: calc(100Vh - 40px);
      align-items: center;
      img {
        width: 100%;
        height: auto;
        transition: 0.4s all linear;
      }
    }
  }
}

// 画廊显示
.gallery-container {
  .gallery-container-box {
    .gallery-img {
      position: relative;
      img {
        // max-height: 50vh;
        // max-width: 100vw;
        height: 100%;
        width: auto;
        max-width: 100%;
        max-height: 80vh;
      }
    }
    .opa {
      width: .convertCalc(52) [ @rem];
      height: .convertCalc(52) [ @rem];
      position: absolute;
      top: 50%;
      margin-top: .convertCalc(-52) [ @rem];
      background-size: cover;
      box-shadow: 0 0 20px 2px rgba(171, 25, 65, 0.2);
      border-radius: 50%;
      &.prev {
        left: 10px;
        .background-image-mixin(@base-url, "icon_gallery_prev");
      }
      &.next {
        right: 10px;
        .background-image-mixin(@base-url, "icon_gallery_next");
      }
    }

    .title {
      padding: 12px 10px;
      font-size: 20px;
      line-height: 28px;
      margin-bottom: 5px;
      border-bottom: 1px solid #f1f1f1;
      white-space: pre-wrap;
      word-wrap: break-word;
      word-break: break-all;
    }
    .desc {
      padding: 0 10px;
      font-size: 16px;
      line-height: 28px;
      color: #999;
      white-space: pre-wrap;
      word-wrap: break-word;
      word-break: break-all;
    }
  }
}

.show-expand {
  padding: 10px;
  .table-container {
    padding: 10px;
  }
  table {
    border-collapse: collapse;
  }
  table th {
    font-weight: 700;
    background-color: #f5f2f0;
  }
  table th,
  table td {
    border: 1px solid #ddd;
    padding: 5px;
  }
  p {
    line-height: 1.5;
    font-size: 16px;
    font-family: "宋体";
    margin: 10px 0;
    img {
      max-width: 100% !important;
      height: auto;
    }
  }

  pre {
    white-space: pre-wrap;
    word-break: break-all;
    word-wrap: break-word;
    line-height: 20px;
    font-size: 14px;
    padding: 10px;
    color: #333;
    background-color: #f5f2f0;
  }

  blockquote {
    padding: 10px;
    line-height: 20px;
    font-size: 14px;
    background-color: #f5f2f0;
    border-left: 5px solid #b4d5ff;
    margin: 10px 0;
  }

  a {
    color: #aa1941;
    &:link,
    &:visited,
    &:hover {
      color: #aa1941;
    }
    span {
      color: #aa1941 !important;
    }
  }

  h1 {
    line-height: 40px;
    font-size: 24px;
  }
  h2 {
    line-height: 34px;
    font-size: 20px;
  }
  h3 {
    line-height: 28px;
    font-size: 18px;
  }
  h4 {
    line-height: 22px;
    font-size: 16px;
  }
  h5 {
    line-height: 18px;
    font-size: 14px;
  }
  h6 {
    line-height: 16px;
    font-size: 12px;
  }
  video,
  audio {
    width: 100%;
  }
  .chapter-image-pic {
    img {
      width: 100%;
      height: auto;
    }
  }

  .w-e-image-container {
    img {
      &:not([style]) {
        width: auto;
      }
      width: 100%;
    }
  }
}

.scale-img {
  display: flex;
  width: 100vw;
  height: 100vh;
  align-items: center;
  position: relative;
  img {
    width: 100%;
    height: auto;
  }
  p {
    position: absolute;
    background-color: #f2f2f2;
    line-height: 20px;
    font-size: 14px;
    padding: 10px;
    color: #666;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-all;
    bottom: 0;
    left: 0;
    width: 100vw;
  }
}
