/* 全局重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Microsoft YaHei", Arial, sans-serif;
}

body {
    background-color: #fff;
    color: #333;
    line-height: 1.6;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部：保持原有正常样式 */
.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid #eee;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.header-title h1 {
    font-size: 1.8rem;
    font-weight: 500;
    color: #444;
}

.header-nav {
    display: flex;
    align-items: center;
}

.header-nav a {
    margin-left: 20px;
    text-decoration: none;
    color: #666;
    font-size: 0.9rem;
}

.header-nav a:hover {
    color: #000;
    text-decoration: underline;
}

/* 搜索框样式 */
.header-search {
    display: flex;
    align-items: center;
}

.header-search input {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
    font-size: 0.9rem;
    width: 200px;
}

.header-search button {
    padding: 6px 12px;
    background-color: #333;
    color: #fff;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 0.9rem;
}

/* 提示消息 */
.flash-messages {
    padding: 10px;
    background-color: #f0f9ff;
    border: 1px solid #e0f0ff;
    border-radius: 4px;
    margin-bottom: 20px;
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
}

.flash-messages p {
    color: #2d7d9a;
    font-size: 0.9rem;
}

/* 主内容区 */
.main-container {
    min-height: 80vh;
    padding: 10px 0;
}

/* 首页博客列表：加宽到1100px */
.posts-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 1100px;
    margin: 0 auto;
}

.post-card {
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 4px;
    transition: box-shadow 0.2s;
    width: 100%;
}

.post-card:hover {
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.post-title {
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.post-title a {
    text-decoration: none;
    color: #333;
}

.post-title a:hover {
    color: #000;
    text-decoration: underline;
}

.post-meta {
    font-size: 0.8rem;
    color: #999;
    margin-bottom: 8px;
}

.post-excerpt {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.5;
}

.no-posts {
    text-align: center;
    padding: 30px;
    color: #999;
    font-size: 0.9rem;
    max-width: 1100px;
    margin: 0 auto;
}

/* 关于我页面：加宽到1100px */
.about-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 10px 0;
    width: 100%;
}

.about-container h2 {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 20px;
    color: #444;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.about-content {
    font-size: 1rem;
    line-height: 1.8;
    color: #555;
    width: 100%;
}

/* 博客详情页：加宽到1100px + Markdown元素样式 */
.post-detail {
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
}

.post-detail h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #444;
}

.post-detail-meta {
    font-size: 0.8rem;
    color: #999;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

/* 核心：Markdown内容样式（代码块、表格、标题等） */
.post-detail-content {
    font-size: 1rem;
    line-height: 1.8;
    margin-bottom: 30px;
    width: 100%;
}

/* Markdown标题样式 */
.post-detail-content h1 {
    font-size: 1.8rem;
    font-weight: 600;
    margin: 20px 0 10px;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.post-detail-content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 18px 0 9px;
    color: #333;
}

.post-detail-content h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 16px 0 8px;
    color: #333;
}

.post-detail-content h4,
.post-detail-content h5,
.post-detail-content h6 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 14px 0 7px;
    color: #333;
}

/* Markdown段落样式 */
.post-detail-content p {
    margin: 10px 0;
    color: #555;
}

/* Markdown列表样式 */
.post-detail-content ul,
.post-detail-content ol {
    margin: 10px 0;
    padding-left: 25px;
    color: #555;
}

.post-detail-content li {
    margin: 5px 0;
}

/* Markdown代码块样式（核心！） */
/* 重置原有代码块样式，让 highlight.js 主题生效 */
.post-detail-content pre {
    background: transparent !important; /* 不覆盖 highlight.js 的背景色 */
    border: none !important;
    padding: 0 !important;
    margin: 15px 0 !important;
    overflow-x: auto !important;
}

.post-detail-content pre code {
    display: block;
    padding: 15px !important;
    border-radius: 8px !important;
    font-family: 'Consolas', 'Monaco', monospace !important;
    font-size: 0.9rem !important;
    line-height: 1.5 !important;
}

/* 行内代码样式（保留原有高亮） */
.post-detail-content code:not(pre code) {
    background-color: #f8f9fa;
    padding: 2px 6px;
    border-radius: 3px;
    color: #d63384;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
}

/* Markdown表格样式 */
.post-detail-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    font-size: 0.95rem;
}

.post-detail-content th,
.post-detail-content td {
    border: 1px solid #e9ecef;
    padding: 10px;
    text-align: left;
}

.post-detail-content th {
    background-color: #f8f9fa;
    font-weight: 600;
}

/* Markdown引用样式 */
.post-detail-content blockquote {
    border-left: 4px solid #e9ecef;
    padding-left: 15px;
    margin: 15px 0;
    color: #666;
    font-style: italic;
}

/* Markdown链接样式 */
.post-detail-content a {
    color: #2d7d9a;
    text-decoration: none;
}

.post-detail-content a:hover {
    text-decoration: underline;
}

/* Markdown图片样式 */
.post-detail-content img {
    max-width: 100%;
    height: auto;
    margin: 15px 0;
    border-radius: 4px;
}

/* 评论区：加宽到1100px */
.comments-container {
    max-width: 1100px;
    margin: 20px auto;
    width: 100%;
    padding: 0;
}

.comments-container h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    font-weight: 500;
}

/* 评论表单：输入框缩放图标改为向下 */
.comment-form {
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 4px;
    width: 100%;
}

.comment-form input, 
.comment-form textarea {
    width: 100%;
    padding: 8px;
    margin: 8px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    resize: vertical;
    box-sizing: border-box;
}

/* 统一所有按钮为黑框样式（核心！） */
.comment-form button,
.admin-form button,
.btn-save,
.btn-add,
.btn-delete,
.btn-edit,
.btn-cancel {
    padding: 8px 16px;
    background-color: #333;
    color: #fff;
    border: 1px solid #333;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.2s;
}

.comment-form button:hover,
.admin-form button:hover,
.btn-save:hover,
.btn-add:hover,
.btn-delete:hover,
.btn-edit:hover,
.btn-cancel:hover {
    background-color: #555;
    border-color: #555;
}

/* 取消按钮单独样式（浅灰背景，黑框） */
.btn-cancel {
    background-color: #eee;
    color: #333;
    border-color: #ddd;
}

.btn-cancel:hover {
    background-color: #ddd;
    border-color: #ccc;
}

/* 删除按钮单独样式（红框，黑字） */
.btn-delete {
    background-color: #fff;
    color: #d9534f;
    border-color: #d9534f;
}

.btn-delete:hover {
    background-color: #fdf2f2;
    border-color: #d9534f;
}

.comment-item {
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
    width: 100%;
}

.comment-author {
    font-weight: 500;
    color: #444;
}

.comment-time {
    font-size: 0.7rem;
    color: #999;
    margin-left: 10px;
}

/* 管理员表单：加宽到1100px */
.admin-form {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
    border: 1px solid #eee;
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
}

.admin-form h2 {
    font-size: 1.4rem;
    font-weight: 500;
    margin-bottom: 20px;
    color: #444;
}

.admin-form .form-group {
    margin-bottom: 15px;
    width: 100%;
}

.admin-form label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
    color: #666;
}

.admin-form input, 
.admin-form textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
    min-width: 100%;
    max-width: 100%;
}

.admin-form .form-tip {
    font-size: 0.75rem;
    color: #999;
    margin-top: 5px;
    margin-bottom: 10px;
    text-align: center;
    display: block;
}

.admin-form .form-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    width: 100%;
}

/* 博客管理列表：加宽到1100px */
.admin-posts {
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
}

.admin-posts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    width: 100%;
}

.posts-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.posts-table th, .posts-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.posts-table th {
    background-color: #f9f9f9;
    font-weight: 500;
}

.post-actions {
    display: flex;
    gap: 10px;
}

/* 页脚：加宽到1100px */
.footer-container {
    text-align: right;
    padding: 20px 0;
    border-top: 1px solid #eee;
    margin-top: 30px;
    font-size: 0.8rem;
    color: #999;
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

.footer-container a {
    color: #999;
    text-decoration: none;
}

.footer-container a:hover {
    color: #666;
    text-decoration: underline;
}

/* 响应式适配：所有容器同步缩放 */
@media (max-width: 1120px) {
    .comments-container,
    .admin-form,
    .post-detail,
    .about-container,
    .posts-container,
    .admin-posts,
    .flash-messages,
    .footer-container {
        max-width: 100%;
        padding-left: 0;
        padding-right: 0;
    }
    
    .comment-form input,
    .comment-form textarea,
    .admin-form input,
    .admin-form textarea {
        width: 100%;
        min-width: 100%;
        max-width: 100%;
    }
    
    .header-search input {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        align-items: flex-start;
    }
    .header-nav {
        width: 100%;
        margin-top: 10px;
    }
    .header-nav a {
        margin-left: 10px;
        margin-right: 10px;
    }
    .header-search {
        width: 100%;
    }
    .posts-table th:nth-child(1), .posts-table td:nth-child(1) {
        display: none;
    }
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 30px 0;
    gap: 15px;
}

.page-btn {
    padding: 8px 16px;
    background-color: #333;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.page-btn:hover:not(.disabled) {
    background-color: #555;
}

.page-btn.disabled {
    background-color: #ccc;
    cursor: not-allowed;
    color: #666;
}

.page-info {
    color: #666;
    font-size: 0.9rem;
}