/* css/blog_styles.css */

/* --- Reset & Base (来自 blog_styles.css，基本不变) --- */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --light-bg: #f8f9fa; /* 或者 #f9f9f9 来自 prototype */
    --dark-text: #212529; /* 或者 #333 来自 prototype */
    --light-text: #6c757d; /* 或者 #555, #777 来自 prototype */
    --border-color: #dee2e6; /* 或者 #ddd, #eee 来自 prototype */
    --card-shadow: 0 4px 12px rgba(0,0,0,0.08); /* 或者 prototype 中的 0 2px 8px rgba(0,0,0,0.08) */
    --font-sans-serif: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    --font-serif: "Georgia", "Times New Roman", serif;
}

body.blog-frontend { 
    font-family: var(--font-sans-serif);
    line-height: 1.7; /* prototype 中是 1.6，这里保留 1.7 */
    color: var(--dark-text);
    background-color: var(--light-bg);
    margin: 0;
    font-size: 16px;
}

a { color: var(--primary-color); text-decoration: none; transition: color 0.2s ease; }
a:hover { text-decoration: underline; color: #0056b3; }
img { max-width: 100%; height: auto; display: block; }
figure { margin: 0 0 1em 0; } 
figcaption { font-size: 0.9em; color: var(--light-text); text-align: center; margin-top: 0.5em; }

.page-container { max-width: 1200px; margin: 20px auto; padding: 0 15px; }
/* .blog-page-container {} */ /* 如果没有特殊样式，可以移除 */

/* --- Navigation (来自 blog_styles.css，基本不变，假设这是项目主导航样式) --- */
.main-nav { background-color: #fff; box-shadow: 0 2px 4px rgba(0,0,0,0.05); padding: 0 20px; position: sticky; top: 0; z-index: 1000; }
.nav-container { max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; height: 60px; }
.logo { font-size: 1.4rem; font-weight: 700; color: var(--dark-text); }
.nav-links { list-style: none; display: flex; margin: 0; padding: 0; }
.nav-links li { margin-left: 20px; }
.nav-links a { color: #555; font-weight: 500; padding: 8px 0; position: relative; font-size: 0.95rem; }
.nav-links a.active, .nav-links a:hover { color: var(--primary-color); }
.menu-toggle { display: none; font-size: 1.5em; cursor: pointer; } /* 移动端显示，来自 prototype */
/* ... (如果需要，从 prototype 中合并更详细的移动端导航切换样式 .nav-links.active 等) ... */


/* --- Blog Header (来自 blog_styles.css, 可根据 prototype 调整颜色) --- */
.blog-header { 
    text-align: center; 
    padding: 40px 20px 50px; 
    /* background: var(--primary-color); color: white;  /* from blog_styles.css */
    background-color: #eef4f7; /* from prototype - 淡蓝色背景 */
    color: var(--dark-text); /* 确保文字颜色在淡背景上可读 */
    margin-bottom: 35px; 
    border-radius: 8px; 
}
.blog-header h1 { 
    font-size: 2.8rem; 
    margin-bottom: 0.5em; 
    font-weight: 700; 
    color: #2c3e50; /* from prototype */
}
.blog-header p { 
    font-size: 1.15rem; 
    /* opacity: 0.9; */ /* from blog_styles.css */
    color: #555; /* from prototype */
}
.blog-header .btn { /* 写文章按钮 */
    margin-top: 10px; 
    background-color: var(--primary-color); 
    color: white; 
    border: 1px solid var(--primary-color);
    padding: 8px 15px;
    border-radius: 4px;
}
.blog-header .btn:hover { 
    background-color: #0056b3; /* 深一点的 primary color */
}

/* --- Main Content Grid (来自 blog_styles.css，但与 prototype 的 flex 布局不同，这里保留 grid) --- */
.blog-main-content { display: grid; grid-template-columns: repeat(12, 1fr); gap: 35px; }
.posts-section { grid-column: span 12; }
.sidebar-section { grid-column: span 12; margin-top: 30px; }
@media (min-width: 992px) { 
    .posts-section { grid-column: span 8; } 
    .sidebar-section { grid-column: span 4; margin-top: 0; } 
}

/* --- Article Cards (主要来自 blog_prototype.css，并与 blog_styles.css 结合) --- */
.section-title { /* "最新发布" 等标题，from prototype */
    font-size: 1.6em;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee; /* var(--border-color) */
    color: var(--dark-text);
}

.post-card { /* 替换 .post-card-item */
    background-color: #fff;
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    margin-bottom: 30px;
    overflow: hidden;
    display: flex;
    flex-direction: column; /* 默认是纵向排列 */
}
.post-card:hover { /* 悬浮效果可以保留 */
    box-shadow: 0 8px 20px rgba(0,0,0,0.1); 
}

.post-card.featured { 
    /* 特殊样式，如果焦点文章需要不同的 flex-direction (prototype 中是 column) */
    /* flex-direction: column; */ /* 已经是 column */
}
.post-card:not(.featured) {
    flex-direction: row; /* 水平排列，图片在左 */
    align-items: flex-start; 
}

.post-image { /* 焦点文章大图 */
    width: 100%;
    height: auto; 
    max-height: 400px;
    object-fit: cover;
    display: block;
}
.post-image-small { /* 列表文章小图 */
    width: 200px; 
    min-width: 200px;
    height: 150px; 
    object-fit: cover;
    margin-right: 20px;
    border-radius: 8px 0 0 8px; 
    display: block;
}

.post-card .post-content { /* 内容区 */
    padding: 25px; /* for featured */
    flex: 1; 
}
.post-card:not(.featured) .post-content {
    padding: 20px;
}

.post-meta { /* 元信息区域 */
    font-size: 0.85em;
    color: var(--light-text, #777);
    margin-bottom: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 15px; /* 之前是 .post-meta-info */
}
.post-meta .post-category a, /* .post-category 是 prototype 中的类，如果 JS 生成了它 */
.post-meta .topic-tag { /* .topic-tag 是你之前 JS 生成的 */
    font-weight: 500;
    color: var(--primary-color);
    /* 以下是你之前的 .topic-tag 样式，可以保留或调整 */
    /* background-color: #e6f2ff; */
    /* padding: 3px 8px; */
    /* border-radius: 4px; */
    /* font-size: 0.8rem; */
}
.post-meta .post-date, .post-meta .post-author {
    /* 按需添加具体样式 */
}
.post-meta .post-meta-item i, /* 之前 .post-meta-info .meta-item i */
.post-meta .action-link i { /* 之前 .post-actions .action-link i */
    margin-right: 6px;
    opacity: 0.7;
}


.post-title { /* 标题 */
    font-size: 1.8em; /* 焦点文章标题 */
    margin-top: 0;
    margin-bottom: 15px;
    line-height: 1.35; /* 来自 blog_styles.css */
}
.post-card:not(.featured) .post-title {
    font-size: 1.4em; /* 列表文章标题 */
}
.post-title a {
    color: var(--dark-text);
    text-decoration: none;
}
.post-title a:hover {
    color: var(--primary-color);
}
/* 文章卡片中推荐星标 (来自 blog_styles.css) */
.post-card .post-title .featured-star-public {
    color: #ffc107; 
    font-size: 0.7em; 
    margin-left: 8px;
    vertical-align: middle; 
}
.post-card.featured-post-card { /* 来自 blog_styles.css，用于后台判断的推荐文章 */
    border-left: 5px solid #ffc107; 
}


.post-excerpt { /* 摘要，来自 prototype */
    color: #555; /* var(--light-text) */
    margin-bottom: 20px;
    font-size: 0.95em;
    line-height: 1.7;
    /* 移除之前的 -webkit-line-clamp，如果需要再加回来 */
}
.post-book-association { /* 关联书籍，来自 blog_styles.css */
    font-size: 0.9em; 
    color: var(--light-text); 
    /* margin-top: -10px; */ /* 调整为与 .post-excerpt 的间距协调 */
    margin-bottom: 15px; 
}
.post-book-association i { margin-right: 5px; }

.read-more { /* "阅读全文" 链接，主要用于焦点文章，来自 prototype */
    display: inline-block;
    font-weight: bold;
    color: var(--primary-color);
    margin-top: 15px; /* 如果摘要内容不多，这个间距可能需要调整 */
}
.read-more:hover {
    text-decoration: none; /* prototype 中无下划线 */
    color: #0056b3;
}

.post-actions { /* 评论数、阅读数等，来自 prototype */
    font-size: 0.9em;
    color: var(--light-text, #777);
    /* margin-top: 15px; */ /* 移到 .post-card-footer 或在 JS 生成时控制 */
    display: flex;
    gap: 15px;
}
.post-actions .action-link {
    color: var(--light-text, #777);
    text-decoration: none;
}
.post-actions .action-link:hover {
    color: var(--primary-color);
    text-decoration: none;
}


/* .post-card-footer (你之前有的，可以看是否与 .post-actions 合并或保留) */
/* 如果保留 .post-card-footer, .post-actions 可以作为其子元素 */
/* 为了与 prototype 对齐，暂时不使用 .post-card-footer */
/* .read-more-link 和 .post-stats 也可以整合到 .post-actions 或 .post-content 中 */


/* --- Article Detail Page (来自 blog_styles.css，基本不变) --- */
.post-detail-container { max-width: 800px; margin: 30px auto; background-color: #fff; padding: 35px 45px; border-radius: 10px; box-shadow: var(--card-shadow); }
.post-detail-header h1 { font-size: 2.5rem; margin-bottom: 15px; color: #2c3e50; line-height: 1.3; font-weight: 700; }
.post-detail-header h1 .featured-star-public { color: #ffc107; font-size: 0.6em; margin-left: 10px; vertical-align: middle; } /* 详情页星标 */
.post-detail-meta { display: flex; flex-wrap: wrap; gap: 10px 25px; color: var(--light-text); font-size: 0.95rem; margin-bottom: 30px; border-bottom: 1px solid var(--border-color); padding-bottom: 20px; }
.post-detail-meta .meta-item i { margin-right: 7px; }
.post-content-area { line-height: 1.8; font-size: 1.1rem; color: var(--dark-text); }
.post-content-area p { margin-bottom: 1.5em; }
.post-content-area h2 { font-size: 1.8rem; margin: 2em 0 1em; } .post-content-area h3 { font-size: 1.5rem; margin: 1.8em 0 0.8em; }
.post-content-area ul, .post-content-area ol { margin-bottom: 1.5em; padding-left: 1.8em; }
.post-content-area li { margin-bottom: 0.5em; }
.post-content-area img { max-width: 100%; height: auto; margin: 25px auto; display:block; border-radius: 8px; box-shadow: 0 3px 10px rgba(0,0,0,0.1); }
.post-content-area blockquote { border-left: 5px solid var(--primary-color); padding: 10px 20px; margin: 25px 0; font-style: italic; color: #444; background-color: #f9f9f9; border-radius: 0 5px 5px 0; }
.post-content-area pre, .post-content-area .ql-syntax { background-color: #2d2d2d; color: #f8f8f2; padding: 20px; border-radius: 5px; overflow-x: auto; font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 0.9em; margin: 25px 0; }
.post-content-area .katex-display { overflow-x: auto; overflow-y: hidden; padding: 0.5em 0; }
.post-associations { margin-top: 35px; padding-top: 25px; border-top: 1px solid var(--border-color); }
.post-associations h4 { font-size: 1.2rem; margin-bottom: 12px; color: #333; font-weight: 600; }
.post-associations .tag-link, .post-associations .book-link { display: inline-block; margin-right: 10px; margin-bottom: 10px; background-color: #e9ecef; color: #495057; padding: 5px 10px; border-radius: 4px; font-size: 0.9em;} /* 统一标签样式 */
.post-associations .tag-link:hover, .post-associations .book-link:hover { background-color: #007bff; color: #fff; text-decoration: none;}

.post-actions-footer { margin-top: 35px; display: flex; justify-content: space-between; align-items: center; padding-top:20px; border-top:1px solid #eee;}
.like-button { background-color: #f0f0f0; color: #555; border: 1px solid #ccc; padding: 10px 18px; border-radius: 25px; cursor: pointer; transition: all 0.2s ease; font-weight: 500; }
.like-button:hover { background-color: #e0e0e0; border-color: #bbb; }
.like-button.liked { background-color: var(--primary-color); color: white; border-color: var(--primary-color); }
.like-button.liked i { animation: pulseLike 0.5s ease; }
@keyframes pulseLike { 0% { transform: scale(1); } 50% { transform: scale(1.2); } 100% { transform: scale(1); } }
.like-button i { margin-right: 7px; }
.edit-post-link { font-size: 0.9rem; color: var(--secondary-color); } .edit-post-link:hover { color: var(--primary-color); }

/* --- Sidebar Widgets (大部分来自 blog_prototype.css, 调整以适应现有变量) --- */
.widget { 
    background-color: #fff; 
    padding: 20px 25px; 
    border-radius: 8px; /* prototype 是 8px, blog_styles 是 10px, 统一为 8px */
    box-shadow: 0 1px 4px rgba(0,0,0,0.05); /* prototype 的阴影更轻 */
    margin-bottom: 25px; /* prototype */
}
.widget-title { 
    font-size: 1.2em; /* prototype */
    font-weight: 600; 
    margin-top: 0; 
    margin-bottom: 15px; /* prototype */
    padding-bottom: 10px; /* prototype */
    border-bottom: 1px solid #eee; /* var(--border-color) */
    color: var(--dark-text); 
}
.widget-list { list-style: none; padding: 0; margin: 0; }
.widget-list li { margin-bottom: 10px; }
.widget-list li a { color: var(--light-text, #555); }
.widget-list li a:hover { color: var(--primary-color); }
.widget-list .count { font-size: 0.9em; color: #aaa; margin-left: 5px; } /* 新增计数样式 */
/* .post-meta-small from prototype - 如果用于热门文章等列表项 */
.post-meta-small { font-size: 0.8em; color: #888; display: block; margin-top: 3px; }

/* 搜索框 from prototype */
.search-form { display: flex; }
.search-form input[type="search"] { 
    flex-grow: 1; padding: 10px; border: 1px solid var(--border-color, #ddd); 
    border-right: none; border-radius: 4px 0 0 4px; outline: none; font-size: 0.95rem;
}
.search-form button { 
    padding: 10px 12px; border: 1px solid var(--primary-color); 
    background-color: var(--primary-color); color: #fff; cursor: pointer; 
    border-radius: 0 4px 4px 0;
}
.search-form button:hover { background-color: #0056b3; }

/* 标签云 from prototype - 如果你的 topic widget 也用这种形式 */
.tag-cloud .tag { /* prototype 中用 .tag, 你的是 .topic-tag */
    display: inline-block; background-color: #e9ecef; color: #495057; 
    padding: 5px 10px; margin-right: 5px; margin-bottom: 5px; 
    border-radius: 4px; font-size: 0.9em;
}
.tag-cloud .tag:hover { background-color: var(--primary-color); color: #fff; text-decoration: none;}


/* --- Pagination (来自 blog_prototype.css，可根据需要调整样式) --- */
.pagination-nav { /* ID=blogPaginationContainer 的容器 */
    text-align: center;
    margin-top: 40px;
    margin-bottom: 20px;
}
.pagination-nav ul { list-style: none; padding: 0; display: flex; justify-content: center; flex-wrap: wrap;}
.pagination-nav .page-item { margin: 0 4px; }
.pagination-nav .page-link {
    display: inline-block;
    padding: 8px 12px;
    border: 1px solid var(--border-color, #ddd);
    color: var(--light-text, #555);
    border-radius: 4px;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.pagination-nav .page-item.active .page-link,
.pagination-nav .page-link:hover {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    text-decoration: none;
}
.pagination-nav .page-item.disabled .page-link {
    color: #aaa;
    pointer-events: none;
    background-color: #f9f9f9;
}


/* --- Loading & Error Placeholders (来自 blog_styles.css) --- */
.loading-placeholder { text-align: center; padding: 50px 20px; font-style: italic; color: var(--light-text); font-size: 1.1rem; }
.loading-placeholder.small { font-size: 0.9em; padding: 25px; }
.error-message { color: #d9534f; background-color: #fdf7f7; border: 1px solid #f5c6cb; padding: 15px; border-radius: 5px; text-align: center; }

/* --- Footer (来自 blog_styles.css，与 prototype 的深色页脚不同，保留你现有的) --- */
.main-footer { 
    text-align: center; 
    padding: 30px 20px; 
    background-color: #2c3e50; /* prototype 中是 #343a40，选择一个或用变量 */
    color: #adb5bd; /* prototype */
    margin-top: 50px; 
    font-size: 0.9rem; 
}

/* --- Utility Buttons (来自 blog_styles.css) --- */
.btn { /* 通用按钮，如果你的“写新文章”等用到了 */
    display: inline-block;
    padding: 8px 16px; /* 调整为与 prototype 协调 */
    border-radius: 4px; /* 调整为与 prototype 协调 */
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.btn-primary { /* 如“写新文章”按钮 */
    background-color: var(--primary-color);
    color: white;
    border: 1px solid var(--primary-color);
}
.btn-primary:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}
.btn-outline-secondary {
    color: var(--secondary-color);
    border: 1px solid var(--secondary-color);
    background-color: transparent;
}
.btn-outline-secondary:hover {
    color: #fff;
    background-color: var(--secondary-color);
}
.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 0.2rem;
}

/* --- Responsive (基本框架来自 prototype, 细化调整) --- */
@media (max-width: 850px) { /* prototype 的断点 */
    /* 导航栏响应式 */
    .nav-links {
        display: none; 
        flex-direction: column; position: absolute;
        top: 60px; /* 导航栏高度 */
        left: 0; width: 100%;
        background-color: #fff; box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    }
    .nav-links.active { display: flex; }
    .nav-links li { margin: 0; text-align: center; border-bottom: 1px solid #f0f0f0; }
    .nav-links li:last-child { border-bottom: none; }
    .nav-links a { display: block; padding: 15px; }
    .menu-toggle { display: block; }

    /* 主内容区响应式 */
    .blog-main-content {
        grid-template-columns: 1fr; /* 单列布局 */
    }
    .sidebar-section {
        grid-column: span 1; /* 占满整行 */
        margin-top: 30px;
    }
    .posts-section {
        grid-column: span 1; /* 占满整行 */
    }
    
    /* 卡片在小屏幕上的调整已在 .post-card:not(.featured) 和 .post-image-small 的 @media 中处理 */
}

@media (max-width: 768px) { /* blog_styles.css 已有的断点，可以合并或调整 */
    .blog-header h1 { font-size: 2rem; }
    .blog-header p { font-size: 1rem; }
    .post-detail-header h1 { font-size: 1.8rem; }
    .post-content-area { font-size: 1rem; }
    /* .form-row { flex-direction: column; gap: 0; } /* 这个是表单的，与博客列表无关 */
}