/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2c3e50;
    --accent-color: #3498db;
    --text-color: #333;
    --light-gray: #ecf0f1;
    --dark-gray: #95a5a6;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #f9f9f9;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

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

/* 头部导航 */
header {
    background: linear-gradient(135deg, var(--primary-color), #34495e);
    color: white;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-links a {
    color: white;
    opacity: 0.9;
}

.nav-links a:hover {
    opacity: 1;
    color: var(--accent-color);
}

/* 主容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
}

/* 文章列表 */
.main-content {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.post-card {
    border-bottom: 1px solid var(--light-gray);
    padding: 1.5rem 0;
    transition: transform 0.3s ease;
}

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

.post-card:hover {
    transform: translateX(5px);
}

.post-card h2 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.post-meta {
    color: var(--dark-gray);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.post-excerpt {
    color: #666;
    margin-bottom: 1rem;
}

.read-more {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--accent-color);
    color: white;
    border-radius: 4px;
    font-size: 0.9rem;
}

.read-more:hover {
    background: var(--primary-color);
    color: white;
}

/* 侧边栏 */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.widget {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.widget h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 0.5rem;
}

.widget ul {
    list-style: none;
}

.widget li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--light-gray);
}

.widget li:last-child {
    border-bottom: none;
}

/* 标签云 */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background: var(--light-gray);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--primary-color);
}

.tag:hover {
    background: var(--accent-color);
    color: white;
}

/* 文章详情页 */
.article-content {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.article-content h1 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.article-content h2 {
    color: var(--primary-color);
    margin: 1.5rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--light-gray);
}

.article-content h3 {
    color: var(--primary-color);
    margin: 1rem 0;
}

.article-content p {
    margin-bottom: 1rem;
    text-align: justify;
}

.article-content code {
    background: #f4f4f4;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.article-content pre {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 1rem;
    border-radius: 5px;
    overflow-x: auto;
    margin: 1rem 0;
}

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

.article-content ul, .article-content ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

.article-content li {
    margin-bottom: 0.5rem;
}

.article-content blockquote {
    border-left: 4px solid var(--accent-color);
    padding-left: 1rem;
    margin: 1rem 0;
    color: #666;
    font-style: italic;
}

.article-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem auto;
    border-radius: 5px;
}

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

.article-content th, .article-content td {
    border: 1px solid var(--light-gray);
    padding: 0.8rem;
    text-align: left;
}

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

/* 页脚 */
footer {
    background: var(--primary-color);
    color: white;
    text-align: center;
    padding: 2rem;
    margin-top: 2rem;
}

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

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
        padding: 1rem;
    }
    
    .nav-links {
        gap: 1rem;
    }
    
    .post-card {
        padding: 1rem 0;
    }
}

/* 代码高亮主题 */
.syntax-highlight {
    background: #2d2d2d;
    color: #f8f8f2;
}

/* 回到顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--accent-color);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

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

.back-to-top:hover {
    background: var(--primary-color);
    color: white;
}
