@import '../../../style/theme/default/index.less';

@badge-prefix-cls: ~'@{idoll-prefix}-badge';
@number-prefix-cls: ~'@{idoll-prefix}-scroll-number';
.@{badge-prefix-cls} {
  position: relative;
  display: inline-block;
  line-height: 1;
  vertical-align: middle;
  p {
    margin-bottom: 0;
  }
  &-count {
    position: absolute;
    transform: translateX(-50%);
    top: -15%;
    height: @badge-height;
    border-radius: @badge-radius;
    min-width: @badge-height;
    background: @error-color;
    color: @badge-color;
    line-height: @badge-height;
    text-align: center;
    padding: 0 @padding-xs - 3px;
    font-size: @font-size-sm;
    white-space: nowrap;
    transform-origin: -10% center;
    z-index: 10;
    font-family: @font-family;
    box-shadow: 0 0 0 @border-width-base @badge-color ;
    a,
    a:hover {
      color: @badge-color ;
    }
  }

  a,a:link,a:visited,a:hover,a:active {
    text-decoration: none;
  }

  &-dot {
    position: absolute;
    transform: translateX(-50%);
    transform-origin: 0px center;
    top: -(@badge-dot-size / 2);
    height: @badge-dot-size;
    width: @badge-dot-size;
    border-radius: 100%;
    background: @error-color;
    z-index: 10;
    box-shadow: 0 0 0 @border-width-base @badge-color;
  }
  &-zoom-appear,
  &-zoom-enter {
    animation: enterIn @animation-duration-slow @ease-out-back;
    animation-fill-mode: both;
  }

  &-zoom-leave {
    animation: enterOut @animation-duration-slow @ease-in-back;
    animation-fill-mode: both;
  }

  &-not-a-wrapper &-count {
    top: auto;
    display: block;
    position: relative;
    transform: translateX(0);
  }
}

a & {
  &-count:hover {
    background: tint(@error-color, 20%);
  }
  &-count:active {
    background: shade(@error-color, 5%);
  }
}

.@{number-prefix-cls} {
  overflow: hidden;
  &-only {
    display: inline-block;
    transition: transform @animation-duration-slow @ease-in-out;
  }
  // for IE8/9 display
  &.not-support-css-animation &-only {
    > p {
      display: none;
      &.current {
        display: block;
      }
    }
  }

  &.@{badge-prefix-cls}-success-dot,&.@{badge-prefix-cls}-error-dot, &.@{badge-prefix-cls}-default-dot,&.@{badge-prefix-cls}-processing-dot,&.@{badge-prefix-cls}-warning-dot {
    width: @badge-dot-size;
    height: @badge-dot-size;
    top: 0;
    left: 100%;
    position: absolute;
    border-radius: 100%;
  }

  &.@{badge-prefix-cls}-success-dot {
    background-color: @success-color;
  }
  &.@{badge-prefix-cls}-error-dot {
    background-color: @error-color;
  }
  &.@{badge-prefix-cls}-default-dot {
    background-color: @badge-default-color;
  }
  &.@{badge-prefix-cls}-warning-dot {
    background-color: @warning-color;
  }
  &.@{badge-prefix-cls}-processing-dot {
    background-color: @badge-processing-color;
    overflow: visible;
    &:after {
      content: '';
      width: @badge-dot-size;
      height: @badge-dot-size;
      left: 0;
      top: 0;
      position: absolute;
      border: @border-width-base @border-style-base @primary-color;
      border-radius: 100%;
      animation: enterEffect 1.2s infinite;
    }
  }
}

.state-dot-text {
  .@{badge-prefix-cls}-success-dot,.@{badge-prefix-cls}-error-dot,.@{badge-prefix-cls}-default-dot,.@{badge-prefix-cls}-processing-dot,.@{badge-prefix-cls}-warning-dot {
    width: @badge-dot-size;
    height: @badge-dot-size;
    top: 50%;
    transform: translate(-50%,-50%);
    left: 0px;
    position: absolute;
    border-radius: 100%;
  }
}

@keyframes enterEffect {
  0% {
    transform: scale(0);
    opacity: 1;
  }

  100% {
    transform: scale(2);
    opacity: 0;
  }
  0% {
    transform: scale(0);
    opacity: 1;
  }
}
.@{badge-prefix-cls}-success,.@{badge-prefix-cls}-error,.@{badge-prefix-cls}-default,.@{badge-prefix-cls}-processing,.@{badge-prefix-cls}-warning {
  padding-left: @badge-dot-size;
  position: relative;
}

@keyframes enterIn {
  0% {
    transform: scale(0);
  }
  100% {
    transform: scale(1) translateX(-50%);
  }
  0% {
    opacity: 0;
    transform: scale(0) translateX(-50%);
  }
}
