@use 'sass:map';
@use '~@angular/material' as mat;

@mixin color($theme) {
  $config: mat.get-color-config($theme);
  $primary: map.get($config, primary);
  $accent: map.get($config, accent);
  $background: map.get($config, background);
  $foreground: map.get($config, foreground);
  $is-dark-theme: map-get($config, is-dark);
  $disabled-search: if($is-dark-theme, map-get(mat.$grey-palette, 500), map-get(mat.$grey-palette, 300));

  .mtna-search__toolbar {
    &.mat-primary,
    &.mat-accent {
      .mtna-search__selection-button {
        .mat-raised-button.mat-button-disabled {
          // try disable button, or selectes-diabled
          background-color: mat.get-color-from-palette($background, selected-disabled-button);
          color: mat.get-color-from-palette($foreground, disabled-text);
        }
      }
    }
    &:not(.mat-primary):not(.mat-accent) {
      $bottomBorderColor: mat.get-color-from-palette($foreground, divider);
      border-bottom: 1px solid $bottomBorderColor;
    }
  }

  .mtna-search-filter-header .bracket-effect {
    color: mat.get-color-from-palette($foreground, text);
  }
}

@mixin typography($theme) {
}

@mixin theme($theme) {
  $config: mat.get-color-config($theme);
  @if $config != null {
    @include color($theme);
  }

  @include typography($theme);
}
