/* 全局样式 */
* {
    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-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部 */
.header {
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2c3e50;
    text-decoration: none;
}

.nav {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.nav-link {
    color: #2c3e50;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-link:hover {
    color: #3498db;
}

.user-info {
    color: #666;
}

/* 主内容区 */
.main {
    min-height: calc(100vh - 200px);
    padding: 2rem 0;
}

/* 页头 */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2rem;
    color: #2c3e50;
}

/* 按钮 */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 1rem;
    transition: all 0.3s;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
}

.btn-primary {
    background: #3498db;
    color: #fff;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-block {
    display: block;
    width: 100%;
}

/* 话题列表 */
.discussion-list {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.discussion-item {
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.discussion-item:hover {
    background: #f8f9fa;
}

.discussion-item.pinned {
    background: #fff3cd;
}

.discussion-item:last-child {
    border-bottom: none;
}

.discussion-main {
    flex: 1;
}

.discussion-title {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.discussion-title a {
    color: #2c3e50;
    text-decoration: none;
}

.discussion-title a:hover {
    color: #3498db;
}

.discussion-meta {
    color: #666;
    font-size: 0.9rem;
}

.discussion-meta .author {
    margin-right: 1rem;
    font-weight: 500;
}

.discussion-stats {
    display: flex;
    gap: 2rem;
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: #3498db;
}

.stat-label {
    font-size: 0.8rem;
    color: #666;
}

/* 徽章 */
.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-size: 0.8rem;
    margin-right: 0.5rem;
}

.badge-pin {
    background: #e74c3c;
    color: #fff;
}

.badge-lock {
    background: #95a5a6;
    color: #fff;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
}

.page-link {
    padding: 0.5rem 1rem;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #3498db;
}

.page-link:hover {
    background: #3498db;
    color: #fff;
}

.page-info {
    color: #666;
}

/* 话题详情 */
.discussion-detail {
    background: #fff;
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.discussion-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #eee;
}

.discussion-header h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #2c3e50;
}

.discussion-content {
    font-size: 1.1rem;
    line-height: 1.8;
}

.discussion-content img,
.post-content img {
    display: block;
    max-width: 100% !important;
    height: auto !important;
}

.discussion-content p {
    margin-bottom: 1rem;
}

/* 回复列表 */
.posts-section {
    background: #fff;
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.posts-section h2 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

.post-item {
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
}

.post-item:last-child {
    border-bottom: none;
}

.post-header {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    color: #666;
    font-size: 0.9rem;
}

.post-author {
    font-weight: 500;
    color: #3498db;
}

.post-content {
    line-height: 1.8;
}

/* 回复表单 */
.reply-section {
    background: #fff;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.reply-section h2 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

/* 认证页面 */
.auth-container {
    max-width: 500px;
    margin: 3rem auto;
}

.auth-card {
    background: #fff;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.auth-card h2 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

.auth-footer {
    margin-top: 1.5rem;
    text-align: center;
    color: #666;
}

.auth-footer a {
    color: #3498db;
}

/* 表单 */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #2c3e50;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

/* 提示框 */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-error {
    background: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

.alert-info {
    background: #e7f3ff;
    color: #0066cc;
    border: 1px solid #b3d9ff;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #666;
}

/* 模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: #fff;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
}

.modal-header h2 {
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #666;
}

.modal-header + form {
    padding: 1.5rem;
}

/* 页脚 */
.footer {
    background: #2c3e50;
    color: #fff;
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .discussion-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .discussion-stats {
        margin-top: 1rem;
        width: 100%;
        justify-content: space-around;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

/* 管理员操作按钮 */
.discussion-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.discussion-title-row h1 {
    flex: 1;
    margin: 0;
}

.admin-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.post-header .btn {
    margin-left: auto;
}

.btn-warning {
    background: #ffc107;
    color: #333;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-info {
    background: #17a2b8;
    color: #fff;
}

.btn-info:hover {
    background: #138496;
}

.btn-danger {
    background: #dc3545;
    color: #fff;
}

.btn-danger:hover {
    background: #c82333;
}
