@mixin make-mat-button($name, $palette) {
  &.btn-#{$name} {
    @include textColor($palette, 'dark');
    @include borderColor($palette, 'dark');
    .mat-button-focus-overlay { @include bgColor($palette, 'default'); }
    &[disabled] {
      border-color: currentColor;
      .mat-button-focus-overlay { background-color: transparent; }
    }
  }
}

@mixin make-banner-type($name, $palette) {
  .banner-#{$name} {
    color: map_get($palette, 'dark');
    background-color: map_get($palette, 'lighter');

    .mat-ripple-element {
      background-color: map_get($palette, 'default');
    }

    [mat-button], [mat-stroked-button] {
      @include make-mat-button($name, $palette);
    }
  }
}

ar-banner { display: block; }

ar-banner .banner {
  @extend .rounded;
  display: flex;
  padding: 1rem;
}

.banner-addon {
  flex: 0 0 34px;
  display: flex;
}

.banner-content {
  flex: 1 0;
}

.banner-text {
  @extend .mat-body;
  display: flex;
  flex-direction: column;

  .banner-title {
    @extend .mat-subheading-2;
    margin-bottom: 4px;
    font-weight: bold;
    font-size: 1.15rem;
  }
}

@include make-banner-type('primary', $palette-primary);
@include make-banner-type('success', $palette-success);
@include make-banner-type('warning', $palette-warning);
@include make-banner-type('danger', $palette-danger);

.banner-actions {
  margin-top: 1rem;

  button + button {
    @extend .ml-2;
  }
}

@include media-breakpoint-up(md) {
  ar-banner .banner.banner-inline {
    align-items: center;
    padding-top: 8px;
    padding-bottom: 6px;

    .banner-text, .banner-content {
      display: flex;
      flex-direction: row;
      align-items: center;
      justify-content: space-between;
    }

    .banner-title {
      margin-right: 8px;
      margin-bottom: 0;
    }

    .banner-actions {
      display: flex;
      flex-wrap: nowrap;
      margin-top: -3px;
      margin-bottom: -1px;
      margin-left: 1rem;
    }

    .banner-dismiss {
      position: relative;
      top: 2px;
    }
  }
}

mat-card.banner-bleed ar-banner {
  .banner {
    margin-left: -16px;
    margin-right: -16px;
    border-radius: 0;
  }

  &:first-child {
    .banner { margin-top: -16px; }
  }

  &:last-child {
    .banner { margin-bottom: -16px; }
  }
}

