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

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

.nut-toast {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  text-align: center;
  pointer-events: none;
  z-index: 1300;

  &-overlay-default {
    --nutui-overlay-bg-color: rgba(0, 0, 0, 0);
    --nutui-overlay-zIndex: 1300;
  }

  &-small {
    .nut-toast-inner {
      font-size: $font-size-small;
    }
  }

  &-large {
    .nut-toast-inner {
      font-size: $font-size-large;
    }
  }

  &-inner {
    display: inline-block;
    position: absolute;
    left: 50%;
    top: $toast-inner-top;
    min-width: 30%;
    max-width: 95.7%;
    font-size: $toast-text-font-size;
    text-align: $toast-inner-text-align;
    padding: $toast-inner-padding;
    word-break: break-all;
    background: $toast-inner-bg-color;
    border-radius: $toast-inner-border-radius;
    color: $toast-font-color;
    transform: translate(-50%, -50%);

    &.normal {
      word-break: normal;
      word-wrap: normal;
    }

    &.break-word {
      word-break: normal;
      word-wrap: break-word;
    }
  }

  &-center {
    top: var(--nutui-toast-inner-top, 50%);
  }

  &-bottom {
    top: var(--nutui-toast-inner-top, 80%);
  }

  &-top {
    top: var(--nutui-toast-inner-top, 20%);
  }

  &-text {
    &:empty {
      margin-bottom: -8px;
    }
  }

  &-title {
    font-size: $toast-title-font-size;
    font-weight: 500;

    &:empty {
      margin-bottom: -8px;
    }
  }

  &-has-icon {
    .nut-toast-icon-wrapper {
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
      margin-bottom: 8px;

      .nut-icon {
        width: 24px;
        height: 24px;
      }
    }
  }

  &-loading {
    .nut-toast-inner {
      display: inline-flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
    }

    .nut-toast-icon-wrapper {
      animation: rotation 2s linear infinite;

      .nut-icon {
        width: 24px;
        height: 24px;
      }
    }
  }
}

[dir='rtl'] .nut-toast,
.nut-rtl .nut-toast {
  left: auto;
  right: 0;

  &-inner {
    left: auto;
    right: 50%;
    transform: translate(50%, -50%);
  }
}

.toast-fade-enter-active {
  transition: opacity 0.3s;
}

.toast-fade-leave-active {
  transition: opacity 0.3s;
}

.toast-fade-enter-from,
.toast-fade-leave-to {
  opacity: 0;
}
