@use "../globals/" as *;
@use "../util/" as *;

.snackbar-group {
  position: fixed;
  z-index: $snackbar-zindex;
  // top: 0;
  // right: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  max-height: 100svh;
  //background:linear-gradient(to left,transparent, transparent, rgba(255,255,255,.15));
//   border: 1px solid rgba(255, 255, 255, 0.25);
//   border-radius: 0.6rem;
//   backdrop-filter: blur(25px) opacity(0.5);
  transform: translateX(100%);
  transition: $transition;
}

.snackbar-group.show {
    transform: translateX(0);
  }

.snackbar {
  width: 350px;
  //min-height: 60px;
  background-color: var(--bg-core-primary-light);
  background-color: rgba(255,255,255,.8);
  backdrop-filter: blur(10px);
  margin: 0 0.75rem 0.75rem;
  padding: 1rem;
  border-radius: $border-radius-lg;
  filter: drop-shadow(1px 2px 4px rgba(0, 0, 0, 0.15));
  //transform: translateX(100%);
}

.snackbar.slide-in {
  animation: slidein 0.3s ease-in-out forwards;
}

.snackbar.slide-out {
  animation: slideout 0.3s ease-in-out forwards;
}

@keyframes slidein {
  0% {
    transform: translateX(110%);
  }

  100% {
    transform: translateX(0);
  }
}

@keyframes slideout {
  0% {
    transform: translateX(0);
  }

  100% {
    transform: translateX(110%);
  }
}

.snackbar:first-of-type {
  margin-top: 1rem;
}

.snackbar:after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: $border-radius-lg;
  opacity: 0.3;
  pointer-events: none;
}

.snackbar.danger:after,
.snackbar.danger .snackbar-leading-icon {
  background-color: $danger;
}

.snackbar.warning:after,
.snackbar.warning .snackbar-leading-icon {
  background-color: $warning;
}

.snackbar.success:after,
.snackbar.success .snackbar-leading-icon {
  background-color: $success;
}

.snackbar.info:after,
.snackbar.info .snackbar-leading-icon {
  background-color: $info;
}

.snackbar-content {
  --height: 2rem;

  display: flex;
  //align-items: center;
  justify-content: center;

  .snackbar-leading-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: $border-radius-pill;
    background-color: var(--bg-core-primary);
    height: var(--height);
    aspect-ratio: 1 / 1;
    overflow: hidden;
  }

  .snackbar-leading-icon img {
    object-fit: cover;
    height: var(--height);
    aspect-ratio: 1 / 1;
  }

  .snackbar-cta-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: $border-radius-pill;
    background-color: transparent;
    cursor: pointer;
    height: var(--height);
    aspect-ratio: 1 / 1;
    transition: all 0.35s cubic-bezier(0.6, -1.25, 0.6, 2.25);
  }

  .snackbar-cta-abs {
    position: absolute;
    opacity: 0;
    left: -13px;
    top: -13px;
    box-shadow: $base-box-shadow;
    transition: $transition;
  }

  .snackbar-cta-abs .btn-icon {
    padding: 4px;
  }

  .snackbar-message {
    font-size: $font-size-sm;
    margin-left: 0.85rem;
    display: flex;
    flex-direction: column;
    align-items: start;
    justify-content: center;
    flex: 1;
  }

  .snackbar-header {
    display: flex;
    justify-content: space-between;
    width: 100%;
  }

  .snackbar-title {
    font-size: $font-size-sm;
    font-weight: $font-weight-600;
    color: $text-core-hc;
  }

  .snackbar-recived {
    font-size: .75rem;
    font-weight: $font-weight-600;
    color: $text-core-vc;
  }

  .snackbar-action {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
  }

  .snackbar-action .btn {
    font-size: 0.85rem;
    text-transform: none;
    padding: 0.1rem 0.7rem;
    border-radius: 0.35rem;
  }

  .snackbar-cta-icon:hover {
    background-color: rgba(0, 0, 0, 0.15);
  }
}

.snackbar:hover .snackbar-cta-abs {
    opacity: .9;
  }

.snackbar-group {
  &.top {
    top: 0;
  }
  &.right {
    right: 0;
  }
  &.bottom {
    bottom: 150px;
  }
  &.left {
    left: 0;
  }

  @include breakpoint(sm) {
    &.top {
      top: 0;
    }
    &.right {
      right: 0;
    }
    &.bottom {
      bottom: 0;
    }
    &.left {
      left: 0;
    }
  }

  @include breakpoint(lg) {
    &.top {
      top: 0;
    }
    &.right {
      right: 0;
    }
    &.bottom {
      bottom: 0;
    }
    &.left {
      left: 0;
    }
  }
}

.snackbar {
  width: 90%;
  margin: 0 auto 0.75rem auto;

  @include breakpoint(sm) {
    width: 50vw;
    margin: 0 0.75rem 0.75rem;
  }

  @include breakpoint(lg) {
    width: 350px;
  }
}
