@import "mixins/mixins";
@import "mixins/utils";
@import "common/var";
@import "common/popup";

@include b(dialog) {
  position: relative;
  margin: 0 auto 50px;
  background: $--dialog-background-color;
  border-radius: $--border-radius-small;
  box-shadow: $--dialog-box-shadow;
  box-sizing: border-box;
  width: 50%;

  @include when(fullscreen) {
    width: 100%;
    margin-top: 0;
    margin-bottom: 0;
    height: 100%;
    overflow: auto;
  }

  @include e(wrapper) {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    overflow: auto;
    margin: 0;
  }

  @include e(header) {
    padding: $--dialog-header-padding-primary;
    padding-bottom: 8px;
    padding-top: 8px;
    height: 32px;
    line-height: 32px;
    background: $--background-dialog-header;
  }

  @include e(headerbtn) {
    position: absolute;
    top: $--dialog-header-padding-primary;
    right: 12px;
    padding: 0;
    top: 8px;
    background: transparent;
    border: none;
    outline: none;
    cursor: pointer;
    font-size: $--message-close-size;

    .el-dialog__close {
      color: $--color-default-text-plain;
    }

    &:focus, &:hover {
      .el-dialog__close {
        color: $--color-primary;
      }
    }
  }
  

  @include e(title) {
    line-height: 10px;
    height: 32px;
    font-size: $--dialog-title-font-size;
    font-weight: bold;
    color: $--color-text-primary;
    position: absolute;
    margin-top: 3px;
  }

  @include e(tip) {
    font-size: $--dialog-title-font-size;
    height: 40px;
    line-height: 40px;
    padding: 0 32px;
    border-bottom: 1px solid $--border-color-base;
    margin: -20px -20px 18px -20px;
    
    @include e(infotip){
      color: $--color-info;
    }
    @include e(successtip){
      color: $--color-success;
    }
    @include e(errortip){
      color: $--color-danger;
    }
  }
  

  @include e(body) {
    padding: $--dialog-padding-primary;
    color: $--color-text-regular;
    font-size: $--dialog-content-font-size;
    word-break: break-all;
  }

  @include e(footer) {
    padding: 0 0 $--dialog-padding-footer 0;
    text-align: center;
    box-sizing: border-box;
 
     & button:nth-child(2) {
       margin-left: 12px;
     }
     & button:nth-child(3) {
      margin-left: 12px;
    }
    & button:nth-child(4) {
      margin-left: 12px;
    }
  }

  // 内容居中布局
  @include m(center) {
    text-align: center;

    @include e(body) {
      text-align: initial;
      padding: 25px ($--dialog-padding-primary + 5px) 30px;
    }

    @include e(footer) {
      text-align: inherit;
    }
  }
}

.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;
  }
}
