@use "../mixins/function.scss" as *;
@use "../mixins/mixins.scss" as *;
@use "../common/var.scss" as *;

@include b(message) {
  padding: 8px 12px;
  max-width: 750px;
  background-color: getCssVar("color", "bg-3");
  border-radius: getCssVar("radius", "medium");
  border: 1px solid getCssVar("color", "fill-3");
  box-shadow: getCssVar("shadow", "2");
  display: flex;
  align-items: center;
  position: relative;

  @include e(wrapper) {
    display: inline-flex;
    align-items: flex-start;
    margin: 0 0 8px 0;
    pointer-events: auto;
    transition:
      color 0.3s getCssVar("bezier", "1"),
      box-shadow 0.3s getCssVar("bezier", "1"),
      background-color 0.3s getCssVar("bezier", "1"),
      opacity 0.3s getCssVar("bezier", "1"),
      transform 0.3s getCssVar("bezier", "1"),
      margin-bottom 0.3s getCssVar("bezier", "1");
  }

  @include e(container) {
    position: fixed;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 16px;
    pointer-events: none;
    width: 100%;
  }

  @include e(content) {
    display: inline-block;
    line-height: 1.6;
    font-size: 14px;
  }

  @include e(icon) {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-right: 10px;
  }

  @include e(close) {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 20px;
    width: 20px;
    font-size: 16px;
    margin-left: 10px;
    border-radius: getCssVar("radius", "circle");
    cursor: pointer;
    &:hover {
      background-color: getCssVar("color", "fill-3");
    }
  }

  @include e(grouping) {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 18px;
    width: 18px;
    font-size: 12px;
    margin-left: 10px;
    border-radius: getCssVar("radius", "circle");
    background-color: getCssVar("color", "danger-6");
    color: #fff;
    position: absolute;
    top: -4px;
    right: -4px;
  }

  @include m(container-top) {
    top: 12px;
    left: 0;
    right: 0;
    bottom: 0;
    justify-content: flex-start;
  }

  @include m(container-bottom) {
    bottom: 4px;
    left: 0;
    right: 0;
    top: 0;
    justify-content: flex-end;
  }

  @include m(container-center) {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    justify-content: center;
  }

  @include m(wrapper-top) {
    transform-origin: top center;
  }

  @include m(wrapper-bottom) {
    transform-origin: bottom center;
  }

  @include m(wrapper-center) {
    transform-origin: center center;
  }

  @include m(default) {
    color: getCssVar("color", "text-1");
  }

  @each $type in $type-list {
    @include m(#{$type}) {
      color: getCssVar("color", #{$type}-6);
    }
  }
}

.message-fade-enter-active,
.message-fade-leave-active,
.message-fade-move {
  transition:
    color 0.3s getCssVar("bezier", "1"),
    box-shadow 0.3s getCssVar("bezier", "1"),
    background-color 0.3s getCssVar("bezier", "1"),
    opacity 0.3s getCssVar("bezier", "1"),
    transform 0.3s getCssVar("bezier", "1"),
    margin-bottom 0.3s getCssVar("bezier", "1");
}

.message-fade-enter-from,
.message-fade-leave-to {
  opacity: 0;
  transform: scale(0.85);
}
