/**
 * comment.css - 评论系统样式（含待审核状态）
 */
.comment-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #f0f2f5;
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
}
.comment-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.comment-header h3 i {
    color: #4a6cf7;
}
#commentList {
    margin-bottom: 20px;
}
.comment-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f5f7fa;
}
.comment-item:last-child {
    border-bottom: none;
}
.comment-avatar {
    position: relative;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background: #eef3ff;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 首字母打底：list.php 没配 QQ 时只输出 <b>，不再请求 /assets/images/default-avatar.png
   （该文件在线上是 404，一条评论一个破图标）。有头像时 <img> 绝对定位盖在上面，
   加载失败由 onerror="this.remove()" 移除，露出首字母，不会循环重试。 */
.comment-avatar > b {
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    color: #4a6cf7;
}

.comment-avatar img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.comment-body {
    flex: 1;
    min-width: 0;
}
.comment-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.comment-author {
    font-weight: 600;
    color: #1a202c;
}
.comment-time {
    font-size: 12px;
    color: #a0aec0;
}
.comment-content {
    font-size: 14px;
    color: #2d3748;
    line-height: 1.6;
    word-wrap: break-word;
}
.comment-actions {
    margin-top: 6px;
}
.comment-reply-btn {
    font-size: 12px;
    color: #4a6cf7;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}
.comment-reply-btn:hover {
    text-decoration: underline;
}
.comment-empty {
    text-align: center;
    color: #a0aec0;
    padding: 30px 0;
}
.comment-form-wrapper {
    margin-top: 20px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #eef2f6;
}
.comment-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}
.comment-form-group {
    margin-bottom: 12px;
}
.comment-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #4a5568;
    margin-bottom: 4px;
}
.comment-form-group input,
.comment-form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    background: #fff;
    box-sizing: border-box;
}
.comment-form-group input:focus,
.comment-form-group textarea:focus {
    border-color: #4a6cf7;
    box-shadow: 0 0 0 3px rgba(74,108,247,0.08);
}
.comment-form-group textarea {
    resize: vertical;
    min-height: 80px;
}
.comment-submit-btn {
    padding: 10px 30px;
    background: #4a6cf7;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
}
.comment-submit-btn:hover {
    background: #3a5cd9;
}
.comment-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.comment-msg {
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    display: none;
}
.comment-msg.success {
    display: block;
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
.comment-msg.error {
    display: block;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}
.comment-pagination {
    display: flex;
    gap: 4px;
    margin-top: 12px;
    justify-content: center;
    flex-wrap: wrap;
}
.comment-page {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 13px;
    color: #4a6cf7;
    cursor: pointer;
    border: 1px solid #e2e8f0;
    background: #fff;
}
.comment-page.active {
    background: #4a6cf7;
    color: #fff;
    border-color: #4a6cf7;
}
.comment-page.is-nav {
    padding: 4px 10px;
    color: #5c6b86;
}
.comment-page-gap {
    display: inline-flex;
    align-items: center;
    padding: 0 2px;
    color: #a9b5c8;
    font-size: 13px;
}
.comment-page:hover:not(.active) {
    background: #f0f5ff;
}

/* ----- 待审核评论样式 ----- */
.comment-item.pending {
    background: #fffbeb;
    border-left: 3px solid #f6ad55;
    padding-left: 12px;
    border-radius: 4px;
}
.comment-item.pending .comment-status.pending {
    color: #d69e2e;
    font-size: 12px;
    background: #fef3c7;
    padding: 0 8px;
    border-radius: 4px;
    margin-left: 8px;
}

/* 深色模式 */
body.dark-mode .comment-header h3 {
    color: #e2e8f0;
}
body.dark-mode .comment-item {
    border-bottom-color: #2a2a4a;
}
body.dark-mode .comment-avatar { background: #1c2740; }
body.dark-mode .comment-avatar > b { color: #8ba4f5; }
body.dark-mode .comment-page.is-nav { color: #a9b8d2; }
body.dark-mode .comment-author {
    color: #e2e8f0;
}
body.dark-mode .comment-content {
    color: #cbd5e0;
}
body.dark-mode .comment-form-wrapper {
    background: #1a2a4a;
    border-color: #2a3a5a;
}
body.dark-mode .comment-form-group label {
    color: #a0aec0;
}
body.dark-mode .comment-form-group input,
body.dark-mode .comment-form-group textarea {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
}
body.dark-mode .comment-form-group input:focus,
body.dark-mode .comment-form-group textarea:focus {
    border-color: #4a6cf7;
}
body.dark-mode .comment-msg.success {
    background: #1a3a2a;
    color: #9ae6b4;
    border-color: #2f855a;
}
body.dark-mode .comment-msg.error {
    background: #3a1a1a;
    color: #fc8181;
    border-color: #9b2c2c;
}
body.dark-mode .comment-page {
    background: #2d3748;
    border-color: #4a5568;
    color: #a0aec0;
}
body.dark-mode .comment-page.active {
    background: #4a6cf7;
    color: #fff;
}
body.dark-mode .comment-item.pending {
    background: #2a2a2a;
    border-left-color: #d69e2e;
}
body.dark-mode .comment-item.pending .comment-status.pending {
    background: #3a3a2a;
    color: #ecc94b;
}

@media (max-width: 768px) {
    .comment-form-row {
        grid-template-columns: 1fr;
    }
    .comment-section {
        padding-left: 12px;
        padding-right: 12px;
    }
    .comment-form-wrapper {
        padding: 16px;
    }
}