/* =====================================================
   自定义评论区样式
   ===================================================== */

#custom-comments {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line-color);
}

.comments-heading {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--post-heading-color);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.comments-heading .comments-count {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--sec-text-color);
}

/* ===== 评论列表 ===== */

#comments-list {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  margin-bottom: 2rem;
}

.comment-item {
  display: flex;
  gap: 1rem;
  animation: fadeInUp 0.25s ease;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.comment-avatar {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--post-link-color), #818cf8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  flex-shrink: 0;
  user-select: none;
}

.comment-body {
  flex: 1;
  min-width: 0;
}

.comment-meta {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.comment-author {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--post-heading-color);
}

.comment-time {
  font-size: 0.8rem;
  color: var(--sec-text-color);
}

.comment-text {
  font-size: 0.9375rem;
  line-height: 1.75;
  color: var(--post-text-color);
  word-break: break-word;
  white-space: pre-wrap;
}

.comments-empty {
  color: var(--sec-text-color);
  font-size: 0.9rem;
  text-align: center;
  padding: 1.5rem 0;
}

.comments-loading {
  text-align: center;
  color: var(--sec-text-color);
  font-size: 0.9rem;
  padding: 1rem 0;
}

/* ===== 评论表单 ===== */

.comment-form-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--post-heading-color);
  margin-bottom: 1rem;
}

#comment-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.comment-form-row {
  display: flex;
  gap: 0.75rem;
}

.comment-form-row input {
  flex: 1;
}

#comment-form input,
#comment-form textarea {
  width: 100%;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--line-color);
  border-radius: 8px;
  background: var(--board-bg-color);
  color: var(--post-text-color);
  font-family: inherit;
  font-size: 0.9375rem;
  line-height: 1.6;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  box-sizing: border-box;
  resize: vertical;
}

#comment-form input:focus,
#comment-form textarea:focus {
  outline: none;
  border-color: var(--post-link-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--post-link-color) 15%, transparent);
}

#comment-form textarea {
  min-height: 7rem;
}

.comment-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.cf-turnstile {
  flex-shrink: 0;
}

#comment-submit {
  padding: 0.55rem 1.6rem;
  background: var(--post-link-color);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, opacity 0.18s ease;
  white-space: nowrap;
}

#comment-submit:hover {
  opacity: 0.88;
}

#comment-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.comment-msg {
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  margin-top: 0.25rem;
}

.comment-msg.success {
  color: #065f46;
  background: #d1fae5;
}

.comment-msg.error {
  color: #991b1b;
  background: #fee2e2;
}

/* 深色模式 */
html[data-user-color-scheme='dark'] .comment-msg.success {
  color: #6ee7b7;
  background: rgba(6, 95, 70, 0.3);
}

html[data-user-color-scheme='dark'] .comment-msg.error {
  color: #fca5a5;
  background: rgba(153, 27, 27, 0.3);
}
