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

.vxe-modal--wrapper {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  line-height: 1.5;
  width: calc(100% + 18px);
  height: calc(100% + 18px);
  color: $vxe-font-color;
  font-family: $vxe-font-family;
  transition: top .4s ease-in-out;
  &.is--active {
    display: block;
  }
  &.is--visible {
    &.is--mask {
      &:before {
        background-color: rgba(0, 0, 0, 0.5);
      }
    }
    &.type--message {
      .vxe-modal--box {
        opacity: 1;
        transform: translateY(0);
      }
    }
    .vxe-modal--box {
      opacity: 1;
      visibility: visible;
    }
  }
  &.is--loading {
    .vxe-modal--header,
    .vxe-modal--footer {
      position: relative;
      border-bottom-color: $vxe-loading-background-color;
      &:before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 1;
        user-select: none;
        background-color: $vxe-loading-background-color;
      }
    }
  }
  &:not(.lock--view) {
    pointer-events: none;
  }
  &:not(.type--message) {
    &.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 {
      .vxe-modal--box {
        &:not(.is--drag) {
          @include animatTransition(all, .4s, ease-out);
        }
      }
    }
  }
  &.type--message,
  &.type--alert,
  &.type--confirm {
    .vxe-modal--body {
      white-space: normal;
      word-break: break-word;
    }
  }
  &.type--message {
    text-align: center;
    .vxe-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);
      opacity: 0;
      transform: translateY(-100%);
      .vxe-modal--body {
        &:after {
          content: '';
          display: block;
          clear: both;
          height: 0;
          overflow: hidden;
          visibility: hidden;
        }
      }
      .vxe-modal--content {
        max-width: 800px;
        float: left;
      }
    }
    .vxe-modal--status-wrapper {
      font-size: 1.4em;
      padding-left: 10px;
    }
  }
  &.type--modal,
  &.type--alert,
  &.type--confirm {
    .vxe-modal--box {
      display: flex;
      flex-direction: column;
      position: fixed;
      left: 50%;
      top: 0;
      box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.2);
      .vxe-modal--header {
        cursor: move;
      }
    }
    .vxe-modal--body {
      overflow: auto;
      .vxe-modal--content {
        overflow: auto;
      }
    }
  }

  &.type--modal {
    .vxe-modal--header {
      padding: 0.6em 4.6em 0.6em 1em;
    }
  }
  &.type--alert,
  &.type--confirm {
    .vxe-modal--status-wrapper {
      font-size: 1.6em;
      padding-left: 10px;
    }
  }
  .vxe-modal--box {
    visibility: hidden;
    width: 420px;
    background-color: $vxe-modal-body-background-color;
    border-radius: $vxe-border-radius;
    border: 1px solid $vxe-modal-border-color;
    text-align: left;
    pointer-events: auto;
    opacity: 0;
    &.is--drag {
      cursor: move;
     .vxe-modal--body,
     .vxe-modal--footer {
        &:after {
          content: "";
          position: absolute;
          top: 0;
          left: 0;
          width: 100%;
          height: 100%;
        }
      }
      .vxe-modal--body {
        overflow: hidden;
        .vxe-modal--content {
          overflow: hidden;
        }
      }
    }
  }
  &.status--info {
    .vxe-modal--status-wrapper {
      color: $vxe-info-color;
    }
  }
  &.status--warning,
  &.status--question {
    .vxe-modal--status-wrapper {
      color: $vxe-warning-color;
    }
  }
  &.status--success {
    .vxe-modal--status-wrapper {
      color: $vxe-success-color;
    }
  }
  &.status--error {
    .vxe-modal--status-wrapper {
      color: $vxe-danger-color;
    }
  }
  &.status--loading {
    .vxe-modal--status-wrapper {
      color: $vxe-disabled-color;
    }
  }
  .vxe-modal--status-wrapper {
    flex-shrink: 0;
    display: flex;
    align-items: center;
  }
  .vxe-modal--content {
    flex-grow: 1;
    padding: 0.8em 1em;
  }
  .vxe-modal--header,
  .vxe-modal--body,
  .vxe-modal--footer {
    position: relative;
  }
  .vxe-modal--body {
    display: flex;
    flex-grow: 1;
  }
  .vxe-modal--header {
    flex-shrink: 0;
    font-size: 1.1em;
    font-weight: 700;
    padding: 0.6em 2.8em 0.6em 1em;
    border-bottom: 1px solid $vxe-modal-border-color;
    background-color: $vxe-modal-header-background-color;
    border-radius: $vxe-border-radius $vxe-border-radius 0 0;
    user-select: none;
    &.is--ellipsis {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
  }
  .vxe-modal--zoom-btn,
  .vxe-modal--close-btn {
    position: absolute;
    right: 14px;
    top: 0.85em;
    z-index: 1;
    cursor: pointer;
    &:hover {
      color: $vxe-primary-color;
    }
  }
  .vxe-modal--zoom-btn {
    right: 44px;
  }
  .vxe-modal--footer {
    flex-shrink: 0;
    text-align: right;
    padding: 0.4em 1em 0.8em 1em;
  }
  &.is--maximize {
    .vxe-modal--box {
      .vxe-modal--header {
        cursor: default;
      }
    }
    .vxe-modal--resize {
      .wl-resize,
      .wr-resize,
      .swst-resize,
      .sest-resize,
      .st-resize,
      .swlb-resize,
      .selb-resize,
      .sb-resize {
        display: none;
      }
    }
  }
  .vxe-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;
    }
  }
}

.vxe-modal--wrapper {
  font-size: $vxe-font-size;
  &.size--medium {
    font-size: $vxe-font-size-medium;
  }
  &.size--small {
    font-size: $vxe-font-size-small;
  }
  &.size--mini {
    font-size: $vxe-font-size-mini;
  }
}