/* 教程页面布局 */
.tutorial-layout {
    display: grid;
    grid-template-columns: 250px 1fr 200px;
    gap: 30px;
    margin-top: 30px;
}

/* 左侧边栏 */
.sidebar {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 80px;
    height: fit-content;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 2px solid #f0f0f0;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.sidebar-header h3 {
    font-size: 18px;
    color: #333;
}

.tutorial-nav {
    padding: 10px 0;
}

.tutorial-nav a {
    display: block;
    padding: 12px 20px;
    color: #666;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.tutorial-nav a:hover {
    background: #f9f9f9;
    color: #667eea;
}

.tutorial-nav a.active {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    color: #667eea;
    border-left-color: #667eea;
    font-weight: bold;
}

/* 分级导航样式 */
.nav-category {
    margin-bottom: 10px;
}

.nav-category-title {
    padding: 12px 20px;
    font-weight: bold;
    color: #333;
    background: #f5f5f5;
    border-left: 3px solid #667eea;
    font-size: 14px;
}

.nav-category-items a {
    padding-left: 30px;
    font-size: 13px;
}

.tutorial-nav a.active {
    background: #f0f4ff;
    color: #667eea;
    border-left-color: #667eea;
    font-weight: 500;
}

/* 中间内容区 */
.tutorial-content {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* 教程内容中的图片限制大小 */
.tutorial-content img {
    max-width: 120px;
    max-height: 120px;
    width: auto;
    height: auto;
    display: block;
    margin: 20px auto;
}

.breadcrumb {
    padding: 15px 0;
    margin-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    color: #999;
}

.breadcrumb a {
    color: #667eea;
    transition: color 0.3s;
}

.breadcrumb a:hover {
    color: #764ba2;
}

.content-wrapper h1 {
    font-size: 32px;
    margin-bottom: 30px;
    color: #333;
    border-bottom: 3px solid #667eea;
    padding-bottom: 15px;
}

#articleContent {
    line-height: 1.8;
    color: #333;
}

#articleContent h2 {
    font-size: 24px;
    margin: 30px 0 20px;
    color: #333;
    border-left: 4px solid #667eea;
    padding-left: 15px;
}

#articleContent h3 {
    font-size: 20px;
    margin: 25px 0 15px;
    color: #333;
}

#articleContent p {
    margin-bottom: 15px;
}

#articleContent ul, #articleContent ol {
    margin: 15px 0;
    padding-left: 30px;
}

#articleContent li {
    margin-bottom: 8px;
}

#articleContent code {
    background: #f5f5f5;
    padding: 2px 8px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    color: #e83e8c;
}

#articleContent pre {
    background: #282c34;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 20px 0;
    position: relative;
}

#articleContent pre code {
    background: none;
    padding: 0;
    color: #abb2bf;
}

/* 代码块复制按钮 */
.code-block-wrapper {
    position: relative;
}

.copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px 15px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.3s;
}

.copy-btn:hover {
    background: #764ba2;
}

/* 在线运行按钮 */
.run-btn {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 20px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
}

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

/* 文章导航 */
.article-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 50px;
    padding-top: 30px;
    border-top: 2px solid #f0f0f0;
}

.article-nav a {
    flex: 1;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    transition: all 0.3s;
}

.article-nav a:hover {
    background: #f0f4ff;
    transform: translateY(-2px);
}

.article-nav .prev {
    margin-right: 10px;
}

.article-nav .next {
    margin-left: 10px;
    text-align: right;
}

.article-nav span {
    display: block;
    font-size: 12px;
    color: #999;
    margin-bottom: 5px;
}

.article-nav p {
    color: #333;
    font-weight: 500;
}

/* 右侧目录 */
.toc {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 80px;
    height: fit-content;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.toc h3 {
    font-size: 16px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

#tocNav a {
    display: block;
    padding: 8px 0;
    color: #666;
    font-size: 14px;
    transition: color 0.3s;
}

#tocNav a:hover {
    color: #667eea;
}

#tocNav a.h3 {
    padding-left: 15px;
    font-size: 13px;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .tutorial-layout {
        grid-template-columns: 250px 1fr;
    }

    .toc {
        display: none;
    }
}

@media (max-width: 768px) {
    .tutorial-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        max-height: none;
    }

    .tutorial-content {
        padding: 20px;
    }

    .article-nav {
        flex-direction: column;
    }

    .article-nav .prev,
    .article-nav .next {
        margin: 5px 0;
    }
}
