/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4CAF50;
    --primary-hover: #45a049;
    --secondary-color: #2196F3;
    --danger-color: #f44336;
    --warning-color: #ff9800;
    --text-color: #333;
    --text-muted: #666;
    --bg-color: #f5f5f5;
    --card-bg: #fff;
    --border-color: #e0e0e0;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px;
    width: 100%;
}

/* 头部样式 */
.header {
    background: var(--card-bg);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: bold;
    color: var(--primary-color);
}

.logo i {
    font-size: 28px;
}

.nav {
    display: flex;
    gap: 30px;
}

.nav-link {
    color: var(--text-color);
    font-weight: 500;
    padding: 5px 0;
    position: relative;
}

.nav-link:hover {
    text-decoration: none;
    color: var(--primary-color);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width 0.3s;
}

.nav-link:hover::after {
    width: 100%;
}

/* PC版头部搜索框 */
.header-search {
    flex: 1;
    max-width: 300px;
    margin: 0 20px;
}

.header-search form {
    display: flex;
    align-items: center;
    background: #f1f5f9;
    border-radius: 20px;
    padding: 3px;
    border: 2px solid transparent;
    transition: all 0.3s;
}

.header-search form:focus-within {
    background: #fff;
    border-color: var(--primary-color);
}

.header-search input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 6px 12px;
    font-size: 14px;
    outline: none;
}

.header-search button {
    background: var(--primary-color);
    color: #fff;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 手机版搜索图标 - PC版隐藏 */
.mobile-search-btn {
    display: none;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-hover);
    text-decoration: none;
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: #fff;
    text-decoration: none;
}

.btn-danger {
    background: var(--danger-color);
    color: #fff;
}

.btn-danger:hover {
    background: #d32f2f;
    text-decoration: none;
}

.btn-block {
    width: 100%;
}

.btn-lg {
    padding: 12px 30px;
    font-size: 16px;
}

/* 用户菜单 */
.user-menu {
    position: relative;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border-radius: var(--radius);
    transition: background 0.3s;
}

.user-info:hover {
    background: var(--bg-color);
    text-decoration: none;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    overflow: hidden;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: normal;
}

.badge.admin {
    background: var(--danger-color);
    color: #fff;
}

.dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 180px;
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s;
}

.user-menu:hover .dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-color);
    font-size: 14px;
}

.dropdown a:hover {
    background: var(--bg-color);
    text-decoration: none;
}

.dropdown .divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 0;
}

/* 主内容区 */
.main {
    flex: 1;
    padding: 0;
}

/* 警告框 */
.alert {
    padding: 15px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.alert-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.alert-error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffe082;
}

/* 卡片样式 */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.card-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* 板块列表 */
.category-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.category-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
}

.category-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.category-icon {
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 24px;
    margin-bottom: 15px;
}

.category-card h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.category-card p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 15px;
}

.category-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-muted);
}

/* 帖子列表 */
.post-list {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.post-item {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 15px;
}

.post-item:last-child {
    border-bottom: none;
}

.post-item:hover {
    background: #fafafa;
}

.post-avatar {
    flex-shrink: 0;
}

.post-avatar .avatar {
    width: 48px;
    height: 48px;
    font-size: 20px;
}

.post-content {
    flex: 1;
    min-width: 0;
}

.post-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.post-title a {
    color: var(--text-color);
}

.post-title a:hover {
    color: var(--primary-color);
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 13px;
    color: var(--text-muted);
}

.post-meta a {
    color: var(--text-muted);
}

.post-meta a:hover {
    color: var(--primary-color);
}

.post-stats {
    display: flex;
    gap: 20px;
    align-items: center;
}

.stat-item {
    text-align: center;
    min-width: 50px;
}

.stat-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
}

/* 置顶和精华标签 */
.tag {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: normal;
}

.tag-top {
    background: var(--danger-color);
    color: #fff;
}

.tag-essence {
    background: var(--warning-color);
    color: #fff;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

.form-text {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 5px;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 30px;
}

.page-link {
    padding: 8px 16px;
    border-radius: var(--radius);
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    transition: all 0.3s;
}

.page-link:hover {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    text-decoration: none;
}

.page-link.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.page-ellipsis {
    color: var(--text-muted);
}

/* 帖子详情 */
.post-detail {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 30px;
    margin-bottom: 20px;
}

.post-header {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.post-header h1 {
    font-size: 24px;
    margin-bottom: 15px;
}

.post-author {
    display: flex;
    align-items: center;
    gap: 15px;
}

.post-author .avatar {
    width: 52px;
    height: 52px;
    font-size: 24px;
}

.post-author-info h4 {
    font-size: 16px;
    margin-bottom: 4px;
}

.post-author-info span {
    font-size: 13px;
    color: var(--text-muted);
}

.post-body {
    font-size: 16px;
    line-height: 1.8;
}

.post-body p {
    margin-bottom: 15px;
}

.post-body h1, .post-body h2, .post-body h3 {
    margin: 20px 0 15px;
    font-weight: 600;
}

.post-body h1 {
    font-size: 24px;
}

.post-body h2 {
    font-size: 20px;
}

.post-body h3 {
    font-size: 18px;
}

.post-body ul, .post-body ol {
    margin: 15px 0;
    padding-left: 30px;
}

.post-body li {
    margin-bottom: 5px;
}

.post-body a {
    color: var(--secondary-color);
    text-decoration: underline;
}

.post-body blockquote {
    border-left: 4px solid var(--border-color);
    padding-left: 15px;
    margin: 15px 0;
    color: var(--text-muted);
}

.post-body img {
    max-width: 52px;
    max-height: 52px;
    width: auto;
    height: auto;
    border-radius: var(--radius);
    margin: 5px;
    cursor: pointer;
    transition: transform 0.2s;
}

.post-body img:hover {
    transform: scale(1.1);
}

/* 回复列表 */
.reply-list {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.reply-item {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 15px;
}

.reply-item:last-child {
    border-bottom: none;
}

.reply-avatar {
    flex-shrink: 0;
}

.reply-avatar .avatar {
    width: 52px;
    height: 52px;
    font-size: 18px;
}

.reply-content {
    flex: 1;
}

.reply-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.reply-author {
    font-weight: 600;
}

.reply-time {
    font-size: 13px;
    color: var(--text-muted);
}

.floor-number {
    font-size: 13px;
    color: var(--text-muted);
    background: var(--bg-color);
    padding: 2px 10px;
    border-radius: 4px;
}

.reply-body {
    font-size: 15px;
    line-height: 1.7;
}

.reply-body p {
    margin-bottom: 10px;
}

.reply-body h1, .reply-body h2, .reply-body h3 {
    margin: 15px 0 10px;
    font-weight: 600;
}

.reply-body h1 {
    font-size: 20px;
}

.reply-body h2 {
    font-size: 18px;
}

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

.reply-body ul, .reply-body ol {
    margin: 10px 0;
    padding-left: 25px;
}

.reply-body li {
    margin-bottom: 3px;
}

.reply-body a {
    color: var(--secondary-color);
    text-decoration: underline;
}

.reply-body img {
    max-width: 52px;
    max-height: 52px;
    width: auto;
    height: auto;
    border-radius: var(--radius);
    margin: 5px;
    cursor: pointer;
    transition: transform 0.2s;
}

.reply-body img:hover {
    transform: scale(1.1);
}

/* 登录注册页面 */
.auth-container {
    max-width: 400px;
    margin: 50px auto;
}

.auth-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 40px;
}

.auth-card h2 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 24px;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    font-size: 14px;
    color: var(--text-muted);
}

/* 页脚 */
.footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 20px 0;
    margin-top: auto;
}

.footer-inner {
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

.footer-inner p {
    margin: 5px 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header-inner {
        flex-wrap: wrap;
        height: auto;
        padding: 10px 0;
    }

    .nav {
        order: 3;
        width: 100%;
        justify-content: center;
        margin-top: 10px;
        gap: 20px;
    }

    .category-list {
        grid-template-columns: 1fr;
    }

    .post-item {
        flex-direction: column;
    }

    .post-stats {
        justify-content: flex-start;
        margin-top: 10px;
    }

    .reply-item {
        flex-direction: column;
    }
}

/* ==================== 搜索页面样式 ==================== */
.search-page {
    max-width: 800px;
    margin: 0 auto;
}

.search-box-large {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.search-form-large {
    display: flex;
    gap: 10px;
}

.search-input-large {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 16px;
    transition: all 0.3s;
}

.search-input-large:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-btn-large {
    padding: 12px 24px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-btn-large:hover {
    background: var(--primary-hover);
}

.search-stats {
    color: var(--text-muted);
    margin-bottom: 20px;
    padding: 0 10px;
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.search-result-item {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.search-result-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
}

.search-result-title .pinned-icon {
    color: #f59e0b;
    margin-right: 5px;
}

.search-result-title a {
    color: var(--text-color);
}

.search-result-title a:hover {
    color: var(--primary-color);
}

.search-result-content {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-result-content mark {
    background: #fef08a;
    color: #854d0e;
    padding: 0 2px;
    border-radius: 2px;
}

.search-result-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 13px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.search-result-meta a {
    color: var(--text-muted);
}

.search-result-meta a:hover {
    color: var(--primary-color);
}

.empty-search {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-search i {
    font-size: 64px;
    margin-bottom: 20px;
    color: var(--border-color);
}

.empty-search h3 {
    font-size: 20px;
    margin-bottom: 10px;
}

/* ==================== 新版首页三栏布局 ==================== */
.home-layout {
    display: grid;
    grid-template-columns: 200px 1fr 260px;
    gap: 15px;
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 15px;
}

/* 侧边栏盒子 */
.side-box {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 15px;
    overflow: hidden;
}

.side-title {
    padding: 12px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.side-title i {
    color: #4CAF50;
}

.side-title .more {
    margin-left: auto;
    font-size: 12px;
    color: #666;
    font-weight: normal;
}

.side-title .more:hover {
    color: #4CAF50;
}

/* 左侧板块列表 */
.category-side-list {
    padding: 8px;
}

.category-side-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-radius: 6px;
    color: #333;
    font-size: 14px;
    transition: all 0.2s;
}

.category-side-item:hover {
    background: #f0f7f0;
    text-decoration: none;
}

.category-side-item .cat-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.category-side-item .cat-count {
    font-size: 12px;
    color: #999;
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 10px;
}

/* 中间内容区 */
.home-center {
    min-width: 0;
}

.main-content-box {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

.content-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.content-header h2 {
    font-size: 16px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.content-header h2 i {
    color: #4CAF50;
}

.btn-post {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    background: #4CAF50;
    color: #fff;
    border-radius: 4px;
    font-size: 13px;
    text-decoration: none;
}

.btn-post:hover {
    background: #45a049;
    text-decoration: none;
    color: #fff;
}

/* 帖子列表 */
.post-list-new {
    padding: 10px;
}

.post-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 6px;
    transition: background 0.2s;
    cursor: pointer;
}

.post-row:hover {
    background: #f8f9fa;
}

.post-author-avatar {
    flex-shrink: 0;
}

.post-author-avatar a {
    display: block;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
}

.post-author-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-author-avatar .default-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 16px;
}

.post-main-info {
    flex: 1;
    min-width: 0;
}

.post-title-line {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 5px;
}

.label-top {
    font-size: 11px;
    padding: 1px 5px;
    background: #ff6b6b;
    color: #fff;
    border-radius: 3px;
}

.label-essence {
    font-size: 11px;
    padding: 1px 5px;
    background: #ffa726;
    color: #fff;
    border-radius: 3px;
}

.title-text {
    font-size: 14px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.post-meta-line {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #999;
}

.post-meta-line a {
    color: #666;
}

.post-meta-line a:hover {
    color: #4CAF50;
}

.post-meta-line .dot {
    color: #ccc;
}

.post-counts {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #999;
    flex-shrink: 0;
}

.post-counts i {
    margin-right: 3px;
}

.empty-tip {
    text-align: center;
    padding: 50px 20px;
    color: #999;
}

.empty-tip i {
    font-size: 40px;
    margin-bottom: 10px;
    display: block;
}

/* 右侧公告 */
.announcement-side-list {
    padding: 8px;
}

.ann-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 6px;
    color: #333;
    font-size: 13px;
    transition: background 0.2s;
}

.ann-item:hover {
    background: #f8f9fa;
    text-decoration: none;
}

.ann-tag {
    font-size: 10px;
    padding: 1px 4px;
    background: #ff6b6b;
    color: #fff;
    border-radius: 3px;
    flex-shrink: 0;
}

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

.empty-side {
    padding: 20px;
    text-align: center;
    color: #999;
    font-size: 13px;
}

/* 统计区域 */
.stats-box {
    background: #fff;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: #e9ecef;
}

.stat-cell {
    background: #fff;
    padding: 15px;
    text-align: center;
}

.stat-num {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin-bottom: 3px;
}

.stat-name {
    font-size: 12px;
    color: #999;
}

/* 响应式 */
@media (max-width: 992px) {
    .home-layout {
        grid-template-columns: 1fr;
    }
    
    .home-left,
    .home-right {
        order: 2;
    }
    
    .home-center {
        order: 1;
    }
}

@media (max-width: 768px) {
    .home-layout {
        padding: 10px;
        margin: 10px auto;
    }
    
    .post-row {
        flex-wrap: wrap;
    }
    
    .post-counts {
        width: 100%;
        margin-top: 8px;
        padding-left: 52px;
    }
}
