.react-tags {
  position: relative;
  padding: 0.25rem 0 0 0.25rem;
  cursor: text;

  --pico-border-color: var(--pico-form-element-border-color);
  --pico-color: var(--pico-form-element-color);
  --pico-box-shadow: none;
  border: var(--pico-border-width) solid var(--pico-border-color);
  border-radius: var(--pico-border-radius);
  background-color: var(--pico-form-element-background-color);
  color: var(--pico-color);
  font-weight: var(--pico-font-weight);
  transition:
    background-color var(--pico-transition),
    color var(--pico-transition),
    box-shadow var(--pico-transition);
  outline: 0;

  margin-bottom: calc(var(--pico-spacing) + 1rem);
}

.react-tags.is-active {
  --pico-border-color: var(--pico-form-element-focus-color);
  --pico-outline-width: 0.0625rem;
  --pico-box-shadow: 0 0 0 var(--pico-outline-width) var(--pico-form-element-focus-color);
}

.react-tags.is-disabled {
  opacity: 0.75;
  background-color: #eaeef2;
  /* Prevent any clicking on the component */
  pointer-events: none;
  cursor: not-allowed;
}

.react-tags.is-invalid {
  border-color: #fd5956;
  box-shadow: 0 0 0 2px rgba(253, 86, 83, 0.25);
}

.react-tags__label {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.react-tags__list {
  /* Do not use display: contents, it's too buggy */
  display: inline;
  padding: 0;
}

.react-tags__list-item {
  display: inline;
  list-style: none;
}

.react-tags__tag {
  --pico-border-color: var(--pico-secondary);
  --pico-border-radius: 0.5rem;
  margin: 0 0.25rem 0.25rem 0;
  padding: 0.1rem 0.4rem;
  color: var(--pico-h1-color);
  border: var(--pico-border-width) solid var(--pico-border-color);
  background-color: var(--pico-card-background-color);
}

.react-tags__tag:hover {
  --pico-border-color: var(--pico-primary-hover);
}

.react-tags__tag::after {
  content: "";
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  clip-path: polygon(
    10% 0,
    0 10%,
    40% 50%,
    0 90%,
    10% 100%,
    50% 60%,
    90% 100%,
    100% 90%,
    60% 50%,
    100% 10%,
    90% 0,
    50% 40%
  );
  margin-left: 0.5rem;
  font-size: 0.875rem;
  background-color: #7c7d86;
}

.react-tags__tag:hover::after {
  background-color: #ffffff;
}

.react-tags__combobox {
  display: inline-block;
  /* match tag layout */
  padding: 0.375rem 0.25rem;
  margin-bottom: 0.25rem;
  /* prevents autoresize overflowing the container */
  max-width: 100%;
}

.react-tags__combobox-input {
  all: unset;
  /* prevent autoresize overflowing the container */
  max-width: 100%;
  /* remove styles and layout from this element */
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
  background: none;
  /* match the font styles */
  font-size: inherit;
  line-height: inherit;
}

.react-tags__combobox-input::placeholder {
  color: #7c7d86;
  opacity: 1;
}

.react-tags__listbox {
  position: absolute;
  z-index: 1;
  overflow-x: clip;
  top: calc(100% - 0.5rem);
  /* Negate the border width on the container */
  left: -1px;
  right: -1px;
  max-height: 12.5rem;
  padding-top: 0.4rem;
  /* overflow-y: auto; */
  border-radius: var(--pico-border-radius);
  border-top-left-radius: 0;
  border-top-right-radius: 0;

  background-color: var(--pico-form-element-background-color);
  color: var(--pico-dropdown-color);
  border: var(--pico-border-width) solid var(--pico-border-color);
  border-top: none;

  /* &::before {
    content: "";
    position: absolute;
    border: var(--pico-border-width) solid var(--pico-border-color);
    background-color: var(--pico-form-element-background-color);
    border-top: none;
    top: -0.5rem;
    left: -1px;
    right: -1px;
    height: 0.5rem;
  } */
}

.react-tags__listbox-option {
  padding: calc(var(--pico-form-element-spacing-vertical) * 0.5) var(--pico-form-element-spacing-horizontal);
}

.react-tags__listbox-option:hover {
  cursor: pointer;
  background-color: var(--pico-dropdown-hover-background-color);
}

.react-tags__listbox-option:not([aria-disabled="true"]).is-active {
  background: var(--pico-border-color);
  color: var(--pico-contrast-inverse);
}

.react-tags__listbox-option[aria-disabled="true"] {
  color: #7c7d86;
  cursor: not-allowed;
  pointer-events: none;
}

.react-tags__listbox-option[aria-selected="true"]::after {
  margin-left: 0.5rem;
}

.react-tags__listbox-option[aria-selected="true"]:not(.is-active)::after {
  color: var(--pico-primary-hover);
}

.react-tags__listbox-option-highlight {
  background-color: var(--pico-primary-hover);
  color: var(--pico-contrast-inverse);
  padding: 0;
}

.tag-group {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-content: flex-start;
  padding: 8px;
  gap: 8px;
  background-color: #00000003;
  margin: 0.25rem 0.5rem 0.5rem 0.25rem;
  justify-content: flex-start;
  border: 1px solid #e2e2e2;
  align-items: flex-start;
  border-radius: 4px;
}

.tag-group ul {
  margin: 0;
}

.tag-group > p {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.5rem;
  color: #00000080;
}
