@import "../../base.less";

@import "./_var.less";

.@{prefix}-badge {
  position: relative;
  display: inline-block;
  vertical-align: top;

  &--basic {
    z-index: 100;
    padding: 0 @badge-basic-padding;
    font-size: @badge-font-size;
    color: @badge-text-color;
    background-color: @badge-color;
    text-align: center;
    height: @badge-basic-height;
    line-height: @badge-basic-height;
    font-weight: @badge-font-weight;
    border-radius: @badge-border-radius;
  }

  &--dot {
    height: @badge-dot-size;
    border-radius: 50%;
    min-width: @badge-dot-size;
    padding: 0;
  }

  &--count {
    min-width: @badge-basic-width;
    white-space: nowrap;
    box-sizing: border-box;
  }

  &--circle {
    border-radius: calc(@badge-basic-height / 2);
  }

  &__ribbon {
    &-outer {
      position: absolute;
      top: 0;
      right: 0;
    }
  }

  &--ribbon {
    display: inline-block;
    transform: rotate(45deg);
    border-radius: 0;
    // padding: 0;

    &::before,
    &::after {
      content: "";
      position: absolute;
      width: 0;
      height: 0;
      bottom: 0;
      border-bottom: @badge-basic-height solid @badge-color;
    }

    &::before {
      left: calc(-1 * @badge-basic-height + .5px);
      border-left: @badge-basic-height solid transparent;
    }

    &::after {
      right: calc(-1 * @badge-basic-height + .5px);
      border-right: @badge-basic-height solid transparent;
    }
  }

  &--bubble {
    border-radius: @border-bubble-border-radius;
  }

  // size
  &--large {
    font-size: @badge-large-font-size;
    height: @badge-large-height;
    min-width: @badge-large-height;
    line-height: @badge-large-height;
    padding: 0 @badge-large-padding;
  }

  &--large&--circle {
    border-radius: calc(@badge-large-height / 2);
  }

  &__content:not(:empty) + .@{prefix}-has-count {
    transform: translate(50%, -50%);
    position: absolute;
    right: 0;
    top: 0;
  }

  &__content-text {
    display: block;
    line-height: 24px;
  }
}
