@import url(../var.less);

@alert-prefix: ~"@{prefix}alert";

.@{alert-prefix}{
  width: 100%;
  padding: @alert-padding;
  margin: 0;
  box-sizing: border-box;
  border-radius: @alert-border-radius;
  color: @primary-text-color;
  background-color: @color-white;
  position: relative;
  overflow: hidden;
  opacity: 1;
  display: flex;
  align-items: center;
  transition: opacity .2s;

  &.is-light {
    .w-alert__closebtn {
      color: @placeholder-text-color;
      &:hover {
        color: @primary-text-color;
      }
    }
  }

  &.is-dark {
    .w-alert__closebtn {
      color: @color-white;
    }
    .w-alert__description {
      color: @color-white;
    }
  }

  &.is-center {
    justify-content: center;
    .w-alert__content {
      width: auto;
    }
    .w-alert__action {
      position: absolute;
      right: 10px;
    }
  }

  @typeList: primary, success, warning, error, info;
  each(@typeList, {
    &--@{value} {
      &.is-light {
        background-color: ~"@{alert-@{value}-color}";
        border: 1px solid  ~"@{alert-@{value}-border-color}";
        .w-alert__icon {
          color: ~"@{@{value}-color}";
        }
      }
  
      &.is-dark {
        background-color: ~"@{@{value}-color}";
        color: @color-white;
        border: 1px solid  ~"@{alert-@{value}-border-color}";
      }

      &.is-plain {
        background-color: ~"@{alert-@{value}-color}";
        border:1px solid ~"@{alert-@{value}-color}";
        .w-alert__title {
          color: ~"@{@{value}-color}";
        }
        .w-alert__icon {
          color: ~"@{@{value}-color}";
        }
      }
    }
  })

  &__content {
    width: 100%;
    display: flex;
    justify-content: space-between;
    line-height: 21px;
  }

  &__action {
    display: flex;
    align-items: center;
  }

  &__icon {
    font-size: @alert-icon-size;
    width: @alert-icon-size;
    &.is-big {
      font-size: @alert-icon-large-size;
      width: @alert-icon-large-size;
    }
  }

  &__title {
    font-size: @alert-title-font-size;
    margin-left: 8px;
    word-break: break-all;
    &.is-bold {
      font-weight: bold;
    }
  }

  & .w-alert__description {
    font-size: @alert-description-font-size;
    margin: 5px 0 0 8px;
  }

  &__closebtn {
    font-size: @alert-close-font-size;
    opacity: 1;
    cursor: pointer;

    &.is-customed {
      font-style: normal;
      font-size: @alert-close-customed-font-size;
    }
  }
}

.w-alert-fade-enter,
.w-alert-fade-leave-active {
  opacity: 0;
}