$_pills: (
  agents: (
    background-color: $blue-100,
    border-color: $blue-100,
    color: map-get($color-aliases, "text-base"),
    content: "Agents",
  ),
  access-token: (
    background-color: $pink-100,
    border-color: $pink-100,
    color: map-get($color-aliases, "text-base"),
    content: "Access token",
  ),
  builds: (
    background-color: $orange-100,
    border-color: $orange-100,
    color: map-get($color-aliases, "text-base"),
    content: "Builds",
  ),
  jobs: (
    background-color: $purple-100,
    border-color: $purple-100,
    color: map-get($color-aliases, "text-base"),
    content: "Jobs",
  ),
  meta: (
    background-color: $gray-300,
    border-color: $gray-300,
    color: map-get($color-aliases, "text-base"),
    content: "Meta",
  ),
  notification-services: (
    background-color: $purple-100,
    border-color: $purple-100,
    color: map-get($color-aliases, "text-base"),
    content: "Notification services",
  ),
  organizations: (
    background-color: $pink-100,
    border-color: $pink-100,
    color: map-get($color-aliases, "text-base"),
    content: "Organizations",
  ),
  pipelines: (
    background-color: $aqua-100,
    border-color: $aqua-100,
    color: map-get($color-aliases, "text-base"),
    content: "Pipelines",
  ),
  users: (
    background-color: $red-100,
    border-color: $red-100,
    color: map-get($color-aliases, "text-base"),
    content: "Users",
  ),
  beta: (
    background-color: rgba(255, 165, 0, 0.2),
    border-color: rgba(255, 165, 0, 0.2),
    color: rgb(255, 165, 0),
    content: "Beta",
  ),
  coming-soon: (
    background-color: $gray-200,
    border-color: $gray-200,
    color: $charcoal-500,
    content: "Coming soon",
  ),
  deprecated: (
    background-color: $gray-200,
    border-color: $gray-200,
    color: $charcoal-500,
    content: "Deprecated",
  ),
  new: (
    background-color: $olive-700,
    border-color: $olive-700,
    color: $base-0,
    content: "New",
  ),
  required: (
    background-color: $red-100,
    border-color: $red-100,
    color: $red-700,
    content: "Required",
  ),
  object: (
    background-color: $blue-100,
    border-color: $blue-100,
    color: $blue-700,
    content: "Object",
  ),
  scalar: (
    background-color: $pink-100,
    border-color: $pink-100,
    color: $pink-800,
    content: "Scalar",
  ),
  interface: (
    background-color: $gray-300,
    border-color: $gray-300,
    color: $charcoal-600,
    content: "Interface",
  ),
  enum: (
    background-color: $green-100,
    border-color: $green-100,
    color: $olive-800,
    content: "ENUM",
  ),
  input_object: (
    background-color: $purple-100,
    border-color: $purple-100,
    color: $purple-600,
    content: "Input object",
  ),
  union: (
    background-color: $orange-100,
    border-color: $orange-100,
    color: $orange-700,
    content: "Union",
  ),
);

@mixin pill {
  border-radius: 4px;
  border-style: solid;
  border-width: 1px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.025rem;
  line-height: map-get($line-heights, "tighest");
  padding: 3px 7px;
  text-transform: uppercase;
}

@mixin pill-style($type) {
  & {
    $_styles: map-get($_pills, $type);
    background: map-get($_styles, background-color);
    border-color: map-get($_styles, border-color);
    color: map-get($_styles, color);
    content: map-get($_styles, content);

    &[href] {
      color: map-get($_styles, color);
      text-decoration: none;
      text-decoration-color: rgba(map-get($_styles, color), 0);

      &:hover {
        border-color: map-get($_styles, color);
        color: map-get($_styles, color);
        text-decoration-color: map-get($_styles, color);
      }
    }
  }
}

@mixin pill-small {
  font-size: 8px;
  padding: 3px 5px;
}

@mixin pill-large {
  font-size: 14px;
}

.pill {
  @include pill;
}

.pill--small {
  @include pill-small;
}

.pill--large {
  @include pill-large;
}

.pill--normal-case {
  text-transform: none;
}

@each $type, $styles in $_pills {
  .pill--#{$type} {
    @include pill-style($type);
  }

  .has-pill-#{$type} {
    &::after {
      @include pill;
      @include pill-style($type);
      @include pill-small;
      position: relative;
      left: 5px;
      top: -3px;
    }
  }
}

.has-pills {
  align-items: center;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
}
