@use "@tencentcloud/uikit-base-component-react/dist/styles/theme/util" as *;

.conversationPreview {
  display: flex;
  align-items: center;
  border: none;
  cursor: pointer;
  line-height: 17px;
  height: 64px;
  box-sizing: border-box;
  padding: 0 12px;
  flex: 0 0 auto;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;

  @include theme() {
    background-color: get(list-color-default);
    color: get(text-color-primary);
  }

  &:hover {
    @include theme() {
      background-color: get(list-color-hover);
    }
  }

  &--mobile {
    padding: 0 10px;
  }

  &--pin {
    @include theme() {
      background-color: get(list-color-hover);
    }
  }

  &__title {
    font-style: normal;
    font-weight: 500;
    font-size: 14px;
    line-height: 20px;
    flex: 1;
    min-width: 0;

    @include theme() {
      color: get(text-color-primary);
    }

    &--normal {
      @include theme() {
        color: get(text-color-primary);
      }
    }

    &--highlight {
      @include theme() {
        color: get(text-color-link);
      }
    }
  }

  &__unread {
    box-sizing: border-box;
    min-width: 16px;
    height: 16px;
    border-radius: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2px 5px;
    font-size: 11px;
    font-weight: 700;
    margin-block: 2px;
    margin-inline-start: auto;
  }

  &--active {
    &, &:hover {
      @include theme() {
        background-color: get(list-color-focused);
      }
    }

    .conversationPreview__title {
      @include theme() {
        color: get(text-color-link);
      }
    }
  }

  &--unread {
    .conversationPreview__unread {
      @include theme() {
        color: get(text-color-button);
        background-color: get(text-color-error);
      }
    }
  }

  &__avatar {
    display: flex;
  }

  &__content {
    flex: 1;
    text-align: start;
    margin-inline-start: 8px;
    min-width: 0;
  }

  &__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 20px;
  }

  &__footer {
    display: flex;
    align-items: center;
    height: 18px;
    margin-top: 2px;
  }

  &__mute-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    margin-inline-start: 8px;

    @include theme() {
      color: get(text-color-primary);
    }

    svg {
      width: 14px;
      height: 14px;
    }
  }

  &__abstract {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-style: normal;
    font-weight: 400;
    font-size: 12px;
    line-height: 18px;

    @include theme() {
      color: get(text-color-secondary);
    }

    &__drafts {
      @include theme() {
        color: get(text-color-error);
      }
    }

    &__at-info {
      @include theme() {
        color: get(text-color-error);
      }
    }
  }

  &__actions-wrapper {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    align-self: center;
    margin-inline-start: 8px;
  }

  &__external {
    text-align: end;
    min-width: 32px;
    flex: 0 1 auto;
    display: flex;
    flex-direction: column;
  }

  &__time {
    font-style: normal;
    font-weight: 400;
    font-size: 12px;
    line-height: 20px;
    text-wrap: nowrap;
    flex-shrink: 0;
    margin-inline-start: 8px;

    @include theme() {
      color: get(text-color-secondary);
    }
  }
}

.textEllipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
