@use '@/styles/variables' as *;
@use '@/styles/mixins' as *;

.toastContainer {
  position: fixed;
  top: $spacing-xl;
  right: $spacing-xl;
  z-index: $z-index-toast;
  display: flex;
  flex-direction: column;
  gap: $spacing-sm;
}

.toast {
  @include flex-start;
  gap: $spacing-sm;
  padding: $spacing-md $spacing-base;
  background-color: $card-background;
  border-radius: $border-radius-base;
  box-shadow: $shadow-lg;
  min-width: 300px;
  max-width: 400px;
  animation: slideInRight $duration-base $ease-out;

  &--exiting {
    animation: slideOutRight $duration-fast $ease-in forwards;
  }

  &--success {
    .toast__icon {
      color: $success-color;
    }
  }

  &--error {
    .toast__icon {
      color: $error-color;
    }
  }

  &--warning {
    .toast__icon {
      color: $warning-color;
    }
  }

  &--info {
    .toast__icon {
      color: $info-color;
    }
  }

  &__icon {
    @include flex-center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;

    svg {
      width: 100%;
      height: 100%;
    }
  }

  &__message {
    flex: 1;
    font-size: $font-size-sm;
    color: $text-primary;
    line-height: $line-height-base;
  }

  &__close {
    @include flex-center;
    width: 20px;
    height: 20px;
    color: $text-secondary;
    flex-shrink: 0;
    @include transition-fast;

    &:hover {
      color: $text-primary;
    }

    svg {
      width: 14px;
      height: 14px;
    }
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}
