/* Mac/Linux网络命令学习笔记样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2383e2;
    --secondary-color: #37352f;
    --background: #ffffff;
    --surface: #f7f6f3;
    --border: #e9e9e7;
    --text-primary: #37352f;
    --text-secondary: #787774;
    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;
    --code-bg: #f8f9fa;
    --code-border: #e9ecef;
}

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* 头部样式 */
.header {
    background: var(--background);
    border-bottom: 1px solid var(--border);
    padding: 40px 0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 800px;
    line-height: 1.6;
}

/* 目录导航 */
.toc {
    background: var(--surface);
    border-radius: 12px;
    padding: 24px;
    margin: 32px 0;
    border: 1px solid var(--border);
}

.toc h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.toc ul {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 8px;
}

.toc li {
    padding: 8px 0;
}

.toc a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

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

/* 主要内容 */
.content {
    margin: 32px 0;
}

.section {
    margin-bottom: 48px;
}

.section h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 24px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-color);
}

.subsection {
    margin-bottom: 32px;
}

.subsection h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

/* 命令组 */
.command-group {
    margin-bottom: 40px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
}

.command-group h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.command-group h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 16px 0 8px;
}

/* 命令块 */
.command-block {
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

.command-block code {
    background: transparent;
    padding: 0;
    font-size: inherit;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    display: block;
}

/* 行内代码 */
code {
    background: var(--code-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875em;
    color: var(--primary-color);
    border: 1px solid var(--code-border);
}

/* 键盘按键 */
kbd {
    background: var(--text-secondary);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: monospace;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 解释说明 */
.explanation {
    background: rgba(35, 131, 226, 0.05);
    border-left: 4px solid var(--primary-color);
    padding: 16px;
    margin: 16px 0;
    border-radius: 0 8px 8px 0;
}

.explanation h4 {
    color: var(--primary-color);
    margin-bottom: 8px;
}

.explanation ul {
    margin-left: 20px;
}

/* 示例 */
.example {
    background: rgba(34, 197, 94, 0.05);
    border-left: 4px solid var(--success);
    padding: 16px;
    margin: 16px 0;
    border-radius: 0 8px 8px 0;
}

.example h4 {
    color: var(--success);
    margin-bottom: 8px;
}

/* 提示 */
.tip {
    background: rgba(245, 158, 11, 0.05);
    border-left: 4px solid var(--warning);
    padding: 12px 16px;
    margin: 16px 0;
    border-radius: 0 8px 8px 0;
    font-size: 0.875rem;
}

/* 故障排查流程 */
.troubleshooting-flow {
    display: grid;
    gap: 24px;
}

.problem-case {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
}

.problem-case h3 {
    color: var(--error);
    margin-bottom: 16px;
    font-size: 1.125rem;
}

/* 技巧部分 */
.tips-section {
    margin-bottom: 32px;
}

.tips-section h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

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

.comparison-table table {
    width: 100%;
    border-collapse: collapse;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.comparison-table th,
.comparison-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.comparison-table th {
    background: var(--surface);
    font-weight: 600;
    color: var(--text-primary);
}

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

.comparison-table code {
    font-size: 0.75rem;
}

/* 总结部分 */
.summary {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
}

.summary ul {
    margin: 16px 0;
    margin-left: 20px;
}

.summary li {
    margin-bottom: 8px;
}

/* 列表样式 */
ol, ul {
    margin: 12px 0;
}

ol {
    margin-left: 20px;
}

ul {
    margin-left: 20px;
}

li {
    margin-bottom: 6px;
}

/* 段落样式 */
p {
    margin: 12px 0;
    line-height: 1.6;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
    
    .header {
        padding: 24px 0;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .nav-container {
        padding: 0 16px;
    }
    
    .toc ul {
        grid-template-columns: 1fr;
    }
    
    .command-group,
    .problem-case,
    .summary {
        padding: 16px;
    }
    
    .section h2 {
        font-size: 1.5rem;
    }
    
    .command-block {
        padding: 12px;
        font-size: 0.8rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .command-block code {
        word-break: break-word;
        overflow-wrap: anywhere;
    }
    
    .comparison-table {
        font-size: 0.875rem;
    }
    
    .comparison-table th,
    .comparison-table td {
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.75rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .section h2 {
        font-size: 1.375rem;
    }
    
    .command-group h3 {
        font-size: 1rem;
    }
    
    .comparison-table {
        font-size: 0.8rem;
    }
    
    .comparison-table th,
    .comparison-table td {
        padding: 6px 8px;
    }
    
    .command-block {
        font-size: 0.75rem;
        padding: 10px;
        line-height: 1.5;
    }
    
    .command-block code {
        line-height: 1.4;
    }
}

/* 滚动行为 */
html {
    scroll-behavior: smooth;
}

/* 链接样式 */
a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* 选中文本样式 */
::selection {
    background: rgba(35, 131, 226, 0.2);
}

/* 代码块复制按钮样式 */
.command-block {
    position: relative;
}

.command-block:hover {
    background: #f1f3f4;
}

/* 增强可访问性 */
.command-block:focus-within {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* 高对比度支持 */
@media (prefers-contrast: high) {
    .command-block {
        border-width: 2px;
    }
    
    .command-block code {
        font-weight: 500;
    }
}

/* 打印样式 */
@media print {
    .toc {
        break-inside: avoid;
    }
    
    .section {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    .command-group {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    .command-block {
        background: #f8f9fa !important;
        border: 1px solid #dee2e6 !important;
    }
}