// sass-lint:disable force-pseudo-nesting, force-element-nesting

.alert {
  @include alert-variant($color-white, $color-gray-4000, $color-gray-1000);

  &-with-buttons {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  position: relative;

  h1,
  h2,
  h3,
  h4,
  h5 {
    margin-top: 0;
  }
}

.alert-success,
.alert-info,
.alert-warning,
.alert-danger {

  &.alert {
    padding-left: $alert-padding + $alert-icon-width;
  }

  &.alert::before {
    background: transparent;
    color: $color-white;
    content: "";
    font-family: FontAwesome;
    font-size: 20px;
    height: 100%;
    left: 0;
    line-height: $alert-icon-width;
    position: absolute;
    text-align: center;
    top: 0;
    width: $alert-icon-width;
  }

  &.alert::after {
    color: $color-white;
    content: "";
    font-family: FontAwesome;
    font-size: 12px;
    left: 0;
    line-height: $alert-icon-width;
    position: absolute;
    text-align: center;
    top: 50%;
    transform: translateY(-50%);
    width: $alert-icon-width;
  }
}

.alert-success.alert::before {
  background: $color-chewing-grass;
}

.alert-danger.alert::before {
  background: $color-copenhagen-red;
}

.alert-info.alert::before {
  background: $color-feel-good-blue;
}

.alert-warning.alert::before {
  background: $color-lemons;
}

.alert-success.alert::after {
  content: "\f058";
}

.alert-danger.alert::after {
  content: "\f057";
}

.alert-info.alert::after {
  content: "\f05a";
}

.alert-warning.alert::after {
  content: "\f071";
}

.alert-buttons {
  margin-left: 36px;
  white-space: nowrap;

  .btn {
    margin-right: 15px;

    &:last-of-type {
      margin-right: 0;
    }
  }

  .close {
    position: relative;
    margin-top: 10px;
    margin-left: 20px;
  }
}

@media only screen and (max-width : 768px) {
  .alert-buttons .close {
    position: absolute;
    right: 20px;
    top: 5px;
  }

  .alert-with-buttons {
    flex-direction: column;
    align-items: flex-start;

    .alert-buttons {
      margin-left: 0;
      white-space: normal;
    }

    .btn {
      margin-top: 10px;
    }
  }
}
