/* 响应式调整：在小屏幕下，侧边栏和大纲之间增加间距 */
@media (max-width: 991px) {
    .col-lg-3, .col-lg-6 {
        margin-bottom: 1rem;
    }
}

/* 左侧边栏 - 版块列表 */
.forum-list .list-group-item {
    border-left: 0;
    border-right: 0;
}
.forum-list .list-group-item:first-child {
    border-top: 0;
}
.forum-list .list-group-item:last-child {
    border-bottom: 0;
}
.forum-list .fa-fw {
    margin-right: 5px;
}

/* 中间主内容 - 主题列表 */
.thread-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
}

.thread-icon {
    width: 50px;
    text-align: center;
}

.thread-details {
    flex-grow: 1;
    overflow: hidden; /* 防止标题过长破坏布局 */
}

.thread-title a {
    font-weight: bold;
    line-height: 1.3rem;
}

.thread-stats {
    width: 120px;
    text-align: right;
    white-space: nowrap;
}
.thread-stats div {
    display: inline-block;
    margin-left: 10px;
}
.thread-stats .fa {
    margin-right: 3px;
}

/* 响应式调整：在小屏幕下隐藏主题统计数据 */
@media (max-width: 576px) {
    .thread-stats {
        display: none;
    }
    .thread-details {
        padding-right: 0;
    }
}

/* 右侧边栏 */
.sidebar-link {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-group-item {
    padding: 0.75rem 1rem;
}
.grey .grace,.grey .card-header{
    background-color: #303030;
    color: #fff;
}
.dark .grace,.dark .card-header{
    background-color: #354759;
    color: #fff;
}
.black .grace,.black .card-header{
    background-color: #313347;
    color: #fff;
}
.grey .card-header,.dark .card-header,.black .card-header{
    border-color: rgba(120, 130, 140, 0.265);
}
.thread-stats .view-orange{
    color: rgb(254, 122, 21);
    font-weight: bold;
}
.thread-stats .view-brown{
    color: rgb(155, 118, 79);
    font-weight: bold;
}
.thread-stats .view-default{
    color: #000;
    opacity: 0.6;
}
.page-ta{
    text-align: center;
}
.post-title {
    font-size: 1.75rem;
    font-weight: 500;
}

.post-content p {
    line-height: 1.8;
    margin-bottom: 1.25rem;
}

.post-content pre {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 1rem;
    border-radius: 0.25rem;
    font-size: 0.9em;
}

/* 回复列表样式 */
.reply-item {
    background-color: #fff;
}

.reply-avatar img {
    width: 48px;
    height: 48px;
}

.reply-content {
    font-size: 0.95rem;
    line-height: 1.7;
}

/* 右侧边栏 - 用户信息卡片 */
.user-avatar {
    max-width: 100px;
    border: 3px solid #fff;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.user-stats {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background-color: #f8f9fa;
    border-radius: 0.25rem;
    padding: 0.5rem 0;
}

.stat-item {
    text-align: center;
}

.stat-item .stat-value {
    font-size: 1.2rem;
    font-weight: bold;
    line-height: 1.2;
}

.stat-item .stat-label {
    font-size: 0.8rem;
    color: #777;
}

/* 确保 .card-body 在 v4 alpha 中有内边距 (Bootstrap 4 正式版中是 .card-body) */
/* Bootstrap v4.0.0-alpha.6 使用 .card-block */
.card-body {
    padding: 1.25rem;
}
.grey .reply-item,.dark .reply-item,.black .reply-item{
    background-color: inherit;
}
.content-main{
    background-color: #fff;
}
.grey .content-main,.dark .content-main,.black .content-main{
    background-color: inherit;
}
.stat-item .view-orange{
    color: rgb(254, 122, 21);
    font-weight: bold;
}

/* 1. 将父容器 .reply-item 设置为 flex 布局 */
.reply-item {
    display: flex;           /* 核心：让子元素（.reply-avatar 和 .reply-main）水平排列 */
    align-items: flex-start; /* 推荐：让头像和内容在垂直方向上顶部对齐 */
}

/* 2. 设置头像容器 .reply-avatar 的样式 */
.reply-avatar {
    margin-right: 15px; /* 在头像右侧留出 15px 的间距 */
    flex-shrink: 0;     /* 防止在窄屏幕上头像被压缩变形，保持其原始宽度 */
}

/* 确保头像图片本身大小固定 */
.reply-avatar img {
    object-fit: cover; /* 确保图片不变形地填充圆形 */
}

/* 3. 设置右侧主内容区 .reply-main 的样式 */
.reply-main {
    flex-grow: 1; /* 核心：让这个元素自动伸展，占据所有剩余的水平空间 */
    min-width: 0; /* 一个重要的修复，防止长单词或链接破坏布局 */
}

/* (可选优化) 在用户名/元信息和回复正文之间增加一点垂直间距 */
.reply-main .reply-content {
    margin-top: 0.5rem; /* 约 8px 的上边距 */
}
.card-title {
    margin-top: 10px;
}
#main .card{
    margin-bottom: 0;
}
.grey .user-stats,.dark .user-stats,.black .user-stats{
    background-color: inherit;
}
/* ========================================= */
/*  附件下载卡片样式                         */
/* ========================================= */

.attachment-card .card-header {
    font-size: 0.95rem;
}

.attachment-card .list-group-item {
    /* 调整内边距，让列表项不那么拥挤 */
    padding: 0.75rem 1.25rem;
}

.attachment-card .list-group-item span {
    font-size: 0.9rem;
    /* 防止文件名过长时破坏布局 */
    word-break: break-all;
}

.attachment-card .btn-sm {
    /* 给下载按钮添加一点过渡效果 */
    transition: all 0.2s ease-in-out;
    padding: 0.25rem 0.75rem; /* 微调按钮大小 */
}

.attachment-card .btn-sm:hover {
    transform: translateY(-2px); /* 鼠标悬浮时轻微上移 */
    box-shadow: 0 4px 8px rgba(0,0,0,0.1); /* 添加一点阴影 */
}
/*颜文字表情开始*/
.emoji-wrap {
    display: flex;
    flex-wrap: wrap; /* 允许换行 */
    padding: 10px;
    margin: 0;
    list-style: none;
}

.emoji-reply{
    display: none;
}

.emoji-wrap li {
    flex: 0 0 20%; /* 每行5个表情（100% / 5 = 20%） */
    text-align: center;
    padding: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.emoji-wrap li:hover {
    background-color: #f0f0f0; /* 悬停效果 */
}

/* 确保popover内容区域适应 */
.popover {
    max-width: 400px; /* 限制popover的最大宽度 */
}

/* 优化popover在小屏幕上的显示 */
@media (max-width: 576px) {
    #emojiMain {
        width: 280px; /* 小屏幕上缩小宽度 */
    }

    .emoji-wrap li {
        flex: 0 0 25%; /* 小屏幕上每行4个 */
    }
    .popover{
        left: -25% !important;
    }
}
#emojibox{
    color: rgba(0, 0, 0, 0.87);
}
/*颜文字表情结束*/
.grey .swal-content,.dark .swal-content,.black .swal-content{
    color: #000;
}
.swal-button-container {
    margin-top: 30px;
}

/* ========================================= */
/*  搜索小部件样式                              */
/* ========================================= */

.custom-search-group {
    display: flex; /* 核心：使用 Flexbox 布局 */
    width: 100%;
}

/* 让输入框占据所有剩余空间 */
.custom-search-group .form-control {
    flex-grow: 1;
    /* 修复 Bootstrap 样式，确保圆角正确 */
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

/* 让按钮宽度固定，不被压缩 */
.custom-search-group .btn {
    flex-shrink: 0;
    /* 修复 Bootstrap 样式，确保圆角正确 */
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* pre代码块样式开始 */
/* 基础重置和全局样式 */
pre {
    position: relative;
    background: #1e1e2e; /* 深色背景，现代感 */
    color: #cdd6f4; /* 柔和的文字颜色 */
    font-family: 'JetBrains Mono', 'Consolas', 'Monaco', monospace; /* 编程字体 */
    font-size: 14px;
    line-height: 1.6;
    padding: 20px;
    border-radius: 12px; /* 圆润边角 */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3); /* 轻微阴影，增加立体感 */
    overflow-x: auto; /* 水平滚动条 */
    margin: 20px 0;
    border: 1px solid #2a2a3b; /* 微妙的边框 */
}

/* 滚动条美化 */
pre::-webkit-scrollbar {
    height: 8px;
}
pre::-webkit-scrollbar-track {
    background: #2a2a3b;
    border-radius: 4px;
}
pre::-webkit-scrollbar-thumb {
    background: #585876;
    border-radius: 4px;
}
pre::-webkit-scrollbar-thumb:hover {
    background: #7a7a9d;
}

/* 代码高亮样式（基于常见的语法高亮配色方案） */
pre code {
    display: block;
    padding-top: 20px;
}
pre code .keyword {
    color: #ff79c6; /* 关键字：粉紫色 */
}
pre code .string {
    color: #f1fa8c; /* 字符串：浅黄色 */
}
pre code .comment {
    color: #6272a4; /* 注释：灰蓝色 */
    font-style: italic;
}
pre code .function {
    color: #50fa7b; /* 函数：亮绿色 */
}
pre code .number {
    color: #bd93f9; /* 数字：紫色 */
}
pre code .operator {
    color: #ff5555; /* 操作符：红色 */
}

/* 代码块头部装饰（模拟编辑器窗口） */
pre::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 30px;
    background: linear-gradient(90deg, #2a2a3b, #1e1e2e); /* 渐变头部 */
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

/* 模拟窗口控制按钮 */
pre::after {
    content: '● ● ●';
    position: absolute;
    top: 10px;
    left: 15px;
    font-size: 10px;
    color: #ff5555; /* 红、黄、绿按钮 */
    letter-spacing: 8px;
    opacity: 0.8;
}

/* 行号样式 */
pre.line-numbers {
    counter-reset: line;
    padding-left: 50px;
}
pre.line-numbers code span {
    display: block;
    position: relative;
}
pre.line-numbers code span::before {
    content: counter(line);
    counter-increment: line;
    position: absolute;
    left: -40px;
    color: #6272a4;
    font-size: 12px;
    text-align: right;
    width: 30px;
    opacity: 0.6;
}

/* 响应式调整 */
@media (max-width: 768px) {
    pre {
        font-size: 12px;
        padding: 15px;
    }
    pre.line-numbers {
        padding-left: 40px;
    }
    pre.line-numbers code span::before {
        left: -30px;
        width: 20px;
    }
}
/* pre代码块样式结束 */
.post-content h2{
    font-size: 1.45rem;
}
.post-content h3{
    font-size: 1.3rem;
}
.post-content h4{
    font-size: 1.2rem;
}
.post-content h5{
    font-size: 1rem;
}
.reply-content p{
    margin-bottom: 0.2rem;
}