@import './token.less';
// @import './mixin.less';

@btn-prefix-cls: ~'@{prefix}-Viewer-modal';

.@{btn-prefix-cls} {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: left;
  box-shadow: 0 6px 40px 0 rgba(0, 0, 0, 0.25);
  border: none !important;
  transition: all 0.15s;
  z-index: 2;

  &-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    background-clip: padding-box;
    border: 0;
    transition: box-shadow 0.2s;
    border-radius: 4px;
    overflow: hidden;
    user-select: auto;

    &.max {
      border-radius: 0;
    }

    &.dragging {
      user-select: none;
      pointer-events: none;
    }
  }

  &-header {
    position: relative;
    display: flex;
    flex-shrink: 0;
    justify-content: space-between;
    align-items: center;

    border-bottom: 1px solid #f1f1f1;
    user-select: none;
    overflow: hidden;

    &.draggable {
      cursor: move;
    }

    .header-title {
      flex: 1;
      height: 30px;
      overflow: hidden;
      display: flex;
      align-items: center;
      padding: 0 10px;
    }

    &.is-dark {
      color: #fff;
    }
  }

  .header-toolbar {
    display: flex;
    position: absolute;
    right: 0;
    top: 0;
    z-index: 1;

    .tool {
      width: 38px;
      height: 30px;
      vertical-align: top;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14.5px;
      color: rgb(136, 136, 136);
      cursor: pointer;

      & > a.icon {
        display: block;
        text-decoration: none;
        float: left;
        width: 100%;
        height: 100%;
        color: #888;
        background-position: center center;
        background-repeat: no-repeat;
        outline: none;
        cursor: pointer;
        border-top: none;
        font-size: 1.15em;
        text-align: center;
        background-color: transparent;
        transition: background 0.2s;
        line-height: 30px;
        text-shadow: 1px 1px 0 #fff;
        transition: all 0.2s;
      }

      &.close {
        &:hover {
          background: #e81123;
        }
      }
      &:hover {
        background-color: rgba(150, 150, 150, 0.3);
      }
    }

    &.is-dark {
      .tool {
        & > a.icon {
          filter: invert(1) brightness(1);
        }
      }
    }
  }

  &-main {
    position: relative;
    flex: 1;
    flex-shrink: 1;
    overflow: hidden;
  }

  &.can-resize {
    .resize-handle {
      position: absolute;
      z-index: 100;
      display: block;

      &.resize-top {
        cursor: n-resize;
        top: -3px;
        left: 0px;
        height: 7px;
        width: 100%;
      }
      &.resize-right {
        cursor: e-resize;
        right: -3px;
        top: 0px;
        width: 7px;
        height: 100%;
      }
      &.resize-bottom {
        cursor: s-resize;
        bottom: -3px;
        left: 0px;
        height: 7px;
        width: 100%;
      }
      &.resize-left {
        cursor: w-resize;
        left: -3px;
        top: 0px;
        width: 7px;
        height: 100%;
      }

      &.resize-top-right,
      &.resize-bottom-right,
      &.resize-bottom-left,
      &.resize-top-left {
        &::before {
          position: absolute;
          content: '';
          -ms-transition: all 0.2s;
          -webkit-transition: all 0.2s;
          -moz-transition: all 0.2s;
          -o-transition: all 0.2s;
          transition: all 0.2s;
          width: 15px;
          height: 15px;
          opacity: 0;
          pointer-events: none;
          border: 1px solid #1890ff;
          border-radius: 0;
        }

        &:hover,
        &:active {
          &::before {
            opacity: 1;
          }
        }
      }
      &.resize-top-right {
        cursor: ne-resize;
        width: 16px;
        height: 16px;
        right: -8px;
        top: -8px;
        &::before {
          border-left: none;
          border-bottom: none;
          border-radius: 0 4px 0 0;
          left: -8px;
          top: 8px;
        }
      }
      &.resize-bottom-right {
        cursor: se-resize;
        width: 20px;
        height: 20px;
        right: -8px;
        bottom: -8px;
        background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKAgMAAADwXCcuAAAABGdBTUEAALGPC/xhBQAAAAlQTFRFAAAAfX19yMjIpeh73AAAAAF0Uk5TAEDm2GYAAAApSURBVAjXDcexDQAwCASxEx1bpGAQlAlvZL6zgQcItdDh5Er9pfPJ1QNGsQUOQ61KsAAAAABJRU5ErkJggg==)
          no-repeat;
        opacity: 0.4;
        &::before {
          border-left: none;
          border-top: none;
          border-radius: 0 0 4px 0;
          left: -4px;
          top: -4px;
        }
      }
      &.resize-bottom-left {
        cursor: sw-resize;
        width: 16px;
        height: 16px;
        left: -8px;
        bottom: -8px;
        &::before {
          border-right: none;
          border-top: none;
          border-radius: 0 0 0 4px;
          left: 8px;
          top: -8px;
        }
      }
      &.resize-top-left {
        cursor: nw-resize;
        width: 16px;
        height: 16px;
        left: -8px;
        top: -8px;
        &::before {
          border-right: none;
          border-bottom: none;
          border-radius: 4px 0 0 0;
          left: 8px;
          top: 8px;
        }
      }
    }
  }
}

.@{btn-prefix-cls}-mask {
  position: fixed;
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
  background-color: rgba(0, 0, 0, 0.3);
  z-index: 1;

  &.transparent {
    background-color: rgba(0, 0, 0, 0);
  }
}
