/* ═══════════════════════════════════════
   微信表情面板 Wx Emoji Panel
═══════════════════════════════════════ */

/* 评论框包装器 */
.comment-textarea-wrapper {
  position: relative;
}

/* 可视编辑器 */
.comment-editor {
  display: block;
  width: 100%;
  min-height: 120px;
  padding: 12px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  outline: none;
  overflow-y: auto;
}

.comment-editor:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.1);
}

.comment-editor:empty:before {
  content: attr(data-placeholder);
  color: var(--text-secondary);
  pointer-events: none;
}

.comment-editor img.wx-emoji {
  display: inline !important;
  width: 24px !important;
  height: 24px !important;
  vertical-align: middle !important;
  margin: 0 2px !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  cursor: default;
}

[data-theme=dark] .comment-editor {
  background: #1a1a1a;
  border-color: #333;
  color: #ddd;
}

[data-theme=dark] .comment-editor:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.1);
}

/* 隐藏的 textarea */
.comment-textarea {
  display: none !important;
}

/* 表情切换按钮（在右下角） */
.wx-emoji-toggle-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  z-index: 10;
}

.wx-emoji-toggle-btn:hover {
  background: var(--gray-100);
  border-color: var(--gray-300);
  color: var(--gray-700);
  transform: translateY(-1px);
}

.wx-emoji-toggle-btn:active {
  transform: translateY(0);
}

.wx-emoji-toggle-btn svg {
  flex-shrink: 0;
}

[data-theme=dark] .wx-emoji-toggle-btn {
  background: #2a2a2a;
  border-color: #444;
  color: #999;
}

[data-theme=dark] .wx-emoji-toggle-btn:hover {
  background: #3a3a3a;
  border-color: #555;
  color: #fff;
}

/* 表情网格容器（在文本框范围内） */
.wx-emoji-container {
  position: absolute;
  bottom: 48px;
  right: 8px;
  width: calc(100% - 16px);
  max-height: 280px;
  z-index: 20;
  overflow: hidden;
}

.wx-emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(32px, 1fr));
  gap: 6px;
  padding: 12px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  max-height: 280px;
  overflow-y: auto;
}

[data-theme=dark] .wx-emoji-grid {
  background: #1a1a1a;
  border-color: #333;
}

/* 表情项 */
.wx-emoji-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  aspect-ratio: 1;
}

[data-theme=dark] .wx-emoji-item {
  background: #2a2a2a;
  border-color: #444;
}

.wx-emoji-item:hover {
  background: rgba(39, 174, 96, 0.1);
  border-color: var(--green);
  transform: scale(1.1);
}

.wx-emoji-item img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  display: block;
}

/* 评论内容中的微信表情 */
.comment-content img.wx-emoji {
  display: inline !important;
  width: 24px !important;
  height: 24px !important;
  vertical-align: middle !important;
  margin: 0 2px !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

/* 表情面板滚动条美化 */
.wx-emoji-grid::-webkit-scrollbar {
  width: 6px;
}

.wx-emoji-grid::-webkit-scrollbar-track {
  background: var(--gray-100);
  border-radius: 3px;
}

.wx-emoji-grid::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 3px;
}

.wx-emoji-grid::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}
