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

:root {
    --primary: #2496ed;
    --primary-dark: #1a7bc9;
    --bg: #ffffff;
    --bg-gray: #f6f8fa;
    --sidebar-bg: #161b22;
    --sidebar-text: #c9d1d9;
    --sidebar-active: #fff;
    --text: #24292f;
    --text-light: #57606a;
    --border: #d0d7de;
    --code-bg: #f6f8fa;
    --pre-bg: #161b22;
    --pre-text: #c9d1d9;
    --sidebar-width: 240px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    font-size: 18px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
}

/* 左侧导航 */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
    font-size: 24px;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 600;
}

.tree-nav {
    list-style: none;
    padding: 10px 0;
}

.tree-nav > li {
    margin: 2px 0;
}

.tree-nav a {
    display: block;
    padding: 8px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 16px;
}

.tree-nav a:hover {
    background: rgba(255,255,255,0.05);
}

.tree-nav a.active {
    color: var(--sidebar-active);
    background: rgba(36, 150, 237, 0.2);
    border-left: 3px solid var(--primary);
    padding-left: 17px;
}

.tree-nav details {
    color: var(--sidebar-text);
}

.tree-nav summary {
    padding: 8px 20px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    list-style: none;
}

.tree-nav summary::-webkit-details-marker {
    display: none;
}

.tree-nav summary::before {
    content: '▶';
    display: inline-block;
    margin-right: 8px;
    font-size: 16px;
    transition: transform 0.2s;
}

.tree-nav details[open] > summary::before {
    transform: rotate(90deg);
}

.tree-nav summary:hover {
    background: rgba(255,255,255,0.05);
}

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

.tree-nav ul a {
    padding-left: 36px;
    font-size: 15px;
}

/* 主内容区 */
.main {
    margin-left: var(--sidebar-width);
    padding: 40px 60px;
    max-width: none;
}

/* 区块 */
.section {
    padding-bottom: 40px;
    margin-bottom: 40px;
    border-bottom: 1px solid var(--border);
}

.section:last-of-type {
    border-bottom: none;
}

.section-gray {
    background: var(--bg-gray);
    margin-left: -60px;
    margin-right: -60px;
    padding: 40px 60px;
    border-radius: 8px;
}

/* 标题 */
h2 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 16px;
}

h3 {
    font-size: 1.75rem;
    font-weight: 600;
    margin: 24px 0 12px;
}

h4 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 16px 0 8px;
}

p {
    margin-bottom: 16px;
    color: var(--text-light);
}

/* 代码 */
code {
    background: var(--code-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 16px;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
}

pre {
    background: var(--pre-bg);
    color: var(--pre-text);
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 12px 0;
    position: relative;
}

pre code {
    background: none;
    padding: 0;
    font-size: 16px;
    line-height: 1.5;
}

pre.collapsed {
    max-height: 500px;
    overflow: hidden;
    position: relative;
}

pre.collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(transparent, var(--pre-bg));
    pointer-events: none;
}

pre.collapsed:hover {
    max-height: 500px;
}

pre.collapsed .fold-toggle {
    display: block !important;
}

pre:not(.collapsed) .fold-toggle {
    display: none !important;
}

/* 确保按钮样式优先级高于Prism.js */
pre[class*="language-"] .fold-toggle,
pre .fold-toggle {
    position: absolute !important;
    top: 8px !important;
    right: 60px !important;
    background: rgba(255, 255, 255, 0.8) !important;
    color: #000000 !important;
    border: 2px solid #000000 !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    z-index: 1000 !important;
    transition: all 0.2s ease !important;
    backdrop-filter: blur(4px) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
    margin-left: 8px !important;
}

pre:hover .fold-toggle,
pre[class*="language-"]:hover .fold-toggle {
    opacity: 1 !important;
    background: rgba(255, 255, 255, 0.95) !important;
    border-color: #000000 !important;
    transform: translateY(-1px) !important;
}

pre .fold-toggle:hover {
    background: #ffffff !important;
    border-color: #000000 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

pre[class*="language-"] .copy-btn,
pre .copy-btn {
    position: absolute !important;
    top: 8px !important;
    right: 8px !important;
    padding: 4px 8px !important;
    font-size: 16px !important;
    background: rgba(255, 255, 255, 0.8) !important;
    border: 2px solid #000000 !important;
    border-radius: 4px !important;
    color: #000000 !important;
    cursor: pointer !important;
    opacity: 0 !important;
    transition: all 0.2s ease !important;
    backdrop-filter: blur(4px) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
}

pre:hover .copy-btn,
pre[class*="language-"]:hover .copy-btn {
    opacity: 1 !important;
    background: rgba(255, 255, 255, 0.95) !important;
    border-color: #000000 !important;
    transform: translateY(-1px) !important;
}

pre .copy-btn:hover {
    background: #ffffff !important;
    border-color: #000000 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

/* 复制按钮 */
.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 8px;
    font-size: 16px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 4px;
    color: #c9d1d9;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

pre:hover .copy-btn {
    opacity: 1;
}

.copy-btn:hover {
    background: rgba(255,255,255,0.2);
}

/* 卡片 */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin: 20px 0;
}

.card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
}

.card h3, .card h4 {
    margin-top: 0;
}

.card pre {
    margin-top: 12px;
}

/* 错误列表样式 */
.error-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.error-item {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    transition: all 0.2s ease;
}

.error-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.error-header {
    margin-bottom: 16px;
}

.error-header h4 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text);
}

.error-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.error-solution {
    margin-top: 8px;
}

.error-solution h4 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--primary);
}

/* 存储架构图样式 */
.storage-diagram {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin: 30px 0;
}

.storage-layer {
    background: var(--bg-gray);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    width: 100%;
    max-width: 600px;
}

.layer-name {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: var(--text);
    text-align: center;
}

.layer-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.storage-type {
    background: white;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
}

.storage-type strong {
    color: var(--primary);
    display: block;
    margin-bottom: 4px;
}

.storage-location {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #666;
    background: #f5f5f5;
    padding: 4px;
    border-radius: 3px;
    margin: 4px 0;
}

.storage-desc {
    font-size: 0.9rem;
    color: #555;
}

.container-layer {
    background: white;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
}

.container-layer .layer-name {
    font-size: 1rem;
    color: var(--text-light);
}

.layer-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}

.layer-item {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    background: #f5f5f5;
    padding: 4px;
    border-radius: 3px;
}

.layer-desc {
    font-size: 0.9rem;
    color: #555;
    margin-top: 8px;
}

.storage-arrow {
    font-size: 2rem;
    color: var(--primary);
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* 表格 */
.table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.table th, .table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e1e4e8;
    border-right: 1px solid #e1e4e8;
}

.table th:last-child, .table td:last-child {
    border-right: none;
}

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

.table th {
    background: linear-gradient(135deg, #2496ed 0%, #1a7bc9 100%);
    color: white;
    font-weight: 600;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tbody tr {
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.table tbody tr:hover {
    background-color: #f6f8fa;
    transform: translateX(4px);
    border-left-color: #2496ed;
}

.table tbody tr:hover {
    background-color: #f6f8fa;
}

.table tbody tr:nth-child(even) {
    background-color: #fafbfc;
}

.table tbody tr:nth-child(even):hover {
    background-color: #f0f3f6;
}

/* 重点行样式 */
.table .highlight-row {
    background-color: #fff3cd !important;
}

.table .highlight-row:hover {
    background-color: #ffeaa7 !important;
}

/* 重点单元格样式 */
.table .highlight-cell {
    background-color: #e7f3ff;
    font-weight: 600;
    color: #0066cc;
    border-radius: 4px;
    padding: 4px 8px;
    display: inline-block;
}

/* 重要数据样式 */
.table .important {
    background-color: #fff3cd;
    font-weight: 700;
    color: #856404;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 14px;
}

/* 关键指标样式 */
.table .critical {
    background-color: #f8d7da;
    font-weight: 700;
    color: #721c24;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 14px;
}

/* 警告信息样式 */
.table .alert {
    background-color: #fff3cd;
    font-weight: 600;
    color: #856404;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 14px;
}

/* 成功/错误状态样式 */
.table .success {
    background-color: #d4edda;
    color: #155724;
    font-weight: 600;
}

.table .error {
    background-color: #f8d7da;
    color: #721c24;
    font-weight: 600;
}

.table .warning {
    background-color: #fff3cd;
    color: #856404;
    font-weight: 600;
}

/* 链接在表格中的样式 */
.table a {
    color: #2496ed;
    text-decoration: none;
    font-weight: 500;
}

.table a:hover {
    text-decoration: underline;
    color: #1a7bc9;
}

/* 表格图标样式 */
.table .icon {
    display: inline-block;
    margin-right: 8px;
    font-size: 18px;
}

/* 表格排序样式 */
.table .sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
}

.table .sortable:hover {
    background-color: rgba(36, 150, 237, 0.1);
}

.table .sortable::after {
    content: ' ↕';
    opacity: 0.3;
    font-size: 12px;
}

.table .sortable.asc::after {
    content: ' ↑';
    opacity: 1;
    color: #2496ed;
}

.table .sortable.desc::after {
    content: ' ↓';
    opacity: 1;
    color: #2496ed;
}

.table code {
    background: var(--code-bg);
}

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

a:hover {
    text-decoration: underline;
}

.links {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.links li a {
    display: block;
    padding: 12px 16px;
    background: var(--bg-gray);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.links li a:hover {
    border-color: var(--primary);
    text-decoration: none;
}

/* 页脚 */
.footer {
    padding: 24px 0;
    text-align: center;
    color: var(--text-light);
    font-size: 16px;
}

/* 架构图 */
.architecture {
    margin: 20px 0;
    text-align: center;
}

.arch-box {
    border: 2px solid var(--primary);
    border-radius: 8px;
    padding: 16px;
    margin: 8px 0;
    background: #f0f7ff;
}

.arch-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
}

.arch-desc {
    font-size: 15px;
    color: var(--text-light);
    margin-top: 4px;
}

.arch-arrow {
    font-size: 16px;
    color: var(--primary);
    padding: 8px 0;
}

.arch-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.arch-row .arch-box {
    flex: 1;
    min-width: 100px;
    max-width: 150px;
}

.arch-client { border-color: #28a745; background: #f0fff4; }
.arch-daemon { border-color: var(--primary); background: #f0f7ff; }
.arch-containerd { border-color: #6f42c1; background: #f5f0ff; }
.arch-runc { border-color: #e36209; background: #fff5f0; }
.arch-image { border-color: #0366d6; background: #f0f5ff; }
.arch-container { border-color: #28a745; background: #f0fff4; }
.arch-network { border-color: #d73a49; background: #fff0f0; }
.arch-volume { border-color: #f9a825; background: #fffdf0; }
.arch-host { border-color: #6a737d; background: #f6f8fa; }

/* 响应式 */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        overflow: visible;
    }

    .main {
        margin-left: 0;
        padding: 20px;
    }

    .section-gray {
        margin-left: -20px;
        margin-right: -20px;
        padding: 20px;
    }

    h2 {
        font-size: 1.75rem;
    }

    .grid {
        grid-template-columns: 1fr;
    }
}

/* ========== 流程图样式 ========== */
.flowchart {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0;
    margin: 24px 0;
    padding: 24px;
    background: var(--bg-gray);
    border-radius: 12px;
    overflow-x: auto;
}

.flow-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 100px;
}

.flow-box {
    padding: 16px 24px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 16px;
    text-align: center;
    min-width: 80px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.flow-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.flow-box.primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.flow-box.success {
    background: linear-gradient(135deg, #28a745 0%, #20903c 100%);
    color: white;
}

.flow-box.warning {
    background: linear-gradient(135deg, #f9a825 0%, #f57f17 100%);
    color: white;
}

.flow-box.info {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
}

.flow-box.secondary {
    background: linear-gradient(135deg, #6c757d 0%, #545b62 100%);
    color: white;
}

.flow-box.outline {
    background: white;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.flow-box.dashed {
    background: white;
    border: 2px dashed var(--border);
    color: var(--text-light);
}

.flow-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.flow-label {
    font-size: 16px;
    color: var(--text-light);
    margin-top: 8px;
}

.flow-arrow {
    display: flex;
    align-items: center;
    padding: 0 16px;
    color: var(--primary);
    font-size: 24px;
}

.flow-arrow::before {
    content: '→';
}

.flow-arrow.down {
    padding: 8px 0;
}

.flow-arrow.down::before {
    content: '↓';
}

.flow-arrow.up::before {
    content: '↑';
}

.flow-arrow.left::before {
    content: '←';
}

/* 垂直流程图 */
.flowchart-vertical {
    flex-direction: column;
    align-items: stretch;
}

.flowchart-vertical .flow-step {
    flex-direction: row;
    justify-content: center;
    padding: 8px 0;
}

.flowchart-vertical .flow-arrow {
    padding: 4px 0;
}

/* 分支流程图 */
.flowchart-branch {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 16px;
    align-items: center;
}

.flow-branch-left, .flow-branch-right {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.flow-branch-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

/* ========== 序列图样式 ========== */
.sequence-diagram {
    margin: 24px 0;
    padding: 24px;
    background: var(--bg-gray);
    border-radius: 12px;
    overflow-x: auto;
}

.sequence-participants {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border);
}

.sequence-participant {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 100px;
}

.sequence-participant-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 8px;
}

.sequence-participant-icon.client { background: linear-gradient(135deg, #28a745 0%, #20903c 100%); }
.sequence-participant-icon.daemon { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); }
.sequence-participant-icon.registry { background: linear-gradient(135deg, #6f42c1 0%, #5a32a3 100%); }
.sequence-participant-icon.container { background: linear-gradient(135deg, #f9a825 0%, #f57f17 100%); }

.sequence-participant-name {
    font-weight: 600;
    font-size: 16px;
}

.sequence-participant-type {
    font-size: 16px;
    color: var(--text-light);
}

.sequence-lifeline {
    position: relative;
    padding: 0 20px;
}

.sequence-message {
    display: flex;
    align-items: center;
    margin: 16px 0;
    position: relative;
}

.sequence-message-row {
    display: grid;
    grid-template-columns: repeat(var(--participants, 3), 1fr);
    gap: 8px;
    align-items: center;
}

.sequence-arrow-right, .sequence-arrow-left {
    display: flex;
    align-items: center;
    font-size: 15px;
    padding: 8px 12px;
    border-radius: 4px;
    background: white;
    border: 1px solid var(--border);
}

.sequence-arrow-right {
    flex-direction: row;
}

.sequence-arrow-right::after {
    content: '→';
    margin-left: 8px;
    color: var(--primary);
    font-weight: bold;
}

.sequence-arrow-left {
    flex-direction: row-reverse;
}

.sequence-arrow-left::after {
    content: '←';
    margin-right: 8px;
    color: var(--success, #28a745);
    font-weight: bold;
}

.sequence-dashed {
    border-style: dashed;
    opacity: 0.7;
}

.sequence-note {
    background: #fffbeb;
    border: 1px solid #f9a825;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 15px;
    margin: 8px auto;
    max-width: 300px;
    text-align: center;
}

.sequence-actor {
    text-align: center;
    font-size: 16px;
    color: var(--text-light);
}

/* 简化序列图 */
.sequence-simple {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sequence-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.sequence-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    flex-shrink: 0;
}

.sequence-step-content {
    flex: 1;
}

.sequence-step-title {
    font-weight: 500;
    font-size: 16px;
}

.sequence-step-desc {
    font-size: 15px;
    color: var(--text-light);
}

.sequence-step-code {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 16px;
    background: var(--code-bg);
    padding: 2px 6px;
    border-radius: 4px;
}

/* ========== 交互图样式 ========== */
.interaction-diagram {
    margin: 24px 0;
    padding: 24px;
    background: var(--bg-gray);
    border-radius: 12px;
}

.interaction-center {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    min-height: 200px;
}

.interaction-hub {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    z-index: 2;
}

.interaction-hub-icon {
    font-size: 32px;
    margin-bottom: 4px;
}

.interaction-hub-text {
    font-size: 16px;
}

.interaction-nodes {
    position: absolute;
    width: 100%;
    height: 100%;
}

.interaction-node {
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 500;
    color: white;
    transition: transform 0.2s;
}

.interaction-node:hover {
    transform: scale(1.1);
}

.interaction-node-1 { background: #28a745; top: 0; left: 50%; transform: translateX(-50%); }
.interaction-node-2 { background: #6f42c1; top: 20%; right: 10%; }
.interaction-node-3 { background: #f9a825; bottom: 20%; right: 10%; }
.interaction-node-4 { background: #e36209; bottom: 0; left: 50%; transform: translateX(-50%); }
.interaction-node-5 { background: #17a2b8; bottom: 20%; left: 10%; }
.interaction-node-6 { background: #d73a49; top: 20%; left: 10%; }

.interaction-line {
    position: absolute;
    height: 2px;
    background: var(--border);
    transform-origin: left center;
}

/* ========== 层级图样式 ========== */
.layer-diagram {
    margin: 24px 0;
    padding: 24px;
    background: var(--bg-gray);
    border-radius: 12px;
}

.layer-stack {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 400px;
    margin: 0 auto;
}

.layer {
    padding: 16px 24px;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    position: relative;
    transition: transform 0.2s;
}

.layer:hover {
    transform: scale(1.02);
}

.layer-app { background: linear-gradient(135deg, #28a745 0%, #20903c 100%); color: white; }
.layer-deps { background: linear-gradient(135deg, #17a2b8 0%, #138496 100%); color: white; }
.layer-runtime { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: white; }
.layer-os { background: linear-gradient(135deg, #6c757d 0%, #545b62 100%); color: white; }
.layer-kernel { background: linear-gradient(135deg, #343a40 0%, #1d2124 100%); color: white; }

.layer-label {
    font-size: 16px;
    opacity: 0.9;
}

.layer-size {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    opacity: 0.8;
}

/* ========== 对比图样式 ========== */
.compare-diagram {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 24px;
    margin: 24px 0;
    padding: 24px;
    background: var(--bg-gray);
    border-radius: 12px;
    align-items: start;
}

.compare-side {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.compare-title {
    font-weight: 600;
    font-size: 16px;
    text-align: center;
    padding: 12px;
    background: white;
    border-radius: 8px;
    border: 2px solid var(--primary);
}

.compare-title.bad {
    border-color: #d73a49;
    color: #d73a49;
}

.compare-title.good {
    border-color: #28a745;
    color: #28a745;
}

.compare-item {
    padding: 12px 16px;
    background: white;
    border-radius: 8px;
    font-size: 16px;
}

.compare-item.bad {
    border-left: 3px solid #d73a49;
}

.compare-item.good {
    border-left: 3px solid #28a745;
}

.compare-vs {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
    color: var(--text-light);
    padding-top: 60px;
}

/* ========== 时间线样式 ========== */
.timeline {
    margin: 24px 0;
    padding: 24px;
    background: var(--bg-gray);
    border-radius: 12px;
}

.timeline-line {
    position: relative;
    padding-left: 32px;
}

.timeline-line::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--primary);
}

.timeline-item {
    position: relative;
    padding: 16px 0;
    padding-left: 24px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 20px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    border: 3px solid white;
    box-shadow: 0 0 0 2px var(--primary);
}

.timeline-item.success::before { background: #28a745; box-shadow: 0 0 0 2px #28a745; }
.timeline-item.warning::before { background: #f9a825; box-shadow: 0 0 0 2px #f9a825; }
.timeline-item.error::before { background: #d73a49; box-shadow: 0 0 0 2px #d73a49; }

.timeline-title {
    font-weight: 600;
    font-size: 15px;
}

.timeline-desc {
    font-size: 15px;
    color: var(--text-light);
    margin-top: 4px;
}

.timeline-code {
    margin-top: 8px;
}

/* ========== 思维导图样式 ========== */
.mindmap {
    margin: 24px 0;
    padding: 24px;
    background: var(--bg-gray);
    border-radius: 12px;
    overflow-x: auto;
}

.mindmap-root {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.mindmap-center {
    padding: 16px 32px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: 24px;
    font-weight: 600;
    font-size: 16px;
}

.mindmap-branches {
    display: flex;
    gap: 16px;
    margin-top: 24px;
    flex-wrap: wrap;
    justify-content: center;
}

.mindmap-branch {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.mindmap-node {
    padding: 12px 20px;
    background: white;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-weight: 500;
    font-size: 16px;
    margin-bottom: 8px;
}

.mindmap-node.primary { border-color: var(--primary); color: var(--primary); }
.mindmap-node.success { border-color: #28a745; color: #28a745; }
.mindmap-node.warning { border-color: #f9a825; color: #f9a825; }
.mindmap-node.info { border-color: #17a2b8; color: #17a2b8; }

.mindmap-children {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mindmap-leaf {
    padding: 8px 16px;
    background: var(--bg-gray);
    border-radius: 4px;
    font-size: 15px;
    color: var(--text-light);
}

/* ========== 状态图样式 ========== */
.state-diagram {
    margin: 24px 0;
    padding: 24px;
    background: var(--bg-gray);
    border-radius: 12px;
}

.state-flow {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.state-box {
    padding: 12px 24px;
    border-radius: 20px;
    font-weight: 500;
    font-size: 16px;
    text-align: center;
}

.state-box.initial {
    border: 2px solid var(--primary);
    color: var(--primary);
    background: white;
}

.state-box.active {
    background: linear-gradient(135deg, #28a745 0%, #20903c 100%);
    color: white;
}

.state-box.paused {
    background: linear-gradient(135deg, #f9a825 0%, #f57f17 100%);
    color: white;
}

.state-box.stopped {
    background: linear-gradient(135deg, #6c757d 0%, #545b62 100%);
    color: white;
}

.state-box.error {
    background: linear-gradient(135deg, #d73a49 0%, #cb2431 100%);
    color: white;
}

.state-arrow {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 16px;
    color: var(--text-light);
}

.state-arrow::before {
    content: '→';
    font-size: 20px;
    color: var(--primary);
}

.state-arrow-label {
    margin-top: 2px;
}

/* ========== 表格响应式样式 ========== */
@media (max-width: 768px) {
    .table {
        font-size: 14px;
        overflow-x: auto;
        display: block;
    }
    
    .table th, .table td {
        padding: 8px 12px;
        white-space: nowrap;
    }
    
    .table tbody tr:hover {
        transform: none;
        background-color: #f6f8fa;
    }
    
    .table tbody tr:hover::before {
        content: '';
        position: absolute;
        left: 0;
        right: 0;
        top: 0;
        bottom: 0;
        background-color: #f6f8fa;
        z-index: -1;
    }
}

/* ========== 响应式调整 ========== */
@media (max-width: 768px) {
    .flowchart {
        flex-direction: column;
    }
    
    .flow-arrow {
        transform: rotate(90deg);
        padding: 8px 0;
    }
    
    .sequence-participants {
        flex-direction: column;
        align-items: center;
        gap: 16px;
    }
    
    .compare-diagram {
        grid-template-columns: 1fr;
    }
    
    .compare-vs {
        padding: 16px 0;
    }
    
    .interaction-node {
        width: 60px;
        height: 60px;
        font-size: 16px;
    }
    
    .interaction-hub {
        width: 100px;
        height: 100px;
    }
}