// card-preview
.card-preview {
  padding: 10px 0;
  background-color: #f0f0f0;
  color: #000;
  .page-box {
    margin: 10px auto;
    box-shadow: 0 0 4px #ddd;
  }
}
.card-print {
  padding: 0;

  .page-box {
    margin: 0 auto;
    box-shadow: none;
    page-break-after: always;
  }
  // 印刷模式：隐藏客观题强调标记
  .elem-fill-question-first {
    .fill-question-sign {
      display: none;
    }
  }
}

// page-box
.page-box {
  position: relative;
  background: #fff;
  margin: 0 auto;
  font-weight: normal;
  font-family: "宋体", "宋体-简", Arial, sans-serif;

  .page-main {
    height: 100%;
    position: relative;
    white-space: nowrap;
    margin: 0 -10px;

    &-2 {
      .page-column {
        width: 50%;
      }
    }
    &-3 {
      .page-column {
        width: 33.33%;
      }
    }
    &-4 {
      .page-column {
        width: 25%;
      }
    }
  }

  &-A3 {
    width: 1586px;
    height: 1122px;

    &.page-box-0 {
      .page-main-inner {
        padding: 60px 40px 86px 160px;
      }
    }
    &.page-box-1 {
      .page-main-inner {
        padding: 60px 160px 86px 40px;
      }
      .page-main-side {
        right: 40px;
        left: auto;
      }
    }

    .page-main {
      &-1 {
        .page-column-forbid-area {
          &::before {
            width: 2000px;
            transform: rotate(34.326deg);
          }
          &::after {
            width: 2000px;
            transform: rotate(-34.326deg);
          }
        }
      }
      &-2 {
        .page-column-forbid-area {
          &::before {
            transform: rotate(54.98deg);
          }
          &::after {
            transform: rotate(-54.98deg);
          }
        }
      }

      &-3 {
        .page-column-forbid-area {
          &::before {
            transform: rotate(64.6555deg);
          }
          &::after {
            transform: rotate(-64.6555deg);
          }
        }
      }
      &-4 {
        .page-column-forbid-area {
          &::before {
            transform: rotate(70.3109deg);
          }
          &::after {
            transform: rotate(-70.3109deg);
          }
        }
      }
    }
  }
  &-A4 {
    width: 793px;
    height: 1122px;

    .page-main {
      &-inner {
        padding: 60px 45px 86px;
      }

      &-1 {
        .page-column-forbid-area {
          &::before {
            transform: rotate(54.216deg);
          }
          &::after {
            transform: rotate(-54.216deg);
          }
        }
      }

      &-2 {
        .page-column-forbid-area {
          &::before {
            transform: rotate(70.5109deg);
          }
          &::after {
            transform: rotate(-70.5109deg);
          }
        }
      }
    }
  }

  &-8K {
    // w:370mm,h:255mm
    width: 1399px;
    height: 964px;

    .page-main-side {
      position: absolute;
      top: 40px;
      bottom: 66px;
      width: 90px;
      left: 20px;
    }

    &.page-box-0 {
      .page-main-inner {
        padding: 40px 20px 66px 130px;
      }
    }
    &.page-box-1 {
      .page-main-inner {
        padding: 40px 130px 66px 20px;
      }
      .page-main-side {
        right: 20px;
        top: 40px;
        left: auto;
      }
    }

    .page-main {
      &-1 {
        .page-column-forbid-area {
          &::before {
            width: 2000px;
            transform: rotate(34.43deg);
          }
          &::after {
            width: 2000px;
            transform: rotate(-34.43deg);
          }
        }
      }
      &-2 {
        .page-column-forbid-area {
          &::before {
            transform: rotate(54.38deg);
          }
          &::after {
            transform: rotate(-54.38deg);
          }
        }
      }

      &-3 {
        .page-column-forbid-area {
          &::before {
            transform: rotate(64.88deg);
          }
          &::after {
            transform: rotate(-64.88deg);
          }
        }
      }
      &-4 {
        .page-column-forbid-area {
          &::before {
            transform: rotate(70.95deg);
          }
          &::after {
            transform: rotate(-70.95deg);
          }
        }
      }
    }

    .page-locator {
      position: absolute;

      &-top {
        top: 20px;
      }
      &-bottom {
        bottom: 20px;
      }

      &-item {
        width: 20px;
        border-bottom: 14px solid #000;

        &:nth-of-type(1) {
          left: 40px;
        }
        &:nth-of-type(2) {
          right: 86px;
        }
      }
    }

    .page-number {
      &-rect {
        bottom: 20px;
        left: 260px;
      }
      &-rect-list {
        li {
          width: 24px;
          height: 16px;
          &.rect-li-act {
            border-bottom: 16px solid #000;
          }
        }
      }
      &-text {
        &-cont {
          height: 14px;
          line-height: 14px;
        }
      }
    }
  }
}
.page-main-side {
  position: absolute;
  top: 60px;
  bottom: 86px;
  width: 90px;
  left: 40px;
  z-index: 10;

  .free-topic-preview {
    position: absolute;
  }
  .element-item-gutter {
    height: 100% !important;
  }
  .element-item-fill-field {
    transform: rotate(-90deg);
    transform-origin: 0 0;
  }
}
// 分栏间距，默认20px
// page-main-inner
.page-main-inner {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  padding: 60px 40px 86px 40px;
  z-index: 9;
  font-size: 0;
}
// page-main-outer
.page-main-outer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 7;
  background-color: transparent;
  overflow: hidden;
}

.page-column {
  display: inline-block;
  vertical-align: middle;
  position: relative;
  height: 100%;
  width: 100%;
  font-size: 14px;
  padding: 0 10px;

  &-forbid-area {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    z-index: 1;
    border: 1px solid #000;
    overflow: hidden;
    &::before {
      content: "";
      display: block;
      position: absolute;
      width: 1200px;
      border-bottom: 1px solid rgba(172, 172, 172, 1);
      top: 0;
      left: 0;
      transform: rotate(54.216deg);
      transform-origin: left;
      z-index: 1;
    }
    &::after {
      content: "";
      display: block;
      position: absolute;
      width: 1200px;
      border-bottom: 1px solid rgba(172, 172, 172, 1);
      bottom: 0;
      left: 0;
      transform: rotate(-54.216deg);
      transform-origin: left;
      z-index: 1;
    }
    > p {
      padding: 20px;
      position: absolute;
      width: 260px;
      height: 82px;
      top: 50%;
      left: 50%;
      margin-top: -41px;
      margin-left: -130px;
      z-index: 9;
      font-weight: bold;
      font-size: 30px;
      color: #999;
      background-color: #fff;
      text-align: center;
    }
  }
  &-main {
    position: relative;
    height: 100%;
    overflow: hidden;
  }
  &-body {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9;
  }
  &-element {
    .element-item {
      position: relative;
      background-color: #fff;

      &-width {
        width: 100% !important;
      }

      &::before {
        content: "";
        position: absolute;
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        box-sizing: border-box;
        z-index: 2;
        border: 1px solid #000;
        border-top: 0;
      }

      > div {
        z-index: 9;
        position: relative;
      }
      &-card-head {
        &::before {
          border: 0;
        }
      }

      &-topic-head {
        &::before {
          border: 0;
        }
      }
      &-fill-question,
      &-fill-line {
        &::before {
          border-bottom: 0;
        }
      }
      // 预览时，小题扩展答题区之间隐藏分割线
      &-explain {
        &::before {
          border-bottom-color: transparent;
        }
      }
      &-type-last {
        &::before {
          border-bottom: 1px solid #000;
        }
      }
    }
    &:last-child {
      .element-item {
        &::before {
          border-bottom: 1px solid #000;
        }
      }
      .element-item-card-head.element-item-type-pre {
        &::before {
          border-bottom: none;
        }
      }
    }
  }

  .page-number {
    position: absolute;
    width: 100%;
    text-align: center;
    bottom: -20px;
  }
}

// locator
.page-locator {
  position: absolute;
  left: 80px;
  right: 80px;
  height: 16px;
  z-index: 8;

  &-top {
    top: 40px;
  }
  &-bottom {
    bottom: 40px;
  }

  &-item {
    position: absolute;
    width: 24px;
    border-bottom: 16px solid #000;
    top: 0;

    &:nth-of-type(1) {
      left: 50px;
    }
    &:nth-of-type(2) {
      right: 96px;
    }
  }
}

// page-number
.page-number {
  &-rect {
    position: absolute;
    bottom: 40px;
    left: 300px;
  }
  &-rect-list {
    font-size: 0;

    li {
      display: inline-block;
      vertical-align: top;
      font-size: 14px;
      width: 30px;
      height: 20px;
      border: 1px solid #000;
      margin-right: 10px;
      &.rect-li-act {
        height: 0;
        border: none;
        border-bottom: 20px solid #000;
      }
    }
  }
  &-text {
    &-cont {
      height: 16px;
      line-height: 16px;
    }
  }
}

// elem
.elem {
  &-title {
    padding: 10px;
    font-size: 14px;
    color: rgba(0, 0, 0, 1);
    line-height: 1;
    white-space: normal;
  }
  &-body {
    padding: 10px;
  }
}
// grid
.grid-container {
  margin-left: -10px;
  margin-right: -10px;
}
.grid-row {
  display: table;
  width: 100%;
  border-spacing: 10px 0;
  border-collapse: separate;

  &:nth-of-type(2) {
    margin-top: 10px;
  }

  .grid-col {
    display: table-cell;
    width: 50%;
    vertical-align: top;
    border: 1px solid #000;
    &-dash {
      border-style: dashed;
      vertical-align: middle;
    }
  }
}
// card-head
.card-head {
  &-title {
    text-align: center;
    color: #000;
    font-size: 24px;
    font-weight: bold;
    overflow: hidden;

    > h1 {
      line-height: 40px;
      white-space: nowrap;
      letter-spacing: -1px;
    }
  }
  &-info {
    padding-bottom: 30px;
    .info-item {
      height: 30px;
      line-height: 30px;
      position: relative;
      overflow: hidden;
      width: 80%;
      margin: 0 auto;

      &::after {
        content: "";
        display: block;
        position: absolute;
        width: 100%;
        border-bottom: 1px solid #000;
        bottom: 6px;
        left: 0;
        z-index: 1;
      }

      > span {
        z-index: 2;
        display: block;
        position: relative;
        font-size: 14px;

        &:first-child {
          float: left;
          background-color: #fff;
          text-align: justify;
        }
        &:nth-of-type(2) {
          float: left;
          width: 20px;
          background-color: #fff;
        }
        &:last-child {
          height: 100%;
        }
      }
    }
  }

  &-notice {
    border: 1px solid #000;
    padding: 6px 8px;
    > h4 {
      font-weight: normal;
      margin-bottom: 8px;
    }
    &-cont {
      line-height: 1.5;
      font-size: 12px;
      margin-bottom: 5px;

      > span {
        display: block;

        &:first-child {
          width: 20px;
          white-space: nowrap;
          float: left;
        }
        &:last-child {
          margin-left: 20px;
          white-space: normal;
        }
      }
    }
  }

  &-dynamic {
    padding: 6px 8px;
    border: 1px solid #000;
    border-top: none;

    p {
      display: inline-block;
      vertical-align: middle;
      line-height: 18px;
      word-wrap: normal;

      &:first-child {
        margin-right: 100px;
      }

      > span,
      > i {
        display: inline-block;
        vertical-align: middle;
        box-sizing: border-box;
      }
      &:first-child {
        i {
          width: 28px;
          height: 14px;
          background-color: #000;
        }
      }
      &:last-child {
        > i {
          width: 28px;
          height: 14px;
          border: 1px solid #000;
          font-size: 14px;
          font-weight: bold;
          margin-right: 6px;
          line-height: 12px;
          text-align: center;

          &:last-child {
            margin-right: 0;
          }
          // wkhtmltopdf 工具无法渲染如下样式：
          // &:nth-of-type(1) {
          //   position: relative;
          //   &::before {
          //     content: "";
          //     display: block;
          //     position: absolute;
          //     left: 30%;
          //     top: 1px;
          //     height: 5px;
          //     width: 11px;
          //     transform: rotate(-45deg);
          //     border-left: 1px solid #000;
          //     border-bottom: 1px solid #000;
          //   }
          // }
          // &:nth-of-type(2) {
          //   position: relative;
          //   &::before {
          //     content: "";
          //     display: block;
          //     position: absolute;
          //     left: 7px;
          //     top: 5px;
          //     width: 11px;
          //     transform: rotate(-45deg);
          //     transform-origin: center center;
          //     border-bottom: 1px solid #000;
          //   }
          //   &::after {
          //     content: "";
          //     display: block;
          //     position: absolute;
          //     left: 8px;
          //     top: 5px;
          //     width: 11px;
          //     transform: rotate(45deg);
          //     transform-origin: center center;
          //     border-bottom: 1px solid #000;
          //   }
          // }

          &:nth-of-type(3) {
            &::before {
              content: "";
              display: inline-block;
              vertical-align: top;
              margin-left: -5px;
              height: 100%;
              width: 5px;
              background-color: #000;
            }
          }
          &:nth-of-type(4) {
            &::before {
              content: "";
              display: inline-block;
              margin-top: 1px;
              width: 10px;
              height: 10px;
              border-radius: 50%;
              background-color: #000;
            }
          }
        }
      }
    }
  }
}
// elem-topic-head
.elem-topic-head {
  text-align: center;
  .elem-body {
    padding: 0;
    border: 1px solid #000;
  }
  &-pad {
    padding-top: 10px;
  }
  h3 {
    font-size: 16px;
    height: 29px;
    line-height: 28px;
    border-bottom: 1px dotted #000;
    font-weight: normal;
  }
  p {
    font-size: 12px;
    height: 29px;
    line-height: 29px;
    white-space: nowrap;
    overflow: hidden;
    // text-overflow: ellipsis;
  }
}
// elem-line
.elem-line-horizontal {
  height: 100%;
  line-height: 30px;
  .line-body {
    display: inline-block;
    vertical-align: middle;
    width: 100%;
    border-bottom: 1px solid #000;
  }
}
.elem-line-vertical {
  height: 100%;
  text-align: center;
  .line-body {
    display: inline-block;
    vertical-align: top;
    height: 100%;
    border-left: 1px solid #000;
  }
}
// elem-lines
.elem-lines {
  .line-item {
    display: inline-block;
    vertical-align: top;
  }
}
// elem-rect
.elem-rect {
  .rect-body {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
  }
}
// elem-text
.elem-text {
  .text-body {
    padding: 5px;
    line-height: 1.4;

    span {
      white-space: pre-wrap;
      word-wrap: normal;
      word-break: break-all;
      &.cont-variate {
        color: #a0a0a0;
        margin: 0 2px;
      }
    }
  }
  &.is-side {
    -webkit-transform: rotate(-90deg);
    transform: rotate(-90deg);
    -webkit-transform-origin: 0 100%;
    transform-origin: 0 100%;
  }
}
// elem-barcode
.elem-barcode {
  height: 100%;
  border-color: transparent;
  border-width: 1pt;
  position: relative;
  > img {
    max-height: 100%;
    max-width: 100%;
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    margin: auto;
  }
}
// elem-image
.elem-image {
  height: 100%;
  border-color: transparent;
  border-width: 1pt;
  position: relative;
  > p {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    display: table;
    text-align: center;
    color: #b0b0b0;
    font-size: 30pt;

    i {
      display: table-cell;
      vertical-align: middle;
    }
  }
  > img {
    max-height: 100%;
    max-width: 100%;
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    margin: auto;
  }
}
// elem-girds
.elem-grids {
  > table {
    table-layout: fixed;
    border-spacing: 0;
    border-collapse: collapse;
    td {
      border: 1px solid #000;
    }
  }
  &-halving {
    > table {
      table-layout: auto;
      width: 100%;
    }
  }
}
// elem-fill-question
.elem-fill-question {
  white-space: normal;

  // 客观题强调标记
  .fill-question-sign {
    position: absolute;
    right: 0;
    top: 0;
    z-index: 99;
    color: #fff;
    padding: 6px 10px;
    line-height: 1;
    font-size: 18px;
    border-bottom-left-radius: 10px;
    display: none;

    &.is-simple {
      background-color: mix(#fff, $--color-success, 20%);
    }
    &.is-multiply {
      background-color: $--color-primary-light;
    }
    &.is-boolean {
      background-color: mix(#fff, $--color-warning, 20%);
    }
  }
  &-first {
    .fill-question-sign {
      display: block;
    }
  }

  .elem-body {
    padding: 18px 0 18px 16px;
    font-size: 0px;
  }

  .group-item {
    font-family: "Times New Roman", Arial, sans-serif;
    display: inline-block;
    vertical-align: top;
    font-size: 0;
    // margin-bottom: 20px;
  }
  .question-item {
    font-size: 0;
  }
  .option-item {
    display: inline-block;
    vertical-align: middle;
    padding: 0;
    width: 18px;
    height: 14px;
    text-align: center;
    font-size: 12px;
    line-height: 1;
    // border-rect
    border: 1px solid #000;
    color: #000;
    box-sizing: border-box;

    > i {
      display: inline-block;
      transform: scale(0.67, 0.67);
    }

    &:first-child {
      text-align: right;
      border-color: transparent;
      font-size: 12px;
      color: #000;
      > i {
        transform: scale(1, 1);
      }
    }
    &:last-child {
      margin-right: 0 !important;
    }
  }

  &-vertical {
    .question-item {
      display: inline-block;
      vertical-align: top;
      &:last-child {
        margin-right: 0 !important;
      }
    }
    .option-item {
      display: block;

      &:first-child {
        padding: 0;
        text-align: center;
      }
      &:last-child {
        margin-bottom: 0 !important;
      }
    }
  }
}
// elem-fill-area
.elem-fill-area {
  .option-item {
    display: inline-block;
    vertical-align: middle;
    width: 30px;
    height: 16px;
    border: 1px solid #000;

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

  &-vertical {
    .option-item {
      display: block;
      &:last-child {
        margin-bottom: 0 !important;
      }
    }
  }
}
// elem-fill-line
.elem-fill-line {
  white-space: normal;

  .elem-body {
    padding: 0 15px 0 10px;
    font-size: 0;
  }
  .elem-fill-quesiton {
    display: inline-block;
    vertical-align: top;
    position: relative;
    padding: 0 1px;
    font-size: 12px;

    li {
      &.elem-fill-line {
        height: 40px;
        position: relative;
        margin: 0 10px 0 20px;
        z-index: 8;
        &::after {
          content: "";
          display: block;
          position: absolute;
          width: 100%;
          border-bottom: 1px solid #000;
          bottom: 8px;
        }
      }
      &.elem-fill-no {
        position: absolute;
        top: 2px;
        bottom: 2px;
        left: 1px;
        z-index: 9;
        min-width: 20px;
        text-align: left;
        background-color: #fff;
        border: none;

        span {
          display: block;
          position: relative;
          padding-bottom: 5px;
          padding-right: 3px;
          transform: translateY(-100%);
        }
      }
      &.elem-fill-comma {
        position: absolute;
        top: 0;
        right: -10px;
        z-index: 9;
        transform: translateY(-100%);
        width: 10px;
        padding-bottom: 4px;
        background-color: #fff;
        text-align: center;
        border: none;
      }
    }
  }
}

// elem-explain
.elem-explain {
  .elem-title {
    padding-bottom: 0;
  }
  .elem-body {
    min-height: 60px;
    position: relative;
  }
  .elem-explain-no {
    position: absolute;
    left: 20px;
    top: 10px;
    font-size: 12px;
    z-index: 9;
  }
  .elem-explain-elements {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 8;
  }
  .elem-explain-element {
    .explain-element-body {
      position: absolute;
    }
  }
}
// .elem-composition
.elem-composition {
  .elem-title {
    padding-bottom: 0;
  }
  .elem-body {
    min-height: 60px;
    position: relative;
  }
  &-elements {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 8;
  }

  .elem-composition-element {
    .composition-element-body {
      position: absolute;
      overflow: hidden;
    }
  }
}
// elem-fill-number
.elem-fill-number {
  border: 1px solid #000;
  .fill-number {
    &-rect {
      font-size: 0;
      height: 27px;
      border-bottom: 1px solid #000;
    }
    &-number {
      display: inline-block;
      vertical-align: top;
      width: 7.692%;
      height: 100%;
      &:not(:last-child) {
        border-right: 1px solid #000;
      }
    }

    &-head {
      height: 51px;

      > h5 {
        border-bottom: 1px solid #000;
        line-height: 24px;
        font-size: 16px;
        font-weight: bold;
        text-align: center;
      }
    }

    &-body {
      display: table;
      width: 100%;
    }
    &-list {
      display: table-cell;
      width: 7.692%;
      padding: 1px 0;
    }
    &-option {
      margin: 8px auto;
      width: 20px;
      height: 14px;
      font-size: 12px;
      line-height: 1;
      text-align: center;
      color: #000;
      // border-rect
      border: 1px solid #000;
      font-family: "Times New Roman", Arial, sans-serif;
      > i {
        display: inline-block;
        transform: scale(0.67, 0.67);
      }
    }
  }
}
// elem-fill-field
.elem-fill-field {
  white-space: normal;
  overflow: hidden;
  font-size: 0;

  &.is-side {
    -webkit-transform: rotate(-90deg);
    transform: rotate(-90deg);
    -webkit-transform-origin: 0 100%;
    transform-origin: 0 100%;
  }
}
.fill-field {
  &-item {
    display: inline-block;
    padding: 0 10px;
    width: 100%;
    font-size: 14px;
  }
  &-content {
    height: 30px;
    line-height: 26px;
    overflow: hidden;
    position: relative;

    &::after {
      content: "";
      display: block;
      position: absolute;
      width: 100%;
      border-bottom: 1px solid #000;
      bottom: 2px;
      left: 0;
      z-index: 1;
    }

    > span {
      z-index: 2;
      display: inline-block;
      position: relative;
      font-size: 14px;
      vertical-align: top;

      &:first-child {
        background-color: #fff;
        text-align: justify;

        // &::after {
        //   content: "";
        //   display: inline-block;
        //   width: 100%;
        //   height: 0;
        //   line-height: 0;
        // }
      }
      &:nth-of-type(2) {
        width: 10px;
        background-color: #fff;
      }
    }
  }
}

// elem-fill-pane
.elem-fill-pane {
  font-size: 0;
  white-space: normal;
  overflow: hidden;
  .fill-pane {
    &-item {
      display: inline-block;
      vertical-align: top;
      font-size: 14px;
    }
    &-cont {
      border: 1px solid #000;
    }
  }
}

// elem-gutter
.elem-gutter {
  position: relative;
  width: 30px;
  height: 100%;

  &-left {
    border-right: 1px solid #000;
  }
  &-right {
    border-left: 1px solid #000;
  }

  &-content {
    position: absolute;
    width: 100%;
    top: 50%;
    left: 0;
    transform: translateY(-50%);

    > span {
      display: block;
      padding: 5px;
      line-height: 20px;
      transform: rotate(-90deg);
    }
  }
}

// card-free-preview
.card-free-preview {
  &:not(.card-print) {
    padding: 10px 0;
    background-color: #f0f0f0;

    .page-box {
      margin: 10px auto;
      box-shadow: 0 0 4px #ddd;
    }
  }
  .page-column-element {
    .element-item {
      position: absolute;

      &::before {
        display: none;
      }
    }
  }
}
