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

@include b(alert) {
  width: 100%;
  padding: $--alert-padding;
  margin: 0;
  box-sizing: border-box;
  border-radius: 0;
  position: relative;
  background-color: $--color-white;
  overflow: hidden;
  opacity: 1;
  display: flex;
  align-items: center;
  transition: opacity .2s;
  &.is-radius {
    border-radius: $--alert-border-radius;
  }
  @include m(small) {
    padding: 5.5px 24px;
  }

  @include m(mini) {
    padding: 3.5px 16px;
    &.is-radius {
      border-radius: 2px;
    }   
  }

  @include when(light) {
    .el-alert__closebtn {
      color: $--color-text-placeholder;
    }
  }

//   @include when(dark) {
//     .el-alert__closebtn {
//       color: $--color-white;
//     }
//     .el-alert__description {
//       color: $--color-white;
//     }
//   }

  @include when(center) {
    justify-content: center;
  }

  @include m(success) {
    &.is-light {
      background-color: $--alert-success-color;
      color: $--color-success;

      .el-alert__description {
        color: $--color-success;
      }
    }

    // &.is-dark {
    //   background-color: $--color-success;
    //   color: $--color-white;
    // }
    &.is-primary {
      background-color: $--alert-success-color;
      color: $--color-text-primary;
    }
    &.is-border {
      border: 1px solid $--color-success;
    }
    .el-alert__icon {
      color: $--color-success;  
    }
  }

  @include m(primary) {
    &.is-light {
      background-color: $--alert-primary-color;
      color: $--color-primary;
    }

    // &.is-dark {
    //   background-color: $--color-primary;
    //   color: $--color-white;
    // }

    .el-alert__description {
      color: $--color-primary;
    }

    &.is-primary {
      background-color: $--alert-primary-color;
      color: $--color-text-primary;
    }
    &.is-border {
      border: 1px solid $--color-primary;
    }
    .el-alert__icon {
      color: $--color-primary;  
    }
  }

  @include m(warning) {
    &.is-light {
      background-color: $--alert-warning-color;
      color: $--color-warning;

      .el-alert__description {
        color: $--color-warning;
      }
    }

    // &.is-dark {
    //   background-color: $--color-warning;
    //   color: $--color-white;
    // }
    &.is-primary {
      background-color: $--alert-warning-color;
      color: $--color-text-primary;
    }
    &.is-border {
      border: 1px solid $--color-warning;
    }
    .el-alert__icon {
      color: $--color-warning;  
    }    
  }

  @include m(error) {
    &.is-light {
      background-color: $--alert-danger-color;
      color: $--color-danger;

      .el-alert__description {
        color: $--color-danger;
      }
    }

    // &.is-dark {
    //   background-color: $--color-danger;
    //   color: $--color-white;
    // }
    &.is-primary {
      background-color: $--alert-danger-color;
      color: $--color-text-primary;
    }
    &.is-border {
      border: 1px solid $--color-danger;
    }
    .el-alert__icon {
      color: $--color-danger;  
    }
  }

  @include e(content) {
    display: table-cell;
    padding-right: 8px;
  }

  @include e(icon) {
    font-size: $--alert-icon-size;
    width: $--alert-icon-size;
    margin-right: 8px;
    @include when(big) {
      font-size: $--alert-icon-large-size;
      width: $--alert-icon-large-size;
    }
  }

  @include e(title) {
    font-size: $--alert-title-font-size;
    line-height: 18px;
    @include when(bold) {
      font-weight: bold;
    }
  }

  & .el-alert__description {
    font-size: $--alert-description-font-size;
    margin: 5px 0 0 0;
  }

  @include e(closebtn) {
    font-size: $--alert-close-font-size;
    opacity: 1;
    position: absolute;
    top: 50%;
    margin-top: -6px;
    right: 15px;
    cursor: pointer;

    @include when(customed) {
      font-style: normal;
      font-size: $--alert-close-customed-font-size;
      top: 18px;
    }
  }
}

.el-alert-fade-enter,
.el-alert-fade-leave-active {
  opacity: 0;
}
