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

@mixin color($theme) {
  $config: mat.get-color-config($theme);
  $background: map.get($config, background);
  $foreground: map.get($config, foreground);

  mtna-confirm-dialog .mat-dialog-content {
    .mat-form-field.mat-accent,
    .mat-form-field.mat-primary {
      // text input indicator line
      .mat-input-element {
        caret-color: mat.get-color-from-palette($background, focused-button);
      }
    }

    .mat-form-field-appearance-outline,
    .mat-form-field {
      &.mat-focused:not(.mat-form-field-invalid) {
        // label color
        .mat-form-field-label,
        .mat-form-field-label.mat-accent {
          color: mat.get-color-from-palette($foreground, text);
        }
        // appearance outline border
        .mat-form-field-outline-thick,
        &.mat-accent .mat-form-field-outline-thick {
          color: mat.get-color-from-palette($foreground, text);
        }
        .mat-form-field-ripple,
        .mat-form-field-ripple.mat-accent {
          background-color: mat.get-color-from-palette($background, focused-button);
        }
      }
    }
    // 'required' asterisk
    .mat-focused .mat-form-field-required-marker {
      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);
  }

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