@import '../colors';

.tix-label.v4 {
  display: inline-block;
  position: relative;

  .content-label {
    background-color: $color-B100;
    border-radius: 2px;
    box-sizing: content-box;
    color: $color-B400;
    padding: 2px 4px;
    position: absolute;
    text-align: center;
    width: max-content;
    display: flex;
    align-items: center;

    &.desktop {
      height: 28px;
      padding: 4px 8px;
      border-radius: 4px;
      border: solid 1px;
    }

    .tix-icon {
      width: 12px;
      height: 12px;
      margin: 1px 4px 1px 0;
      fill: currentColor;

      use {
        fill: currentColor;
      }
    }

    &.inverted {
      background-color: $color-B400;
      color: $color-N0;
    }

    &.positive {
      background-color: $color-G100;
      color: $color-G500;

      &.inverted {
        background-color: $color-G500;
        color: $color-N0;
      }
    }

    &.important {
      background-color: $color-R100;
      color: $color-R400;

      &.inverted {
        background-color: $color-R400;
        color: $color-N0;
      }
    }

    &.urgent {
      background-color: $color-Y200;
      color: $color-R400;

      &.inverted {
        background-color: $color-Y500;
        color: $color-R400;
      }
    }

    &.ribbon {
      background-color: $color-G500;
      color: $color-N0;
      border-radius: 4px 0px 4px 4px;
      padding-left: 8px;
      padding-right: 6px;

      .tix-icon {
        margin-left: -2px;
      }

      &.wave {
        animation: shimmer-label 2s ease-in infinite;
        background-image: linear-gradient(
          90deg,
          transparent,
          rgba(255, 255, 255, 0.7),
          transparent
        );
        background-size: 11px 100%;
        background-repeat: no-repeat;
        background-position: -11px;
        animation-delay: 0.5s;
      }

      &:before,
      &:after {
        position: absolute;
        content: '';
        display: block;
      }

      &:before {
        width: 4px;
        height: 4px;
        top: -4px;
        right: 0;
        background: inherit;
        background-image: none;
        border-radius: 0 2px 0 0;
      }

      &:after {
        width: 4px;
        height: 4px;
        border: solid 1px inherit;
        opacity: 0.5;
        top: -4px;
        right: 0;
        background: rgba(0, 0, 0, 0.8);
        border-radius: 0 4px 4px 0;
      }

      &.inverted {
        border-radius: 0 16px 16px 6px;
        padding-right: 8px;
        padding-left: 6px;

        &:before {
          left: 0;
          border-radius: 2px 0 0 0;
          border: solid 1px inherit;
        }

        &:after {
          border-radius: 4px 0 0 4px;
          left: 0;
        }
      }

      @keyframes shimmer-label {
        0% {
          background-position: -11px 0;
        }

        100% {
          background-position: calc(11px + 100%) 0;
        }
      }
    }
  }
}
