@import "mixins/mixins";
@import "common/var";

@include b(message) {
  // min-width: $--message-min-width;
  max-width: $--message-max-width;
  box-sizing: border-box;
  border-radius: $--border-radius-base;
  border-width: $--border-width-base;
  border-style: $--border-style-base;
  border-color: $--nc9;
  box-shadow: $--box-shadow-light;
  position: fixed;
  left: 50%;
  top: 120px;
  transform: translateX(-50%);
  background-color: $--color-white;
  transition: opacity 0.3s, transform .4s, top 0.4s;
  overflow: hidden;
  padding: $--message-padding;
  display: flex;
  align-items: center;
  height: 48px;
  line-height: 48px;

  @include when(center) {
    justify-content: center;
  }

  @include when(closable) {
    .y-message__content {
      padding-right: 16px; 
    }
  }

  p {
    margin: 0;
  }

  @include m(info) {
    background-color: $--nc18;
    border-color: $--nc8;

    .y-message__content {
      color: $--message-info-font-color;
    }
  }

  @include m(success) {
    background-color: $--color-success-lighter;
    border-color: $--color-success-light;

    .y-message__content {
      color: $--message-success-font-color;
    }
  }

  // @include m(warning) {
  //   background-color: $--color-warning-lighter;
  //   border-color: $--color-warning-light;

  //   .y-message__content {
  //     color: $--message-warning-font-color;
  //   }
  // }

  @include m(error) {
    background-color: $--color-danger-lighter;
    border-color: $--color-danger-light;

    .y-message__content {
      color: $--message-danger-font-color;
    }
  }

  @include e(icon) {
    font-size: 24px;
    margin-right: 8px;
  }

  @include e(content) {
    padding: 0;
    font-size: 16px; 
    line-height: 22px;
    &:focus {
      outline-width: 0;
    }
  }

  @include e(closeBtn) {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    cursor: pointer;
    color: $--message-close-icon-color;
    font-size: $--message-close-size;

    &:focus {
      outline-width: 0;
    }
    &:hover {
      color: $--message-close-hover-color;
    }
  }

  & .y-icon-tick_surface {
    color: $--color-primary;
  }

  & .y-icon-warning_surface {
    color: $--message-danger-font-color;
  }

  & .y-icon-message_surface {
    color: $--nc5;
  }

  // & .y-icon-warning {
  //   color: $--message-warning-font-color;
  // }
}

.y-message-fade-enter,
.y-message-fade-leave-active {
  opacity: 0;
  transform: translate(-50%, -100%);
}
