//
// CloudBees custom alert styles
//
@use "sass:map";

.alert {
  padding: $alert-padding-y $alert-padding-x;
  line-height: 1.5;
  border: 0 solid transparent;
  margin-bottom: rem(20px);
  @include border-radius($alert-border-radius);
  &.alert-primary {
    color: $blue-dark;
    background-color: $blue-lightest;
  }
  &.alert-success {
    color: $green-dark;
    background-color: $green-lightest;
  }
  &.alert-danger {
    color: $red-dark;
    background-color: $red-lightest;
  }
  &.alert-warning {
    color: $yellow-dark;
    background-color: $yellow-lightest;
  }
  &.alert-info {
    background-color: $purple-lightest;
    color: $purple-dark;
    .alert-link {
      color: $purple-dark;
    }
  }
  &.alert-light {
    background-color: $gray-lightest;
    color: $gray-dark;
  }
  &.alert-dark {
    background-color: $gray-primary;
    color: $white;
    .alert-link {
      color: $white;
    }
  }
  .alert-link {
    text-decoration: underline;
  }
}

// Dismissible alerts
//
// Expand the right padding and account for the close button's positioning.

.alert-dismissible .close {
  font-weight: 500;
  text-shadow: none;
}

// Icon alerts

.alert-container {
  padding: 0 0 0 0.5rem;
  display: flex;
  flex-direction: row;
  @each $color, $value in $alert-background {
    &.alert-#{$color} .alert-container-icon {
      padding: $alert-padding-y 0 $alert-padding-y 0.5rem;
      display: flex;
      flex-direction: column;
      justify-content: flex-start;
      svg {
        fill: map.get($alert-icon-fill, $color);
      }
    }
  }
  .alert-container-p {
    padding: $alert-padding-y $alert-padding-x $alert-padding-y 0.5rem;
    width: 100%;
    p {
      margin-bottom: 0;
    }
  }
  .alert-close-btn {
    margin-left: auto;
    padding: rem(10px) $alert-padding-x;
    display: flex;
    align-items: flex-start;
  }
}
