@import url(../var.less);

@dialog-prefix: ~"@{prefix}dialog";

.@{dialog-prefix}{
  position: relative;
  margin: 0 auto 50px;
  background: @dialog-background-color;
  border-radius: @border-radius-base;
  box-shadow: @dialog-box-shadow;
  box-sizing: border-box;
  width: 50%;

  &.is-fullscreen {
    width: 100%;
    margin-top: 0;
    margin-bottom: 0;
    height: 100%;
    overflow: auto;
  }

  &__wrapper {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    overflow: auto;
    margin: 0;
  }

  &__header {
    padding: @dialog-padding-primary;
    border-bottom: @border-base;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  &__headerbtn {
    padding: 0;
    background: transparent;
    border: none;
    outline: none;
    cursor: pointer;
    font-size: @message-close-size;

    .w-dialog__close {
      color: @info-color;
      font-size: @dialog-content-font-size + 6px;
    }

    &:focus, &:hover {
      .w-dialog__close {
        color: @primary-color;
      }
    }
  }

  &__title {
    line-height: @dialog-font-line-height;
    font-size: @dialog-title-font-size;
    font-weight: @dialog-title-font-weight;
    color: @primary-text-color;
  }

  &__body {
    padding: (@dialog-padding-primary-vertical + 10px) (@dialog-padding-primary-horizontal + 24px);
    color: @regular-text-color;
    font-size: @dialog-content-font-size;
    word-break: break-all;
  }

  &__footer {
    padding: @dialog-padding-primary;
    text-align: right;
    box-sizing: border-box;
    border-top: @border-base;
  }

  &--center {
    text-align: center;
    .w-dialog__title {
      width: 100%;
    }

    .w-dialog__body {
      text-align: initial;
      padding: 25px (@dialog-padding-primary-horizontal + 5px) 30px;
    }

    .w-dialog__footer {
      text-align: inherit;
    }
  }

  &.is-vertical-center {
    display: flex;
    display: -ms-flex; /* 兼容IE */
    flex-direction: column;
    -ms-flex-direction: column; /* 兼容IE */
    margin:0 !important;
    position:absolute;
    top:50%;
    left:50%;
    transform:translate(-50%,-50%);
    max-height:calc(100% - 30px);
    max-width:calc(100% - 30px);

    .w-dialog__body{
      max-height: 100%;
      flex: 1;
      -ms-flex: 1 1 auto; /* 兼容IE */
      overflow-y: auto;
      overflow-x: hidden;
    }

    .w-dialog__wrapper {
      /*隐藏ie和edge中遮罩的滚动条*/
      overflow: hidden;
    }
  }
}

.dialog-fade-enter-active {
  animation: dialog-fade-in .3s;
}

.dialog-fade-leave-active {
  animation: dialog-fade-out .3s;
}

@keyframes dialog-fade-in {
  0% {
    transform: translate3d(0, -20px, 0);
    opacity: 0;
  }
  100% {
    transform: translate3d(0, 0, 0);
    opacity: 1;
  }
}

@keyframes dialog-fade-out {
  0% {
    transform: translate3d(0, 0, 0);
    opacity: 1;
  }
  100% {
    transform: translate3d(0, -20px, 0);
    opacity: 0;
  }
}