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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #fff;
    padding-top: 120px;
    /* 为固定的头部留出空间 */
    overflow: visible;
    -webkit-text-size-adjust: 100%;
    /* 防止iOS缩放文本 */
    -webkit-tap-highlight-color: transparent;
    /* 移除iOS点击高亮 */
}

/* 侧边栏打开时防止背景滚动 */
body.sidebar-open {
    overflow: hidden;
}

/* 容器样式 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    /* 移动端添加左右内边距 */
}

/* 头部样式 */
header {
    background-color: #fff;
    color: #333;
    padding: 10px 0;
    text-align: center;
    border-bottom: 1px solid #eee;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: #4F46E5;
}

header p {
    font-size: 1.2rem;
    color: #666;
}

/* T型布局样式 */
.t-layout {
    display: flex;
    min-height: calc(100vh - 120px);
    /* 减去头部高度 */
    position: relative;
    z-index: 1;
}

/* 侧边栏样式 */
.sidebar {
    width: 250px;
    padding: 30px 20px;
    background-color: #f8fafc;
    border-right: 1px solid #eee;
    position: fixed;
    left: 0;
    top: 120px;
    bottom: 0;
    overflow-y: auto;
    z-index: 900;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
    /* 增强侧边栏阴影 */
}

.sidebar-title {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: #333;
    padding-bottom: 10px;
    border-bottom: 2px solid #4F46E5;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 10px;
}

.sidebar-menu a {
    display: block;
    padding: 12px 15px;
    color: #666;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
    /* 触摸友好的点击区域 */
    min-height: 48px;
    line-height: 24px;
    -webkit-tap-highlight-color: transparent;
}

.sidebar-menu a:hover {
    background-color: #eef2ff;
    color: #4F46E5;
}

/* 导航链接激活状态 */
.sidebar-menu a.active {
    background-color: #4F46E5;
    color: #fff;
    font-weight: 500;
}

/* 其他导航区域的active样式 */
.nav-list a.active {
    color: #4F46E5;
    font-weight: 600;
    border-bottom: 2px solid #4F46E5;
}

/* 主内容区域样式 */
.main-content {
    flex: 1;
    padding: 30px 15px 0px;
    /* 移动端添加内边距 */
    margin-left: 250px;
    /* 与侧边栏宽度相同 */
    overflow-y: auto;
    background-color: #fff;
}

/* 内容区块样式 */
.content-section {
    max-width: 95%;
    margin: 0 auto;
    margin-bottom: 30px;
    background: #ffffff;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.04);
    border: 1px solid #f0f0f0;
}

/* 内容介绍部分 */
.content-intro {
    margin-bottom: 30px;
    padding: 25px;
    background-color: #f8fafc;
    border-radius: 8px;
    border-left: 4px solid #4F46E5;
}

.content-intro p {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #4b5563;
    margin-bottom: 0;
}

/* 详细内容部分 */
.content-detail {
    margin-top: 40px;
}

.content-detail h3 {
    font-size: 1.5rem;
    color: #333;
    margin: 40px 0 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e5e7eb;
}

.content-detail h4 {
    font-size: 1.25rem;
    color: #4F46E5;
    margin: 30px 0 15px;
}

.content-detail p {
    margin-bottom: 20px;
    color: #4b5563;
    font-size: 1.05rem;
    line-height: 1.7;
}

/* 表格样式优化 */
.content-detail table {
    width: 100%;
    border-collapse: collapse;
    margin: 25px 0;
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    display: block;
    /* 允许表格在小屏幕上水平滚动 */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* iOS平滑滚动 */
    max-width: 100%;
}

.content-detail table th {
    background-color: #4F46E5;
    color: white;
    text-align: left;
    padding: 15px 20px;
    font-weight: 600;
}

.content-detail table td {
    padding: 12px 20px;
    border-bottom: 1px solid #f0f0f0;
    color: #4b5563;
}

.content-detail table tr:last-child td {
    border-bottom: none;
}

.content-detail table tr:hover {
    background-color: #f8fafc;
}

/* 列表样式优化 */
.content-detail ul,
.content-detail ol {
    margin: 20px 0;
    padding-left: 25px;
    color: #4b5563;
}

.content-detail li {
    margin-bottom: 12px;
    line-height: 1.6;
}

/* 强调文本 */
.content-detail strong {
    color: #374151;
    font-weight: 600;
}

.content-detail em {
    font-style: italic;
    color: #6b7280;
}

/* 介绍部分 */
.intro-section {
    margin-bottom: 60px;
}

.intro-section h2 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: #333;
}

.intro-section p {
    font-size: 1.1rem;
    max-width: 800px;
    margin: 0 auto 40px;
    color: #666;
}

.feature-boxes {
    display: flex;
    gap: 20px;
    justify-content: space-between;
    flex-wrap: wrap;
}

.feature-box {
    flex: 1;
    min-width: 250px;
    padding: 30px;
    background-color: #f8fafc;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease;
}

.feature-box:hover {
    transform: translateY(-5px);
}

.feature-box h3 {
    font-size: 1.4rem;
    margin-bottom: 15px;
    color: #4F46E5;
}

/* 教程目录部分 */
.tutorials-section {
    margin-bottom: 60px;
}

/* 汉堡菜单按钮样式 */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1001;
}

.menu-icon {
    display: block;
    width: 24px;
    height: 3px;
    background-color: #333;
    margin: 5px 0;
    transition: all 0.3s ease;
}

/* 教程卡片样式 */
.tutorials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.tutorial-card {
    display: block;
    padding: 25px;
    background-color: #f8fafc;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
}

.tutorial-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
    border-color: #4F46E5;
}

.tutorial-card h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: #4F46E5;
}

.tutorial-card p {
    color: #666;
    font-size: 1rem;
}

/* 开始学习部分 */
.start-learning {
    text-align: center;
    margin-top: 60px;
    padding: 40px 20px;
    background-color: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

.start-learning h2 {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: #333;
}

.start-learning p {
    max-width: 600px;
    margin: 0 auto 30px;
    color: #666;
}

.btn-primary {
    display: inline-block;
    background-color: #4F46E5;
    color: white;
    padding: 15px 30px;
    text-decoration: none;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: #4338ca;
    transform: translateY(-2px);
}

/* 代码块样式 */
pre {
    background-color: #1e293b;
    color: #e2e8f0;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 20px 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    -webkit-overflow-scrolling: touch;
    /* iOS平滑滚动 */
    scrollbar-width: thin;
    /* Firefox滚动条 */
}

pre::-webkit-scrollbar {
    height: 8px;
}

pre::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    background-color: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    color: #4F46E5;
}

pre code {
    background-color: transparent;
    padding: 0;
    color: inherit;
}

/* 示例部分样式 */
.example-section {
    margin: 40px 0;
    padding: 30px;
    background-color: #f8fafc;
    border-radius: 8px;
    border-left: 4px solid #4F46E5;
}

.example-section h3 {
    margin-top: 0;
    color: #4F46E5;
}

/* 页脚样式 */
footer {
    background-color: #fff;
    padding: 40px 0 20px;
    border-top: 1px solid #eee;
    margin-top: 60px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-column h3 {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: #333;
}

.footer-column p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 15px;
}

.footer-column ul {
    list-style: none;
    padding: 0;
}

.footer-column ul li {
    margin-bottom: 10px;
}

.footer-column ul li a {
    text-decoration: none;
    color: #666;
    transition: color 0.3s ease;
}

.footer-column ul li a:hover {
    color: #4F46E5;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.footer-bottom p {
    color: #666;
    font-size: 0.9rem;
}

.beian-link {
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
}

.beian-link:hover {
    color: #4F46E5;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .main-content {
        margin-left: 0;
        padding: 20px 15px;
        /* 调整内边距 */
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: 80%;
        /* 移动端侧边栏占更大宽度 */
        max-width: 300px;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .mobile-menu-btn {
        display: block;
        /* 增加触摸区域 */
        padding: 15px;
        margin-left: 5px;
    }

    .header h1 {
        font-size: 2rem;
    }

    .header p {
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    body {
        padding-top: 100px;
    }

    .t-layout {
        margin-top: 95px;
    }

    .header {
        padding: 15px 0;
    }

    .header h1 {
        font-size: 1.8rem;
    }

    .header p {
        font-size: 0.9rem;
        margin-bottom: 10px;
    }

    .content-section {
        padding: 20px 15px;
        /* 调整内边距 */
        border-radius: 8px;
        /* 移动端圆角稍小 */
    }

    /* 内容介绍部分优化 */
    .content-intro {
        padding: 15px;
    }

    .content-intro p {
        font-size: 1rem;
        line-height: 1.7;
    }

    /* 详细内容字体调整 */
    .content-detail p {
        font-size: 1rem;
        line-height: 1.7;
    }

    .content-detail h3 {
        font-size: 1.35rem;
        margin-top: 30px;
    }

    .content-detail h4 {
        font-size: 1.2rem;
    }

    .feature-boxes {
        flex-direction: column;
    }

    .tutorials-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 0 15px;
    }

    /* 按钮触摸区域优化 */
    .btn-primary {
        padding: 15px 25px;
        min-width: 140px;
        text-align: center;
    }

    /* 开始学习区域优化 */
    .start-learning {
        padding: 30px 15px;
    }
}

@media (max-width: 480px) {

    .header h1 {
        font-size: 1rem;
    }

    .t-layout {
        margin-top: 95px;
    }

    .header p {
        font-size: 0.85rem;
    }

    .content-section {
        padding: 15px 10px;
        /* 进一步调整小屏幕内边距 */
    }

    /* 代码块在小屏幕上优化 */
    pre {
        padding: 15px 10px;
        font-size: 0.85rem;
    }

    /* 表格在小屏幕上进一步优化 */
    .content-detail table {
        font-size: 0.85rem;
    }

    .content-detail table th,
    .content-detail table td {
        padding: 10px 15px;
    }

    .btn-primary {
        padding: 14px 22px;
        font-size: 1rem;
        min-width: 100%;
        /* 小屏幕按钮全宽显示 */
    }

    /* 移动端导航菜单项增强 */
    .sidebar-menu a {
        padding: 15px;
        font-size: 1rem;
        min-height: 50px;
        display: flex;
        align-items: center;
    }

    /* 侧边栏标题调整 */
    .sidebar-title {
        font-size: 1.1rem;
        padding-bottom: 8px;
    }

    /* 改进移动端链接和按钮的触摸反馈 */
    a,
    button {
        cursor: pointer;
        transition: all 0.15s ease;
        /* 更快的反馈速度 */
    }
}

@media (max-width: 430px) {

    .header h1 {
        font-size: 1rem;
    }

    .t-layout {
        margin-top: 120px;
    }

    .header p {
        font-size: 0.85rem;
    }

    .content-section {
        padding: 15px 10px;
        /* 进一步调整小屏幕内边距 */
    }

    /* 代码块在小屏幕上优化 */
    pre {
        padding: 15px 10px;
        font-size: 0.85rem;
    }

    /* 表格在小屏幕上进一步优化 */
    .content-detail table {
        font-size: 0.85rem;
    }

    .content-detail table th,
    .content-detail table td {
        padding: 10px 15px;
    }

    .btn-primary {
        padding: 14px 22px;
        font-size: 1rem;
        min-width: 100%;
        /* 小屏幕按钮全宽显示 */
    }

    /* 移动端导航菜单项增强 */
    .sidebar-menu {
        margin-top: 50px;
    }
    .sidebar-menu a {
        padding: 15px;
        font-size: 1rem;
        min-height: 50px;
        display: flex;
        align-items: center;
    }

    /* 侧边栏标题调整 */
    .sidebar-title {
        font-size: 1.1rem;
        padding-bottom: 8px;
    }

    /* 改进移动端链接和按钮的触摸反馈 */
    a,
    button {
        cursor: pointer;
        transition: all 0.15s ease;
        /* 更快的反馈速度 */
    }
}