/* 评论按钮上的评论数 — 通过 data-count 属性显示 */
.news-comment-btn[data-count]::after {
    content: attr(data-count);
    margin-left: 2px;
    font-size: 10px;
}

/* ==========================================================================
   Full Comment Panel
   ========================================================================== */

@keyframes hn-cpp-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.hn-comment-panel {
  position: fixed;
  z-index: 10001;
  width: 360px;
  max-height: 480px;
  background: var(--card-bg, #fff);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.06);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  animation: hn-cpp-in 0.15s ease-out;
}

.hn-cp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #333);
  border-bottom: 1px solid var(--border-color, #f0f0f0);
  flex-shrink: 0;
}

.hn-cp-close {
  background: none;
  border: none;
  font-size: 16px;
  color: var(--text-tertiary, #999);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.hn-cp-close:hover { background: var(--hover-bg, #f3f4f6); }

.hn-cp-loading {
  padding: 40px 16px;
  text-align: center;
  color: var(--text-tertiary, #999);
  font-size: 13px;
}

.hn-cp-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-tertiary, #999);
  font-size: 13px;
}

/* Extension install hint */
.hn-cp-extension-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: #fffbeb;
  border-bottom: 1px solid #fef3c7;
  font-size: 12px;
  color: #92400e;
  flex-shrink: 0;
}
.hn-cp-extension-hint a {
  color: #d97706;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  margin-left: 8px;
}
.hn-cp-extension-hint a:hover { text-decoration: underline; }

/* Input area */
.hn-cp-input-area {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color, #f0f0f0);
  flex-shrink: 0;
}

.hn-cp-textarea {
  flex: 1;
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  resize: none;
  outline: none;
  font-family: inherit;
  background: var(--input-bg, #fafafa);
  color: var(--text-primary, #333);
}
.hn-cp-textarea:focus { border-color: #3b82f6; }

.hn-cp-submit {
  padding: 6px 14px;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  align-self: flex-end;
}
.hn-cp-submit:hover { background: #2563eb; }
.hn-cp-submit:disabled { opacity: 0.6; cursor: not-allowed; }

/* Login hint */
.hn-cp-login-btn {
  margin-left: 8px;
  padding: 4px 12px;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
.hn-cp-login-btn:hover { background: #2563eb; }

/* Comment list */
.hn-cp-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  scrollbar-width: thin;
}

/* Single comment */
.hn-cp-comment {
  padding: 10px 16px;
}
.hn-cp-comment + .hn-cp-comment {
  border-top: 1px solid var(--border-color, #f5f5f5);
}

.hn-cp-comment-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.hn-cp-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.hn-cp-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e5e7eb;
  color: #6b7280;
  font-size: 11px;
  font-weight: 600;
}

.hn-cp-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary, #333);
}

.hn-cp-time {
  font-size: 11px;
  color: var(--text-tertiary, #999);
  margin-left: auto;
}

.hn-cp-delete {
  background: none;
  border: none;
  font-size: 12px;
  cursor: pointer;
  padding: 2px;
  opacity: 0;
  transition: opacity 0.15s;
}
.hn-cp-comment:hover .hn-cp-delete { opacity: 0.6; }
.hn-cp-delete:hover { opacity: 1 !important; }

.hn-cp-quote {
  padding: 4px 8px;
  margin: 4px 0;
  background: var(--hover-bg, #f9fafb);
  border-left: 3px solid #d1d5db;
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-tertiary, #999);
  line-height: 1.4;
}

.hn-cp-content {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary, #555);
  word-break: break-word;
}

.hn-cp-reply-to {
  color: #3b82f6;
  font-size: 12px;
}

/* Reactions */
.hn-cp-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.hn-cp-reaction {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: var(--hover-bg, #f3f4f6);
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 12px;
  cursor: pointer;
}
.hn-cp-reaction:hover { background: #e5e7eb; }
.hn-cp-reaction.active {
  background: #eff6ff;
  border-color: #93c5fd;
}

.hn-cp-add-reaction {
  color: var(--text-tertiary, #999);
  font-size: 14px;
}

/* Emoji picker */
.hn-cp-emoji-picker {
  display: flex;
  gap: 4px;
  padding: 6px;
  background: var(--card-bg, #fff);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  position: absolute;
  z-index: 10;
}
.hn-cp-emoji-option {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}
.hn-cp-emoji-option:hover { background: var(--hover-bg, #f3f4f6); }

/* Reply button */
.hn-cp-reply-btn {
  background: none;
  border: none;
  font-size: 12px;
  color: var(--text-tertiary, #999);
  cursor: pointer;
  padding: 2px 0;
  margin-top: 4px;
}
.hn-cp-reply-btn:hover { color: #3b82f6; }

/* Reply input */
.hn-cp-reply-input {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color, #f0f0f0);
}
.hn-cp-reply-input .hn-cp-textarea {
  width: 100%;
  box-sizing: border-box;
}
.hn-cp-reply-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 6px;
}
.hn-cp-reply-cancel {
  padding: 4px 10px;
  background: none;
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-secondary, #555);
}
.hn-cp-reply-submit {
  padding: 4px 10px;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
.hn-cp-reply-submit:hover { background: #2563eb; }

/* Nested replies */
.hn-cp-replies {
  margin-left: 28px;
}
.hn-cp-reply {
  padding: 8px 0;
}

/* Mobile responsive */
@media (max-width: 640px) {
  .hn-comment-panel {
    width: calc(100vw - 16px);
    left: 8px !important;
    max-height: 60vh;
  }
}


/* Sending state - optimistic update */
.hn-cp-comment.hn-cp-sending {
  opacity: 0.7;
}
.hn-cp-comment.hn-cp-sending::after {
  content: '发送中...';
  display: block;
  font-size: 11px;
  color: var(--text-tertiary, #999);
  margin-top: 4px;
}
