/**
 * @license
 * Copyright Tyler Technologies, Inc. 
 * License: Apache-2.0
 */
@use './core' as *;
@use '../core/styles/theme';

//
// Host
//

:host {
  @include host;
}

:host([hidden]) {
  display: none;
}

//
// Base
//

.forge-badge {
  @include tokens;
}

.forge-badge {
  @include base;

  .content {
    @include content;
  }
}

//
// Start/End slots
//

::slotted(:is([slot=start],[slot=end])) {
  font-size: inherit;
}

//
// Hide
//

:host([hide]) {
  .forge-badge {
    @include hide;
  }
}

//
// Dot
//

:host([dot]) {
  .forge-badge {
    @include dot;
  }
  
  .forge-badge > slot {
    display: none;
  }
}

//
// Themes
//

// General theme overrides
@each $theme in [primary secondary tertiary success warning] {
  :host([theme=#{$theme}]) {
    .forge-badge {
      @include override(background, theme.variable(#{$theme}-container), value);
      @include override(color, theme.variable(on-#{$theme}-container), value);
    }
  }
  
  :host([strong][theme=#{$theme}]) {
    .forge-badge {
      @include override(background, theme.variable($theme), value);
      @include override(color, theme.variable(on-#{$theme}), value);
    }
  }
}

// Map both "error" and "danger" for backwards compatibility with legacy "danger" theme
:host(:not([strong]):is([theme=error],[theme=danger])) {
  .forge-badge {
    @include override(background, theme.variable(error-container), value);
    @include override(color, theme.variable(error), value);
  }
}
:host([strong]:is([theme=error],[theme=danger])) {
  .forge-badge {
    @include override(background, theme.variable(error), value);
    @include override(color, theme.variable(on-error), value);
  }
}

// Map both "info" and "info-primary" for backwards compatibility with "info" theme
:host(:not([strong]):is([theme=info],[theme=info-primary])) {
  .forge-badge {
    @include override(background, theme.variable(info-container), value);
    @include override(color, theme.variable(on-info-container), value);
  }
}
:host([strong]:is([theme=info],[theme=info-primary])) {
  .forge-badge {
    @include override(background, theme.variable(info), value);
    @include override(color, theme.variable(on-info), value);
  }
}

// Support "info-secondary" separately since it is not a core theme
:host(:not([strong])[theme=info-secondary]) {
  .forge-badge {
    @include override(background, theme.variable(surface-container-low), value);
    @include override(color, theme.variable(on-surface-container-low), value);
  }
}
:host([strong][theme=info-secondary]) {
  .forge-badge {
    @include override(background, theme.variable(surface-inverse), value);
    @include override(color, theme.variable(on-surface-inverse), value);
  }
}
