/* =============================================================================
   评论系统样式
   ============================================================================= */

/* ----- 文章详情页 ----- */
.article-detail {
  background: rgba(255, 255, 255, 0.98);
  min-height: 60vh;
}

.article-header {
  padding: clamp(1.5rem, 4vw, 2.5rem) 0 clamp(1rem, 3vw, 1.5rem);
  border-bottom: 1px solid rgba(17, 17, 17, 0.08);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--tf-ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  opacity: 0.7;
  transition: opacity 0.2s, transform 0.2s;
  margin-bottom: 1rem;
}

.back-link:hover {
  opacity: 1;
  transform: translateX(-4px);
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.article-category {
  background: var(--tf-glow);
  color: var(--tf-white);
  padding: 0.25em 0.75em;
  border-radius: 20px;
  font-size: 0.75rem;
}

.article-meta time {
  color: rgba(17, 17, 17, 0.6);
}

.article-title {
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 900;
  margin: 0 0 1rem;
  line-height: 1.2;
  color: var(--tf-ink);
}

.article-excerpt {
  font-size: 1.1rem;
  opacity: 0.8;
  margin: 0 0 1.5rem;
  max-width: 60ch;
}

.article-actions {
  display: flex;
  gap: 1rem;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6em 1.2em;
  background: rgba(17, 17, 17, 0.06);
  border: 2px solid rgba(17, 17, 17, 0.1);
  border-radius: 30px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--tf-ink);
  cursor: pointer;
  transition: all 0.3s ease;
}

.action-btn:hover {
  background: var(--tf-white);
  border-color: var(--tf-glow);
  transform: translateY(-2px);
}

.action-btn.liked {
  background: #ffebeb;
  border-color: #ff4d4d;
  color: #ff4d4d;
}

.action-btn .icon {
  font-size: 1.1rem;
}

.action-btn .count {
  background: rgba(255, 77, 0, 0.15);
  padding: 0.15em 0.5em;
  border-radius: 10px;
  font-size: 0.8rem;
}

/* ----- 文章内容 ----- */
.article-content {
  padding: 2rem 0 3rem;
  font-size: 1.05rem;
  line-height: 1.8;
}

.article-content h2 {
  font-size: 1.5rem;
  font-weight: 900;
  margin: 2rem 0 1rem;
  color: var(--tf-ink);
}

.article-content h3 {
  font-size: 1.2rem;
  font-weight: 800;
  margin: 1.5rem 0 0.75rem;
}

.article-content p {
  margin: 0 0 1.25rem;
}

.article-content blockquote {
  background: linear-gradient(135deg, rgba(255, 77, 0, 0.08), rgba(245, 166, 35, 0.08));
  border-left: 4px solid var(--tf-glow);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  border-radius: 0 12px 12px 0;
  font-weight: 600;
}

.article-content ul, 
.article-content ol {
  margin: 1rem 0 1.5rem 1.5rem;
}

.article-content li {
  margin-bottom: 0.5rem;
}

.article-content strong {
  color: var(--tf-glow);
}

.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}

.article-content th,
.article-content td {
  padding: 0.75rem 1rem;
  border: 1px solid rgba(17, 17, 17, 0.1);
  text-align: left;
}

.article-content th {
  background: rgba(255, 77, 0, 0.08);
  font-weight: 800;
}

.article-tags {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.article-tags span {
  padding: 0.4em 0.9em;
  background: rgba(255, 77, 0, 0.08);
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--tf-glow);
}

/* ----- 评论区 ----- */
.comments-section {
  background: linear-gradient(180deg, rgba(17, 17, 17, 0.04), rgba(17, 17, 17, 0.08));
  padding: clamp(2rem, 5vw, 3rem) 0 calc(3rem + var(--safe-bottom));
}

.comments-header {
  margin-bottom: 1.5rem;
}

.comments-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.3rem;
  font-weight: 900;
  margin: 0;
}

.comments-icon {
  font-size: 1.5rem;
}

.comments-count {
  background: var(--tf-glow);
  color: var(--tf-white);
  padding: 0.15em 0.6em;
  border-radius: 15px;
  font-size: 0.85rem;
}

/* ----- 评论表单 ----- */
.comment-form-wrapper {
  background: rgba(255, 255, 255, 0.98);
  border-radius: 20px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.comment-form-wrapper h3 {
  margin: 0 0 1.25rem;
  font-size: 1.1rem;
  font-weight: 800;
}

.form-row {
  display: grid;
  gap: 1rem;
}

@media (min-width: 560px) {
  .form-row {
    grid-template-columns: 1fr 1fr;
  }
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: rgba(17, 17, 17, 0.8);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 2px solid rgba(17, 17, 17, 0.1);
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.9);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--tf-glow);
  box-shadow: 0 0 0 3px rgba(255, 77, 0, 0.15);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.char-count {
  text-align: right;
  font-size: 0.75rem;
  color: rgba(17, 17, 17, 0.5);
  margin-top: 0.25rem;
}

.submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8em 2em;
  background: var(--tf-glow);
  color: var(--tf-white);
  border: none;
  border-radius: 30px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 140px;
}

.submit-btn:hover {
  background: var(--tf-ink);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 77, 0, 0.25);
}

.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ----- 评论列表 ----- */
.comments-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.comments-empty {
  text-align: center;
  padding: 3rem 1rem;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 16px;
}

.empty-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 1rem;
  opacity: 0.6;
}

.comments-empty p {
  margin: 0;
  font-weight: 600;
  opacity: 0.7;
}

/* ----- 单条评论 ----- */
.comment-item {
  background: rgba(255, 255, 255, 0.98);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s, box-shadow 0.2s;
  animation: slide-in 0.4s ease-out;
}

.comment-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.comment-item.new-comment {
  animation: bounce-in 0.5s ease-out;
  border: 2px solid var(--tf-glow);
}

.comment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.comment-author {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.comment-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--tf-orange), var(--tf-glow));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tf-white);
  font-weight: 900;
  font-size: 1.1rem;
  text-transform: uppercase;
  transition: transform 0.3s ease;
}

.comment-avatar:hover {
  transform: scale(1.1) rotate(5deg);
}

.comment-author-info {
  display: flex;
  flex-direction: column;
}

.comment-author-name {
  font-weight: 800;
  font-size: 0.95rem;
}

.comment-time {
  font-size: 0.75rem;
  color: rgba(17, 17, 17, 0.5);
}

.comment-badge {
  background: var(--tf-glow);
  color: var(--tf-white);
  font-size: 0.65rem;
  padding: 0.15em 0.5em;
  border-radius: 4px;
  margin-left: 0.5rem;
}

.comment-body {
  padding-left: 57px;
}

.comment-content {
  margin: 0 0 0.75rem;
  line-height: 1.6;
  word-break: break-word;
}

.comment-actions {
  display: flex;
  gap: 1rem;
}

.comment-action {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3em 0.7em;
  background: none;
  border: none;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(17, 17, 17, 0.6);
  cursor: pointer;
  transition: all 0.2s ease;
}

.comment-action:hover {
  background: rgba(17, 17, 17, 0.06);
  color: var(--tf-ink);
}

.comment-action.liked {
  color: #ff4d4d;
}

.comment-action.liked .action-icon {
  animation: heartbeat 0.6s ease-in-out;
}

/* ----- 回复 ----- */
.comment-replies {
  margin-top: 1rem;
  padding-left: 2rem;
  border-left: 3px solid rgba(255, 77, 0, 0.15);
}

.reply-item {
  background: rgba(255, 77, 0, 0.04);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.reply-item:last-child {
  margin-bottom: 0;
}

.reply-form {
  margin-top: 1rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  display: none;
}

.reply-form.active {
  display: block;
  animation: slide-in 0.3s ease-out;
}

.reply-form textarea {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid rgba(17, 17, 17, 0.1);
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
  margin-bottom: 0.75rem;
}

.reply-form textarea:focus {
  outline: none;
  border-color: var(--tf-glow);
}

.reply-form-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.reply-submit {
  padding: 0.5em 1.2em;
  background: var(--tf-glow);
  color: var(--tf-white);
  border: none;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.reply-submit:hover {
  background: var(--tf-ink);
}

.reply-cancel {
  padding: 0.5em 1.2em;
  background: rgba(17, 17, 17, 0.06);
  color: var(--tf-ink);
  border: none;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.reply-cancel:hover {
  background: rgba(17, 17, 17, 0.12);
}

/* ----- 分享弹窗 ----- */
.share-platforms {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
}

.share-platform {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.25rem;
  background: rgba(17, 17, 17, 0.04);
  border-radius: 12px;
  text-decoration: none;
  color: var(--tf-ink);
  font-weight: 700;
  transition: all 0.2s ease;
}

.share-platform:hover {
  background: rgba(255, 77, 0, 0.1);
  transform: translateY(-2px);
}

/* ----- 加载状态 ----- */
.comment-loading {
  display: flex;
  justify-content: center;
  padding: 2rem;
}

.comment-skeleton {
  background: rgba(255, 255, 255, 0.98);
  border-radius: 16px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.skeleton-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
}

.skeleton-line {
  height: 14px;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

/* ----- 响应式 ----- */
@media (max-width: 560px) {
  .article-meta {
    flex-wrap: wrap;
  }
  
  .article-actions {
    flex-wrap: wrap;
  }
  
  .comment-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .comment-body {
    padding-left: 0;
  }
  
  .comment-replies {
    padding-left: 1rem;
  }
}

/* ----- 动画 ----- */
@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes bounce-in {
  0% {
    transform: scale(0.9);
    opacity: 0;
  }
  50% {
    transform: scale(1.02);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes heartbeat {
  0% { transform: scale(1); }
  25% { transform: scale(1.3); }
  50% { transform: scale(1); }
  75% { transform: scale(1.2); }
  100% { transform: scale(1); }
}
