/**
 * @license
 * Copyright 2023 Tyler Technologies, Inc. 
 * License: Apache-2.0
 */
@use '@material/theme/theme' as mdc-theme;
@use '../theme';
@use './variables';

@mixin base() {
  @include mdc-theme.property(background-color, surface);
  @include theme.css-custom-property(min-height, --forge-toolbar-min-height, variables.$min-height);
  @include theme.css-custom-property(height, --forge-toolbar-height, variables.$height);
  @include theme.css-custom-property(padding-inline, --forge-toolbar-padding, variables.$padding);
  @include theme.css-custom-property(border-bottom, --forge-toolbar-border-bottom, variables.$border-bottom);
  @include theme.css-custom-property(border-top-left-radius, --forge-toolbar-border-top-left-radius, 0);
  @include theme.css-custom-property(border-top-right-radius, --forge-toolbar-border-top-right-radius, 0);
  @include theme.css-custom-property(border-bottom-left-radius, --forge-toolbar-border-bottom-left-radius, 0);
  @include theme.css-custom-property(border-bottom-right-radius, --forge-toolbar-border-bottom-right-radius, 0);
  @include theme.property(border-color, border-color);

  display: grid;
  grid-template-columns: auto 1fr auto;
  box-sizing: border-box;
}

@mixin inverted() {
  @include theme.css-custom-property(border-top, --forge-toolbar-border-top, variables.$border-bottom);

  border-bottom: none;
}

@mixin section() {
  display: flex;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
}

@mixin section-start() {
  grid-column: 1;
}

@mixin section-center() {
  justify-content: center;
  grid-column: 2;
}

@mixin section-end() {
  justify-content: flex-end;
  grid-column: 3;
}

@mixin core-styles() {
  .forge-toolbar {
    @include base;

    &__section {
      @include section;

      &--align-start {
        @include section-start;
      }

      &--align-center {
        @include section-center;
      }

      &--align-end {
        @include section-end;
      }
    }

    &--inverted {
      @include inverted;
    }
  }
}
