@import './mixins/mixins.scss';

@mixin message-type-mixin ($type) {
  @include m($type + '-type') {
    color: map-get($--message-text-color, $type);
    background-color: map-get($map: $--message-background-color, $key: $type);
    box-shadow: map-get($map: $--message-box-shadow, $key: $type);
    @include e(icon) {
      @include b(icon) {
        fill: $--message-icon-color;
      }
    }
  }
}

@include b(message-container) {
  @include once {
    z-index: 6000;
    position: fixed;
    top: 12px;
    left: 0;
    right: 0;
    height: 0;
    overflow: visible;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
}

@include themes-mixin {
  @include b(message) {
    @include once {
      display: flex;
      transition: color .3s $--n-ease-in-out-cubic-bezier, box-shadow .3s $--n-ease-in-out-cubic-bezier, background-color .3s $--n-ease-in-out-cubic-bezier, opacity .3s $--n-ease-in-out-cubic-bezier, transform .3s $--n-ease-in-out-cubic-bezier,  max-height .3s $--n-ease-in-out-cubic-bezier, margin-bottom .3s $--n-ease-in-out-cubic-bezier;
      max-height: 40px;
      opacity: 1;
      margin-bottom: 12px;
      padding: 0 40px;
      height: 40px;
      border-radius: 20px;
      flex-shrink: 0;
      font-weight: 400;
      overflow: hidden;
      &#{&}-transition-enter, &#{&}-transition-leave-to {
        opacity: 0;
        transform: translateY(-12px) scale(.5);
        transform-origin: top center;
        max-height: 0;
        margin-bottom: 0;
      }
    }
    @include once {
      @include e(content) {
        display: inline-block;
        height: 40px;
        line-height: 40px;
        font-size: 15px;
      }
      @include e(icon) {
        margin-right: 10px;
        display: inline-flex;
        height: 40px;
        line-height: 40px;
        align-items: center;
        @include b(icon) {
          svg {
            @include icon-switch-transition();
          }
          font-size: 20px;
        }
      }
    }
    @include message-type-mixin('info');
    @include message-type-mixin('success');
    @include message-type-mixin('error');
    @include message-type-mixin('warning');
    @include message-type-mixin('loading');
  }
}