/* 外层容器：提供外边距（左右 16px，下 8px） */
.wk-messageinput-box {
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0 16px 8px 16px;
  box-sizing: border-box;
}

/* 悬浮卡片容器：包含引用 + 输入框 + 工具栏 */
.wk-messageinput-card {
  width: 100%;
  min-height: 40px;
  display: flex;
  flex-direction: column;
  background: var(--wk-bg-surface, var(--input-bg));
  border-radius: 12px;
  border: 1px solid #1c1c231a;
  padding: 8px 16px;
  box-sizing: border-box;
  cursor: text;
}

.wk-messageinput-card:focus-within {
  border-color: #1c1c23;
}

/* 展开状态 */
.wk-messageinput-box--expanded {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-top: 80px;
  overflow: hidden;
}

.wk-messageinput-box--expanded .wk-messageinput-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  overflow: hidden;
}

.wk-messageinput-box--expanded .wk-messageinput-row {
  flex: 1;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
}

.wk-messageinput-box--expanded .wk-messageinput-inputbox {
  flex: 1;
  margin-right: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.wk-messageinput-box--expanded .wk-messageinput-editor {
  min-height: 100%;
}

.wk-messageinput-box--expanded .wk-messageinput-editor .ProseMirror,
.wk-messageinput-box--expanded
  .wk-messageinput-editor
  .tiptap.ProseMirror-focused {
  min-height: 100%;
  max-height: none;
  height: auto;
}

.wk-messageinput-box--expanded .wk-messageinput-actionbox {
  flex-shrink: 0;
  margin-top: var(--wk-sp-2);
  margin-left: auto;
}

/* 附件预览区域 */
.wk-messageinput-attachments {
  width: 100%;
  margin-bottom: var(--wk-sp-2);
}

/* 输入行：输入框 + 按钮横向排列 */
.wk-messageinput-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  width: 100%;
  min-height: 24px;
}

/* 多行模式：输入行变成上下结构 */
.wk-messageinput-card--multiline .wk-messageinput-row {
  flex-direction: column;
  align-items: stretch;
}

.wk-messageinput-card--multiline .wk-messageinput-inputbox {
  width: 100%;
  margin-right: 0;
}

.wk-messageinput-card--multiline .wk-messageinput-actionbox {
  margin-top: 8px;
  margin-left: auto;
}

/* 卡片内引用容器 */
.wk-messageinput-topview {
  width: 100%;
  margin-bottom: 8px;
}

/* 引用条样式 */
.wk-replyview-new {
  display: flex;
  align-items: center;
  background-color: #f6f6f6;
  padding: 6px 12px;
  border-radius: 4px;
  width: 100%;
  box-sizing: border-box;
}

.wk-replyview-new-close {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  background-color: #b0b0b0;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background-color 0.15s;
}

.wk-replyview-new-close:hover {
  background-color: #888;
}

.wk-replyview-new-close svg {
  width: 8px;
  height: 8px;
}

.wk-replyview-new-divider {
  flex-shrink: 0;
  width: 1px;
  height: 12px;
  background-color: #d1d5db;
  margin: 0 8px;
}

.wk-replyview-new-content {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1;
  font-size: 14px;
  line-height: 1.4;
  color: #333;
}

.wk-replyview-new-label {
  flex-shrink: 0;
  margin-right: 4px;
}

.wk-replyview-new-name {
  flex-shrink: 0;
  font-weight: 500;
  margin-right: 4px;
}

.wk-replyview-new-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #555;
}

/* 输入框区域 */
.wk-messageinput-inputbox {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  margin-right: 16px;
  cursor: text;
}

.wk-messageinput-menu-btn {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-right: 8px;
  user-select: none;
  transition: background-color 0.2s, border-color 0.2s;
}

.wk-messageinput-menu-btn:hover {
  background-color: var(--bg-hover);
  border-color: var(--text-tertiary);
}

.wk-messageinput-menu-btn:active {
  background-color: var(--border-color);
}

.wk-messageinput-input {
  height: 100%;
  width: 100%;
  flex: 1;
  min-width: 0;
  border: none;
  color: var(--wk-text-primary, var(--text-primary));
  font-size: 14px;
  overflow: hidden;
  display: inline-block;
  -webkit-user-modify: read-write-plaintext-only;
  outline: none;
  background: transparent;
}

.wk-messageinput-input textarea {
  outline: none;
  border: none;
  color: var(--wk-text-primary, var(--text-primary));
  background: transparent;
}

.wk-messageinput-input:empty:before {
  content: attr(data-placeholder);
  position: absolute;
  color: var(--text-tertiary);
}

.wk-messageinput-tabs {
  height: 100%;
  width: 50%;
}

.wk-messageinput-toolbar {
  height: 100%;
  width: 100%;
  display: flex;
  justify-content: flex-end;
}

.wk-messageinput-actionbox {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
  gap: 8px;
}

/* 覆盖 toolbar ul 的样式 */
.wk-messageinput-actionbox .wk-conversation-chattoolbars {
  display: flex;
  align-items: center;
  gap: 8px;
  height: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* 覆盖工具栏中所有按钮的尺寸，统一 24px */
.wk-messageinput-card .wk-messageinput-actionbox .wk-iconclick,
.wk-messageinput-card .wk-messageinput-actionbox .wk-iconclick.wk-iconclick--sm,
.wk-messageinput-card .wk-messageinput-actionbox .wk-iconclick.wk-iconclick--md,
.wk-messageinput-card
  .wk-messageinput-actionbox
  .wk-conversation-chattoolbars-item {
  width: var(--wk-sp-6);
  height: var(--wk-sp-6);
  padding: 0;
  margin: 0;
  flex-shrink: 0;
  color: var(--wk-icon-muted);
}

.wk-messageinput-card .wk-messageinput-actionbox .wk-iconclick:hover,
.wk-messageinput-card
  .wk-messageinput-actionbox
  .wk-conversation-chattoolbars-item:hover {
  color: var(--wk-text-primary);
}

.wk-messageinput-actionitem {
  width: 24px;
  height: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  color: var(--wk-icon-muted);
  transition: color 0.15s, opacity 0.15s;
}

.wk-messageinput-actionitem:hover {
  color: var(--wk-text-primary);
}

.wk-messageinput-actionitem:active {
  opacity: 0.7;
}

.wk-messageinput-sendbtn {
  height: 28px;
  width: 32px;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: var(--wk-bg-secondary);
  border-radius: 2px;
  cursor: pointer;
}

.wk-messageinput-hasValue {
  background-color: var(--wk-color-theme);
}

.wk-messageinput-member {
  height: 100%;
  width: 100%;
  padding: 0 16px;
  align-items: center;
  box-sizing: border-box;
  display: flex;
}

.wk-messageinput-iconbox {
  margin-right: 8px;
}

.wk-messageinput-icon {
  width: 20px;
  height: 20px;
  border-radius: 3px;
}

.wk-messageinput-selected {
  color: var(--wk-text-inverse);
  /* background-color: #1264a3; */
}

.quickReplyPanel {
  position: absolute;
  box-shadow: var(--wk-shadow-md);
  max-height: 400px;
  overflow-x: hidden;
  bottom: 0;
  background-color: var(--card-bg);
  width: 100%;
  border-radius: 4px;
}

.quickReplyPanel ul {
  margin: 0;
  padding: 0;
}

.quickReplyPanel ul li {
  list-style-type: none;
  height: 60px;
  border-bottom: 1px solid var(--wk-border-subtle);
  cursor: pointer;
}

.quickReplyItem {
}

.quickReplyItem :hover {
  background-color: var(--bg-hover);
}

.quickReplySelect {
  background-color: var(--wk-text-secondary) !important;
  color: var(--wk-text-inverse) !important;
}

.wk-messageinput-header {
}

.wk-messageinput-reply {
  margin: 10px 10px 0px 10px;
  background-color: var(--bg-secondary);
  display: flex;
  color: var(--wk-text-secondary);
  align-items: center;
}

.wk-messageinput-closeicon {
  margin: 0px 6px;
  cursor: pointer;
}

.wk-messageinput-replycontent {
  overflow: hidden;
  text-overflow: ellipsis;
  height: 22px;
}

.wk-messageinput-input__control {
  background-color: var(--input-bg);
}

.wk-messageinput-input__suggestions {
  background-color: var(--wk-color-item);
}

/* Tiptap 编辑器样式 */
.wk-messageinput-editor {
  width: 100%;
  flex: 1;
  min-width: 0;
}

.wk-messageinput-editor .tiptap.ProseMirror-focused,
.wk-messageinput-editor .ProseMirror {
  padding: 0;
  font-size: 14px;
  line-height: 20px;
  min-height: 20px;
  max-height: 100px;
  overflow-y: auto;
  outline: none;
  color: var(--wk-text-primary, var(--text-primary));
  box-sizing: border-box;
}

.wk-messageinput-editor .ProseMirror p {
  margin: 0;
}

/* Mention 样式 */
.wk-messageinput-editor .mention {
  color: var(--wk-color-theme);
  font-weight: 600;
  background-color: transparent;
  border-radius: 0.25rem;
  padding: 0 0.125rem;
}

/* Placeholder - Tiptap Placeholder 扩展 */
.wk-messageinput-editor .ProseMirror p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: left;
  color: var(--text-tertiary, #999);
  pointer-events: none;
  height: 0;
}

.wk-messageinput-editor .ProseMirror.is-empty::before {
  content: attr(data-placeholder);
  float: left;
  color: var(--text-tertiary, #999);
  pointer-events: none;
  height: 0;
}

/* ============================================
   Attachment Node 样式（编辑器内附件卡片）
   ============================================ */

.wk-attachment-node {
  display: inline-flex;
  vertical-align: bottom;
  /* margin + padding 组合：padding 为 outline 留空间，避免被父容器裁剪 */
  margin: 0 var(--wk-sp-1) 0 0;
  padding: 2px;
  user-select: none;
}

.wk-attachment-node--selected .wk-attachment-node-card {
  outline: 2px solid var(--wk-border-strong);
}

.wk-attachment-node-card {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: var(--wk-sp-2);
  background: var(--wk-bg-elevated);
  border-radius: var(--wk-r-md);
  padding: var(--wk-sp-1) var(--wk-sp-3) var(--wk-sp-2) var(--wk-sp-1);
  width: 224px;
  height: 56px;
  box-sizing: border-box;
}

.wk-attachment-node-icon {
  width: var(--wk-sp-12);
  height: var(--wk-sp-12);
  min-width: var(--wk-sp-12);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wk-attachment-node-icon img {
  width: var(--wk-sp-12);
  height: var(--wk-sp-12);
  object-fit: contain;
}

.wk-attachment-node-video-cover-wrapper {
  position: relative;
  width: var(--wk-sp-12);
  height: var(--wk-sp-12);
  overflow: hidden;
  border-radius: var(--wk-r-sm);
}

.wk-attachment-node-icon .wk-attachment-node-video-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wk-attachment-node-video-play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: var(--wk-sp-5);
  height: var(--wk-sp-5);
  min-width: var(--wk-sp-5);
  min-height: var(--wk-sp-5);
  max-width: var(--wk-sp-5);
  max-height: var(--wk-sp-5);
  display: block;
  pointer-events: none;
}

.wk-attachment-node-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: var(--wk-sp-2);
  overflow: hidden;
}

.wk-attachment-node-name-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--wk-sp-2);
}

.wk-attachment-node-name {
  flex: 1;
  min-width: 0;
  font-size: var(--wk-text-size-md);
  color: var(--wk-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: var(--wk-sp-5);
  font-weight: var(--wk-font-regular);
}

.wk-attachment-node-size {
  font-size: var(--wk-text-size-md);
  color: var(--wk-text-tertiary);
  line-height: var(--wk-sp-5);
}

.wk-attachment-node-remove {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--wk-icon-muted);
  transition: color var(--wk-dur-fast);
  flex-shrink: 0;
  width: var(--wk-sp-4);
  height: var(--wk-sp-4);
}

.wk-attachment-node-remove:hover {
  color: var(--wk-text-strong);
}

.wk-attachment-node-remove svg {
  width: var(--wk-sp-4);
  height: var(--wk-sp-4);
}

/* ============================================
   Attachment Node 图片预览样式
   ============================================ */

.wk-attachment-node--selected .wk-attachment-node-image {
  outline: 2px solid var(--wk-border-strong);
}

.wk-attachment-node-image {
  display: block;
  max-width: 76px;
  max-height: 76px;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* ============================================
   顶部附件区样式（非图片文件 + 上传的图片）
   复用 .wk-attachment-node 样式
   ============================================ */

.wk-messageinput-top-attachments {
  width: 100%;
  margin-bottom: var(--wk-sp-2);
  overflow: hidden;
}

.wk-messageinput-top-attachments-scroll {
  display: flex;
  flex-direction: row;
  gap: var(--wk-sp-2);
  overflow-x: auto;
  overflow-y: hidden;
  padding: var(--wk-sp-1) 0;
  scrollbar-width: thin;
  scrollbar-color: var(--wk-border-default) transparent;
}

.wk-messageinput-top-attachments-scroll::-webkit-scrollbar {
  height: 4px;
}

.wk-messageinput-top-attachments-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.wk-messageinput-top-attachments-scroll::-webkit-scrollbar-thumb {
  background: var(--wk-border-default);
  border-radius: 2px;
}

/* 顶部附件区的附件项不需要 inline 布局 */
.wk-messageinput-top-attachments-scroll > .wk-attachment-node {
  display: flex;
  flex-shrink: 0;
  position: relative;
}

/* 图片缩略图样式（在卡片内显示） */
.wk-attachment-node-image-thumb {
  width: var(--wk-sp-12);
  height: var(--wk-sp-12);
  object-fit: cover;
  border-radius: var(--wk-r-sm);
}
