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

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* 头部样式 */
header {
    background-color: #333;
    color: white;
    padding: 1rem 0;
    text-align: center;
}

nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

nav ul li {
    margin: 0 1rem;
}

nav ul li a {
    color: white;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
}

nav ul li a:hover {
    color: #4CAF50;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

header p {
    font-size: 1.2rem;
    opacity: 0.8;
}

/* 主内容区域 */
main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* 英雄区域 */
.hero {
    background: linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0.7)), url('https://trae-api-cn.mchost.guru/api/ide/v1/text_to_image?prompt=minimalist%20coding%20workspace%20with%20laptop%20and%20notebooks&image_size=landscape_16_9');
    background-size: cover;
    background-position: center;
    color: white;
    padding: 4rem 2rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    text-align: center;
}

.hero-content h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero-content p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.btn {
    display: inline-block;
    background-color: #4CAF50;
    color: white;
    padding: 0.8rem 1.5rem;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.btn:hover {
    background-color: #45a049;
}

/* 最近文章区域 */
.recent-posts {
    margin-bottom: 2rem;
}

.recent-posts h3 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    text-align: center;
    color: #333;
}

.post-card {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.post-card h4 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    color: #333;
}

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

.post-card a {
    color: #4CAF50;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
}

.post-card a:hover {
    color: #45a049;
    text-decoration: underline;
}

/* 关于页面样式 */
.about-content {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.about-content h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: #333;
}

.about-content p {
    margin-bottom: 1rem;
    line-height: 1.8;
    color: #666;
}

/* 博客页面样式 */
.blog-content {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.blog-content h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: #333;
}

.blog-post {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #eee;
}

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

.blog-post h3 {
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
    color: #333;
}

.blog-post .date {
    color: #999;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.blog-post p {
    margin-bottom: 1rem;
    line-height: 1.8;
    color: #666;
}

/* Python课程页面样式 */
.course-content {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.course-intro {
    margin-bottom: 2.5rem;
}

.course-intro h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: #333;
}

.course-intro p {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #666;
}

.course-outline {
    margin-bottom: 2.5rem;
}

.course-outline h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: #333;
}

.module {
    background-color: #f9f9f9;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border-left: 4px solid #4CAF50;
}

.module h3 {
    font-size: 1.4rem;
    margin-bottom: 1rem;
    color: #333;
}

.module ul {
    list-style: none;
    padding-left: 0;
}

.module ul li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: #666;
}

.module ul li:before {
    content: "•";
    color: #4CAF50;
    font-weight: bold;
    position: absolute;
    left: 0;
}

.learning-resources h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: #333;
}

.resource-card {
    background-color: #f9f9f9;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.resource-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.resource-card h4 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: #333;
}

.resource-card p {
    margin-bottom: 1rem;
    color: #666;
}

.resource-card a {
    color: #4CAF50;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
}

.resource-card a:hover {
    color: #45a049;
    text-decoration: underline;
}

.module-btn {
    margin-top: 1rem;
    display: inline-block;
}

/* Python基础学习页面样式 */
.basics-content {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.chapter {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid #eee;
}

.chapter:last-child {
    border-bottom: none;
}

.chapter h2 {
    font-size: 1.8rem;
    color: #333;
    margin-bottom: 1.5rem;
    padding-left: 1rem;
    border-left: 4px solid #4CAF50;
}

.section {
    margin-bottom: 2rem;
}

.section h3 {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 1rem;
}

.section p {
    color: #666;
    line-height: 1.8;
    margin-bottom: 1rem;
}

.section ul {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.section ul li {
    color: #666;
    line-height: 1.8;
    margin-bottom: 0.5rem;
}

.code-block {
    margin: 1rem 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.code-container {
    position: relative;
}

.code-control-bar {
    background-color: #1e1e1e;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.run-button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.run-button:hover {
    background-color: #45a049;
}

.reset-button {
    background-color: #FF9800;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-left: 0.5rem;
}

.reset-button:hover {
    background-color: #F57C00;
}

.collapse-button {
    background: none;
    border: none;
    color: #ccc;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.3s ease;
}

.collapse-button:hover {
    color: white;
}

.code-editor {
    background-color: #2d2d2d;
    color: #f8f8f2;
    margin: 0;
    padding: 1.5rem;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    overflow-x: auto;
    transition: max-height 0.3s ease;
    max-height: 500px;
    min-height: 100px;
    width: 100%;
    border: none;
    resize: vertical;
}

.code-editor:focus {
    outline: none;
    border: 1px solid #4CAF50;
}

.code-editor.collapsed {
    max-height: 50px;
    overflow: hidden;
    min-height: 50px;
}

.code-output {
    background-color: #f5f5f5;
    border-top: 1px solid #ddd;
    padding: 1rem;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    color: #333;
    white-space: pre-wrap;
    min-height: 50px;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 300px;
}

.code-output.collapsed {
    max-height: 0;
    padding: 0;
    opacity: 0;
    border-top: none;
}

.exercise {
    background-color: #f9f9f9;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border-left: 4px solid #FF9800;
}

.exercise h3 {
    color: #FF9800;
    font-size: 1.2rem;
    margin-bottom: 0.8rem;
}

.back-link {
    text-align: center;
    margin-top: 2rem;
}

/* 页脚样式 */
footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 2rem;
}

footer p {
    opacity: 0.8;
}

/* 响应式设计 */
@media (max-width: 768px) {
    nav ul {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .hero-content h2 {
        font-size: 2rem;
    }
    
    main {
        padding: 0 1rem;
    }
    
    .post-card {
        padding: 1rem;
    }
    
    .about-content,
    .blog-content {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    header p {
        font-size: 1rem;
    }
    
    .hero-content h2 {
        font-size: 1.8rem;
    }
    
    .hero-content p {
        font-size: 1rem;
    }
    
    .btn {
        padding: 0.6rem 1.2rem;
    }
    
    .recent-posts h3 {
        font-size: 1.5rem;
    }
    
    .post-card h4 {
        font-size: 1.2rem;
    }
}