@import "../../../style/theme/default/index.less";
@import "../../../style/mixins/index.less";

@alert-prefix-cls: ~"@{idoll-prefix}-alert";

.@{alert-prefix-cls} {
  .reset-component;
  position: relative;
  padding: @padding-xs @padding-md;
  font-size: @font-size-base;
  border-radius: @border-radius-base;

  &&-no-icon {
    padding: @padding-xs @padding-md;
  }

  &-icon {
    top: 8px + @font-size-base * @alert-line-height-base / 2 - @font-size-base / 2 + 1px;
    left: 16px;
    position: absolute;
  }

  &-description {
    font-size: @font-size-base;
    line-height: @alert-line-height;
    display: none;
  }

  &&-hasicon {
    .@{alert-prefix-cls}-message {
      left: 22px;
    }
  }

  &-success {
    background-color: @success-lightBg;
    color: @success-color;
    .@{alert-prefix-cls}-icon {
      color: @success-color;
    }
  }

  &-no-description {
    height: @aletr-no-description-height;
  }

  &-info {
    background-color: @primary-lightBg;
    color: @primary-color;
    .@{alert-prefix-cls}-icon {
      color: @primary-color;
    }
  }

  &-warning {
    background-color: @warning-lightBg;
    color: @warning-color;
    .@{alert-prefix-cls}-icon {
      color: @warning-color;
    }
  }

  &-error {
    background-color: @error-lightBg;
    color: @error-color;
    .@{alert-prefix-cls}-icon {
      color: @error-color;
    }
  }

  &-close-icon {
    font-size: @font-size-sm;
    position: absolute;
    right: 16px;
    top: 8px;
    line-height: @alert-line-height;
    overflow: hidden;
    cursor: pointer;

    .@{iconfont-css-prefix}-close {
      color: @text-color-secondary;
      transition: color .3s;
      width: @alser-icon-width;
      height: @alser-icon-height;
      line-height: @alert-line-height-sm;
      &:hover {
        color: @text-color;
      }
    }
  }

  &-close-text {
    position: absolute;
    right: 16px;
  }

  &-with-description {
    padding: @padding-xs @padding-lg;
    position: relative;
    border-radius: @border-radius-base;
    color: @alert-text-color;
    line-height: @alert-line-height-base;
  }

  &-with-description&-no-icon {
    padding: @padding-md;
  }

  &-with-description &-icon {
    position: absolute;
    top: 10px;
    left: 24px;
    font-size: @alert-icon-font-size;
  }

  &-with-description &-close-icon {
    position: absolute;
    top: 16px;
    right: 16px;
    cursor: pointer;
    font-size: @font-size-base;
  }

  &-with-description &-message {
    font-size: @font-size-lg;
    color: @alert-message-color;
    display: block;
    margin-bottom: 8px;
  }

  &-hasicon-description &-message {
    margin-left: 40px;
  }

  &-message {
    position: relative;
    top: 1px;
  }

  &-with-description &-description {
    display: block;
  }

  &-hasicon-description &-description {
    margin-left: 40px;
  }

  &&-close {
    height: 0 !important;
    margin: 0;
    padding-top: 0;
    padding-bottom: 0;
    transition: all .3s @ease-in-out-circ;
    transform-origin: 50% 0;
  }

  &-slide-up-leave {
    animation: antAlertSlideUpOut .3s @ease-in-out-circ;
    animation-fill-mode: both;
  }

  &-banner {
    border-radius: 0;
    border: 0;
    margin-bottom: 0;
  }
}

@keyframes idollAlertSlideUpIn {
  0% {
    opacity: 0;
    transform-origin: 0% 0%;
    transform: scaleY(0);
  }
  100% {
    opacity: 1;
    transform-origin: 0% 0%;
    transform: scaleY(1);
  }
}

@keyframes idollAlertSlideUpOut {
  0% {
    opacity: 1;
    transform-origin: 0% 0%;
    transform: scaleY(1);
  }
  100% {
    opacity: 0;
    transform-origin: 0% 0%;
    transform: scaleY(0);
  }
}