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

@include b(alert) {
  width: 100%;
  padding: $--alert-padding;
  margin: 0;
  box-sizing: border-box;
  border-radius: $--alert-border-radius;
  position: relative;
  background-color: $--color-white;
  overflow: hidden;
  opacity: 1;
  display: flex;
  transition: opacity .2s;

  @include when(light) {
    border: $--alert-border;
    .el-alert__closebtn {
      color: $--icon-color;
      &:hover{
        color: #333;
      }
    }
    .el-alert__title,.el-alert__description{
      color: $--alert-font-default-color;
    }
  }

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

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

  @include m(primary) {
    &.is-light {
      background-color: $--alert-primary-color;
      color: $--color-primary;
      border-color: mix($--color-white,$--color-primary,40%);
    }

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

  @include m(success) {
    &.is-light {
      background-color: $--alert-success-color;
      color: $--color-success;
      border-color: mix($--color-white,$--color-success,40%);
    }

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

  @include m(info) {
    &.is-light {
      background-color: $--alert-info-color;
      color: $--color-info;
      border-color: mix($--color-white,$--color-info,40%);
    }

    &.is-dark {
      background-color: $--color-info-light;
      color: $--color-white;
    }
  }

  @include m(warning) {
    &.is-light {
      background-color: $--alert-warning-color;
      color: $--color-warning;
      border-color: mix($--color-white,$--color-warning,40%);
    }

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

  @include m(error) {
    &.is-light {
      background-color: $--alert-danger-color;
      color: $--color-danger;
      border-color: mix($--color-white,$--color-danger,40%);
    }

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

  @include e(content) {
    display: table-cell;
  }

  @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: $--font-weight-strengthen;
    }
  }

  & .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: 10px;
    right: 10px;
    cursor: pointer;
    padding: 4px;

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

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