@import '../../scss/styles.scss';

@layer payload-default {
  .pill {
    font-size: 1rem;
    line-height: base(1.2);
    display: inline-flex;
    background: var(--theme-elevation-150);
    color: var(--theme-elevation-800);
    border-radius: $style-radius-s;
    cursor: default;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border: 0;
    padding: 0 base(0.4);
    align-items: center;
    flex-shrink: 0;
    gap: base(0.2);

    &--rounded {
      border-radius: var(--style-radius-l);
      line-height: 18px;
      font-size: 12px;
    }

    &:active,
    &:focus:not(:focus-visible) {
      outline: none;
    }

    &:focus-visible {
      outline: var(--accessibility-outline);
      outline-offset: var(--accessibility-outline-offset);
    }

    .icon {
      flex-shrink: 0;
      margin: base(0.1);
    }

    &__label {
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    &--has-action {
      cursor: pointer;
      text-decoration: none;
    }

    &--is-dragging {
      cursor: grabbing;
    }

    &--has-icon {
      gap: 0;
      padding-inline-start: base(0.4);
      padding-inline-end: base(0.1);

      svg {
        display: block;
      }
    }

    &--align-icon-left {
      flex-direction: row-reverse;
      padding-inline-start: base(0.1);
      padding-inline-end: base(0.4);
    }

    &--style-white {
      background: var(--theme-elevation-0);

      &.pill--has-action {
        &:hover,
        &:active {
          background: var(--theme-elevation-100);
        }
      }
    }

    &--style-always-white {
      background: var(--theme-elevation-850);
      color: var(--theme-elevation-0);

      &.pill--has-action {
        &:hover,
        &:active {
          background: var(--theme-elevation-750);
        }
      }
    }

    &--style-light {
      &.pill--has-action {
        &:hover,
        &:active {
          background: var(--theme-elevation-100);
        }
      }
    }

    &--style-light-gray {
      background: var(--theme-elevation-100);
      color: var(--theme-elevation-800);
    }

    &--style-warning {
      background: var(--theme-warning-150);
      color: var(--theme-warning-800);
    }

    &--style-success {
      background: var(--theme-success-150);
      color: var(--theme-success-800);
    }

    &--style-error {
      background: var(--theme-error-150);
      color: var(--theme-error-800);
    }

    &--style-dark {
      background: var(--theme-elevation-800);
      color: var(--theme-elevation-0);

      svg {
        @include color-svg(var(--theme-elevation-0));
      }

      &.pill--has-action {
        &:hover {
          background: var(--theme-elevation-750);
        }

        &:active {
          background: var(--theme-elevation-700);
        }
      }
    }

    &--size-small {
      padding: 0 base(0.2);
      line-height: 18px;
    }
  }

  html[data-theme='light'] {
    .pill {
      &--style-always-white {
        background: var(--theme-elevation-0);
        color: var(--theme-elevation-800);
        border: 1px solid var(--theme-elevation-100);

        &.pill--has-action {
          &:hover,
          &:active {
            background: var(--theme-elevation-100);
          }
        }
      }
    }
  }
}
