@use "../../../../styles/mixins/scrollbar" as *;

.SearchMessageList {
  display: flex;
  flex-direction: column;
  width: 100%;
}

// Status line (loading / error / empty)
.SearchMessageList__status {
  padding: 16px;
  font-size: 14px;
  text-align: center;
  color: var(--uikit-text-color-secondary);

  &--error {
    color: var(--uikit-text-color-error);
  }

  &--special-reason {
    color: var(--uikit-text-color-tertiary);
    text-align: center;
  }
}

// Single message row
.SearchMessageList__row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  transition: background-color 0.15s;

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

.SearchMessageList__avatarWrapper {
  flex-shrink: 0;
}

.SearchMessageList__content {
  flex: 1;
  min-width: 0;
}

.SearchMessageList__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.SearchMessageList__name {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--uikit-text-color-primary);
}

.SearchMessageList__time {
  flex-shrink: 0;
  font-size: 12px;
  margin-left: 8px;
  color: var(--uikit-text-color-secondary);
}

.SearchMessageList__body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.SearchMessageList__messageContent {
  // width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background-color: var(--uikit-bg-color-bubble-reciprocal);
}

// "Locate to Chat" button — hidden until row hover, own line below the message
.SearchMessageList__locateBtn {
  display: none;
  font-size: 12px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
  margin-inline-start: 12px;
  color: var(--uikit-text-color-link);
}

.SearchMessageList__row:hover .SearchMessageList__locateBtn {
  display: block;
}

// Load more
.SearchMessageList__loadMore {
  display: flex;
  justify-content: center;
  padding: 12px;
}

.SearchMessageList__loadMoreBtn {
  font-size: 14px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  color: var(--uikit-text-color-link);

  &:disabled {
    cursor: not-allowed;
    color: var(--uikit-text-color-disabled);
  }
}

// No more messages — shown when hasMore is false and there are messages.
.SearchMessageList__noMore {
  padding: 0 0 8px;
  font-size: 12px;
  text-align: center;
  color: var(--uikit-text-color-tertiary);
}
