/* akong-conversation-item · Web 样式 · 用 var(--ak-*) 接 @akong/tokens */

.ak-conversation-item {
  display: flex;
  align-items: center;
  gap: var(--ak-space-3);
  width: 100%;
  min-height: 64px;
  padding: var(--ak-space-3) var(--ak-space-4);
  background: var(--ak-bg);
  color: var(--ak-fg);
  font-family: var(--ak-font-sans);
  border: 0;
  text-align: left;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: opacity var(--ak-duration-fast) var(--ak-ease-out),
              background-color var(--ak-duration-fast) var(--ak-ease-out);
  outline: none;
  box-sizing: border-box;
}

.ak-conversation-item:focus-visible {
  outline: 2px solid var(--ak-border-strong);
  outline-offset: -2px;
}

.ak-conversation-item:hover:not([aria-disabled="true"]) {
  background: var(--ak-bg-subtle);
}

.ak-conversation-item:active:not([aria-disabled="true"]) {
  opacity: 0.7;
}

/* === 头像 === */
.ak-conversation-item__avatar-wrap {
  position: relative;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
}

.ak-conversation-item__avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--ak-bg-subtle);
  object-fit: cover;
  display: block;
}

.ak-conversation-item__avatar-fallback {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--ak-bg-subtle);
  color: var(--ak-fg-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--ak-text-md);
  font-weight: var(--ak-weight-semibold);
  text-transform: uppercase;
}

.ak-conversation-item__online-dot {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #22c55e; /* green-500 · online 状态硬编码 · 跟 muted/unread 区分 */
  border: 2px solid var(--ak-bg);
  box-sizing: border-box;
}

/* === 中段 内容 === */
.ak-conversation-item__body {
  flex: 1;
  min-width: 0; /* 关键 · 触发 truncate */
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ak-conversation-item__row-top {
  display: flex;
  align-items: center;
  gap: var(--ak-space-1);
}

.ak-conversation-item__name {
  flex: 1;
  min-width: 0;
  font-size: var(--ak-text-base);
  font-weight: var(--ak-weight-semibold);
  color: var(--ak-fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: var(--ak-tracking-tight);
}

.ak-conversation-item__pin {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ak-fg-muted);
}

.ak-conversation-item__mute {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ak-fg-muted);
}

.ak-conversation-item__last-message {
  font-size: var(--ak-text-sm);
  color: var(--ak-fg-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.ak-conversation-item--muted .ak-conversation-item__last-message {
  color: var(--ak-fg-muted);
}

/* === 右段 时间 + 未读 === */
.ak-conversation-item__meta {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  margin-left: var(--ak-space-2);
}

.ak-conversation-item__time {
  font-size: var(--ak-text-xs);
  color: var(--ak-fg-muted);
  white-space: nowrap;
}

.ak-conversation-item__unread {
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 9px;
  background: var(--ak-accent);
  color: var(--ak-accent-fg);
  font-size: var(--ak-text-xs);
  font-weight: var(--ak-weight-semibold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-sizing: border-box;
}

.ak-conversation-item--muted .ak-conversation-item__unread {
  background: var(--ak-bg-hover);
  color: var(--ak-fg-muted);
}

/* === 占位高度 · time 不在时 unread 仍居右上 === */
.ak-conversation-item__meta--empty-time::before {
  content: "";
  display: block;
  height: calc(var(--ak-text-xs) * 1.4);
}
