.root {
  cursor: var(--custom-cursor, pointer);

  position: relative;

  display: flex;
  flex-shrink: 1;
  align-items: center;

  min-width: 0;
  height: 2rem;
  margin-inline: 0.25rem;
  padding-right: 0.75rem;
  border-radius: 1rem;

  background: var(--color-chat-hover);

  transition: background-color 0.15s ease;

  &.minimized {
    padding-right: 0;
  }

  &:hover {
    background-color: var(--color-item-active);
  }

  &.closeable:hover {
    background-color: rgba(var(--color-error-rgb), 0.16);

    .remove {
      opacity: 1;
    }
  }

  &.nonDestructive {
    .remove {
      background: var(--color-primary);
    }

    &:hover {
      background: var(--color-chat-hover);
    }
  }

  &.notClickable {
    cursor: default;
  }

  .avatar,
  .iconWrapper {
    flex-shrink: 0;

    width: 2rem;
    height: 2rem;

    opacity: 1;

    transition: opacity 0.15s ease;
  }

  .iconWrapper {
    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0.375rem;
    border-radius: 50%;

    color: white;

    background-color: var(--color-primary);

    .icon {
      position: relative;
      top: -1px;
      font-size: 1.25rem;
    }
  }

  .name {
    min-width: 0;
    margin-left: 0.5rem;
    text-overflow: ellipsis;
    white-space: nowrap;

    :global(.emoji.emoji-small) {
      width: 1.125rem;
      height: 1.125rem;
      vertical-align: -4px;
      background-size: 1.125rem;
    }
  }

  .remove {
    position: absolute;
    z-index: 1;
    top: 0;
    left: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 2rem;
    height: 2rem;
    border-radius: 50%;

    font-size: 1.5rem;
    color: white;

    opacity: 0;
    background-color: var(--color-error);

    transition: opacity 0.15s ease;
  }

  &.squareAvatar {
    --border-radius-forum-avatar: 0.625rem;

    border-start-start-radius: 0.625rem;
    border-end-start-radius: 0.625rem;

    &.minimized, .remove {
      border-radius: 0.625rem;
    }
  }

  &[dir="rtl"] {
    padding-right: 0;
    padding-left: 1rem;

    &.minimized {
      padding-right: 0;
      padding-left: 0;
    }

    .name {
      margin-right: 0.5rem;
      margin-left: 0;
    }

    .remove {
      right: 0;
      left: auto;
    }
  }
}
