/* 论坛网站样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --secondary: #64748b;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --hover: #f1f5f9;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
}

/* 导航栏 */
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.nav-logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.nav-menu {
    display: flex;
    gap: 24px;
    list-style: none;
}

.nav-menu a {
    color: var(--text);
    font-weight: 500;
    padding: 8px 0;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    gap: 6px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    background: var(--hover);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    color: white;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
}

/* 主容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.main-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 20px;
}

@media (max-width: 768px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
    .sidebar {
        order: -1;
    }
}

/* 卡片 */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: 20px;
}

/* 侧边栏 */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.category-list {
    list-style: none;
}

.category-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s;
    gap: 10px;
}

.category-item:hover {
    background: var(--hover);
}

.category-item.active {
    background: #eff6ff;
    color: var(--primary);
}

.category-icon {
    font-size: 18px;
}

.category-name {
    flex: 1;
    font-weight: 500;
}

.category-count {
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--hover);
    padding: 2px 8px;
    border-radius: 10px;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    text-align: center;
}

.stat-item .stat-num {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.stat-item .stat-label {
    font-size: 12px;
    color: var(--text-secondary);
}

/* 帖子列表 */
.post-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 12px;
    transition: background 0.2s;
}

.post-item:last-child {
    border-bottom: none;
}

.post-item:hover {
    background: var(--hover);
}

.post-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

.post-content {
    flex: 1;
    min-width: 0;
}

.post-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.post-title:hover {
    color: var(--primary);
}

.post-meta {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.post-category {
    background: #eff6ff;
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
}

.post-stats {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-secondary);
    align-items: center;
}

.post-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pinned-badge {
    background: var(--warning);
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 6px;
}

/* 帖子详情 */
.post-detail-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
}

.post-detail-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 12px;
}

.post-detail-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.post-detail-body {
    padding: 24px 20px;
    line-height: 1.8;
    font-size: 15px;
    white-space: pre-wrap;
    word-break: break-word;
}

.post-actions {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 12px;
    align-items: center;
}

.like-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    border: 1px solid var(--border);
    background: white;
    font-size: 14px;
    transition: all 0.2s;
}

.like-btn:hover {
    background: var(--hover);
}

.like-btn.liked {
    background: #fef2f2;
    border-color: var(--danger);
    color: var(--danger);
}

/* 回复区 */
.reply-section {
    margin-top: 16px;
}

.reply-form {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.reply-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 12px;
}

.reply-item:last-child {
    border-bottom: none;
}

.reply-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--secondary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}

.reply-content {
    flex: 1;
}

.reply-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 13px;
}

.reply-username {
    font-weight: 600;
    color: var(--text);
}

.reply-time {
    color: var(--text-secondary);
    font-size: 12px;
}

.reply-text {
    font-size: 14px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}

/* 表单 */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 14px;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
    background: white;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.6;
}

.form-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* 登录注册页面 */
.auth-container {
    max-width: 400px;
    margin: 60px auto;
    padding: 0 20px;
}

.auth-card {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 32px;
}

.auth-title {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.auth-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 14px;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-secondary);
}

/* 搜索栏 */
.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.search-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 20px;
}

.page-btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    background: white;
    font-size: 14px;
}

.page-btn:hover {
    background: var(--hover);
}

.page-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 提示消息 */
.toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: var(--radius);
    color: white;
    font-size: 14px;
    z-index: 1000;
    animation: slideDown 0.3s ease;
}

.toast-success {
    background: var(--success);
}

.toast-error {
    background: var(--danger);
}

.toast-info {
    background: var(--primary);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* 个人中心 */
.profile-header {
    text-align: center;
    padding: 32px 20px;
    border-bottom: 1px solid var(--border);
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 12px;
}

.profile-name {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.profile-bio {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
}

.profile-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
}

.profile-stat {
    text-align: center;
}

.profile-stat-num {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.profile-stat-label {
    font-size: 12px;
    color: var(--text-secondary);
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.empty-text {
    font-size: 14px;
}

/* 加载 */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
    font-size: 13px;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

/* 工具类 */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mt-2 { margin-top: 8px; }
.mb-2 { margin-bottom: 8px; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.hidden { display: none; }
