:root {
  --toast-color-success: #0abf30;
  --toast-color-error: #e24d4c;
  --toast-color-warning: #e9bd0c;
  --toast-color-info: #3498db;
}

@media screen and (max-width: 530px) {
  .notifications {
    width: 95%;
  }
  .notifications .toast {
    width: 100%;
    font-size: 1rem;
    margin-left: 20px;
  }
}

.notifications {
  position: fixed;
  top: 30px;
  right: 20px;
}
.notifications :where(.toast, .column) {
  display: flex;
  align-items: center;
}

.notifications .toast {
  width: 400px;
  position: relative;
  overflow: hidden;
  list-style: none;
  border: 1px solid lightgray;
  border-radius: 4px;
  padding: 16px 17px;
  margin-bottom: 10px;
  justify-content: space-between;
  animation: show_toast 0.3s ease forwards;
  color: white;
}
.toast.success {
  background: var(--toast-color-success);
}
.toast.error {
  background: var(--toast-color-error);
}
.toast.warning {
  background: var(--toast-color-warning);
}
.toast.info {
  background: var(--toast-color-info);
}
@keyframes show_toast {
  0% { transform: translateX(100%); }
  40% { transform: translateX(-5%); }
  80% { transform: translateX(0%); }
  100% { transform: translateX(-10px); }
}

.notifications .toast.hide {
  animation: hide_toast 0.3s ease forwards;
}
@keyframes hide_toast {
  0% { transform: translateX(-10px); }
  40% { transform: translateX(0%); }
  80% { transform: translateX(-5%); }
  100% { transform: translateX(calc(100% + 20px)); }
}

/*********************** Progress bar ***********************/
.toast::before {
  position: absolute;
  content: "";
  height: 3px;
  width: 100%;
  bottom: 0px;
  left: 0px;
  animation: progress 5s linear forwards;
  background: white;
}
@keyframes progress {
  100% { width: 0%; }
}

/*********************** Icon ***********************/
.toast .column i {
  font-size: 1.75rem;
}

/*********************** Message body ***********************/
.toast .column span {
  font-size: 1.07rem;
  margin-left: 12px;
}

/*********************** Close button ***********************/
.toast i:last-child {
  cursor: pointer;
  padding-right: 5px;
}
.toast i:last-child:hover {
  background-color: lightgrey;
  border-radius: 50px;
  padding: 5px;
}

/*********************** Inverted colors ***********************/
.toast.inverted {
  background: white;
  color: inherit;

  /* Progress bar */
  &.success::before {
    background: var(--toast-color-success);
  }
  &.error::before {
    background: var(--toast-color-error);
  }
  &.warning::before {
    background: var(--toast-color-warning);
  }
  &.info::before {
    background: var(--toast-color-info);
  }

  /* Icon */
  &.success .column i {
    color: var(--toast-color-success);
  }
  &.error .column i {
    color: var(--toast-color-error);
  }
  &.warning .column i {
    color: var(--toast-color-warning);
  }
  &.info .column i {
    color: var(--toast-color-info);
  }

  /* Close button */
  i:last-child {
    color: #aeb0d7;
  }
}
