/* ========== Reset & Base ========== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #1a56db;
    --primary-light: #3b82f6;
    --primary-dark: #1e40af;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
    --radius: 8px;
    --radius-lg: 12px;
}

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;
    display: flex;
    flex-direction: column;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { cursor: pointer; border: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========== Header ========== */
.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.logo-img {
    width: 56px;
    height: 56px;
    object-fit: contain;
}

.logo-text {
    font-size: 24px;
}

.nav {
    display: flex;
    gap: 4px;
}

.nav-link {
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.nav-link:hover {
    background: #f1f5f9;
    color: var(--text);
}

.nav-link.active {
    background: #eff6ff;
    color: var(--primary);
}

/* ========== Buttons ========== */
.btn {
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: #f1f5f9;
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-outline:hover {
    background: #f8fafc;
    color: var(--text);
}

/* ========== Main Layout ========== */
.main {
    flex: 1;
    padding: 24px 0;
}

.main .container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
}

/* ========== Content Area ========== */
.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.content-title {
    font-size: 22px;
    font-weight: 700;
}

.filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.filter-tag {
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    background: #f1f5f9;
    transition: all 0.2s;
}

.filter-tag:hover, .filter-tag.active {
    background: var(--primary);
    color: #fff;
}

/* ========== Post List ========== */
.post-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.post-item {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: all 0.2s;
    cursor: pointer;
    border: 1px solid transparent;
}

.post-item:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

.post-item-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.post-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-light);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    flex-shrink: 0;
}

.post-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
    flex: 1;
}

.post-item:hover .post-title {
    color: var(--primary);
}

.post-summary {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    padding-left: 52px;
}

.post-item-footer {
    display: flex;
    align-items: center;
    gap: 20px;
    padding-left: 52px;
    font-size: 13px;
    color: var(--text-muted);
}

.post-tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.tag-finance { background: #dbeafe; color: #1e40af; }
.tag-economics { background: #fef3c7; color: #92400e; }
.tag-quant { background: #d1fae5; color: #065f46; }
.tag-crypto { background: #ede9fe; color: #5b21b6; }

/* ========== Sidebar ========== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 14px;
}

.user-card {
    display: flex;
    align-items: center;
    gap: 14px;
}

.avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
}

.user-info h4 {
    font-size: 15px;
    font-weight: 600;
}

.user-info p {
    font-size: 13px;
    color: var(--text-secondary);
}

.hot-list li {
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hot-list li:last-child { border-bottom: none; }
.hot-list li:hover { color: var(--primary); }

.stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.stat-item {
    text-align: center;
    padding: 12px 8px;
    background: #f8fafc;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.stat-item:hover {
    background: #eff6ff;
}

.stat-num {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ========== Modal ========== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 540px;
    box-shadow: var(--shadow-lg);
    max-height: 85vh;
    overflow-y: auto;
}

.modal-lg {
    max-width: 680px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: #f1f5f9;
    color: var(--text-secondary);
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #e2e8f0;
    color: var(--text);
}

.modal-body {
    padding: 24px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

/* ========== Forms ========== */
.input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    margin-bottom: 12px;
    background: #fff;
}

.input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.textarea {
    resize: vertical;
    min-height: 120px;
}

/* ========== Post Detail ========== */
.post-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-muted);
}

.post-body {
    font-size: 15px;
    line-height: 1.8;
    color: var(--text);
    margin-bottom: 24px;
    white-space: pre-wrap;
}

/* ========== Comments ========== */
.comments-section h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.comment-item {
    padding: 14px 0;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    gap: 12px;
}

.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e2e8f0;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

.comment-content {
    flex: 1;
}

.comment-author {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 2px;
}

.comment-text {
    font-size: 14px;
    color: var(--text-secondary);
}

.comment-time {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.comment-input {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.comment-input .input {
    flex: 1;
    margin-bottom: 0;
}

/* ========== Footer ========== */
.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 20px 0;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: auto;
}

/* ========== Empty State ========== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 15px;
}

/* ========== Responsive ========== */
@media (max-width: 900px) {
    .main .container {
        grid-template-columns: 1fr;
    }
    .sidebar {
        display: none;
    }
    .nav {
        display: none;
    }
}
