/* 王富贵个人博客 - 白色简约风格 */

:root {
    --primary-color: #333;
    --secondary-color: #666;
    --light-color: #999;
    --border-color: #eee;
    --bg-color: #fff;
    --bg-light: #f9f9f9;
    --accent-color: #007bff;
    --success-color: #28a745;
    --error-color: #dc3545;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--primary-color);
    background-color: var(--bg-color);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-color);
}

.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 30px;
}

/* Header */
.header {
    border-bottom: 1px solid var(--border-color);
    padding: 20px 0;
    margin-bottom: 40px;
    position: sticky;
    top: 0;
    background: var(--bg-color);
    z-index: 100;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-img {
    height: 36px;
    width: auto;
    border-radius: 6px;
}

.logo-text {
    display: inline-block;
}

@media (max-width: 768px) {
    .logo-img {
        height: 30px;
    }
    .logo-text {
        display: none;
    }
}

.nav {
    display: flex;
    gap: 8px;
}

.nav a {
    color: var(--secondary-color);
    font-size: 15px;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s;
}

.nav a:hover {
    color: var(--primary-color);
    background: #f5f5f5;
}

.nav a.active {
    color: var(--primary-color);
    background: transparent;
    font-weight: 600;
    border-bottom: 2px solid var(--primary-color);
    border-radius: 0;
    padding-bottom: 4px;
}

/* Main Content */
.main {
    min-height: calc(100vh - 200px);
    padding-bottom: 60px;
}

/* Article List */
.article-list {
    list-style: none;
}

.article-item {
    padding: 30px 0;
    border-bottom: 1px solid var(--border-color);
}

.article-item:first-child {
    padding-top: 0;
}

.article-title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 10px;
    line-height: 1.4;
}

.article-title a:hover {
    color: var(--accent-color);
}

.article-meta {
    color: var(--light-color);
    font-size: 14px;
    margin-bottom: 12px;
}

.article-meta span {
    margin-right: 15px;
}

.article-summary {
    color: var(--secondary-color);
    font-size: 15px;
    line-height: 1.7;
}

.article-top {
    display: inline-block;
    background: var(--accent-color);
    color: #fff;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 3px;
    margin-right: 8px;
}

/* Article Detail */
.article-header {
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.article-header h1 {
    font-size: 32px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 15px;
}

.article-content {
    font-size: 16px;
    line-height: 1.8;
    color: var(--primary-color);
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
    margin: 30px 0 15px;
    font-weight: 600;
}

.article-content h2 {
    font-size: 24px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.article-content h3 {
    font-size: 20px;
}

.article-content p {
    margin-bottom: 16px;
}

.article-content img {
    max-width: 100%;
    height: auto;
    margin: 20px 0;
    border-radius: 4px;
}

.article-content pre {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 16px;
    overflow-x: auto;
    margin: 20px 0;
    font-size: 14px;
    line-height: 1.5;
}

.article-content code {
    background: var(--bg-light);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 14px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.article-content pre code {
    background: none;
    padding: 0;
}

.article-content blockquote {
    border-left: 3px solid var(--primary-color);
    padding: 15px 20px;
    margin: 20px 0;
    color: var(--secondary-color);
    font-style: italic;
    background: var(--bg-light);
}

.article-content ul,
.article-content ol {
    margin: 16px 0;
    padding-left: 24px;
}

.article-content li {
    margin-bottom: 8px;
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.article-content table td,
.article-content table th {
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    font-size: 14px;
}

.article-content table tr:nth-child(even) {
    background: var(--bg-light);
}

/* 关于我页面 */
.about-page .article-header {
    text-align: center;
    border-bottom: none;
    margin-bottom: 30px;
}

.about-page .article-header h1 {
    font-size: 26px;
}

.about-page .article-content h2 {
    font-size: 18px;
    margin-top: 35px;
    padding-bottom: 8px;
}

.about-page .article-content h3 {
    font-size: 15px;
    margin: 20px 0 12px;
}

.about-page .article-content p {
    font-size: 14px;
    line-height: 1.8;
}

.about-page .article-content ul {
    font-size: 14px;
}

.about-page .article-content li {
    margin-bottom: 6px;
}

.article-content th,
.article-content td {
    border: 1px solid var(--border-color);
    padding: 12px;
    text-align: left;
}

.article-content th {
    background: var(--bg-light);
    font-weight: 600;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
}

.pagination a,
.pagination span {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}

.pagination a:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.pagination .current {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.pagination .disabled {
    color: var(--light-color);
    cursor: not-allowed;
}

/* Messages / Guestbook */
.message-form {
    padding: 25px 0;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}

.message-form h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--light-color);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
    background: #fff;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
}

.btn {
    display: inline-block;
    padding: 10px 24px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn:hover {
    background: #444;
}

.btn:disabled {
    background: var(--light-color);
    cursor: not-allowed;
}

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

.message-item {
    padding: 20px 0;
    border-bottom: 1px dashed var(--border-color);
}

.message-item:last-child {
    border-bottom: none;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.message-author {
    font-weight: 600;
    font-size: 14px;
    color: var(--primary-color);
}

.message-location {
    font-size: 12px;
    color: var(--light-color);
}

.message-time {
    color: var(--light-color);
    font-size: 12px;
    margin-left: auto;
}

.message-content {
    color: var(--secondary-color);
    font-size: 14px;
    line-height: 1.7;
}

.message-reply {
    margin-top: 12px;
    padding: 12px 15px;
    background: var(--bg-light);
    border-left: 3px solid var(--primary-color);
    font-size: 13px;
}

.message-reply-label {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 12px;
    margin-bottom: 6px;
}

/* Alert */
.alert {
    padding: 15px 20px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* 菜单博主卡片 - 电脑端隐藏 */
.nav-author-card {
    display: none;
}

/* Footer */
.footer {
    border-top: 2px solid var(--border-color);
    padding: 40px 0 30px;
    text-align: center;
    color: var(--light-color);
    font-size: 13px;
}

.footer p {
    margin: 0;
    color: #bbb;
}

.footer-links {
    margin: 15px 0;
}

.footer-links a {
    color: var(--secondary-color);
    font-size: 13px;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--primary-color);
}

.footer-links .sep {
    margin: 0 12px;
    color: #ddd;
}

/* Category Badge */
.category-badge {
    display: inline-block;
    background: var(--bg-light);
    color: var(--secondary-color);
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 20px;
    margin-right: 10px;
}

/* Page Title */
.page-title {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 10px;
}

.page-description {
    color: var(--secondary-color);
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--light-color);
}

.empty-state p {
    font-size: 16px;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--light-color);
}

/* ========== 首页Hero区域 ========== */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 50px 40px;
    border-radius: 16px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 40px;
}

.hero-content h1 {
    font-size: 32px;
    margin-bottom: 8px;
}

.hero-content > p {
    font-size: 16px;
    opacity: 0.9;
    margin-bottom: 15px;
}

.hero-desc {
    font-size: 14px !important;
    opacity: 0.8 !important;
    line-height: 1.7;
    max-width: 500px;
}

.hero-stats {
    display: flex;
    gap: 30px;
}

.stat-item {
    text-align: center;
    background: rgba(255,255,255,0.15);
    padding: 20px 25px;
    border-radius: 12px;
}

.stat-num {
    display: block;
    font-size: 28px;
    font-weight: 700;
}

.stat-label {
    font-size: 13px;
    opacity: 0.8;
}

/* ========== 分类入口卡片 ========== */
.category-cards {
    display: flex;
    gap: 15px;
    margin-bottom: 35px;
}

.category-card {
    flex: 1;
    background: var(--bg-light);
    padding: 25px 20px;
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.category-card:hover {
    border-color: var(--accent-color);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

.cat-icon {
    display: block;
    font-size: 32px;
    margin-bottom: 10px;
}

.cat-name {
    display: block;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.cat-count {
    font-size: 13px;
    color: var(--light-color);
}

/* ========== 分类Tab切换区 ========== */
.category-tabs-wrapper {
    margin-bottom: 30px;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.category-tabs {
    display: flex;
    gap: 25px;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.tab-btn {
    padding: 0;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 500;
    color: var(--light-color);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
}

.tab-icon {
    width: 16px;
    height: 16px;
    opacity: 0.6;
}

.tab-btn.active .tab-icon {
    opacity: 1;
}

.tab-btn:hover {
    color: var(--secondary-color);
}

.tab-btn.active {
    color: var(--primary-color);
    font-weight: 600;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -13px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.tab-article-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tab-article-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px dashed #eee;
}

.tab-article-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.tab-article-list li:first-child {
    padding-top: 0;
}

.tab-num {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: #999;
    background: #f5f5f5;
    border-radius: 4px;
}

.tab-article-list li:nth-child(1) .tab-num {
    background: var(--primary-color);
    color: #fff;
}

.tab-article-list li:nth-child(2) .tab-num {
    background: #666;
    color: #fff;
}

.tab-article-list li:nth-child(3) .tab-num {
    background: #999;
    color: #fff;
}

.tab-article-list a {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: var(--primary-color);
    transition: color 0.2s;
    min-width: 0;
}

.tab-article-list a:hover {
    color: var(--accent-color);
}

.tab-article-list a span:first-child {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 15px;
}

.tab-date {
    font-size: 12px;
    color: var(--light-color);
    flex-shrink: 0;
    text-align: right;
}

.tab-more {
    display: inline-block;
    margin-top: 12px;
    font-size: 13px;
    color: var(--light-color);
}

.tab-more:hover {
    color: var(--accent-color);
}

.tab-empty {
    text-align: center;
    padding: 25px 20px;
    color: var(--light-color);
    font-size: 14px;
}

/* ========== 分类颜色标识 ========== */
.category-badge.category-1 { /* 资讯分享 */
    background: #f5f5f5;
    color: #333;
}

.category-badge.category-2 { /* 闲言碎语 */
    background: #f5f5f5;
    color: #666;
}

.category-badge.category-3 { /* 每日晨报 */
    background: #333;
    color: #fff;
}

.category-badge.category-4 { /* 深度解读 */
    background: #f5f5f5;
    color: #333;
}

/* 置顶文章 */
.article-card.is-top {
    background: transparent;
}

/* ========== 首页双栏布局 ========== */
.home-layout {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

.main-content {
    flex: 1;
    min-width: 0;
    min-height: 60vh;
}

.section-header {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.section-header h2 {
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-icon {
    width: 22px;
    height: 22px;
}

.page-icon {
    width: 28px;
    height: 28px;
    vertical-align: middle;
}

.about-icon {
    width: 22px;
    height: 22px;
    vertical-align: middle;
    margin-right: 4px;
}

/* ========== 文章卡片 ========== */
.article-cards {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.article-card {
    background: #fff;
    padding: 20px 0;
    position: relative;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s;
}

.article-card:first-child {
    padding-top: 0;
}

.article-card:last-child {
    border-bottom: none;
}

.article-card:hover .article-title a {
    color: var(--accent-color);
}

.article-card .article-top {
    display: inline-block;
    background: #ff6b6b;
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 3px;
    margin-right: 8px;
    vertical-align: middle;
}

.article-card .article-title {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.5;
}

.article-card .article-title a {
    color: var(--primary-color);
    transition: color 0.2s;
}

.article-card .article-summary {
    font-size: 14px;
    color: var(--secondary-color);
    margin-bottom: 12px;
    line-height: 1.7;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-card .article-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--light-color);
}

.article-card .article-meta span {
    margin-right: 0;
}


/* ========== 侧边栏 ========== */
.sidebar {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: 100px;
    align-self: flex-start;
}

.sidebar-widget {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
}

.widget-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

.widget-header h3 {
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    color: var(--primary-color);
}

.widget-icon {
    width: 18px;
    height: 18px;
}

.widget-body {
    padding: 20px;
}

/* 关于博主 */
.about-me {
    text-align: center;
}

.about-me .avatar {
    font-size: 50px;
    margin-bottom: 10px;
}

.about-me .avatar-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 12px;
}

.about-me h4 .name-en {
    font-size: 12px;
    font-weight: normal;
    color: var(--light-color);
}

.about-me .identity {
    font-size: 12px;
    color: var(--accent-color);
    margin-bottom: 10px;
    font-weight: 500;
}

.about-me h4 {
    font-size: 18px;
    margin-bottom: 10px;
}

.about-me p {
    font-size: 13px;
    color: var(--secondary-color);
    line-height: 1.7;
    margin-bottom: 15px;
}

.blog-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 15px;
    padding: 15px 0;
    border-top: 1px dashed var(--border-color);
    border-bottom: 1px dashed var(--border-color);
}

.blog-stat {
    text-align: center;
    font-size: 12px;
    color: var(--light-color);
}

.blog-stat span {
    display: block;
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 2px;
}

.btn-small {
    display: inline-block;
    padding: 8px 20px;
    background: var(--accent-color);
    color: #fff !important;
    border-radius: 20px;
    font-size: 13px;
    transition: background 0.2s;
}

.btn-small:hover {
    background: #0056b3;
}

/* 最新日记列表 */
.diary-preview-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.diary-preview-list li {
    padding: 10px 0;
    border-bottom: 1px dashed var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.diary-preview-list li:last-child {
    border-bottom: none;
}

.diary-preview-list .diary-emoji {
    font-size: 16px;
}

.diary-preview-list .diary-text {
    font-size: 13px;
    color: var(--secondary-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hot-rank {
    position: absolute;
    left: 0;
    top: 12px;
    width: 20px;
    height: 20px;
    background: var(--accent-color);
    color: #fff;
    font-size: 12px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hot-list li:nth-child(1) .hot-rank { background: #ff6b6b; }
.hot-list li:nth-child(2) .hot-rank { background: #ffa94d; }
.hot-list li:nth-child(3) .hot-rank { background: #ffd43b; color: #333; }

.hot-list a {
    font-size: 14px;
    line-height: 1.5;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hot-views {
    display: block;
    font-size: 12px;
    color: var(--light-color);
    margin-top: 3px;
}

/* 最新留言预览 */
.message-preview-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.message-preview-list li {
    padding: 12px 0;
    border-bottom: 1px dashed var(--border-color);
}

.message-preview-list li:last-child {
    border-bottom: none;
}

.message-preview-list strong {
    font-size: 14px;
    color: var(--primary-color);
}

.message-preview-list p {
    font-size: 13px;
    color: var(--secondary-color);
    margin: 5px 0 0;
    line-height: 1.5;
}

.view-all {
    display: block;
    text-align: center;
    padding-top: 10px;
    font-size: 13px;
    color: var(--accent-color);
}

.empty-tip {
    font-size: 14px;
    color: var(--light-color);
    text-align: center;
}

/* ========== 响应式 ========== */
@media (max-width: 960px) {
    .home-layout {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 15px 0;
    }
    
    .header .container {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav {
        display: flex;
        flex-wrap: nowrap;
        gap: 5px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        width: 100%;
    }
    
    .nav::-webkit-scrollbar {
        display: none;
    }
    
    .nav a {
        flex-shrink: 0;
        white-space: nowrap;
        font-size: 13px;
        padding: 8px 10px;
    }
    
    .nav a.active {
        background: #1a73e8;
        color: #fff;
    }
    
    .hero {
        flex-direction: column;
        text-align: center;
        padding: 35px 25px;
    }
    
    .hero-content h1 {
        font-size: 26px;
    }
    
    .hero-stats {
        width: 100%;
        justify-content: center;
    }
    
    .stat-item {
        padding: 15px 20px;
    }
    
    .category-cards {
        flex-wrap: wrap;
    }
    
    .category-card {
        min-width: calc(50% - 10px);
    }
    
    .article-header h1 {
        font-size: 26px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .article-title {
        font-size: 20px;
    }
}

/* Footer Stats */
.footer-stats {
    margin-bottom: 10px;
    font-size: 14px;
    color: var(--light-color);
}

.footer-stats span {
    margin: 0 15px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.footer-icon {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

.footer-stats strong {
    color: var(--secondary-color);
    font-weight: 600;
}

/* 留言地理位置 */
.message-location {
    color: #888;
    font-size: 12px;
    margin-left: 10px;
}

/* 修复留言头部布局 */
.message-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.message-header .message-time {
    margin-left: auto;
}

/* ========== 汉堡菜单 ========== */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    z-index: 200;
}

.menu-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--primary-color);
    border-radius: 2px;
    transition: all 0.3s;
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ========== 返回顶部按钮 ========== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    background: #1a73e8;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.3);
    z-index: 99;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: #1557b0;
    transform: translateY(-3px);
}

/* ========== 手机端优化 ========== */
@media (max-width: 768px) {
    /* Tab切换区手机端优化 */
    .category-tabs-wrapper {
        margin-bottom: 25px;
    }
    
    .category-tabs {
        gap: 20px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .category-tabs::-webkit-scrollbar {
        display: none;
    }
    
    .tab-btn {
        font-size: 13px;
        white-space: nowrap;
    }
    
    .tab-btn.active::after {
        bottom: -13px;
    }
    
    
    .tab-article-list li {
        padding: 8px 0;
    }
    
    .tab-article-list a {
        font-size: 13px;
    }
    
    /* 文章卡片手机端 */
    .article-card {
        padding: 15px 0;
    }
    
    .article-card .article-title {
        font-size: 15px;
    }
    
    .article-card .article-summary {
        font-size: 13px;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }
    
    .article-card .article-meta {
        font-size: 12px;
        gap: 8px;
    }
    
    .article-card.is-top {
        margin: 0;
        padding: 15px 0;
        background: transparent;
    }
    
    /* 分类颜色标识手机端 */
    .category-badge.category-1,
    .category-badge.category-2,
    .category-badge.category-3,
    .category-badge.category-4 {
        font-size: 11px;
        padding: 2px 8px;
    }
    
    /* 汉堡菜单显示 */
    .menu-toggle {
        display: flex;
    }
    
    .header {
        padding: 12px 0;
        margin-bottom: 20px;
    }
    
    .header .container {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    /* 导航菜单 - 右侧抽屉式 */
    .nav {
        position: fixed;
        top: 0;
        right: -200px;
        width: 200px;
        height: 100vh;
        background: #fff;
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        gap: 0;
        transition: right 0.3s ease;
        z-index: 150;
        padding-top: 60px;
        border-left: 1px solid var(--border-color);
    }
    
    .nav.open {
        right: 0;
    }
    
    .nav a {
        font-size: 14px;
        font-weight: 500;
        padding: 14px 18px;
        color: var(--primary-color);
        border-bottom: 1px solid var(--border-color);
        border-radius: 0;
    }
    
    .nav a:hover {
        background: #f8f8f8;
    }
    
    .nav a.active {
        background: var(--primary-color);
        color: #fff;
        border-radius: 0;
    }
    
    /* 菜单底部博主卡片 */
    .nav-author-card {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 20px;
        margin-top: auto;
        border-top: 1px solid var(--border-color);
    }
    
    .nav-avatar {
        width: 45px;
        height: 45px;
        border-radius: 50%;
        object-fit: cover;
    }
    
    .nav-author-info {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }
    
    .nav-author-name {
        font-size: 14px;
        font-weight: 600;
        color: var(--primary-color);
    }
    
    .nav-author-status {
        font-size: 12px;
        color: var(--secondary-color);
    }
    
    /* 容器边距 */
    .container {
        padding: 0 15px;
    }
    
    
    /* 文章详情页优化 */
    .article-header h1 {
        font-size: 22px;
        line-height: 1.4;
    }
    
    .article-content {
        font-size: 16px;
        line-height: 1.8;
    }
    
    .article-content h2 {
        font-size: 20px;
        margin: 25px 0 12px;
    }
    
    .article-content h3 {
        font-size: 18px;
    }
    
    .article-content p {
        margin-bottom: 15px;
    }
    
    /* Hero区域 */
    .hero {
        flex-direction: column;
        text-align: center;
        padding: 30px 20px;
        border-radius: 12px;
        margin-bottom: 20px;
    }
    
    .hero-content h1 {
        font-size: 22px;
    }
    
    .hero-content > p {
        font-size: 14px;
    }
    
    .hero-stats {
        width: 100%;
        justify-content: center;
        gap: 15px;
    }
    
    .stat-item {
        padding: 12px 18px;
    }
    
    .stat-num {
        font-size: 22px;
    }
    
    /* 分类卡片 */
    .category-cards {
        gap: 10px;
        margin-bottom: 25px;
    }
    
    .category-card {
        min-width: calc(50% - 5px);
        padding: 18px 12px;
        border-radius: 10px;
    }
    
    .cat-icon {
        font-size: 26px;
    }
    
    .cat-name {
        font-size: 14px;
    }
    
    /* 手机端隐藏侧边栏 */
    .sidebar {
        display: none;
    }
    
    
    /* 返回顶部按钮位置 */
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    /* 表单优化 */
    .message-form {
        padding: 20px;
        border-radius: 10px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    /* 页面标题 */
    .page-title {
        font-size: 22px;
    }
    
    /* 分页 */
    .pagination {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .pagination a,
    .pagination span {
        padding: 6px 12px;
        font-size: 13px;
    }
}

/* ========== 移动端自适应优化 ========== */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    /* 文章内容区域 */
    .article-content {
        overflow-x: hidden;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .article-content img {
        max-width: 100%;
        height: auto;
    }
    
    .article-content pre {
        overflow-x: auto;
        max-width: 100%;
        font-size: 13px;
    }
    
    .article-content table {
        display: block;
        overflow-x: auto;
        max-width: 100%;
        font-size: 14px;
    }
    
    .article-content blockquote {
        margin-left: 0;
        margin-right: 0;
        padding: 12px 15px;
    }
    
    /* 文章标题 */
    .article-header h1 {
        font-size: 22px;
        line-height: 1.4;
    }
    
    /* 侧边栏 */
    .sidebar {
        padding: 15px;
    }
    
    /* 返回顶部按钮 */
    .back-to-top {
        bottom: 20px;
        right: 15px;
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 12px;
    }
    
    .article-header h1 {
        font-size: 20px;
    }
    
    .article-content {
        font-size: 15px;
    }
    
    .article-content h2 {
        font-size: 18px;
    }
    
    .article-content h3 {
        font-size: 16px;
    }
}

/* ========== 首页移动端优化 ========== */
@media (max-width: 768px) {
    .home-layout {
        flex-direction: column;
        gap: 25px;
    }
    
    .main-content {
        width: 100%;
    }
    
    .sidebar {
        width: 100%;
        order: 2;
    }
    
    .article-card {
        padding: 15px 0;
    }
    
    .article-card .article-title {
        font-size: 16px;
    }
    
    .article-card .article-summary {
        font-size: 13px;
        -webkit-line-clamp: 2;
    }
    
    .article-card .article-meta {
        flex-wrap: wrap;
        gap: 8px;
        font-size: 12px;
    }
    
    .section-header h2 {
        font-size: 18px;
    }
    
    /* Hero区域 */
    .hero {
        padding: 25px 15px;
        margin: 0 -15px 25px;
        border-radius: 0;
    }
    
    .hero-content h1 {
        font-size: 22px;
    }
    
    .hero-stats {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .stat-item {
        padding: 10px 15px;
        min-width: calc(50% - 5px);
    }
}

@media (max-width: 480px) {
    .article-card .article-title {
        font-size: 15px;
    }
    
    .article-card .article-summary {
        font-size: 13px;
        -webkit-line-clamp: 2;
    }
    
    .hero-content h1 {
        font-size: 20px;
    }
    
    .stat-item {
        min-width: 100%;
    }
}

/* ========== 修复移动端内容溢出 ========== */
@media (max-width: 768px) {
    /* 防止内容溢出 */
    body {
        overflow-x: hidden;
    }
    
    .article-card .article-title,
    .article-card .article-summary,
    .tab-article-list a {
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: normal;
    }
    
    /* Tab文章列表 */
    .tab-article-list a span:first-child {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: calc(100vw - 100px);
    }
    
    /* 分类Tab区域 */
    .category-tabs-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .category-tabs {
        white-space: nowrap;
    }
    
    /* 侧边栏卡片 */
    .sidebar-card {
        overflow: hidden;
    }
}

/* ========== 强制修复移动端溢出 ========== */
@media (max-width: 768px) {
    /* 侧边栏改为100%宽度 */
    .sidebar {
        width: 100% !important;
        position: relative !important;
        top: 0 !important;
    }
    
    /* 防止任何元素溢出 */
    .container,
    .main-content,
    .sidebar,
    .sidebar-widget,
    .article-card,
    .tab-article-list {
        max-width: 100% !important;
        overflow: hidden;
    }
    
    /* 文章标题和摘要强制换行 */
    .article-card .article-title,
    .article-card .article-summary {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Tab列表文章标题 */
    .tab-article-list a {
        max-width: calc(100% - 40px);
        overflow: hidden;
    }
    
    .tab-article-list a span:first-child {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* ========== 修复文章摘要溢出 ========== */
@media (max-width: 768px) {
    .article-card .article-summary {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
        word-break: break-all;
    }
    
    .article-card .article-title {
        word-break: break-all;
    }
    
    /* 确保所有文字不溢出 */
    * {
        word-wrap: break-word;
    }
}

/* ========== 最终修复文章卡片溢出 ========== */
@media (max-width: 768px) {
    .article-cards,
    .article-card {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .article-card .article-summary {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        text-overflow: ellipsis;
        word-break: break-word;
        hyphens: auto;
    }
    
    .article-card .article-title {
        width: 100%;
        max-width: 100%;
        word-break: break-word;
    }
    
    .article-card .article-title a {
        display: block;
        width: 100%;
    }
}

/* ========== 彻底修复文章摘要溢出 ========== */
@media (max-width: 768px) {
    .main-content {
        overflow: hidden;
        width: calc(100vw - 30px);
        max-width: calc(100vw - 30px);
    }
    
    .article-card {
        width: 100%;
        max-width: calc(100vw - 30px);
        overflow: hidden;
    }
    
    .article-card .article-summary {
        width: calc(100vw - 60px);
        max-width: calc(100vw - 60px);
    }
}

@media (max-width: 480px) {
    .main-content {
        width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
    }
    
    .article-card {
        max-width: calc(100vw - 24px);
    }
    
    .article-card .article-summary {
        width: calc(100vw - 48px);
        max-width: calc(100vw - 48px);
    }
}

/* ========== 根治文章摘要溢出 ========== */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        width: 100%;
    }
    
    .article-card-body {
        width: 100%;
        overflow: hidden;
    }
    
    .article-card .article-summary {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* ========== 强制修复文章摘要溢出 ========== */
@media (max-width: 768px) {
    .article-card .article-summary {
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: normal !important;
        word-break: break-all !important;
        max-width: calc(100vw - 30px) !important;
    }
    
    .article-card .article-title {
        word-break: break-all !important;
        max-width: calc(100vw - 30px) !important;
    }
    
    .article-card-body {
        max-width: calc(100vw - 30px) !important;
        overflow: hidden !important;
    }
}

/* ========== 2026-02-03 最终修复 ========== */
@media (max-width: 768px) {
    /* Tab列表标题截断 */
    .tab-article-list li {
        max-width: 100%;
        overflow: hidden;
    }
    
    .tab-article-list a {
        display: flex;
        max-width: calc(100% - 35px);
        overflow: hidden;
    }
    
    .tab-article-list a span:first-child {
        flex: 1;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: block;
    }
    
    /* 文章卡片摘要截断 */
    .article-card .article-summary {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: normal;
        word-break: break-word;
    }
    
    /* 文章标题截断 */
    .article-card .article-title {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .article-card .article-title a {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* ========== 2026-02-03 彻底修复溢出 ========== */
@media (max-width: 768px) {
    /* Tab列表 */
    .tab-article-list li {
        max-width: 100%;
    }
    
    .tab-article-list a {
        flex: 1;
        min-width: 0;
        overflow: hidden;
    }
    
    .tab-article-list a span:first-child {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    /* 文章摘要 */
    .article-card .article-summary {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
}

/* ========== 修复移动端菜单 ========== */
@media (max-width: 768px) {
    /* 菜单关闭按钮固定在顶部 */
    .nav::before {
        content: '✕';
        position: absolute;
        top: 15px;
        right: 15px;
        font-size: 20px;
        color: var(--secondary-color);
        cursor: pointer;
        z-index: 200;
    }
    
    /* 菜单内容可滚动 */
    .nav {
        overflow-y: auto;
        padding-bottom: 100px;
    }
    
    /* 博主卡片固定在底部 */
    .nav-author-card {
        position: fixed;
        bottom: 0;
        right: 0;
        width: 200px;
        background: #fff;
        border-top: 1px solid var(--border-color);
        z-index: 160;
    }
    
    /* 菜单打开时显示遮罩 */
    .nav-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.3);
        z-index: 140;
    }
    
    .nav-overlay.show {
        display: block;
    }
}

/* ========== 修复移动端菜单问题 ========== */
@media (max-width: 768px) {
    /* 移除CSS伪元素关闭按钮 */
    .nav::before {
        display: none !important;
        content: none !important;
    }
    
    /* 博主卡片跟随侧边栏，固定在底部 */
    .nav-author-card {
        position: absolute !important;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100% !important;
        background: #fff;
        z-index: 160;
    }
    
    /* 菜单内容区域留出底部空间 */
    .nav {
        padding-bottom: 100px;
    }
}

/* ========== 侧边栏打开时锁定滚动 + 博主卡片间距 ========== */
@media (max-width: 768px) {
    /* 菜单打开时锁定body滚动 */
    body.menu-open {
        overflow: hidden !important;
        position: fixed;
        width: 100%;
    }
    
    /* 博主卡片紧贴菜单项 */
    .nav-author-card {
        position: relative !important;
        margin-top: 20px;
        bottom: auto;
    }
    
    /* 减少菜单底部padding */
    .nav {
        padding-bottom: 20px;
    }
}

/* ========== 侧边栏高度自适应 + 卡片底部对齐 ========== */
@media (max-width: 768px) {
    /* 侧边栏高度自适应屏幕 */
    .nav {
        height: 100vh;
        height: 100dvh; /* 动态视口高度，兼容移动端 */
        display: flex;
        flex-direction: column;
        padding-bottom: 0;
    }
    
    /* 菜单链接区域 */
    .nav > a {
        flex-shrink: 0;
    }
    
    /* 博主卡片固定在底部，和侧边栏底部一平 */
    .nav-author-card {
        margin-top: auto !important;
        position: relative !important;
        bottom: 0;
        flex-shrink: 0;
    }
}

/* ========== 侧边栏高度自适应 + 卡片底部对齐 ========== */
@media (max-width: 768px) {
    /* 侧边栏高度自适应屏幕 */
    .nav {
        height: 100vh;
        height: 100dvh;
        display: flex;
        flex-direction: column;
        padding-bottom: 0;
    }
    
    /* 博主卡片固定在底部 */
    .nav-author-card {
        margin-top: auto !important;
        position: relative !important;
        flex-shrink: 0;
    }
}
