/* 网格交易教学页面样式 */

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

/* H5页面专用优化 */
@viewport {
    width: device-width;
    initial-scale: 1.0;
    maximum-scale: 2.0;
    user-scalable: yes;
}

/* 防止文本选择和长按菜单 */
.article-content {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

/* 优化H5页面的滚动体验 */
body {
    -webkit-overflow-scrolling: touch;
    overflow-scrolling: touch;
}

/* 优化H5页面的字体显示 */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* 优化H5页面的按钮和链接 */
button, a {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    touch-action: manipulation;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    min-height: 100vh;
}

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

/* 文章头部 */
.article-header {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    text-align: center;
}

.article-header h1 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 20px;
    /* 为现代浏览器提供渐变文本效果 */
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    /* 为不支持渐变文本的浏览器提供纯色回退 */
    color: #2c3e50;
}

.article-meta {
    display: flex;
    justify-content: center;
    gap: 20px;
    color: #7f8c8d;
    font-size: 0.9rem;
}

.article-meta span {
    padding: 5px 12px;
    background: #f8f9fa;
    border-radius: 20px;
    border: 1px solid #e9ecef;
}

/* 文章内容 */
.article-content {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
}

.article-content .intro-section {
    padding: 40px;
    background: linear-gradient(135deg, #667eea10, #764ba210);
    border-bottom: 1px solid #e9ecef;
}

.intro-text {
    font-size: 1.1rem;
    color: #555;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

/* 目录 */
.table-of-contents {
    padding: 30px 40px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

/* 移动设备上的目录优化 */
@media screen and (max-width: 768px) {
    .table-of-contents {
        padding: 20px 20px;
    }
    
    .table-of-contents h3 {
        font-size: 1.1rem;
    }
    
    .table-of-contents li {
        margin-bottom: 8px;
    }
    
    .table-of-contents a {
        font-size: 0.9rem;
    }
}

/* 代码块优化 */
pre {
    overflow-x: auto;
    padding: 15px;
    border-radius: 8px;
    background: #f5f7fa;
    border: 1px solid #e5e7eb;
    margin: 15px 0;
}

code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
}

/* 移动设备上的代码块优化 */
@media screen and (max-width: 768px) {
    pre {
        padding: 10px;
        margin: 10px 0;
    }
    
    code {
        font-size: 0.8rem;
    }
}

/* 章节内容优化 */
@media screen and (max-width: 768px) {
    .content-block {
        padding: 20px;
    }
    
    h2 {
        font-size: 1.5rem;
        margin-bottom: 15px;
    }
    
    h3 {
        font-size: 1.2rem;
        margin-bottom: 12px;
    }
    
    p {
        font-size: 0.95rem;
        line-height: 1.6;
    }
}

.table-of-contents h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.table-of-contents ol {
    list-style: none;
    counter-reset: toc-counter;
}

.table-of-contents li {
    counter-increment: toc-counter;
    margin-bottom: 12px;
}

.table-of-contents li::before {
    content: counter(toc-counter) ". ";
    font-weight: bold;
    color: #667eea;
    margin-right: 10px;
}

.table-of-contents a {
    color: #555;
    text-decoration: none;
    transition: color 0.3s ease;
}

.table-of-contents a:hover {
    color: #667eea;
}

/* 章节 */
.section {
    padding: 40px;
    border-bottom: 1px solid #e9ecef;
}

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

.section h2 {
    color: #2c3e50;
    font-size: 1.8rem;
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 3px solid #667eea;
    display: inline-block;
}

.section h3 {
    color: #34495e;
    font-size: 1.4rem;
    margin: 25px 0 15px 0;
}

.section h4 {
    color: #555;
    font-size: 1.1rem;
    margin: 20px 0 10px 0;
}

.content-block p {
    margin-bottom: 15px;
    color: #555;
    line-height: 1.7;
}

/* 问题与解决方案 */
.problem-section, .solution-section {
    margin: 25px 0;
    padding: 25px;
    border-radius: 10px;
}

.problem-section {
    background: linear-gradient(135deg, #ff6b6b10, #ee5a5210);
    border-left: 4px solid #ff6b6b;
}

.solution-section {
    background: linear-gradient(135deg, #51cf6610, #40c05710);
    border-left: 4px solid #51cf66;
}

.problem-list, .advantage-list {
    margin-top: 20px;
}

.problem-item, .advantage-item {
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.problem-item h4, .advantage-item h4 {
    color: #2c3e50;
    margin-bottom: 10px;
}

/* 比较表格 */
.comparison-table {
    margin: 30px 0;
    overflow-x: auto;
}

.comparison-table table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.comparison-table th {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

.comparison-table td {
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
    background: white;
}

.comparison-table tr:hover td {
    background: #f8f9fa;
}

/* 网格类型 */
.grid-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.grid-type {
    padding: 20px;
    background: linear-gradient(135deg, #667eea10, #764ba210);
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.grid-type h4 {
    color: #667eea;
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.2rem;
}

.grid-type ul {
    list-style: none;
}

.grid-type li {
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

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

/* 市场策略 */
.market-strategies {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.strategy-item {
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-top: 4px solid #667eea;
    transition: transform 0.3s ease;
}

.strategy-item:hover {
    transform: translateY(-5px);
}

.strategy-item h4 {
    color: #667eea;
    margin-bottom: 15px;
    text-align: center;
}

/* 操作步骤 */
.steps {
    margin: 30px 0;
}

.step {
    margin-bottom: 30px;
    padding: 25px;
    background: linear-gradient(135deg, #667eea05, #764ba205);
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.step h3 {
    color: #667eea;
    margin-bottom: 15px;
}

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

.step-content li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
}

.step-content li::before {
    content: "▶";
    color: #667eea;
    position: absolute;
    left: 0;
}

/* 代码示例 */
.code-examples {
    margin: 30px 0;
}

.code-block {
    margin-bottom: 30px;
    background: #2d3748;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.code-block h3 {
    background: #4a5568;
    color: white;
    padding: 15px 20px;
    margin: 0;
    font-size: 1rem;
}

.code-block pre {
    margin: 0;
    padding: 20px;
    overflow-x: auto;
    background: #2d3748;
}

.code-block code {
    color: #e2e8f0;
    font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* 语法高亮 */
.language-python {
    color: #f7fafc;
}

.language-javascript {
    color: #f7fafc;
}

/* 页脚 */
.article-footer {
    background: white;
    margin-top: 30px;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.related-articles h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.related-articles ul {
    list-style: none;
}

.related-articles li {
    margin-bottom: 12px;
}

.related-articles a {
    color: #667eea;
    text-decoration: none;
    transition: color 0.3s ease;
    padding: 10px 15px;
    display: block;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid #667eea;
}

.related-articles a:hover {
    background: #667eea;
    color: white;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .article-header {
        padding: 25px;
    }
    
    .article-header h1 {
        font-size: 1.8rem;
    }
    
    .article-meta {
        flex-direction: column;
        gap: 10px;
    }
    
    .section {
        padding: 25px 20px;
    }
    
    .grid-types {
        grid-template-columns: 1fr;
    }
    
    .market-strategies {
        grid-template-columns: 1fr;
    }
    
    .comparison-table {
        font-size: 0.9rem;
    }
    
    .comparison-table th,
    .comparison-table td {
        padding: 10px 8px;
    }
}

@media (max-width: 480px) {
    .article-header h1 {
        font-size: 1.5rem;
    }
    
    .section h2 {
        font-size: 1.4rem;
    }
    
    .section h3 {
        font-size: 1.2rem;
    }
    
    .code-block pre {
        padding: 15px 10px;
    }
    
    .code-block code {
        font-size: 0.8rem;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #5a67d8;
}

/* 打印样式 */
@media print {
    body {
        background: white;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
    
    .article-header,
    .article-content,
    .article-footer {
        box-shadow: none;
        border-radius: 0;
    }
    
    .code-block {
        background: #f8f9fa;
        color: #333;
    }
    
    .code-block code {
        color: #333;
    }
}