@use '../../sass/abstracts/variables' as *;
@use '../../sass/abstracts/mixins';

@mixin background($name, $background-color, $color) {
  &--#{$name} {
    background-color: $background-color;
    color: $color;

    // Full width background color inside a container
    &-full-bleed {
      box-shadow: 0 0 0 100vmax $background-color;
      clip-path: inset(0 -100vmax);
    }

    a:not(#{$object-prefix}button):not(.button) {
      color: $color;
    }
  }
}

#{$component-prefix}alert {
  width: 100%;
  padding: 1rem;
  position: relative;
  background: $blue;
  color: $sodra-black;
  z-index: 650;
  margin-bottom: 1px;
  @include background('error', $red-50, $sodra-black);
  @include background('warning', $red-50, $sodra-black);
  @include background('info', $blue-50, $sodra-black);
  @include background('success', $green-50, $sodra-black);
  @include background('attention', $yellow-50, $sodra-black);

  ul,
  p {
    margin-bottom: 0 !important;
  }

  &--flex {
    display: flex;
  }

  &--sticky-bottom {
    position: sticky;
    bottom: 0;
    padding-right: 1.25rem; // same as all other sides
  }

  &__icon {
    margin-right: 5px;
  }

  &__text {
    width: 100%;
    font-size: 16px;
    p {
      font-size: 16px;
    }
  }

  &__close {
    float: right;
    cursor: pointer;
    &::after {
      @include mixins.unity-symbols('close');
    }
  }

  &--top {
    position: fixed;
    top: 0;
  }

  &[aria-hidden='true'] {
    display: none;
  }
}
