/**Variable**/
@import './helpers/mixin.scss';

.plx-modal--wrapper {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  font-size: $vxe-font-size;
  color: $vxe-font-color;
  font-family: $vxe-font-family;
  transition: top .4s;
  &.active {
    display: block;
  }
  &.is--visible {
    &.is--mask {
      &:before {
        background-color: rgba(0, 0, 0, 0.5);
      }
    }
    &.type--message {
      .plx-modal--box {
        transform: translateY(0);
      }
    }
    .plx-modal--box {
      opacity: 1;
      visibility: visible;
    }
  }
  &:not(.lock--view) {
    pointer-events: none;
  }
  &.lock--scroll {
    overflow: hidden;
  }
  &:not(.lock--scroll) {
    overflow: auto;
  }
  &.lock--view,
  &.is--mask {
    &:before {
      content: "";
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      z-index: -1;
      pointer-events: auto;
    }
  }
  &.is--mask {
    &:before {
      background-color: rgba(0, 0, 0, 0);
    }
  }
  &.is--animat {
    &.is--mask {
      &:before {
        @include animatTransition(background-color, .2s);
      }
    }
    &.type--message {
      .plx-modal--box {
        &:not(.is--drag) {
          @include animatTransition(all, .2s, ease-out);
        }
      }
    }
  }
  &.size--small,
  &.size--mini {
    font-size: 12px;
    .plx-modal--box {
      padding: 6px 0;
    }
    .plx-modal--body {
      padding: 4px 14px 10px 14px;
    }
    .plx-modal--footer {
      padding: 4px 14px 8px 14px;
    }
    .plx-modal--header {
      font-size: 14px;
      padding: 6px 30px 8px 14px;
    }
    .plx-modal--zoom-btn,
    .plx-modal--close-btn {
      font-size: 16px;
      top: 10px;
    }
  }
  &.type--message,
  &.type--alert,
  &.type--confirm {
    .plx-modal--body {
      white-space: normal;
      word-break: break-word;
    }
  }
  &.type--message {
    text-align: center;
    .plx-modal--box {
      display: inline-block;
      padding: 2px 0;
      margin-top: 0;
      width: auto;
      box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.1);
      transform: translateY(-10%);
      .plx-modal--body {
        &:after {
          content: '';
          display: block;
          clear: both;
          height: 0;
          overflow: hidden;
          visibility: hidden;
        }
      }
      .plx-modal--content {
        max-width: 800px;
        float: left;
      }
    }
    .plx-modal--status-wrapper {
      font-size: 1.4em;
      padding-right: 10px;
    }
  }
  &.type--modal,
  &.type--alert,
  &.type--confirm {
    .plx-modal--box {
      display: flex;
      flex-direction: column;
      position: absolute;
      left: 50%;
      top: 15vh;
      box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.2);
      border: 1px solid rgba(0,0,0,.2);
      .plx-modal--header {
        cursor: move;
      }
    }
  }

  &.type--modal {
    .plx-modal--body {
      overflow: auto;
      .plx-modal--content {
        overflow: auto;
      }
    }
  }
  &.type--alert,
  &.type--confirm {
    .plx-modal--status-wrapper {
      font-size: 1.6em;
      padding: 0 10px 0 2px;
    }
  }
  .plx-modal--box {
    visibility: hidden;
    width: 420px;
    background-color: #fff;
    border-radius: 4px;
    border: 1px solid #ebeef5;
    font-size: 14px;
    text-align: left;
    pointer-events: auto;
    opacity: 0;
    &.is--drag {
      cursor: move;
     .plx-modal--body,
     .plx-modal--footer {
        &:after {
          content: "";
          position: absolute;
          top: 0;
          left: 0;
          width: 100%;
          height: 100%;
        }
      }
      .plx-modal--body {
        overflow: hidden;
        .plx-modal--content {
          overflow: hidden;
        }
      }
    }
  }
  &.status--info {
    .plx-modal--status-wrapper {
      color: #2998FF;
    }
  }
  &.status--warning,
  &.status--question {
    .plx-modal--status-wrapper {
      color: #FAAD14;
    }
  }
  &.status--success {
    .plx-modal--status-wrapper {
      color: #52C41A;
    }
  }
  &.status--error {
    .plx-modal--status-wrapper {
      color: #F5222D;
    }
  }
  &.status--loading {
    .plx-modal--status-wrapper {
      color: #78B1EB;
    }
  }
  .plx-modal--status-wrapper {
    flex-shrink: 0;
    display: flex;
    align-items: center;
  }
  .plx-modal--content {
    flex-grow: 1;
  }
  .plx-modal--header,
  .plx-modal--body,
  .plx-modal--footer {
    position: relative;
  }
  .plx-modal--body {
    display: flex;
    flex-grow: 1;
    padding: 10px 16px 12px 16px;
  }
  .plx-modal--header {
    flex-shrink: 0;
    font-size: 16px;
    font-weight: 700;
    padding: 10px 40px 8px 16px;
    border-bottom: 1px solid #eee;
    background-color: $vxe-modal-header-background-color;
    border-radius: 2px 2px 0 0;
    user-select: none;
    .plx-icon--zoomin,
    .plx-icon--zoomout:after {
      background-color: $vxe-modal-header-background-color;
    }
  }
  .plx-modal--zoom-btn,
  .plx-modal--close-btn {
    font-size: 18px;
    position: absolute;
    right: 14px;
    top: 12px;
    z-index: 1;
    color: $vxe-table-column-icon-border-color;
    cursor: pointer;
    &:hover {
      color: $vxe-font-color;
    }
  }
  .plx-modal--zoom-btn {
    right: 44px;
    border-color: $vxe-table-column-icon-border-color;
    &:hover {
      border-color: $vxe-font-color;
    }
  }
  .plx-modal--footer {
    flex-shrink: 0;
    text-align: right;
    padding: 6px 16px 10px 16px;
  }
  &.is--maximize {
    .plx-modal--box {
      .plx-modal--header {
        cursor: default;
      }
    }
    .plx-modal--resize {
      .wl-resize,
      .wr-resize,
      .swst-resize,
      .sest-resize,
      .st-resize,
      .swlb-resize,
      .selb-resize,
      .sb-resize {
        display: none;
      }
    }
  }
  .plx-modal--resize {
    $SpaceSize: 8;
    .wl-resize,
    .wr-resize,
    .swst-resize,
    .sest-resize,
    .st-resize,
    .swlb-resize,
    .selb-resize,
    .sb-resize {
      position: absolute;
      z-index: 100;
    }
    .wl-resize,
    .wr-resize {
      width: #{$SpaceSize}px;
      height: 100%;
      top: 0;
      cursor: w-resize;
    }
    .wl-resize {
      left: -#{$SpaceSize / 2 + 1}px;
    }
    .wr-resize {
      right: -#{$SpaceSize / 2 + 1}px;
    }
    .swst-resize,
    .sest-resize,
    .swlb-resize,
    .selb-resize {
      width: #{$SpaceSize + 2}px;
      height: #{$SpaceSize + 2}px;
      z-index: 101;
    }
    .swst-resize,
    .sest-resize {
      top: -#{$SpaceSize}px;
    }
    .swlb-resize,
    .selb-resize {
      bottom: -#{$SpaceSize}px;
    }
    .sest-resize,
    .swlb-resize {
      cursor: sw-resize;
    }
    .swst-resize,
    .selb-resize {
      cursor: se-resize;
    }
    .swst-resize,
    .swlb-resize {
      left: -#{$SpaceSize}px;
    }
    .sest-resize,
    .selb-resize {
      right: -#{$SpaceSize}px;
    }
    .st-resize,
    .sb-resize {
      width: 100%;
      height: #{$SpaceSize}px;
      left: 0;
      cursor: s-resize;
    }
    .st-resize {
      top: -#{$SpaceSize / 2 + 1}px;
    }
    .sb-resize {
      bottom: -#{$SpaceSize / 2 + 1}px;
    }
  }
}