/* ===== 全局样式 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --sidebar-bg: #1a1a2e;
    --sidebar-text: #eee;
    --main-bg: #f5f7fa;
    --card-bg: #fff;
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 10px 25px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
        'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: var(--main-bg);
    color: var(--text-primary);
    line-height: 1.6;
}

/* ===== 布局容器 ===== */
.container {
    display: flex;
    min-height: 100vh;
}

/* ===== 左侧边栏 ===== */
.sidebar {
    width: 280px;
    background: linear-gradient(135deg, var(--sidebar-bg) 0%, #16213e 100%);
    color: var(--sidebar-text);
    padding: 2rem 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.sidebar-header {
    padding: 0 1.5rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1.5rem;
}

.sidebar-header h1 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.subtitle {
    font-size: 0.9rem;
    opacity: 0.8;
    font-weight: 300;
}

/* 返回按钮 */
.nav-back {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    margin: 0 1rem 1rem 1rem;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    border: none;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    justify-content: center;
}

.nav-back:hover {
    transform: translateX(-5px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.nav-back .icon {
    font-size: 1.3rem;
}

/* 导航菜单 */
.nav-menu {
    padding: 0 1rem;
    margin-bottom: 2rem;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    margin-bottom: 0.5rem;
    border-radius: 10px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.3s;
    cursor: pointer;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.nav-item .icon {
    font-size: 1.3rem;
    margin-right: 0.75rem;
}

.nav-item span:last-child {
    font-weight: 500;
}

/* 技术栈 */
.tech-stack {
    padding: 0 1.5rem;
}

.tech-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 1rem;
}

.tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tech-tag {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* ===== 右侧内容区 ===== */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 2rem 3rem;
    max-width: 1200px;
}

.content-section {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    transition: all 0.3s;
}

.content-section:hover {
    box-shadow: var(--shadow-hover);
}

.content-section h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.content-section h3 {
    font-size: 1.3rem;
    margin: 2rem 0 1rem;
    color: var(--text-primary);
}

.content-section h4 {
    font-size: 1.1rem;
    margin: 1.5rem 0 0.75rem;
    color: var(--text-primary);
}

.desc {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

/* ===== 信息卡片 ===== */
.info-card {
    background: #f7fafc;
    border-left: 4px solid var(--primary-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.info-row {
    display: flex;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: 600;
    color: var(--primary-color);
    min-width: 120px;
    flex-shrink: 0;
}

.info-value {
    color: var(--text-primary);
}

.info-value strong {
    color: var(--secondary-color);
}

.highlight-blue {
    color: var(--primary-color);
    font-weight: 600;
}

.highlight-red {
    color: #e53e3e;
    font-weight: 600;
}

/* ===== 架构图 ===== */
.architecture-box {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    margin: 1.5rem 0;
}

.architecture-box h3 {
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    text-align: center;
}

.architecture-flow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.flow-item {
    flex: 1;
    min-width: 140px;
    text-align: center;
    background: white;
    padding: 1.5rem 1rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: all 0.3s;
}

.flow-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.flow-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.flow-text {
    font-weight: 600;
    color: var(--text-primary);
}

.flow-text small {
    display: block;
    font-weight: 400;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.flow-arrow {
    font-size: 2rem;
    color: var(--primary-color);
    font-weight: bold;
}

/* ===== 代码块 ===== */
.code-block {
    margin: 1.5rem 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: #21252b;
    color: #abb2bf;
    font-size: 0.85rem;
    font-weight: 500;
}

.copy-btn {
    padding: 0.4rem 1rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.3s;
}

.copy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.copy-btn:active {
    transform: translateY(0);
}

.code-block pre {
    margin: 0;
    padding: 1.5rem;
    background: #282c34;
    overflow-x: auto;
}

.code-block code {
    font-family: 'Fira Code', 'Monaco', 'Consolas', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.7;
}

/* ===== 结果框 ===== */
.result-box {
    background: #f7fafc;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.result-box h4 {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.result-list {
    list-style: none;
    padding: 0;
}

.result-list li {
    padding: 0.75rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--text-primary);
}

.result-list li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
    font-size: 1.2rem;
}

/* ===== 高亮框 ===== */
.highlight-box {
    display: flex;
    gap: 1rem;
    background: #fffaf0;
    border-left: 4px solid #ed8936;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
}

.highlight-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.highlight-content {
    flex: 1;
    color: var(--text-primary);
}

/* ===== 技术细节 ===== */
.tech-detail {
    background: #f7fafc;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.tech-detail h4 {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.detail-item {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.detail-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.detail-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* ===== 示例表格 ===== */
.example-box {
    background: #f7fafc;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.example-box h4 {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.example-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.example-table thead {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.example-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

.example-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.example-table tbody tr:last-child td {
    border-bottom: none;
}

.rank-1 {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    font-weight: bold;
}

.rank-2 {
    background: #c6f6d5;
    font-weight: bold;
}

.rank-3 {
    background: #bee3f8;
    font-weight: bold;
}

.score-high {
    color: #38a169;
    font-weight: bold;
}

.score-medium {
    color: #ed8936;
    font-weight: bold;
}

/* ===== 指标卡片 ===== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.metric-card {
    background: linear-gradient(135deg, #ffffff 0%, #f7fafc 100%);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s;
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.metric-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.metric-value {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.metric-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.metric-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ===== 价值框 ===== */
.value-box {
    background: linear-gradient(135deg, #f0fff4 0%, #f7fafc 100%);
    border: 2px solid #9ae6b4;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.value-box h4 {
    color: #276749;
    margin-bottom: 1rem;
}

.value-list {
    list-style: none;
    padding: 0;
}

.value-list li {
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #38a169;
}

.value-list li:last-child {
    margin-bottom: 0;
}

.value-list li strong {
    color: #276749;
    display: block;
    margin-bottom: 0.5rem;
}

.value-list li span {
    color: var(--text-secondary);
    display: block;
}

/* ===== 平滑滚动 ===== */
html {
    scroll-behavior: smooth;
}

/* ===== 滚动条样式 ===== */
.main-content::-webkit-scrollbar {
    width: 8px;
}

.main-content::-webkit-scrollbar-track {
    background: transparent;
}

.main-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.main-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* ===== 响应式设计 ===== */
@media (max-width: 1024px) {
    .main-content {
        padding: 1.5rem 2rem;
    }

    .architecture-flow {
        flex-direction: column;
    }

    .flow-arrow {
        transform: rotate(90deg);
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: relative;
        height: auto;
    }

    .main-content {
        margin-left: 0;
        padding: 1.5rem;
    }

    .content-section {
        padding: 1.5rem;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }
}
