/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* 顶部导航 */
.header {
    background: #fff;
    border-bottom: 2px solid #e74c3c;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
}

.logo a {
    font-size: 24px;
    font-weight: bold;
    color: #e74c3c;
    text-decoration: none;
}

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

.nav a {
    color: #666;
    text-decoration: none;
    padding: 8px 15px;
    border-radius: 4px;
    transition: all 0.3s;
}

.nav a:hover {
    background: #f0f0f0;
    color: #e74c3c;
}

.user-info {
    color: #e74c3c;
    font-weight: bold;
}

/* 公告栏 */
.announcement {
    background: #fff3cd;
    border-bottom: 1px solid #ffc107;
    padding: 10px 0;
    text-align: center;
    color: #856404;
}

/* 广告容器 */
.ad-container {
    background: #fff;
    padding: 15px 0;
    margin: 15px 0;
}

.ad-container .container {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.ad-slot {
    flex: 1;
    min-width: 200px;
    max-width: 500px;
}

.ad-slot img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Flash消息 */
.flash-messages {
    margin: 15px 0;
}

.alert {
    padding: 12px 20px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

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

/* 主内容区 */
.main {
    padding: 20px 0;
}

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
}

.main-content {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 分类导航 */
.categories {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.category-item {
    padding: 8px 16px;
    background: #f8f9fa;
    border-radius: 20px;
    text-decoration: none;
    color: #666;
    transition: all 0.3s;
}

.category-item:hover, .category-item.active {
    background: #e74c3c;
    color: #fff;
}

/* 帖子列表 */
.posts-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.post-item {
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s;
}

.post-item:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.post-item.pinned {
    background: #fff9e6;
    border-color: #ffc107;
}

.post-title {
    font-size: 18px;
    margin-bottom: 10px;
}

.post-title a {
    color: #333;
    text-decoration: none;
}

.post-title a:hover {
    color: #e74c3c;
}

.pin-badge {
    font-weight: bold;
    margin-right: 5px;
}

.post-meta {
    display: flex;
    gap: 15px;
    font-size: 14px;
    color: #999;
    margin-bottom: 10px;
}

.post-meta .category {
    color: #e74c3c;
    font-weight: bold;
}

.post-preview {
    color: #666;
    line-height: 1.8;
}

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

.page-link {
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #666;
}

.page-link:hover, .page-link.active {
    background: #e74c3c;
    color: #fff;
    border-color: #e74c3c;
}

.page-ellipsis {
    padding: 8px 12px;
}

/* 侧边栏 */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: sticky;
    top: 20px;
    align-self: start;
}

.sidebar-widget {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.sidebar-widget h3 {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e74c3c;
    color: #e74c3c;
}

.sidebar-ad {
    margin-bottom: 15px;
}

.stats-list {
    list-style: none;
}

.stats-list li {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

/* 按钮 */
.btn {
    display: inline-block;
    padding: 10px 20px;
    background: #e74c3c;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
}

.btn:hover {
    background: #c0392b;
}

.btn-secondary {
    background: #6c757d;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 14px;
}

.btn-danger {
    background: #dc3545;
}

.btn-danger:hover {
    background: #c82333;
}

/* 帖子详情 */
.post-detail {
    margin-bottom: 30px;
}

.post-detail .post-title {
    font-size: 24px;
    margin-bottom: 15px;
}

.post-content {
    line-height: 1.8;
    padding: 20px 0;
    border-bottom: 1px solid #e0e0e0;
}

.post-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 20px;
}

.post-image {
    width: 100%;
    border-radius: 4px;
    cursor: pointer;
}

.post-actions {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

/* 评论区 */
.comments-section {
    margin-top: 30px;
}

.comment-form {
    margin: 20px 0;
}

.comment-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
}

.comments-list {
    margin-top: 20px;
}

.comment-item {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 10px;
}

.comment-author {
    font-weight: bold;
    color: #e74c3c;
    margin-bottom: 5px;
}

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

/* 表单 */
.auth-form, .post-form {
    max-width: 500px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="url"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.auth-link {
    text-align: center;
    margin-top: 15px;
}

/* 页脚 */
.footer {
    background: #2c3e50;
    color: #fff;
    padding: 30px 0;
    margin-top: 40px;
}

.footer-ads {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.footer-ad img {
    width: 100%;
    border-radius: 4px;
}

.footer-info {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #34495e;
}

.footer-info p {
    margin: 5px 0;
    color: #bdc3c7;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .content-wrapper {
        grid-template-columns: 1fr;
    }
    
    .header-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .categories {
        justify-content: center;
    }
    
    .ad-container .container {
        flex-direction: column;
    }
    
    .footer-ads {
        grid-template-columns: 1fr;
    }
}
