/* style.css - 最终整合版（超紧凑首页 + 卡片式详情页） */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

.container {
    max-width: 100%;
    margin: 0;
    padding: 0 10px;
}

.header {
    background: #4a76a8;
    color: white;
    padding: 0.6rem 10px;
}

.header a {
    color: white;
    text-decoration: none;
}

.header h1 {
    display: inline-block;
    font-size: 1.6rem;
    font-weight: 700;
}

.header .nav {
    float: right;
    margin-top: 6px;
}

.header .nav a,
.header .nav span {
    margin-left: 10px;
    font-size: 14px;
    font-weight: 500;
}

.footer {
    background: #333;
    color: #ccc;
    text-align: center;
    padding: 0.6rem 10px;
    margin-top: 15px;
    font-size: 13px;
}

.mobile-nav-buttons {
    display: none;
    justify-content: space-between;
    padding: 6px 10px;
    background: #f0f0f0;
    border-bottom: 1px solid #ddd;
}

.mobile-nav-btn {
    background: #4a76a8;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
}

.mobile-nav-btn:hover {
    background: #3a5f8a;
}

.two-column-layout {
    display: flex;
    gap: 10px;
    padding: 0 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.left-sidebar {
    width: 10%;
    flex-shrink: 0;
}

.right-main {
    flex: 1;
    min-width: 0;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.content-area {
    flex: 3;
    min-width: 0;
}

.info-sidebar {
    flex: 1;
    max-width: 250px;
    min-width: 0;
}

.widget {
    background: white;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
    padding: 8px;
    font-size: 13px;
}

.widget h3 {
    margin: 0 0 5px 0;
    font-size: 15px;
    font-weight: 700;
    border-bottom: 1px solid #eee;
    padding-bottom: 3px;
}

.widget ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.widget ul li {
    margin-bottom: 3px;
    padding-bottom: 3px;
    border-bottom: 1px dashed #f0f0f0;
}

.widget ul li:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.widget ul li a {
    text-decoration: none;
    color: #4a76a8;
    word-wrap: break-word;
    font-size: 13px;
    font-weight: 500;
}

.widget ul li a:hover {
    text-decoration: underline;
}

.widget .meta {
    color: #999;
    font-size: 11px;
    margin-left: 4px;
}

.left-sidebar .widget ul li a {
    display: block;
    padding: 2px 0;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.left-sidebar .tag-cloud {
    line-height: 1.5;
}
.left-sidebar .tag-cloud a {
    color: #4a76a8;
    text-decoration: none;
    padding: 1px 3px;
    background: #f0f0f0;
    border-radius: 3px;
    display: inline-block;
    margin: 0 2px 3px 0;
    font-size: 11px;
}
.left-sidebar .tag-cloud a:hover {
    background: #e0e0e0;
    text-decoration: underline;
}

.topic-item {
    background: white;
    padding: 6px 8px;
    margin-bottom: 6px;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.topic-item.is-top {
    border-left: 3px solid #f0ad4e;
}

.topic-item h3 {
    margin: 0 0 3px 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
}

.topic-item h3 a {
    color: #4a76a8;
    text-decoration: none;
}

.topic-item h3 a:hover {
    color: #2c5a8c;
}

.topic-meta {
    color: #666;
    font-size: 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 3px;
}

.topic-meta .sep {
    color: #ccc;
    margin: 0 2px;
}

.topic-meta .author {
    font-weight: 500;
}

.user-id {
    color: #999;
    font-size: 11px;
}

.top-tag {
    background: #f0ad4e;
    color: white;
    font-size: 10px;
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: 5px;
    display: inline-block;
    vertical-align: middle;
}

.pagination {
    text-align: center;
    margin: 10px 0;
}

.pagination a,
.pagination span {
    display: inline-block;
    padding: 3px 6px;
    margin: 0 2px;
    border: 1px solid #ddd;
    text-decoration: none;
    color: #333;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
}

.pagination span.current {
    background: #4a76a8;
    color: white;
    border-color: #4a76a8;
}

.pagination a:hover {
    background: #f0f0f0;
}

.info-sidebar .widget {
    margin-bottom: 8px;
    padding: 8px;
}

.info-sidebar input[type="text"] {
    width: 100%;
    padding: 4px 6px;
    margin-bottom: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 12px;
}

.info-sidebar .btn {
    width: 100%;
    padding: 4px;
    font-size: 12px;
    font-weight: 600;
}

.info-sidebar .widget p {
    margin: 3px 0;
    line-height: 1.3;
    font-size: 12px;
}

.info-sidebar .user-card .user-info {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.info-sidebar .user-card .user-info img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 6px;
    border: 1px solid #4a76a8;
}

.info-sidebar .user-card .user-details p {
    margin: 2px 0;
    line-height: 1.3;
    font-size: 12px;
}

.info-sidebar .user-card > p {
    margin: 3px 0;
    font-size: 12px;
}

.info-sidebar .user-card a {
    color: #4a76a8;
    text-decoration: none;
    font-size: 12px;
}

.info-sidebar .user-card a:hover {
    text-decoration: underline;
}

.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.content-header h2 {
    margin: 0;
    font-size: 18px;
}
.content-header .newest-link {
    font-size: 12px;
    color: #4a76a8;
    text-decoration: none;
    white-space: nowrap;
}
.content-header .newest-link:hover {
    text-decoration: underline;
}

.new-post-link {
    margin-bottom: 8px;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    margin-top: 3px;
}

label {
    font-weight: 600;
    font-size: 13px;
}

.btn,
button,
input[type="submit"] {
    display: inline-block;
    background: #4a76a8;
    color: white;
    padding: 5px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.btn:hover,
button:hover {
    background: #3a5f8a;
}

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 6px;
    border-radius: 4px;
    margin: 6px 0;
    font-size: 13px;
    font-weight: 500;
}

.success {
    background: #d4edda;
    color: #155724;
    padding: 6px;
    border-radius: 4px;
    margin: 6px 0;
    font-size: 13px;
    font-weight: 500;
}

/* ===== 响应式设计 ===== */
@media (max-width: 1024px) {
    .left-sidebar {
        width: 15%;
    }
    .right-main {
        width: 85%;
    }
}

@media (max-width: 768px) {
    .mobile-nav-buttons {
        display: flex;
    }
    .two-column-layout {
        flex-direction: column;
    }
    .left-sidebar,
    .info-sidebar {
        display: none;
        width: 100%;
        max-width: 100%;
        margin-bottom: 10px;
    }
    .left-sidebar.mobile-visible,
    .info-sidebar.mobile-visible {
        display: block;
    }
    .right-main {
        width: 100%;
        flex-direction: column;
    }
    .content-area {
        width: 100%;
        flex: none;
    }
    .header .nav {
        float: none;
        text-align: center;
        margin-top: 6px;
    }
    .header .nav a,
    .header .nav span {
        display: inline-block;
        margin: 0 4px;
    }
    .left-sidebar.mobile-visible,
    .info-sidebar.mobile-visible {
        animation: slideDown 0.3s ease;
    }
    @keyframes slideDown {
        from { opacity: 0; transform: translateY(-8px); }
        to { opacity: 1; transform: translateY(0); }
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.4rem;
    }
    .header .nav a,
    .header .nav span {
        font-size: 12px;
        margin: 0 3px;
    }
    .topic-item h3 {
        font-size: 15px;
    }
    .topic-meta {
        font-size: 11px;
    }
    .btn {
        padding: 4px 8px;
        font-size: 12px;
    }
    .content-header {
        flex-wrap: wrap;
    }
    .content-header .newest-link {
        margin-top: 3px;
    }
}

/* ===== Markdown 样式（通用） ===== */
.markdown-body {
    font-size: 15px;
    line-height: 1.6;
    word-wrap: break-word;
}
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    margin-top: 1em;
    margin-bottom: 0.5em;
    font-weight: 600;
}
.markdown-body h1 { font-size: 2em; }
.markdown-body h2 { font-size: 1.5em; }
.markdown-body h3 { font-size: 1.25em; }
.markdown-body p {
    margin-bottom: 1em;
}
.markdown-body ul,
.markdown-body ol {
    margin-left: 2em;
    margin-bottom: 1em;
}
.markdown-body blockquote {
    padding: 0 1em;
    color: #6a737d;
    border-left: 0.25em solid #dfe2e5;
    margin-bottom: 1em;
}
.markdown-body pre {
    background: #f6f8fa;
    border-radius: 3px;
    padding: 16px;
    overflow: auto;
    font-size: 85%;
    line-height: 1.45;
    margin-bottom: 1em;
}
.markdown-body code {
    background: #f6f8fa;
    border-radius: 3px;
    padding: 0.2em 0.4em;
    font-size: 85%;
}
.markdown-body img {
    max-width: 100%;
    box-sizing: content-box;
}
.markdown-body a {
    color: #4a76a8;
    text-decoration: none;
}
.markdown-body a:hover {
    text-decoration: underline;
}

/* ===== 帖子详情页卡片样式（新增） ===== */
.topic-container {
    max-width: 900px;
    margin: 0 auto;
}

/* 卡片通用样式 */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    padding: 20px;
    margin-bottom: 20px;
}

/* 主题卡片 */
.topic-card h2 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 24px;
}

/* 作者栏 */
.author-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.author-bar .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #4a76a8;
}

.author-info {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
}

.author-name {
    font-weight: 600;
    color: #333;
}

.user-id {
    color: #999;
    font-size: 12px;
}

.op-tag {
    background: #f0ad4e;
    color: white;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-block;
    line-height: 1.2;
}

.post-meta {
    margin-left: auto;
    color: #999;
    font-size: 13px;
}

/* 帖子统计 */
.post-stats {
    display: flex;
    gap: 15px;
    color: #666;
    font-size: 14px;
    margin-bottom: 15px;
}

/* 内容区域 */
.content {
    font-size: 16px;
    line-height: 1.7;
    margin-bottom: 15px;
}

/* 操作按钮 */
.post-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.post-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f5f5f5;
    color: #4a76a8;
    border: 1px solid #ddd;
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: normal;
    transition: all 0.2s;
}

.post-actions .btn:hover {
    background: #e9e9e9;
    border-color: #4a76a8;
}

.post-actions .btn .icon {
    font-size: 16px;
}

/* 回复卡片 */
.reply-card {
    background: #fafafa;
    border: 1px solid #eee;
}

/* 回复标题 */
.reply-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0 10px;
    font-size: 20px;
}

.reply-heading .count {
    background: #4a76a8;
    color: white;
    font-size: 14px;
    padding: 2px 8px;
    border-radius: 20px;
}

/* 暂无回复提示 */
.no-reply {
    text-align: center;
    color: #999;
    padding: 30px;
    background: white;
    border-radius: 8px;
}

/* 回复表单卡片 */
.reply-form-card {
    background: white;
}

.reply-form-card h4 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 18px;
}

.reply-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 15px;
}

.upload-group {
    margin-bottom: 15px;
}

.upload-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.upload-group input[type="file"] {
    display: block;
    width: 100%;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f9f9f9;
}

/* 登录提示 */
.login-tip {
    text-align: center;
    padding: 20px;
    background: white;
    border-radius: 8px;
}

/* 移动端适配（针对详情页） */
@media (max-width: 768px) {
    .topic-container {
        padding: 0 10px;
    }
    .card {
        padding: 15px;
    }
    .author-bar {
        flex-direction: column;
        align-items: flex-start;
    }
    .post-meta {
        margin-left: 0;
    }
    .post-stats {
        flex-wrap: wrap;
    }
}