/* 整体容器 */
.comments {
    width: 95%;
    margin: 0 auto;
    font-family: "Microsoft Yahei", Arial, sans-serif;
    font-size: 14px;
    color: #333;
    display: inline-block;
}

/* 标题 */
.comments h2 {
    font-size: 18px;
    border-bottom: 1px solid #eee;
    padding: 20px 0;
    margin: 0 0 20px 0;
}

/* 评论列表 */
.listcomments {
    margin-bottom: 30px;
}

/* 暂无评论 */
.no-comment {
    text-align: center;
    color: #999;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 4px;
}

/* 单条评论 */
.comment-item {
    margin-bottom: 15px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 4px;
    position: relative;
    transition: background 0.3s;
    text-align: left;
}
.comment-item a:link,
.comment-item a:visited {
    color: #2d5898;
    text-decoration: none;
}

/* 锚点高亮 */
.comment-item.highlight {
    background: #fff8e1;
    border: 1px solid #ffc107;
}

/* 锚点链接 */
.anchor-link {
    font-size: 12px;
    color: #999;
    text-decoration: none;
    margin-left: 8px;
}
.anchor-link:hover {
    color: #2d5898;
}

/* 评论头部（头像+用户名+时间） */
.comment-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap; /* 适配小屏幕 */
}

/* 头像 */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #eee;
    flex-shrink: 0; /* 防止头像压缩 */
}

/* 用户信息 */
.user-info {
    flex: 1;
}

.username {
    font-weight: bold;
    color: #2d5898 !important;
}

.time {
    font-size: 12px;
    color: #999;
    margin-left: 8px;
}

/* 回复按钮 */
.reply-btn {
    font-size: 12px;
    color: #fff !important;
    text-decoration: none;
    cursor: pointer;
    flex-shrink: 0;
    background: #1badc7;;
    padding: 6px;
    border-radius: 10px;
}

.reply-btn:hover {
    text-decoration: underline;
}

/* 评论内容 */
.comment-content {
    line-height: 1.6;
    padding-left: 50px;
    margin-bottom: 10px;
}

/* 嵌套子评论 */
.comment-children {
    margin-left: 30px;
    margin-top: 10px;
    border-left: 1px dashed #ddd;
    padding-left: 10px;
}

/* 回复表单容器（默认隐藏，点击回复后显示） */
.reply-box {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #ddd;
}

/* 回复表单样式 */
.reply-form {
    background: #eef2f7;
    padding: 10px;
    border-radius: 3px;
    position: relative;
}

/* 关闭回复按钮 */
.close-reply-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    color: #999;
    font-size: 16px;
    cursor: pointer;
    padding: 0 5px;
}

.close-reply-btn:hover {
    color: #ff0000;
}

/* 回复表单项目 */
.reply-form .form-item {
    display: flex;
    align-items: flex-start; /* 解决标签和输入框错位 */
    margin-bottom: 8px;
    gap: 10px;
}

.reply-form .left {
    width: 80px;
    text-align: right;
    color: #666;
    flex-shrink: 0; /* 固定标签宽度 */
    padding-top: 6px; /* 对齐输入框 */
}

.reply-form input, .reply-form textarea {
    flex: 1; /* 输入框自适应宽度 */
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 14px;
    box-sizing: border-box;
}

/* 发布评论区域（主评论框） */
.newcomments {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.newctitle {
    font-size: 16px;
    margin-bottom: 10px;
    font-weight: bold;
}

/* 提示文字 */
.tips {
    color: #999;
    font-size: 12px;
    margin-bottom: 10px;
}

/* 主表单样式 */
.newcbody table {
    width: 100%;
    border-collapse: collapse;
}

.newcbody .left {
    width: 80px;
    text-align: right;
    padding-right: 10px;
    color: #666;
}

.newcbody input[type="text"],
.newcbody input[type="email"],
.newcbody input[type="url"],
.newcbody textarea {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    margin: 3px 0;
    box-sizing: border-box;
    font-size: 14px;
}

.newcbody textarea {
    resize: vertical;
}

/* 验证码图片 */
.verify-img {
    vertical-align: middle;
    margin-left: 8px;
    cursor: pointer;
    width: 80px;
    height: 30px;
}

/* 提交按钮 */
.submit-btn {
    background: #2d5898;
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
}

.submit-btn:hover {
    background: #1f4788;
}

/* 分页样式 */
.divpage {
    text-align: center;
    margin: 20px 0;
}

.divpage a {
    display: inline-block;
    padding: 5px 10px;
    margin: 0 2px;
    border: 1px solid #ddd;
    color: #2d5898;
    text-decoration: none;
    border-radius: 3px;
    font-size: 12px;
}

.divpage a:hover, .divpage .current {
    background: #2d5898;
    color: #fff;
    border-color: #2d5898;
}

/* 懒加载样式 */
.lazy {
    background: #f0f0f0;
}

/* 隐藏类（点击回复后隐藏主评论框） */
.hidden {
    display: none !important;
}
/* 无限嵌套支持 */
.comment-item[data-level="1"] { background: #f8f8f8; }
.comment-item[data-level="2"] { background: #f0f0f0; }
.comment-item[data-level="3"] { background: #e8e8e8; }
.comment-item[data-level="4"] { background: #e0e0e0; }
.comment-item[data-level="5"] { background: #d8d8d8; }
.comment-item[data-level="6"] { background: #d0d0d0; }

/* 嵌套层级指示器 */
.comment-item[data-level]:before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #2d5898;
    opacity: 0.3;
}

.comment-item[data-level="1"]:before { opacity: 0.3; }
.comment-item[data-level="2"]:before { opacity: 0.4; }
.comment-item[data-level="3"]:before { opacity: 0.5; }
.comment-item[data-level="4"]:before { opacity: 0.6; }
.comment-item[data-level="5"]:before { opacity: 0.7; }

/* 嵌套缩进 */
.comment-children {
    margin-left: 20px;
    margin-top: 10px;
    border-left: 1px dashed #ddd;
    padding-left: 10px;
}

/* 确保子评论内容区域不超出 */
.comment-content {
    min-width: 200px;
    max-width: 100%;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .comment-children {
        margin-left: 10px;
        padding-left: 5px;
    }
    
    .comment-content {
        padding-left: 40px;
    }
}
/* 修复：只有一个回复框时的样式 */
.reply-box:empty {
    display: none;
}

/* 主评论框隐藏/显示动画 */
#main-comment-box {
    transition: opacity 0.3s ease, max-height 0.3s ease;
    opacity: 1;
    max-height: 1000px;
    overflow: hidden;
}

#main-comment-box.hidden {
    opacity: 0;
    max-height: 0;
    padding: 0;
    margin: 0;
    border: none;
}

/* 高亮新评论 */
.comment-item.highlight {
    animation: highlight-pulse 2s ease-in-out;
    box-shadow: 0 0 0 2px #2d5898;
}

@keyframes highlight-pulse {
    0% { box-shadow: 0 0 0 0 rgba(45, 88, 152, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(45, 88, 152, 0); }
    100% { box-shadow: 0 0 0 0 rgba(45, 88, 152, 0); }
}
/* 回复框容器 */
.reply-box {
    margin-top: 10px;
    padding-top: 10px;
    min-height: 10px;
    position: relative;
}

/* 确保空回复框不占空间 */
.reply-box:empty {
    display: none;
}

/* 回复表单样式 */
.reply-form {
    background: #eef2f7;
    padding: 15px;
    border-radius: 4px;
    position: relative;
    border: 1px solid #ddd;
    margin-top: 10px;
    z-index: 100;
}

.reply-form .title {
    font-weight: bold;
    color: #2d5898;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #ddd;
}

/* 确保嵌套回复框有正确的层级 */
.comment-children .reply-form {
    background: #e0e7f0;
}

/* 头像加载样式 */

img.avatar.lazy {
    width: 16px;
    height: 16px;
    padding: 12px;
}

.avatar.lazy.loaded {
    background: transparent;
}
input[name="code"] {
   max-width: 100px;
}

/* 管理员评论样式 */
.comment-item.admin {
    border-left: 3px solid #ff4400 !important; /* 左侧红色边框标识 */
    background-color: #fff8f0; /* 浅橙色背景 */
}

/* 管理员评论的用户名样式 */
.comment-item.admin .username, .comment-item.admin .username a {
    color: #ff4400; /* 用户名红色 */
    font-weight: bold; /* 加粗 */
}

/* 管理员评论的内容样式 */
.comment-item.admin .comment-content {
    font-style: italic; /* 斜体 */
}
/* 置顶评论样式 */
.comment-item.comment-top {
    border-left: 4px solid #ff7800;
    background-color: #fff8f0;
}
/* 置顶标签 */
.comment-top-tag {
    position: absolute;
    top: 0;
    right: 0;
    background-color: #ff7800;
    color: #fff;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 0 4px 0 4px;
}
/* 评论头部相对定位，让置顶标签定位生效 */
.comment-header {
    position: relative;
    padding-right: 40px; /* 给置顶标签留空间 */
}
/* 子评论置顶禁用文字样式 */
.disabled-text {
    color: #999;
    font-size: 12px;
}
/* 后台置顶列样式 */
.comm-table td:nth-child(6) {
    text-align: center;
}