// Import all the tools needed to customize the theme and extract parts of it
// @import '~@angular/material/core/theming/all-theme';
@import '../../all-theme';

// Define a mixin that accepts a theme and outputs the color styles for the component.
@mixin ap-badge-theme($theme) {
  // Extract whichever individual palettes you need from the theme.
  $primary: map-get($theme, primary);
  $accent: map-get($theme, accent);

  $size-mini-icon: 10px;
  $size-small-icon: 20px;
  $size-medium-icon: 25px;
  $size-large-icon: 40px;
  $offset-small: -3px;
  $offset-medium: -10px;
  $offset-large: -5px;

  [ap-badge] {
    background: $badge-default-color;
    color: white;
    font-family: "Open Sans";
    letter-spacing: 0.3px;
    font-size: 11px;
    font-weight: 600;
    line-height: 16px;
    padding: 1px 9px;
    border-radius: 25px;
    min-width: 30px;

    &[round] {
      border-radius: 100%;
      width: 25px;
      height: 25px;
      line-height: 25px;
      font-size: 11px;
    }

    &[clear] {
      background: transparent;
      color: md-color($primary, 500);
      border-radius: 0;
      font-weight: 500;
      padding: 0;
      padding-left: 5px;
      min-width: 0;
      span { text-shadow: none; }
    }

    span {
      display: block;
      text-align: center;
      text-shadow: 0 1px 1px rgba(0,0,0,0.42);
    }
  }

  [ap-badge-icon] {
    overflow: hidden;
    z-index: 1;
    position: absolute;
    border-radius: 100%;
    text-align: center;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    &, & > * {
      min-width: $size-medium-icon;
      max-width: $size-medium-icon;
      min-height: $size-medium-icon;
      max-height: $size-medium-icon;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    &[size="mini"] {
      &, & > * {
        min-width: $size-mini-icon;
        max-width: $size-mini-icon;
        min-height: $size-mini-icon;
        max-height: $size-mini-icon;
      }

      &.top { top: $offset-small; }
      &.bottom { bottom: $offset-small; }
      &.right { right: $offset-small; }
      &.left { left: $offset-small; }
    }
    &[size="sm"] {
      &, & > * {
        min-width: $size-small-icon;
        max-width: $size-small-icon;
        min-height: $size-small-icon;
        max-height: $size-small-icon;
      }

      &.top { top: $offset-small; }
      &.bottom { bottom: $offset-small; }
      &.right { right: $offset-small; }
      &.left { left: $offset-small; }
    }
    &[size="l"] {
      &, & > * {
        min-width: $size-large-icon;
        max-width: $size-large-icon;
        min-height: $size-large-icon;
        max-height: $size-large-icon;
      }
      font-size: 18px;
      font-weight: 500;

      &.top { top: $offset-large; }
      &.bottom { bottom: $offset-large; }
      &.right { right: $offset-large; }
      &.left { left: $offset-large; }
    }

    &.top { top: $offset-medium; }
    &.bottom { bottom: $offset-medium; }
    &.right { right: $offset-medium; }
    &.left { left: $offset-medium; }

    &[no-offset] {
      &.top { top: 0; }
      &.bottom { bottom: 0; }
      &.right { right: 0; }
      &.left { left: 0; }
    }

    &.star, &.check, &.blue { color: #FFF; }
    &.star { background-color: $color-favorite; }
    &.check { background-color: $color-success; }
    &.blue { background-color: $color-blue; }
    &.default { background-color: $badge-default-color; }
    &.primary { background-color: md-color($primary); }

    i[ap-icon], md-icon {
      vertical-align: middle;
      margin-top: 3px;
    }

  }

}
