/* 校园论坛样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --primary-light: #e8f0fe;
    --bg: #f0f2f5;
    --card-bg: #ffffff;
    --text: #1a1a1a;
    --text-secondary: #666;
    --text-muted: #999;
    --border: #e5e7eb;
    --success: #34a853;
    --error: #ea4335;
    --warning: #fbbc04;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 14px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); text-decoration: underline; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* 头部 */
.site-header {
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}
.logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.logo:hover { text-decoration: none; }
.logo-badge {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}
.nav { display: flex; gap: 20px; align-items: center; }
.nav a { color: var(--text-secondary); font-size: 14px; }
.nav a:hover { color: var(--primary); text-decoration: none; }

/* 提示消息 */
.flash {
    padding: 12px 16px;
    margin-bottom: 16px;
    border-radius: var(--radius);
    font-size: 14px;
}
.flash-success { background: #e6f4ea; color: #1e7e34; }
.flash-error { background: #fce8e6; color: #c5221f; }
.flash-info { background: var(--primary-light); color: var(--primary-dark); }

/* 主布局 */
main.container { padding-top: 20px; padding-bottom: 40px; }
.forum-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
}
.forum-main { min-width: 0; }

/* 侧边栏 */
.forum-sidebar { display: flex; flex-direction: column; gap: 16px; }
.sidebar-box {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
}
.sidebar-box h4 {
    font-size: 15px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

/* 欢迎横幅 */
.welcome-banner {
    background: linear-gradient(135deg, var(--primary) 0%, #4285f4 100%);
    color: #fff;
    border-radius: var(--radius);
    padding: 30px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}
.welcome-banner h2 { font-size: 24px; margin-bottom: 8px; }
.welcome-banner p { opacity: 0.9; margin-bottom: 16px; }
.welcome-banner .btn {
    background: #fff;
    color: var(--primary);
    border: none;
}
.welcome-banner .btn:hover { background: #f0f0f0; }
.welcome-badge {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    opacity: 0.45;
    cursor: pointer;
    transition: opacity 0.2s;
    object-fit: cover;
    z-index: 0;
}
.welcome-badge:hover { opacity: 0.9; }
.welcome-slogan { position: relative; z-index: 1; margin-right: 110px; font-size: 20px; font-weight: bold; color: #fff; opacity: 0.95; letter-spacing: 2px; }

/* 板块卡片 */
.section-box {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}
.section-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-light);
}
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.section-header .section-title { margin-bottom: 0; border-bottom: none; padding-bottom: 0; }

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}
.category-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.2s;
    color: var(--text);
}
.category-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(26,115,232,0.15);
    text-decoration: none;
    transform: translateY(-1px);
}
.cat-icon { font-size: 28px; flex-shrink: 0; }
.cat-info { flex: 1; min-width: 0; }
.cat-name { font-weight: 600; font-size: 15px; margin-bottom: 2px; }
.cat-desc { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-count { text-align: center; flex-shrink: 0; }
.cat-count strong { display: block; font-size: 18px; color: var(--primary); }
.cat-count span { font-size: 11px; color: var(--text-muted); }

/* 帖子列表 */
.thread-list { display: flex; flex-direction: column; }
.thread-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}
.thread-item:last-child { border-bottom: none; }
.thread-avatar { flex-shrink: 0; }
.thread-avatar img, .avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
    font-size: 16px;
    object-fit: cover;
}
.avatar-placeholder.large { width: 60px; height: 60px; font-size: 24px; }
.avatar-placeholder.xlarge { width: 80px; height: 80px; font-size: 32px; }

.thread-content { flex: 1; min-width: 0; }
.thread-title-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.thread-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.thread-title:hover { color: var(--primary); text-decoration: none; }
.thread-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
    flex-wrap: wrap;
}
.cat-tag {
    background: var(--primary-light);
    color: var(--primary);
    padding: 1px 8px;
    border-radius: 4px;
    font-size: 11px;
}
.thread-stats { display: flex; gap: 20px; flex-shrink: 0; }
.thread-stats > div { text-align: center; }
.thread-stats strong { display: block; font-size: 16px; color: var(--text); }
.thread-stats span { font-size: 11px; color: var(--text-muted); }

/* 标签 */
.tag {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    flex-shrink: 0;
}
.tag-pin { background: #fef3e2; color: #e67e22; }

/* 帖子详情 */
.post-detail {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}
.post-header { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.post-title { font-size: 22px; font-weight: 600; line-height: 1.4; margin-bottom: 10px; }
.post-meta { display: flex; gap: 16px; font-size: 13px; color: var(--text-muted); }
.post-body { display: flex; gap: 20px; }
.post-author {
    width: 120px;
    flex-shrink: 0;
    text-align: center;
    padding-right: 16px;
    border-right: 1px solid var(--border);
}
.author-avatar { margin-bottom: 8px; }
.author-avatar img { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; }
.author-name { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.author-signature { font-size: 12px; color: var(--text-muted); margin-top: 8px; }
.post-content { flex: 1; font-size: 15px; line-height: 1.8; word-break: break-word; }

/* 角色徽章 */
.role-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}
.role-badge.admin { background: #fce8e6; color: #c5221f; }
.role-badge.founder { background: linear-gradient(135deg, #f093fb, #f5576c); color: #fff; }

/* 管理员操作 */
.admin-actions {
    margin-left: auto;
    display: flex;
    gap: 12px;
}
.admin-actions a {
    font-size: 13px;
    color: var(--primary);
}
.admin-actions a:hover {
    text-decoration: underline;
}

/* 帖子图片 */
.post-image {
    max-width: 100%;
    border-radius: 8px;
    margin: 10px 0;
    display: block;
    cursor: pointer;
}

/* 删除回复按钮 */
.reply-del {
    color: var(--text-muted) !important;
    font-size: 12px;
    margin-left: 8px;
}
.reply-del:hover {
    color: var(--error) !important;
}

/* 回复列表 */
.reply-list { display: flex; flex-direction: column; }
.reply-item {
    display: flex;
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}
.reply-item:last-child { border-bottom: none; }
.reply-avatar { flex-shrink: 0; }
.reply-body { flex: 1; min-width: 0; }
.reply-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 13px;
}
.reply-user { font-weight: 600; color: var(--text); }
.reply-floor { color: var(--text-muted); font-size: 12px; }
.reply-time { color: var(--text-muted); font-size: 12px; margin-left: auto; }
.reply-content { font-size: 14px; line-height: 1.7; word-break: break-word; }

/* 回复表单 */
.reply-form-box textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
}
.reply-form-box textarea:focus { outline: none; border-color: var(--primary); }

/* 按钮 */
.btn {
    display: inline-block;
    padding: 8px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    background: #fff;
    color: var(--text);
}
.btn:hover { text-decoration: none; background: #f5f5f5; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-default { background: #fff; color: var(--text-secondary); }
.btn-sm { padding: 3px 10px; font-size: 12px; }
.btn-block { width: 100%; }

/* 表单 */
.post-form .form-group { margin-bottom: 16px; }
.post-form label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 14px; }
.post-form input, .post-form select, .post-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
}
.post-form input:focus, .post-form select:focus, .post-form textarea:focus {
    outline: none;
    border-color: var(--primary);
}
.post-form textarea { resize: vertical; min-height: 120px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }

/* 面包屑 */
.breadcrumb {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb span { color: var(--text); }

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

/* 分页 */
.pagination {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}
.pagination a, .pagination .current {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
    color: var(--text-secondary);
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* 热门列表 */
.hot-list { list-style: none; }
.hot-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}
.hot-list li:last-child { border-bottom: none; }
.hot-list li a {
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}
.hot-list li a:hover { color: var(--primary); }
.hot-rank {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    background: #e0e0e0;
    color: #999;
    flex-shrink: 0;
}
.hot-rank.rank-1 { background: #ff4d4f; color: #fff; }
.hot-rank.rank-2 { background: #ff7a45; color: #fff; }
.hot-rank.rank-3 { background: #ffa940; color: #fff; }
.hot-list .empty { justify-content: center; color: var(--text-muted); }

/* 活跃用户 */
.active-users { display: flex; flex-wrap: wrap; gap: 8px; }
.active-user { display: block; }
.active-user img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }

/* 统计 */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-item { text-align: center; padding: 8px; }
.stat-item strong { display: block; font-size: 20px; color: var(--primary); }
.stat-item span { font-size: 12px; color: var(--text-muted); }

/* 板块列表（侧边栏） */
.cat-list { list-style: none; }
.cat-list li { padding: 6px 0; }
.cat-list a { color: var(--text-secondary); font-size: 13px; }
.cat-list a:hover { color: var(--primary); }

/* 帖子信息列表 */
.thread-info-list > div {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px solid #f5f5f5;
}
.thread-info-list > div:last-child { border-bottom: none; }
.thread-info-list span { color: var(--text-muted); }
.thread-info-list strong { color: var(--text); font-weight: 500; }

/* 提示列表 */
.tip-list { list-style: none; }
.tip-list li {
    padding: 6px 0;
    font-size: 13px;
    color: var(--text-secondary);
    padding-left: 16px;
    position: relative;
}
.tip-list li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--primary);
}

/* 登录注册页 */
.auth-page {
    min-height: calc(100vh - 200px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 16px;
}
.auth-box {
    background: #fff;
    border-radius: 12px;
    padding: 36px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.auth-box h2 { text-align: center; font-size: 22px; margin-bottom: 6px; }
.auth-subtitle { text-align: center; color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }
.auth-box .form-group { margin-bottom: 16px; }
.auth-box label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 500; }
.auth-box input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
}
.auth-box input:focus { outline: none; border-color: var(--primary); }
.auth-box .btn { margin-top: 8px; padding: 11px; font-size: 15px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 13px; color: var(--text-muted); }

/* 个人主页 */
.profile-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
}
.profile-avatar { flex-shrink: 0; }
.profile-avatar img { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; }
.profile-info { flex: 1; }
.profile-username { font-size: 20px; font-weight: 600; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.profile-signature { color: var(--text-secondary); font-size: 14px; margin-bottom: 12px; }
.profile-stats { display: flex; gap: 24px; }
.profile-stats > div { text-align: center; }
.profile-stats strong { display: block; font-size: 18px; color: var(--primary); }
.profile-stats span { font-size: 12px; color: var(--text-muted); }

.cat-desc-full { color: var(--text-secondary); font-size: 13px; margin-bottom: 16px; }

/* 底部 */
.site-footer {
    background: #fff;
    border-top: 1px solid var(--border);
    padding: 20px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 40px;
}

/* 响应式 */
@media (max-width: 900px) {
    .forum-layout { grid-template-columns: 1fr; }
    .forum-sidebar { order: 2; }
    .post-body { flex-direction: column; }
    .post-author {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding-right: 0;
        padding-bottom: 16px;
        display: flex;
        align-items: center;
        gap: 12px;
        text-align: left;
    }
    .thread-stats { 
        display: flex !important; 
        gap: 16px; 
        margin-top: 8px;
        flex-basis: 100%;
        justify-content: flex-start;
    }
    .thread-stats > div { text-align: left; }
    .thread-item { flex-wrap: wrap; align-items: flex-start; }
    .thread-content { flex-basis: calc(100% - 54px); }
    .profile-card { flex-direction: column; text-align: center; }
    .profile-stats { justify-content: center; }
    .post-body { flex-direction: column !important; gap: 12px; }
    .post-author {
        width: 100% !important;
        flex-shrink: 1 !important;
        text-align: left !important;
        padding-right: 0 !important;
        border-right: none !important;
        display: flex !important;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
    }
    .author-avatar { margin-bottom: 0 !important; flex-shrink: 0; }
    .author-avatar img { width: 36px !important; height: 36px !important; }
    .author-avatar .avatar-placeholder.large { width: 36px !important; height: 36px !important; font-size: 14px !important; }
    .author-name { display: inline-block !important; white-space: nowrap !important; margin-bottom: 0 !important; flex-shrink: 0; font-size: 13px !important; }
    .author-signature { width: 100%; margin-top: 4px; font-size: 11px !important; }
    .role-badge { white-space: nowrap !important; flex-shrink: 0; font-size: 10px !important; padding: 1px 4px !important; }
}

@media (max-width: 600px) {
    .header-inner { flex-wrap: wrap; height: auto; padding: 8px 0; gap: 2px 8px; }
    .logo { font-size: 16px; flex-basis: 100%; white-space: normal; }
    .logo-badge, .logo img { width: 30px; height: 30px; }
    .nav { gap: 10px; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
    .nav a { font-size: 12px; }
    .welcome-banner { padding: 20px; }
    .welcome-banner h2 { font-size: 20px; }
    .welcome-badge { width: 40px; height: 40px; right: 10px; }
    .welcome-slogan { margin-right: 50px; }
    .category-grid { grid-template-columns: 1fr; }
    .post-title { font-size: 18px; }
    .auth-box { padding: 24px; }
    .thread-item { padding: 8px 0; gap: 10px; }
    .thread-avatar img, .avatar-placeholder { width: 32px; height: 32px; font-size: 13px; }
    .thread-title { font-size: 14px; }
    .thread-meta { font-size: 11px; gap: 8px; }
    .thread-stats { gap: 14px !important; margin-top: 6px; }
    .thread-stats strong { font-size: 13px; }
    .thread-stats span { font-size: 10px; }
    .section-box { padding: 12px; }
}
