/* 论坛页面样式 - 参考掘金风格，使用首页配色 */

/* ========== 页面布局 ========== */

.forum-main {
    min-height: calc(100vh - 180px);
    background-color: #f6f8fa;
    padding: 0;
}

/* ========== 顶部导航条（掘金风格） ========== */

.forum-topbar {
    background: #ffffff;
    border-bottom: 1px solid #e8e8e8;
    position: sticky;
    top: 0;
    z-index: 100;
}

.forum-topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 56px;
}

.forum-topbar-left {
    display: flex;
    align-items: center;
    gap: 24px;
}

.forum-topbar-logo {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    text-decoration: none;
}

.forum-topbar-nav {
    display: flex;
    gap: 20px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.forum-topbar-nav a {
    font-size: 16px;
    color: #1a1a1a;
    text-decoration: none;
    padding: 4px 0;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    font-weight: 500;
}

.forum-topbar-nav a:hover {
    color: #1e6dff;
    border-bottom-color: #1e6dff;
}

.forum-topbar-nav a.active {
    color: #1e6dff;
    border-bottom-color: #1e6dff;
}

.forum-topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.forum-search-box {
    position: relative;
}

.forum-search-box input {
    width: 240px;
    height: 32px;
    border: 1px solid #e8e8e8;
    border-radius: 16px;
    padding: 0 14px 0 34px;
    font-size: 13px;
    background: #f6f8fa;
    color: #333;
    outline: none;
    transition: all 0.2s;
}

.forum-search-box input:focus {
    background: #fff;
    border-color: #1e6dff;
    width: 280px;
}

.forum-search-box input::placeholder {
    color: #999;
}

.forum-search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 13px;
}

.forum-btn-login {
    padding: 6px 16px;
    border: 1px solid #e8e8e8;
    border-radius: 4px;
    font-size: 13px;
    color: #666;
    text-decoration: none;
    transition: all 0.2s;
    background: transparent;
}

.forum-btn-login:hover {
    color: #1e6dff;
    border-color: #1e6dff;
}

.forum-btn-register {
    padding: 6px 16px;
    background: #1e6dff;
    color: #fff;
    border: 1px solid #1e6dff;
    border-radius: 4px;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.2s;
}

.forum-btn-register:hover {
    background: #185acc;
}

/* ========== 主体三栏布局 ========== */

.forum-body {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 180px 1fr 280px;
    gap: 0;
    min-height: calc(100vh - 180px);
}

/* ========== 左侧分类栏 ========== */

.forum-sidebar-left {
    background: #ffffff;
    border-right: 1px solid #e8e8e8;
    padding: 16px 0;
    position: sticky;
    top: 56px;
    height: calc(100vh - 56px);
    overflow-y: auto;
}

.forum-sidebar-left::-webkit-scrollbar {
    width: 0;
}

.sidebar-section-title {
    font-size: 12px;
    color: #999;
    padding: 8px 16px;
    font-weight: 500;
}

.sidebar-category {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.sidebar-category:hover {
    background: #f6f8fa;
    color: #1e6dff;
}

.sidebar-category.active {
    background: #eef4ff;
    color: #1e6dff;
    border-left-color: #1e6dff;
    font-weight: 600;
}

.sidebar-category .cat-icon {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-category .cat-count {
    margin-left: auto;
    font-size: 11px;
    color: #999;
    background: #f6f8fa;
    padding: 1px 6px;
    border-radius: 8px;
}

/* 分类图标颜色 */
.cat-icon-blue { background: #1e6dff; }
.cat-icon-green { background: #00b578; }
.cat-icon-orange { background: #f79000; }
.cat-icon-red { background: #e54d42; }
.cat-icon-purple { background: #7262e9; }
.cat-icon-cyan { background: #4fc08d; }
.cat-icon-pink { background: #e54d99; }
.cat-icon-teal { background: #2d8d9a; }

/* ========== 中间帖子流 ========== */

.forum-feed {
    background: #f6f8fa;
    padding: 16px 20px;
}

.feed-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 0 4px;
}

.feed-tabs {
    display: flex;
    gap: 20px;
}

.feed-tab {
    font-size: 14px;
    color: #666;
    text-decoration: none;
    padding: 6px 0;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.feed-tab:hover {
    color: #333;
}

.feed-tab.active {
    color: #1a1a1a;
    font-weight: 600;
    border-bottom-color: #1a1a1a;
}

.feed-post-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 16px;
    background: #1e6dff;
    color: #fff;
    border-radius: 4px;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.2s;
}

.feed-post-btn:hover {
    background: #185acc;
    color: #fff;
}

/* 帖子卡片 */

.feed-item {
    background: #ffffff;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 2px;
    transition: box-shadow 0.2s;
    text-decoration: none;
    display: block;
}

.feed-item:hover {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.feed-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.feed-item-avatar {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #fff;
    flex-shrink: 0;
}

.feed-item-author {
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

.feed-item-tags {
    margin-left: auto;
    display: flex;
    gap: 6px;
}

.feed-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 2px;
    background: #f0f0f0;
    color: #666;
}

.feed-tag-tag {
    background: #e8f4ff;
    color: #1e6dff;
}

.feed-item-title {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 8px;
    line-height: 1.5;
}

.feed-item:hover .feed-item-title {
    color: #1e6dff;
}

.feed-item-excerpt {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.feed-item-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12px;
    color: #999;
}

.feed-item-stat {
    display: flex;
    align-items: center;
    gap: 4px;
}

.feed-item-stat i {
    font-size: 12px;
}

/* 置顶帖 */

.feed-item.pinned {
    border-left: 3px solid #f79000;
}

.feed-item.pinned .feed-item-title::before {
    content: '置顶';
    display: inline-block;
    font-size: 11px;
    padding: 1px 6px;
    background: #f79000;
    color: #fff;
    border-radius: 2px;
    margin-right: 6px;
    font-weight: 500;
    vertical-align: middle;
}

/* ========== 右侧热榜 ========== */

.forum-sidebar-right {
    background: #ffffff;
    border-left: 1px solid #e8e8e8;
    padding: 20px 16px;
    position: sticky;
    top: 56px;
    height: fit-content;
    max-height: calc(100vh - 56px);
    overflow-y: auto;
}

.right-section {
    margin-bottom: 24px;
}

.right-section:last-child {
    margin-bottom: 0;
}

.right-title {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.right-title i {
    color: #f79000;
}

/* 热榜列表 */

.hot-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.hot-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    text-decoration: none;
    color: #333;
    font-size: 13px;
    transition: color 0.15s;
}

.hot-item:hover {
    color: #1e6dff;
}

.hot-rank {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #999;
    background: #f0f0f0;
    flex-shrink: 0;
}

.hot-rank-1 {
    background: #e54d42;
    color: #fff;
}

.hot-rank-2 {
    background: #f79000;
    color: #fff;
}

.hot-rank-3 {
    background: #ffb800;
    color: #fff;
}

.hot-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hot-badge {
    font-size: 10px;
    padding: 1px 4px;
    border-radius: 2px;
    flex-shrink: 0;
}

.hot-badge-hot {
    background: #fef0f0;
    color: #e54d42;
}

.hot-badge-new {
    background: #e8f4ff;
    color: #1e6dff;
}

/* 活跃用户 */

.active-users {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.active-user {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #333;
}

.active-user:hover .active-user-name {
    color: #1e6dff;
}

.active-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #fff;
    flex-shrink: 0;
}

.active-user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.active-user-name {
    font-size: 12px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.active-user-desc {
    font-size: 11px;
    color: #999;
}

/* ========== 分页 ========== */

.forum-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin-top: 24px;
    padding: 20px 0;
}

.page-item {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: 4px;
    font-size: 13px;
    color: #666;
    text-decoration: none;
    background: #fff;
    border: 1px solid #e8e8e8;
    transition: all 0.15s;
}

.page-item:hover {
    color: #1e6dff;
    border-color: #1e6dff;
}

.page-active {
    background: #1e6dff;
    color: #fff;
    border-color: #1e6dff;
}

.page-ellipsis {
    padding: 0 4px;
    color: #999;
    font-size: 13px;
}

.page-next {
    border: none;
    background: transparent;
}

.page-next:hover {
    background: transparent;
    border: none;
    color: #1e6dff;
}

/* ========== 页脚 ========== */

.forum-footer {
    background: #ffffff;
    border-top: 1px solid #e8e8e8;
    padding: 40px 0 24px;
    margin-top: 40px;
}

/* ========== 响应式 ========== */

@media (max-width: 1024px) {
    .forum-body {
        grid-template-columns: 160px 1fr;
    }

    .forum-sidebar-right {
        display: none;
    }

    .forum-topbar-nav {
        display: none;
    }

    .forum-search-box input {
        width: 180px;
    }
}

@media (max-width: 768px) {
    .forum-body {
        grid-template-columns: 1fr;
    }

    .forum-sidebar-left {
        display: none;
    }

    .forum-topbar-inner {
        padding: 0 12px;
    }

    .forum-search-box {
        display: none;
    }

    .forum-feed {
        padding: 12px;
    }

    .feed-item {
        padding: 14px;
    }

    .feed-item-title {
        font-size: 15px;
    }

    .feed-item-excerpt {
        font-size: 13px;
    }

    .feed-toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .forum-topbar-right .forum-btn-login,
    .forum-topbar-right .forum-btn-register {
        padding: 4px 10px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .feed-item {
        padding: 12px;
    }

    .feed-item-title {
        font-size: 14px;
    }

    .feed-item-footer {
        flex-wrap: wrap;
        gap: 8px;
    }
}

/* ========== 帖子详情页 ========== */

.article-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 0;
    font-size: 13px;
    color: #666;
    text-decoration: none;
    margin-bottom: 16px;
    transition: color 0.2s;
}

.article-back:hover {
    color: #1e6dff;
}

.forum-article {
    background: #f6f8fa;
    padding: 16px 20px;
}

.article-content {
    background: #ffffff;
    border-radius: 8px;
    padding: 32px;
    margin-bottom: 16px;
}

.article-header-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.article-avatar {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #fff;
    flex-shrink: 0;
}

.article-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.article-author {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
}

.article-date {
    font-size: 12px;
    color: #999;
}

.article-tags {
    margin-left: auto;
    display: flex;
    gap: 6px;
}

.article-title {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.5;
    margin-bottom: 16px;
}

.article-stats {
    display: flex;
    gap: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e8e8e8;
    margin-bottom: 24px;
}

.article-stat {
    font-size: 13px;
    color: #999;
    display: flex;
    align-items: center;
    gap: 4px;
}

.article-body {
    font-size: 15px;
    line-height: 1.8;
    color: #333;
}

.article-body h1, .article-body h2, .article-body h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 24px 0 12px;
}

.article-body h3 {
    font-size: 16px;
}

.article-body p {
    margin-bottom: 12px;
}

.article-body code {
    background: #f6f8fa;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    color: #e54d42;
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
}

.article-body pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 16px 0;
}

.article-body pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    font-size: 13px;
    line-height: 1.6;
}

.article-body ul {
    padding-left: 20px;
    margin-bottom: 12px;
}

.article-body li {
    margin-bottom: 4px;
}

.article-body strong {
    color: #1a1a1a;
    font-weight: 600;
}

.article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
}

.article-body th, .article-body td {
    border: 1px solid #e8e8e8;
    padding: 8px 12px;
    font-size: 14px;
    text-align: left;
}

.article-body th {
    background: #f6f8fa;
    font-weight: 600;
    color: #1a1a1a;
}

.article-actions {
    display: flex;
    gap: 12px;
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid #e8e8e8;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    background: #fff;
    color: #666;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    border-color: #1e6dff;
    color: #1e6dff;
    background: #f0f6ff;
}

/* 评论区 */

.article-comments {
    background: #ffffff;
    border-radius: 8px;
    padding: 32px;
}

.comments-title {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.comment-form {
    margin-bottom: 24px;
}

.comment-placeholder {
    display: block;
    padding: 12px 16px;
    background: #f6f8fa;
    border: 1px dashed #ddd;
    border-radius: 8px;
    font-size: 14px;
    color: #999;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s;
}

.comment-placeholder:hover {
    background: #fff;
    border-color: #1e6dff;
    color: #1e6dff;
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.comment-item {
    display: flex;
    gap: 12px;
}

.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #fff;
    flex-shrink: 0;
}

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

.comment-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

.comment-author {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.comment-time {
    font-size: 12px;
    color: #999;
}

.comment-text {
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    margin-bottom: 8px;
}

.comment-actions {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: #999;
}

.comment-actions a {
    color: #999;
    text-decoration: none;
    transition: color 0.2s;
}

.comment-actions a:hover {
    color: #1e6dff;
}

/* 响应式 */

@media (max-width: 768px) {
    .article-content {
        padding: 20px;
    }

    .article-title {
        font-size: 20px;
    }

    .article-header-top {
        flex-wrap: wrap;
    }

    .article-tags {
        margin-left: 0;
        width: 100%;
        margin-top: 8px;
    }

    .article-actions {
        flex-wrap: wrap;
    }

    .article-comments {
        padding: 20px;
    }

    .forum-article {
        padding: 12px;
    }
}
