// Base class
//
// Requires one of the contextual, color modifier classes for `color` and
// `background-color`.

.#{$badge-prefix-cls} {
  @include border-radius($badge-height / 2);
  display: inline-block;
  padding: 0 $badge-padding-x;
  font-size: $badge-font-size;
  font-weight: $badge-font-weight;
  height: $badge-height;
  line-height: $badge-height;
  min-width: $badge-height;
  color: $badge-color;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  background-color: $badge-default-bg;
}

a.#{$badge-prefix-cls} {
  @include hover-focus {
    color: $badge-link-hover-color;
    background-color: darken($badge-default-bg, 10%);
  }
}

// Quick fix for badges in buttons
.#{$btn-prefix-cls} .#{$badge-prefix-cls} {
  position: relative;
  top: -1px;
}

// Pill badges
//
// Make them extra rounded with a modifier to replace v3's badges.

//.badge-pill {
//  padding-right: $badge-pill-padding-x;
//  padding-left: $badge-pill-padding-x;
//  @include border-radius($badge-pill-border-radius);
//}

//dot badges
.#{$badge-prefix-cls}--dot {
  position: absolute;
  top: -$badge-dot-height / 2;
  right: 0;
  width: $badge-dot-width;
  height: $badge-dot-height;
  min-width: $badge-dot-width;
  padding: 0;
  font-size: 0;
  border: 1px solid $white;
  border-radius: 100%;
  box-shadow: 0 2px 4px 0 rgba(0, 0, 0, .1);
  transform: translateX(50%);
}

//定位在顶部
.#{$badge-prefix-cls}--top {
  position: absolute;
  top: -$badge-height / 2;
  right: 0;
  transform: translateX(50%);
}

// Colors
//
// Contextual variations (linked badges get darker on :hover).

@each $key, $value in $color-status {
  .#{$badge-prefix-cls}.#{$badge-prefix-cls}--#{$key} {
    background-color: nth($value, 1);
  }
  // scss-lint:disable QualifyingElement
  // Add hover effects, but only for links
  a.#{$badge-prefix-cls}--#{$key} {
    @include hover-focus {
      color: $badge-link-hover-color;
      text-decoration: none;
      background-color: darken(nth($value, 1), 10%);
    }
  }
}

.#{$badge-prefix-cls}.#{$badge-prefix-cls}--dark {
  background-color: $gray-darker;
}

a.#{$badge-prefix-cls}--dark {
  @include hover-focus {
    color: $badge-link-hover-color;
    text-decoration: none;
    background-color: darken($gray-darker, 10%);
  }
}

.#{$badge-prefix-cls}.#{$badge-prefix-cls}--muted {
  color: $gray-light-45;
  background-color: $gray-light-9;
}

a.#{$badge-prefix-cls}--muted {
  @include hover-focus {
    color: $gray-light-45;
    text-decoration: none;
    background-color: darken($gray-light-9, 10%);
  }
}