@import '../../assets/styles/colors';
@import '../../assets/styles/rsfonts';
@import '../../assets/styles/rsfonts';

.toaster-overlay {
  position: fixed;
  bottom: 0;
  right: 0;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  z-index: 9999;
  pointer-events: none;

  &--bottom-right {
    justify-content: flex-end;
    align-items: flex-end;
  }
  &--top-right {
    justify-content: flex-end;
    align-items: flex-start;
  }
  &--bottom {
    justify-content: center;
    align-items: flex-end;
  }
  &--top {
    justify-content: center;
    align-items: flex-start;
  }
  &--bottom-left {
    justify-content: flex-start;
    align-items: flex-end;
  }
  &--top-left {
    justify-content: flex-start;
    align-items: flex-start;
  }

  .toaster {
    background-color: $white;
    display: flex;
    border-radius: 10px;
    margin: 16px;
    pointer-events: auto;
    min-width: 475px;
    max-width: 640px;

    .toaster-container {
      padding: 12px;
      display: flex;
      border-radius: 10px;
      width: 100%;

      .toaster-icon {
        width: 70px;
        height: 65px;
        background: $grey_7;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 8px 0px 6px 16px;
      }
    }

    .toaster-content {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      justify-content: center;
    }

    &--success {
      box-shadow: 0px 0px 12px $success;

      .toaster-header-title {
        color: $success;
        @extend .fontPoppinsSemiboldMd;
      }
    }

    &--warning {
      box-shadow: 0px 0px 12px $warning;

      .toaster-header-title {
        color: $warning;
        @extend .fontPoppinsSemiboldMd;
      }
    }

    &--info {
      box-shadow: 0px 0px 12px $primary;

      .toaster-header-title {
        color: $primary;
        @extend .fontPoppinsSemiboldMd;
      }
    }

    &--danger {
      box-shadow: 0px 0px 12px $error;

      .toaster-header-title {
        color: $error;
        @extend .fontPoppinsSemiboldMd;
      }
    }

    .toaster-content {
      margin-left: 16px;
      .toaster-header-content {
        display: flex;
        font-size: 22px;
        font-weight: 600;
        margin-top: 18px;
      }
      .toaster-main-content {
        @extend .fontPoppinsRegularSm;
        max-width: 500px;
        margin-top: 7px;
        font-size: 14px;
        color: $text_color;
        white-space: normal;
        overflow-wrap: break-word;
        overflow: hidden;
      }
    }

    .closeButton {
      height: 30px;
      width: 30px;
      border-radius: 9px;
      border: none;
      display: flex;
      align-items: center;
      background: transparent;
      justify-content: center;
      margin: 0;
      position: absolute;
      top: 10px;
      right: 3px;

      :first-child {
        height: 0px;
        width: 13px;
        border-bottom: 3px solid $grey_1;
        border-radius: 20px;
        position: absolute;
        transform: rotate(48deg);
      }
      :last-child {
        @extend :first-child;
        transform: rotate(-48deg);
      }
      &--success {
        &:hover {
          background: $grey_7;
          :first-child,
          :last-child {
            border-bottom: 3px solid $success;
          }
        }
      }
      &--warning {
        &:hover {
          background: $grey_7;
          :first-child,
          :last-child {
            border-bottom: 3px solid $warning;
          }
        }
      }
      &--info {
        &:hover {
          background: $grey_7;
          :first-child,
          :last-child {
            border-bottom: 3px solid $primary;
          }
        }
      }
      &--danger {
        &:hover {
          background: $grey_7;
          :first-child,
          :last-child {
            border-bottom: 3px solid $error;
          }
        }
      }
    }

    &--top {
      animation: slideInToasterTop 0.5s forwards;

      @keyframes slideInToasterTop {
        from {
          transform: translateY(-100%);
        }
        to {
          transform: translateY(0%);
        }
      }
    }
    &--bottom {
      animation: slideInToasterBottom 0.5s forwards;

      @keyframes slideInToasterBottom {
        from {
          transform: translateY(100%);
        }
        to {
          transform: translateY(0%);
        }
      }
    }
    &--top-left {
      animation: slideInToasterTopLeft 0.5s forwards;

      @keyframes slideInToasterTopLeft {
        from {
          transform: translateX(-100%);
        }
        to {
          transform: translateX(0%);
        }
      }
    }
    &--top-right {
      animation: slideInToasterTopRight 0.5s forwards;

      @keyframes slideInToasterTopRight {
        from {
          transform: translateX(100%);
        }
        to {
          transform: translateX(0%);
        }
      }
    }
    &--bottom-left {
      animation: slideInToasterBottomLeft 0.5s forwards;

      @keyframes slideInToasterBottomLeft {
        from {
          transform: translateX(-100%);
        }
        to {
          transform: translateX(0%);
        }
      }
    }
    &--bottom-right {
      animation: slideInToasterBottomRight 0.5s forwards;

      @keyframes slideInToasterBottomRight {
        from {
          transform: translateX(100%);
        }
        to {
          transform: translateX(0%);
        }
      }
    }
  }
}

// style related to buttons in storybook UI only
.storybook-stories-toaster-container {
  .storybook-stories-toaster-container-row {
    display: flex;
    gap: 5px;
    margin: 15px;
  }
}
