@use '@vizality' as vz;

/**
 * Entrance and exit animations.
 */
@use 'animations/bounce';
@use 'animations/zoom';
@use 'animations/flip';
@use 'animations/slide';

@keyframes vz-toast-track-progress {
  0% {
    transform: scaleX(1);
  }
  100% {
    transform: scaleX(0);
  }
}

.Toastify {
  &__toast {
    $base: &;
    &-container {
      &--top-left {
        top: 1em;
        left: 2em;
      }
      &--top-center {
        top: 1em;
        left: 50%;
        transform: translateX(-50%);
      }
      &--top-right {
        top: 1em;
        right: 2em;
      }
      &--bottom-left {
        bottom: 1em;
        left: 2em;
      }
      &--bottom-center {
        bottom: 1em;
        left: 50%;
        transform: translateX(-50%);
      }
      &--bottom-right {
        bottom: 1em;
        right: 2em;
      }
    }
    &--show-progress-bar {
      &#{$base}--extra-padding {
        padding-bottom: 26px;
      }
    }
    &--no-content {
      &#{$base}--no-footer {
        .vz-toast-header {
          font-weight: 400;
        }
        .vz-toast-meta {
          display: flex;
          width: 100%;
          justify-content: space-between;
          align-items: center;
        }
        .vz-toast-meta-wrapper {
          align-items: center;
        }
      }
    }
  }
  &--animate {
    animation-fill-mode: both;
    animation-duration: 0.7s;
  }
  &__progress-bar {
    &--animated {
      animation: vz-toast-track-progress linear 1 forwards;
    }
    &--controlled {
      transition: transform .2s;
    }
    &--rtl {
      right: 0;
      left: initial;
      transform-origin: right;
    }
    &--default{
      background: vz.color('blurple');
    }
    &--info {
      background: vz.color('info');
    }
    &--success {
      background: vz.color('success');
    }
    &--warning {
      background: vz.color('warning');
    }
    &--error {
      background: vz.color('danger');
    }
  }
}

.vz-toast {
  $base: &;
  z-index: 999;
  transform: translate3d(0, 0, 9999px);
  max-width: 440px;
  min-width: 300px;
  box-shadow: var(--elevation-medium);
  background: var(--background-floating);
  border-radius: 8px;
  color: var(--text-normal);
  display: flex;
  align-items: flex-start;
  padding: 16px;
  overflow: hidden;
  margin-bottom: 10px;
  min-height: 36px;
  box-sizing: border-box;
  &-container {
    z-index: 999;
    transform: translate3d(0, 0, 9999px);
    position: fixed;
  }
  .vz-markdown-p {
    margin: 0;
  }
  &-body {
    flex: 1;
  }
  &-body-inner {
    display: flex;
    flex-direction: column;
    flex: 1;
  }
  &-meta-wrapper {
    display: flex;
    align-items: flex-start;
  }
  &-decorator {
    margin: 0 12px 0 0;
    align-self: flex-start;
    display: flex;
  }
  &-header {
    @include vz.max-lines(2);
    font-size: 18px;
    line-height: 1.3;
    color: var(--header-primary);
    font-weight: 600;
    padding-right: 20px;
    margin-bottom: 16px;
    margin-top: 5px;
  }
  &-content {
    font-size: 14px;
    line-height: 1.4;
    color: var(--text-normal);
    font-weight: 400;
    margin-top: 6px;
    max-height: 200px;
    overflow: auto;
    &:empty {
      display: none;
    }
  }
  &-close-wrapper {
    color: var(--text-muted);
    cursor: pointer;
    transition: color .125s;
    &:hover {
      color: var(--header-primary);
    }
  }
  &-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 5px;
    z-index: 999;
    transform-origin: left;
  }
}

