$vl-pill-height: 2.4rem;
$vl-pill-padding: 0.7rem;
$vl-custom-easing: cubic-bezier(1, 0.1, 0, 0.9);

// Pill
.vl-pill {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  background-color: $vl-alt-bg;
  font-size: 1.4rem;
  font-weight: 500;
  color: $vl-alt-text-color;
  height: $vl-pill-height;
  text-decoration: none;
  vertical-align: bottom;
  border-radius: 0.6rem;
  border: 0.1rem solid $vl-border-color;
  transition: color 0.2s, background-color 0.2s;
  padding: 0 $vl-pill-padding;

  
  &__text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
  }

  // Pill close
  &__close {
    @include vi;
    @include vi-cross;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: $vl-action-text-color;
    width: $vl-pill-height;
    height: $vl-pill-height;
    border: 0;
    border-left: $vl-border-color 0.1rem solid;
    text-decoration: none;
    margin-left: 0.4rem;
    padding: 0;

    &:hover,
    &:focus {
      color: $vl-action-text-hover-color;
    }

    &::before {
      display: inline-block;
      font-size: 1.1rem;
      text-indent: 0;
      line-height: 1;
    }

    [dir="rtl"] & {
      border-left: 0;
      border-right: $vl-border-color .1rem solid;
    }

    .is-disabled & {
      color: $vl-disabled-color;
      cursor: default;
    }
  }

  // Pill success modifier
  &--success {
    background-color: $vl-success-color;
    color: $vl-success-fg-color;
  }

  // Pill warning modifier
  &--warning {
    background-color: $vl-warning-color;
    color: $vl-warning-fg-color;
  }

  // Pill error modifier
  &--error {
    background-color: $vl-error-color;
    color: $vl-error-fg-color;
  }

  // Pill closable modifier
  &--closable {
    padding-right: 0;
  }

  // Pill clickable modifier
  &--clickable {
    color: $vl-action-text-color;

    &:hover,
    &:focus {
      background-color: $vl-alt-hover-bg;
      color: $vl-action-text-hover-color;
    }
  }

  // Pill checkable modifier
  &--checkable {
    position: relative;
    cursor: pointer;
    padding-left: 2.7rem;
    margin-bottom: 0.3rem;

    // Pill checkable checkbox
    &__checkbox {
      position: absolute;
      overflow: hidden;
      clip: rect(0 0 0 0);
      width: 0.1rem;
      height: 0.1rem;
      padding: 0;
      margin: -0.1rem;

      &:focus + span {
        border-color: $vl-outline-color;
        outline: 0.2rem solid $vl-outline-color;
      }

      &:checked + span {
        color: $vl-action-color;
        background: $vl-action-color;
        border: 0.1rem $vl-action-color solid;
        box-shadow: 0 0 0 0.1rem $vl-action-color;

        &::before {
          transform: translateZ(0) translate(-50%, -50%) scale(1);
        }
      }

      + span {
        @include vi;
        @include vi-check;
        position: absolute;
        display: inline-block;
        background: $vl-white;
        width: ($vl-pill-height - 0.2rem);
        height: ($vl-pill-height - 0.2rem);
        cursor: pointer;
        overflow: hidden;
        white-space: nowrap;
        border-top-left-radius: 0.5rem;
        border-bottom-left-radius: 0.5rem;
        transition: all 0.3s $vl-custom-easing;
        margin: 0 0.5rem 0 0;
        left: 0;

        &::before {
          position: absolute;
          display: block;
          font-size: 0.8rem;
          color: $vl-page-bg;
          line-height: 1;
          text-align: center;
          transition: all 0.3s $vl-custom-easing 0.1s;
          transform: translateZ(0) translate(-50%, -50%) scale(0);
          top: 50%;
          left: 50%;
        }
      }
    }
  }
}
