:root {
    --primary: #1f2937;        /* 深灰蓝 */
    --secondary: #6366f1;      /* 靛蓝 */
    --success: #10b981;        /* 翠绿 */
    --danger: #ef4444;         /* 鲜红 */
    --bg: #f3f4f6;             /* 极浅灰 */
    --border: #e5e7eb;         /* 浅灰边框 */

    --guanli: #8b5cf6;         /* 紫罗兰 */
    --fatie: #f59e0b;          /* 琥珀 */
    --wode: #06b6d4;           /* 青色 */
    --tongzhi: #ec4899;        /* 粉红 */
    --tuichu: #dc2626;         /* 深红 */

    font-size: 16px;
}

@media (min-width: 768px) {
    :root {
        font-size: 17px;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
                 sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    margin: 0;
    background: var(--bg);
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

.navbar {
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 1rem 0;
    margin-bottom: 2rem;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
    text-decoration: none;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ==================== 按钮基础样式（统一 a 和 button） ==================== */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.9rem;
    line-height: 1.5;
    text-align: center;
    vertical-align: middle;
    box-sizing: border-box;
    font-family: inherit;
    background: var(--secondary);
    color: #fff;
    transition: background 0.2s, opacity 0.2s;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.btn:hover {
    opacity: 0.9;
}

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

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

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    line-height: 1.4;
    border-radius: 4px;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--secondary);
    color: var(--secondary);
}
.btn-outline:hover {
    background: var(--secondary);
    color: #fff;
}

a.btn,
button.btn {
    height: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ==================== 新增按钮类 ==================== */
.btn-guanli { background: var(--guanli); color: #fff; }
.btn-guanli:hover { background: #7c3aed; }

.btn-fatie { background: var(--fatie); color: #fff; }
.btn-fatie:hover { background: #d97706; }

.btn-wode { background: var(--wode); color: #fff; }
.btn-wode:hover { background: #0891b2; }

.btn-tongzhi { background: var(--tongzhi); color: #fff; }
.btn-tongzhi:hover { background: #db2777; }

.btn-tuichu { background: var(--tuichu); color: #fff; }
.btn-tuichu:hover { background: #b91c1c; }

/* ==================== 搜索弹层 ==================== */
.search-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.search-overlay.active {
    display: flex;
}

.search-overlay-content {
    background: #fff;
    padding: 30px 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.search-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
}

.search-overlay-content h3 {
    margin-top: 0;
    text-align: center;
}

.search-overlay-content input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    box-sizing: border-box;
    margin-bottom: 10px;
}

.search-overlay-content button {
    width: 100%;
    padding: 12px;
    background: var(--secondary);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

/* ==================== 卡片与表单 ==================== */
.card {
    background: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin-bottom: 1.5rem;
}

.form-group { margin-bottom: 1rem; }
label { display: block; margin-bottom: 0.5rem; font-weight: 600; }
input[type="text"], input[type="email"], input[type="password"], textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1rem;
}
textarea { min-height: 100px; resize: vertical; }

.alert { padding: 1rem; border-radius: 4px; margin-bottom: 1rem; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

.post-item { border-bottom: 1px solid var(--border); padding-bottom: 1.5rem; margin-bottom: 1.5rem; }
.post-item:last-child { border-bottom: none; margin-bottom: 0; }
.post-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.5rem; }
.post-title { font-size: 1.2rem; font-weight: bold; color: var(--primary); margin: 0; }
.post-title a { color: inherit; text-decoration: none; }
.post-title a:hover { color: var(--secondary); }
.post-meta { font-size: 0.85rem; color: #7f8c8d; }
.post-content { margin: 1rem 0; white-space: pre-wrap; }
.post-summary { color: #555; }

.badge-pinned { background: #f39c12; color: #fff; padding: 2px 6px; border-radius: 4px; font-size: 0.75rem; margin-right: 5px; display: inline-block; }
.badge-locked { background: #95a5a6; color: #fff; padding: 2px 6px; border-radius: 4px; font-size: 0.75rem; margin-right: 5px; display: inline-block; }

.reply-list { margin-top: 0.8rem; padding-left: 1.2rem; border-left: 3px solid #eee; }
.reply-item { background: #fafafa; padding: 0.8rem; margin-bottom: 0.5rem; border-radius: 4px; }
.reply-header { font-size: 0.85rem; color: #666; margin-bottom: 0.3rem; }

.reply-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 0.5rem; }
.reply-actions form { display: inline; margin: 0; }

.hidden { display: none; }
.form-container { max-width: 400px; margin: 2rem auto; }
h2, h3 { color: var(--primary); margin-top: 0; }

.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 6px 12px; border: 1px solid #ddd; border-radius: 4px; text-decoration: none; color: #333; background: #fff; }
.pagination a:hover { background: #f0f0f0; }
.pagination .current { color: var(--secondary); font-weight: bold; border: 1px solid var(--secondary); }

/* ================= 富文本内容样式 ================= */
.rich-content { line-height: 1.8; word-wrap: break-word; }
.rich-content h1, .rich-content h2, .rich-content h3, .rich-content h4, .rich-content h5, .rich-content h6 { margin: 1.5em 0 0.75em; line-height: 1.3; color: var(--primary); font-weight: 600; }
.rich-content h1 { font-size: 1.5em; border-bottom: 2px solid #ddd; padding-bottom: 0.3em; }
.rich-content h2 { font-size: 1.3em; border-bottom: 1px solid #eee; padding-bottom: 0.25em; }
.rich-content h3 { font-size: 1.2em; }
.rich-content h4 { font-size: 1.1em; }
.rich-content h5 { font-size: 1em; }
.rich-content h6 { font-size: 0.9em; color: #555; }

.rich-content p { margin: 0.4em 0; line-height: 1.7; }
.rich-content a { color: var(--secondary); text-decoration: none; border-bottom: 1px dashed var(--secondary); transition: all 0.2s; }
.rich-content a:hover { color: #1d6fa5; border-bottom-style: solid; }
.rich-content ul, .rich-content ol { margin: 0.8em 0; padding-left: 2em; }
.rich-content ul { list-style-type: disc; }
.rich-content ol { list-style-type: decimal; }
.rich-content li { margin-bottom: 0.3em; }
.rich-content blockquote { margin: 1em 0; padding: 0.8em 1em; border-left: 4px solid var(--secondary); background: #f7f9fa; color: #555; border-radius: 0 4px 4px 0; }
.rich-content img { max-width: 100%; height: auto; border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); margin: 0.5em 0; }
.rich-content code { background: #f0f2f4; padding: 0.2em 0.4em; border-radius: 4px; font-family: 'Courier New', monospace; font-size: 0.9em; color: #c7254e; }
.rich-content pre { background: #f6f8fa; padding: 1em; border-radius: 6px; overflow-x: auto; border: 1px solid #e1e4e8; margin: 1em 0; }
.rich-content table { width: 100%; border-collapse: collapse; margin: 1em 0; }
.rich-content th, .rich-content td { border: 1px solid #ddd; padding: 0.5em 0.8em; text-align: left; }
.rich-content th { background: #f0f2f4; font-weight: 600; }
.rich-content hr { border: none; border-top: 1px solid #ddd; margin: 2em 0; }

/* ================= 帖子详情页底部区域 ================= */
.post-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

.post-tags {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.post-footer-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ================= 模态框通用样式 ================= */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 999; justify-content: center; align-items: center; }
.modal-content { background: #fff; padding: 20px; border-radius: 8px; max-width: 500px; width: 90%; max-height: 80vh; overflow-y: auto; box-shadow: 0 4px 20px rgba(0,0,0,0.2); }
.modal-close { float: right; cursor: pointer; font-size: 1.5rem; line-height: 1; }
.tag-badge { display: inline-block; background: #e8f0fe; color: #1a73e8; padding: 2px 8px; border-radius: 12px; font-size: 0.8rem; margin: 2px; text-decoration: none; }
.tag-badge:hover { background: #d2e3fc; }

/* ================= 未读通知角标 ================= */
.badge-unread {
    background: #e74c3c;
    color: #fff;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 0.7rem;
    margin-left: 3px;
    display: inline-block;
    line-height: 1;
}

/* ================= 导航栏移动端优化 ================= */
@media (max-width: 600px) {
    .navbar .container {
        flex-direction: column;
        align-items: stretch;
    }
    .brand {
        text-align: center;
        margin-bottom: 8px;
    }
    .user-info {
        justify-content: center;
        flex-wrap: wrap;
        gap: 6px;
    }
    .user-info .btn {
        padding: 0.3rem 0.5rem;
        font-size: 0.75rem;
    }
    .user-info .btn-sm {
        padding: 0.2rem 0.4rem;
        font-size: 0.7rem;
    }
}

/* ================= 相关推荐列表 ================= */
.related-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.related-list li {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}
.related-list li:last-child {
    border-bottom: none;
}
.related-list a {
    text-decoration: none;
    color: var(--primary);
}
.related-list a:hover {
    color: var(--secondary);
}

/* 回复引用块样式 */
.reply-item blockquote {
    border-left: 3px solid #ccc !important;
    padding: 6px 10px !important;
    margin: 0 0 6px 0 !important;
    background: #f9f9f9 !important;
    color: #666 !important;
    font-style: italic !important;
}

.reply-item hr {
    border: none !important;
    border-top: 1px solid #e0e0e0 !important;
    margin: 6px 0 !important;
}