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

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

.@{message-prefix-cls} {
  .reset-component;
  position: fixed;
  z-index: 1010;
  width: 100%;
  top: 16px;
  left: 0;
  pointer-events: none;

  &-notice {
    padding: @padding-xs;
    text-align: center;
    &:first-child {
      margin-top: -8px;
    }
  }

  &-notice-content &-custom-content {
    padding: @padding-xs @padding-md;
    background: @message-base-bg;
    box-shadow: 0 8px 16px 0 @shadow-color;
    border-radius: @border-radius-base;
    display: inline-block;
    pointer-events: all;
    font-size: @font-size-base;
    height: 40px;
    box-sizing: border-box;
    span {
      position: relative;
      top: 1px;
    }
  }

  .content-success {
    background-color: @success-color;
    color: @message-base-bg;
  }

  .content-error {
    background-color: @error-color;
    color: @message-base-bg;
  }

  .content-info {
    background-color: @primary-color;
    color: @message-base-bg;
  }

  .content-loading {
    background-color: @warning-color;
    color: @message-base-bg;
  }

  .content-load::before {
    position: relative;
    left: 0;
    top: 2px;
    display: inline-block;
    content: '';
    width: @message-pseudo-width;
    height: @message-pseudo-height;
    border: @border-width-base @border-style-base;
    margin-right: 8px;
    border-color: @primary-color transparent transparent transparent;
    border-radius: 50%;
    box-sizing: border-box;
    /*动画时间1s，线性变化，无限循环*/
    animation: loading 1s linear infinite;
    animation-name: rotate;
  }


  .content-warning, .content-warning {
    background-color: @warning-color;
    color: @message-base-bg;
  }

  &-success .@{iconfont-css-prefix} {
    color: @success-color;
  }

  &-error .@{iconfont-css-prefix} {
    color: @error-color;
  }

  &-warning .@{iconfont-css-prefix} {
    color: @warning-color;
  }

  &-warn .@{iconfont-css-prefix} {
    color: @warning-color;
  }

  &-loading .@{iconfont-css-prefix} {
    color: @warning-color;
  }

  &-load::before {
    position: relative;
    left: 0;
    top: 2px;
    display: inline-block;
    content: '';
    width: @message-pseudo-width;
    height: @message-pseudo-height;
    border: @border-width-base @border-style-base;
    margin-right: 8px;
    border-color: @primary-color transparent transparent transparent;
    border-radius: 50%;
    box-sizing: border-box;
    /*动画时间1s，线性变化，无限循环*/
    animation: loading 1s linear infinite;
    animation-name: rotate;
  }

  &-info .@{iconfont-css-prefix} {
    color: @primary-color;
  }

  .@{iconfont-css-prefix} {
    margin-right: 8px;
    font-size: @font-size-lg;
    top: -1px;
    position: relative;
  }

  &-notice.move-up-leave.move-up-leave-active {
    animation-name: MessageMoveOut;
    overflow: hidden;
    animation-duration: .3s;
  }
}

@keyframes MessageMoveOut {
  0% {
    opacity: 1;
    max-height: 150px;
    padding: @padding-xs;
  }
  100% {
    opacity: 0;
    max-height: 0;
    padding: 0;
  }
}

@keyframes rotate {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}
