/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

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

/* 头部 */
header {
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    text-decoration: none;
    flex-shrink: 0;
}

/* 移动端菜单按钮 */
.menu-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 101;
}

.menu-toggle span {
    width: 24px;
    height: 2px;
    background-color: #333;
    margin: 3px 0;
    transition: all 0.3s ease;
    border-radius: 2px;
}

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

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

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

/* 遮罩层 */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.overlay.active {
    display: block;
    opacity: 1;
}

.search-form {
    display: flex;
    gap: 10px;
}

.search-input {
    padding: 8px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 250px;
}

/* 布局 */
.content-wrapper {
    display: flex;
    gap: 30px;
    margin-top: 30px;
}

.sidebar {
    width: 250px;
    flex-shrink: 0;
}

.content {
    flex: 1;
    min-width: 0;
}

/* 侧边栏 */
.widget {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.widget h3 {
    font-size: 16px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.category-list {
    list-style: none;
}

.category-list li {
    margin-bottom: 8px;
}

.category-list > li > a {
    display: block;
    padding: 10px 12px;
    color: #333;
    font-weight: 500;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.2s;
}

.category-list > li > a:hover,
.category-list > li > a.active {
    background: #e8f4fd;
    color: #1a73e8;
}

.sub-category {
    list-style: none;
    padding-left: 15px;
    margin: 5px 0;
}

.sub-category li a {
    display: block;
    padding: 6px 12px;
    color: #666;
    font-size: 14px;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s;
}

.sub-category li a:hover,
.sub-category li a.active {
    background: #f0f7ff;
    color: #1a73e8;
}

.sub-category {
    list-style: none;
    padding-left: 15px;
    margin: 5px 0;
}

.sub-category li a {
    display: block;
    padding: 6px 12px;
    color: #666;
    font-size: 14px;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s;
}

.sub-category li a:hover,
.sub-category li a.active {
    background: #f0f7ff;
    color: #1a73e8;
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-cloud a {
    color: #555;
    text-decoration: none;
    font-size: 13px;
    padding: 4px 10px;
    background: #f0f0f0;
    border-radius: 15px;
    transition: background 0.2s;
}

.tag-cloud a:hover,
.tag-cloud a.active {
    background: #1a73e8;
    color: #fff;
}

/* 文章列表 */
.article-list {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
}

.article-item {
    padding: 20px 0;
    border-bottom: 1px solid #eee;
}

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

.article-item h2 {
    font-size: 20px;
    margin-bottom: 10px;
}

.article-item h2 a {
    color: #333;
    text-decoration: none;
}

.article-item h2 a:hover {
    color: #1a73e8;
}

.article-meta {
    color: #888;
    font-size: 14px;
    margin-bottom: 10px;
}

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

.article-summary {
    color: #666;
    margin: 10px 0;
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.tag {
    color: #1a73e8;
    font-size: 13px;
    text-decoration: none;
}

.article-highlights {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
}

.article-highlights ul {
    margin-top: 10px;
    padding-left: 20px;
}

.article-highlights li {
    margin-bottom: 5px;
    color: #555;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 30px;
    padding: 20px 0;
}

.pagination a,
.pagination .page-info {
    padding: 8px 15px;
    background: #fff;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
}

.pagination a:hover {
    background: #1a73e8;
    color: #fff;
}

/* 文章详情 */
.article-detail {
    background: #fff;
    border-radius: 8px;
    padding: 30px;
}

.article-detail h1 {
    font-size: 28px;
    margin-bottom: 15px;
}

.article-summary-box,
.article-highlights-box {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.article-content {
    line-height: 1.8;
    font-size: 16px;
    margin-top: 30px;
}

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

/* AI 分析结果样式 */
.llm-analysis-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 25px;
    border-radius: 12px;
    margin: 20px 0;
}

.llm-analysis-box h3 {
    font-size: 20px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.3);
}

.llm-analysis-box .analysis-section {
    margin-bottom: 20px;
}

.llm-analysis-box .analysis-section:last-child {
    margin-bottom: 0;
}

.llm-analysis-box h4 {
    font-size: 16px;
    margin-bottom: 10px;
    opacity: 0.9;
}

.llm-analysis-box p {
    font-size: 15px;
    line-height: 1.7;
    opacity: 0.95;
}

.llm-analysis-box ul {
    margin-left: 20px;
}

.llm-analysis-box li {
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.6;
}

/* Markdown 内容样式 */
.markdown-content-box {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-top: 30px;
    border: 1px solid #e9ecef;
}

.markdown-content-box h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #333;
}

.markdown-preview {
    background: #282c34;
    color: #abb2bf;
    padding: 20px;
    border-radius: 6px;
    overflow-x: auto;
    max-height: 500px;
    overflow-y: auto;
}

.markdown-preview code {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    line-height: 1.5;
}

/* 底部 */
footer {
    background: #fff;
    padding: 20px 0;
    margin-top: 50px;
    text-align: center;
    color: #888;
}

footer a {
    color: #1a73e8;
    text-decoration: none;
}

/* 响应式 - 平板和手机 */
@media (max-width: 768px) {
    /* 显示菜单按钮 */
    .menu-toggle {
        display: flex;
    }

    /* 导航栏布局 */
    .navbar {
        padding-right: 50px;
    }

    /* 搜索框在小屏幕隐藏或缩小 */
    .search-form {
        position: absolute;
        right: 50px;
        top: 50%;
        transform: translateY(-50%);
    }

    .search-input {
        width: 120px;
        font-size: 14px;
    }

    .search-form button {
        padding: 8px 12px;
        font-size: 14px;
    }

    /* 侧边栏变为抽屉式 */
    .sidebar {
        position: fixed;
        top: 60px;
        left: -280px;
        width: 280px;
        height: calc(100vh - 60px);
        background: #fff;
        z-index: 98;
        overflow-y: auto;
        transition: left 0.3s ease;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
    }

    .sidebar.active {
        left: 0;
    }

    /* 主内容区域 */
    .content-wrapper {
        flex-direction: column;
        gap: 20px;
        margin-top: 20px;
    }

    /* 文章列表优化 */
    .article-list {
        padding: 15px;
    }

    .article-item {
        padding: 15px 0;
    }

    .article-item h2 {
        font-size: 18px;
        line-height: 1.4;
    }

    .article-meta {
        font-size: 12px;
        flex-wrap: wrap;
    }

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

    .article-summary {
        font-size: 14px;
    }

    /* 文章详情优化 */
    .article-detail {
        padding: 20px 15px;
    }

    .article-detail h1 {
        font-size: 22px;
        line-height: 1.4;
    }

    .article-content {
        font-size: 15px;
    }

    /* 分页优化 */
    .pagination {
        flex-wrap: wrap;
        gap: 10px;
    }

    .pagination a,
    .pagination .page-info {
        padding: 6px 12px;
        font-size: 14px;
    }

    /* Widget 优化 */
    .widget {
        padding: 15px;
    }

    /* LLM 分析框优化 */
    .llm-analysis-box {
        padding: 15px;
    }

    .llm-analysis-box h3 {
        font-size: 16px;
    }

    .llm-analysis-box h4 {
        font-size: 14px;
    }

    .llm-analysis-box p,
    .llm-analysis-box li {
        font-size: 13px;
    }

    /* Markdown 预览优化 */
    .markdown-preview {
        font-size: 13px;
        padding: 15px;
    }
}

/* 超小屏幕优化 */
@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .logo {
        font-size: 20px;
    }

    .search-form {
        display: none;
    }

    .search-form.mobile-show {
        display: flex;
        position: static;
        transform: none;
        width: 100%;
        margin-top: 10px;
    }

    .search-form.mobile-show .search-input {
        width: 100%;
        flex: 1;
    }

    /* 文章标题更小 */
    .article-item h2 {
        font-size: 16px;
    }

    /* 按钮和表单元素优化 */
    button,
    input[type="submit"] {
        padding: 10px 16px;
        font-size: 14px;
    }

    /* 侧边栏宽度调整 */
    .sidebar {
        width: 260px;
        left: -260px;
    }
}

/* 横屏模式优化 */
@media (max-width: 768px) and (orientation: landscape) {
    .sidebar {
        top: 50px;
        height: calc(100vh - 50px);
    }
}
