// --------------------------------------------
// Alert Base Mixin ---------------------------
// --------------------------------------------
@mixin alert-base(
  $bg: $alert-background,
  $color: $alert-color,
  $icon: $alert-icon-color
) {
  color: $color;
  display: flex;
  text-align: left;
  position: relative;
  background-color: $bg;
  border: $alert-border;
  margin: $alert-margin;
  padding: $alert-padding;
  align-items: flex-start;
  font-size: $alert-font-size;
  border-radius: $alert-radius;
  font-family: $alert-font;
  font-weight: $alert-font-weight;
  line-height: $alert-line-height;

  &-close {
    @include delete($size: $alert-close-font-size, $color: $color);

    order: 2;
    margin-left: auto;
  }

  &-title {
    font-size: $alert-title-font-size;
    line-height: $alert-title-line-height;
    font-weight: $alert-title-font-weight;
  }

  &-content {
    flex: 1;
    margin-right: $space-xs;
    line-height: $alert-line-height;
  }

  &-icon {
    color: $icon;
    align-self: stretch;
    font-size: $alert-icon-font-size;
    padding-right: $alert-padding;
    line-height: $alert-line-height;
  }
}


// --------------------------------------------
// Alert Style Mixin --------------------------
// --------------------------------------------
@mixin alert-style($bg: $color-gray-0, $color: $color-gray-9) {
  @if $white-label == true {
    background-color: rgba($color, .08);
    border-color: $color;
    color: $color;
  } @else {
    background-color: $bg;
    border-color: $color;
  }

  .c-alert-close {
    @include delete-color($color);
  }

  .c-alert-icon {
    color: $color;
  }
}


// --------------------------------------------
// Toast Base Mixin ---------------------------
// --------------------------------------------
@mixin toast($color: $color-primary) {
  display: flex;
  position: relative;
  align-items: center;
  word-wrap: break-word;
  margin: $alert-margin;
  box-shadow: $shadow-sm;
  background: $color-white;
  color: $alert-color;
  font-size: $alert-font-size;
  border-radius: $alert-radius;
  font-family: $alert-font-family;
  font-weight: $toast-font-weight;
  border: 1px solid $color-gray-2;
  padding: $alert-top-padding $alert-top-padding $alert-top-padding ($alert-top-padding + $toast-left-border);

  &-icon {
    color: $color;
    align-items: center;
    display: inline-flex;
    justify-content: center;
    padding-right: $alert-top-padding;
    font-size: $alert-font-size + 2;
  }

  // Alert Bar
  &::before {
    content: '';
    left: 0;
    right: 0;
    bottom: 0;
    height: 100%;
    position: absolute;
    background: $color;
    width: $toast-left-border;
    border: darken($color, 20);
    border-radius: $alert-radius 0 0 $alert-radius;
  }

  &-close {
    @include delete($size: 12px, $color: $color-gray-6);

    margin-left: auto;
    margin-right: -$space-xs;
  }
}


// --------------------------------------------
// Toast Style Mixin --------------------------
// --------------------------------------------
@mixin toast-style($color: color(primary)) {
  .c-toast-alert-icon {
    color: $color;
  }

  // Alert Bar
  &::before {
    background: $color;
    border: darken($color, 20);
  }
}
