@import "../../style/themes/default.less";

@image-viewer-prefix-cls: ~"@{mkui-prefix}-image-viewer";

.fixLength {
  width: 100%;
  height: 100%;
}

@dotWidth: 12px;
@dotHeight: 12px;
@dotRadius: @dotWidth/2;

@dotColor: #0092FF;
@dotBgColor: @dotColor;
@dotSpacing: @dotWidth+@dotWidth/2;

@leftPos: -9999px;
@x1: -@leftPos - @dotSpacing;
@x2: -@leftPos;
@x3: -@leftPos + @dotSpacing;

.dot(@width: @dotWidth, @height: @dotHeight, @radius: @dotRadius, @bgColor: @dotBgColor, @color: @dotColor) {
  background-color: @bgColor;
  border-radius: @radius;
  color: @color;
  height: @height;
  width: @width;
}

.@{image-viewer-prefix-cls} {
  width: 100%;
  height: 100%;
  position: relative;
  user-select: none;

  .none-info {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 36%;
    left: 35%;
    color: #999;
    font-size: 14px;

    .noInvoice-img {
      width: 31%;
      height: 24%;
    }

    .noInvoice-text {
      width: 31%;
      height: 4%;
      text-align: center;
    }
  }

  .@{image-viewer-prefix-cls}-validate-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -60px;
    margin-left: -30px;
    color: #0092ff;
  }

  .@{image-viewer-prefix-cls}-content {
    .fixLength();

    .@{image-viewer-prefix-cls}-content-warpper {
      position: relative;
      .fixLength();
      background: #757575;
      &-pdf {
        position: absolute;
        top:45px;
        cursor: pointer;
        height:100%;
        width:100%;
        overflow-y: auto;
      }
      &-background {
        overflow: hidden;
        .fixLength();
        position: absolute;
        top: 0;
        left: 0;
        &-img {
          position: absolute;
          cursor: move;
          max-height: 100%;
          max-width: 100%;
          margin: auto;
          top: 0;
          left: 0;
          bottom: 0;
          right: 0;
        }

        &-img-move {
          position: absolute;
          cursor: move;
        }

        .image-spin {
          position: relative;
          top: 50%;
          left: 50%;
          transform: translate(-50%, -50%);
        }

        &-pdf {
          width: 100%;
          height: 100%;
          background-color: #f9f9f9;
          color: #dc6941;
          font-size: 300px;
          position: absolute;
          svg {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
          }
        }

        &-no {
          width: 100%;
          height: 100%;
          background-color: #f9f9f9;
          font-size: 16px;
          &-title {
            text-align: center;
            position: relative;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
          }
        }
      }
    }
  }

  .@{image-viewer-prefix-cls}-option {
    height: 7.5%;
    width: 100%;
    position: absolute;
    top: 0;
    background-color: #333;
    opacity: 0.9;
    z-index: 9;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;

    &-icon {
      outline: none;
      cursor: pointer;
      font-size: 18px;
      margin-right: 4%;
    }

    &-menu {
      margin-left: 4%;
      font-size: 13px;
      cursor: pointer;
      .menu-icon {
        position: relative;
        top: 2px;
        font-size: 19px;
        margin-right: 6px;
      }
      &.isNotValidate {
        display: none;
      }
      &.validated {
        color: #62be61;
      }
    }

    .tool-bar-extra-item {
      cursor: pointer;
      margin-right: 4%;
    }
  }

  .@{image-viewer-prefix-cls}-nav {
    height: 15%;
    width: 100%;
    position: absolute;
    background-color: #333;
    opacity: 0.9;
    bottom: 0;

    &-number {
      height: 32%;
      width: 100%;
      display: flex;
      justify-content: center;
      align-items: center;
      color: aliceblue;
      font-size: 12px;
    }

    .@{image-viewer-prefix-cls}-nav-body {
      width: 100%;
      height: 68%;
      display: flex;
      align-items: center;
      &-prev {
        width: 14%;
        display: flex;
        justify-content: flex-end;
        &-arrows {
          width: 40px;
          height: 40px;
          text-align: center;
          line-height: 45px;
          cursor: pointer;
          &:hover {
            background-color: #555;
          }
          .arrows-icon {
            color: #fff;
            font-size: 20px;
          }
        }
      }

      &-next {
        display: flex;
        justify-content: flex-start;
        width: 14%;
        &-arrows {
          width: 40px;
          height: 40px;
          text-align: center;
          line-height: 45px;
          cursor: pointer;
          &:hover {
            background-color: #555;
          }
          .arrows-icon {
            color: #fff;
            font-size: 20px;
          }
        }
      }

      &-content {
        width: 88%;
        display: flex;
        justify-content: center;

        .nav-img {
          position: relative;
          width: 44px;
          height: 44px;
          margin-right: 8px;
          border: 2px solid #333;
          border-radius: 5px;
          justify-content: center;
          align-items: center;
          background: #fff;
          cursor: pointer;
          &.active {
            border: 2px solid #3296fa;
            animation: target 1s;
          }
          img {
            position: absolute;
            height: 100%;
            width: 100%;
            margin: auto;
            top: 0;
            left: 0;
            bottom: 0;
            right: 0;
          }
          &-pdf {
            height: 100%;
            width: 100%;
            background-color: #f9f9f9;
            color: #dc6941;
            font-size: 30px;
            svg {
              margin-top: 15%;
            }
          }
          .authentication-icon {
            font-size: 13px;
            color: #62be61;
            position: absolute;
            top: 5px;
            right: 5px;
          }
        }

        .nav-nail-font {
          // display: inline-block;
          // width: 40px;
          // height: 40px;
          // background: url(https://cmimg.maycur.com/front-static-resource/imgs/invoice-default.png) no-repeat center;
          // background-size: 40px 40px;
          font-size: 38px;
          color: #dc6941;
        }
      }

      &-icon {
        font-size: 13px;
        position: relative;
        top: 5px;
        right: 5px;
      }
    }
  }

  .@{image-viewer-prefix-cls}-dot {
    position: absolute;
    top: -44px;
    bottom: 0;
    left: 0;
    right: 0;
    margin: auto;
    z-index: 2010;
    width: 100px;
    height: 65px;
    text-align: center;
    &-text {
      font-family: MicrosoftYaHei;
      color: #0092FF;
      font-size: 16px;
    }
    &-pulse {
      .dot;
      margin: 16px auto;
      animation: dotPulse 1.5s infinite linear;
      box-shadow: @x1 0 0 0 @dotColor,
      @x2 0 0 0 @dotColor,
      @x3 0 0 0 @dotColor;
      left: @leftPos;
      position: relative;
    }
  }
}

@keyframes target {
  from {
    border: 2px solid #fff;
  }

  to {
    border: 2px solid #3296fa;
  }
}

@keyframes dotPulse {
  0% {
    box-shadow: @x1 0 0 -5px @dotColor,
    @x2 0 0 0 @dotColor,
    @x3 0 0 2px @dotColor;
  }
  25% {
    box-shadow: @x1 0 0 0 @dotColor,
    @x2 0 0 2px @dotColor,
    @x3 0 0 0 @dotColor;
  }
  50% {
    box-shadow: @x1 0 0 2px @dotColor,
    @x2 0 0 0 @dotColor,
    @x3 0 0 -5px @dotColor;
  }
  75% {
    box-shadow: @x1 0 0 0 @dotColor,
    @x2 0 0 -5px @dotColor,
    @x3 0 0 0 @dotColor;
  }
  100% {
    box-shadow: @x1 0 0 -5px @dotColor,
    @x2 0 0 0 @dotColor,
    @x3 0 0 2px @dotColor;
  }
}
