/* ============================================
   Python数据分析全栈学习包 - 暗色技术风样式
   ============================================ */

/* CSS变量 - 暗色主题 */
:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #1c2333;
    --bg-card: #1a2233;
    --bg-code: #0d1117;
    --bg-hover: #1f2937;
    --bg-active: #1a3a5c;

    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --text-accent: #58a6ff;

    --border-primary: #30363d;
    --border-secondary: #21262d;
    --border-accent: #1f6feb;

    --accent-blue: #58a6ff;
    --accent-green: #3fb950;
    --accent-purple: #bc8cff;
    --accent-orange: #d29922;
    --accent-red: #f85149;
    --accent-cyan: #39d2c0;

    --sidebar-width: 300px;
    --topbar-height: 56px;
    --content-max-width: 900px;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;

    --transition: 0.2s ease;
}

/* 亮色主题 */
body.light-theme {
    --bg-primary: #ffffff;
    --bg-secondary: #f6f8fa;
    --bg-tertiary: #f0f3f6;
    --bg-card: #ffffff;
    --bg-code: #f6f8fa;
    --bg-hover: #eaeef2;
    --bg-active: #ddf4ff;

    --text-primary: #1f2328;
    --text-secondary: #656d76;
    --text-muted: #8c959f;
    --text-accent: #0969da;

    --border-primary: #d0d7de;
    --border-secondary: #e8ecf0;
    --border-accent: #0969da;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.15);
}

/* 重置与基础 */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    overflow-x: hidden;
}

a {
    color: var(--text-accent);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--accent-blue);
}

/* ============================================
   侧边栏
   ============================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-primary);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s ease;
    overflow: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-primary);
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.logo-text {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    display: none;
    transition: all var(--transition);
}

.sidebar-toggle:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* 学习进度 */
.progress-section {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-primary);
    flex-shrink: 0;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.progress-percent {
    color: var(--accent-green);
    font-weight: 600;
}

.progress-bar {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-green), var(--accent-cyan));
    border-radius: 3px;
    width: 0%;
    transition: width 0.5s ease;
}

.progress-stats {
    font-size: 12px;
    color: var(--text-muted);
}

/* 导航 */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--border-primary);
    border-radius: 2px;
}

.nav-section {
    margin-bottom: 4px;
}

.nav-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    user-select: none;
}

.nav-section-title:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.nav-section-title svg:first-child {
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-section-title .arrow {
    margin-left: auto;
    transition: transform 0.2s ease;
    opacity: 0.5;
}

.nav-section-title.expanded .arrow {
    transform: rotate(180deg);
}

.nav-subsection {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.nav-subsection.open {
    max-height: 500px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 8px 20px 8px 48px;
    font-size: 13px;
    color: var(--text-secondary);
    transition: all var(--transition);
    position: relative;
}

.nav-item:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.nav-item.active {
    color: var(--accent-blue);
    background: var(--bg-active);
}

.nav-item.completed::before {
    content: '';
    position: absolute;
    left: 30px;
    width: 8px;
    height: 8px;
    background: var(--accent-green);
    border-radius: 50%;
}

/* ============================================
   主内容区
   ============================================ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 顶部栏 */
.topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    z-index: 50;
    backdrop-filter: blur(12px);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.menu-toggle:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    flex: 1;
}

.breadcrumb-item {
    color: var(--text-secondary);
}

.breadcrumb-sep {
    color: var(--text-muted);
    font-size: 12px;
}

.breadcrumb-current {
    color: var(--text-primary);
    font-weight: 500;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.btn-icon.active {
    color: var(--accent-green);
}

/* 内容容器 */
.content-wrapper {
    flex: 1;
    max-width: var(--content-max-width);
    width: 100%;
    margin: 0 auto;
    padding: 40px 32px 60px;
}

/* ============================================
   首页样式
   ============================================ */
.home-hero {
    text-align: center;
    padding: 60px 0 40px;
}

.home-hero h1 {
    font-size: 36px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple), var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
    line-height: 1.3;
}

.home-hero .subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.home-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 40px 0;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
    transition: all var(--transition);
}

.stat-card:hover {
    border-color: var(--border-accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-number {
    font-size: 36px;
    font-weight: 800;
    color: var(--accent-blue);
    line-height: 1;
    margin-bottom: 8px;
}

.stat-card:nth-child(2) .stat-number {
    color: var(--accent-purple);
}

.stat-card:nth-child(3) .stat-number {
    color: var(--accent-green);
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.home-sections {
    margin-top: 48px;
}

.section-card {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: 28px;
    margin-bottom: 20px;
    transition: all var(--transition);
    cursor: pointer;
}

.section-card:hover {
    border-color: var(--border-accent);
    box-shadow: var(--shadow-md);
}

.section-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}

.section-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.section-icon.blue { background: rgba(88,166,255,0.15); }
.section-icon.purple { background: rgba(188,140,255,0.15); }
.section-icon.green { background: rgba(63,185,80,0.15); }

.section-card h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
}

.section-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.section-card .item-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-muted);
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border-radius: 20px;
}

/* ============================================
   内容页面样式
   ============================================ */
.page-content h1 {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 8px;
    line-height: 1.3;
}

.page-content .page-desc {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-primary);
}

.page-content h2 {
    font-size: 22px;
    font-weight: 700;
    margin: 40px 0 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-primary);
    color: var(--text-primary);
}

.page-content h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 28px 0 12px;
    color: var(--text-primary);
}

.page-content p {
    margin-bottom: 16px;
    color: var(--text-secondary);
    line-height: 1.8;
}

.page-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.page-content ul, .page-content ol {
    margin: 12px 0 20px 24px;
    color: var(--text-secondary);
}

.page-content li {
    margin-bottom: 8px;
    line-height: 1.7;
}

/* 信息卡片 */
.info-card {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: 24px;
    margin: 20px 0;
}

.info-card.blue {
    border-left: 4px solid var(--accent-blue);
}

.info-card.green {
    border-left: 4px solid var(--accent-green);
}

.info-card.purple {
    border-left: 4px solid var(--accent-purple);
}

.info-card.orange {
    border-left: 4px solid var(--accent-orange);
}

.info-card.red {
    border-left: 4px solid var(--accent-red);
}

.info-card-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-card-title.blue { color: var(--accent-blue); }
.info-card-title.green { color: var(--accent-green); }
.info-card-title.purple { color: var(--accent-purple); }
.info-card-title.orange { color: var(--accent-orange); }
.info-card-title.red { color: var(--accent-red); }

/* 争议对比样式 */
.debate-box {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    margin: 20px 0;
    overflow: hidden;
}

.debate-header {
    padding: 16px 20px;
    font-weight: 700;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.debate-header.pro {
    background: rgba(63,185,80,0.1);
    color: var(--accent-green);
    border-bottom: 1px solid rgba(63,185,80,0.2);
}

.debate-header.con {
    background: rgba(248,81,73,0.1);
    color: var(--accent-red);
    border-bottom: 1px solid rgba(248,81,73,0.2);
}

.debate-header.advice {
    background: rgba(88,166,255,0.1);
    color: var(--accent-blue);
    border-bottom: 1px solid rgba(88,166,255,0.2);
}

.debate-body {
    padding: 16px 20px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.8;
}

.debate-body ul {
    margin: 8px 0 8px 20px;
}

.debate-body li {
    margin-bottom: 6px;
}

/* 代码块 */
.code-block {
    position: relative;
    margin: 20px 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-primary);
}

.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-primary);
    font-size: 12px;
    color: var(--text-muted);
}

.code-lang {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    text-transform: uppercase;
}

.copy-btn {
    background: var(--bg-hover);
    border: 1px solid var(--border-primary);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 4px;
}

.copy-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-accent);
}

.copy-btn.copied {
    color: var(--accent-green);
    border-color: var(--accent-green);
}

.code-block pre {
    margin: 0;
    padding: 20px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.6;
    background: var(--bg-code) !important;
}

.code-block pre code {
    font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', 'Consolas', monospace;
    background: transparent !important;
}

/* 行内代码 */
.page-content code:not(pre code) {
    background: var(--bg-tertiary);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.88em;
    font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', 'Consolas', monospace;
    color: var(--accent-orange);
    border: 1px solid var(--border-secondary);
}

/* 任务列表 */
.task-list {
    list-style: none;
    margin: 16px 0;
    padding: 0;
}

.task-list li {
    position: relative;
    padding: 10px 16px 10px 40px;
    margin-bottom: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.task-list li:hover {
    border-color: var(--border-accent);
}

.task-list li::before {
    content: attr(data-step);
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    background: var(--accent-blue);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
}

/* 踩坑提示 */
.pitfall-list {
    list-style: none;
    margin: 16px 0;
    padding: 0;
}

.pitfall-list li {
    position: relative;
    padding: 12px 16px 12px 44px;
    margin-bottom: 8px;
    background: rgba(248,81,73,0.05);
    border: 1px solid rgba(248,81,73,0.15);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.pitfall-list li::before {
    content: '⚠';
    position: absolute;
    left: 14px;
    top: 12px;
    font-size: 16px;
}

/* 交付物 */
.deliverable-list {
    list-style: none;
    margin: 16px 0;
    padding: 0;
}

.deliverable-list li {
    position: relative;
    padding: 10px 16px 10px 44px;
    margin-bottom: 6px;
    background: rgba(63,185,80,0.05);
    border: 1px solid rgba(63,185,80,0.15);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-secondary);
}

.deliverable-list li::before {
    content: '📦';
    position: absolute;
    left: 14px;
    top: 10px;
    font-size: 16px;
}

/* 标签 */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    margin: 2px 4px 2px 0;
}

.tag.blue {
    background: rgba(88,166,255,0.12);
    color: var(--accent-blue);
    border: 1px solid rgba(88,166,255,0.2);
}

.tag.green {
    background: rgba(63,185,80,0.12);
    color: var(--accent-green);
    border: 1px solid rgba(63,185,80,0.2);
}

.tag.purple {
    background: rgba(188,140,255,0.12);
    color: var(--accent-purple);
    border: 1px solid rgba(188,140,255,0.2);
}

.tag.orange {
    background: rgba(210,153,34,0.12);
    color: var(--accent-orange);
    border: 1px solid rgba(210,153,34,0.2);
}

/* ============================================
   上一页/下一页导航
   ============================================ */
.page-nav {
    display: flex;
    justify-content: space-between;
    padding: 24px 32px 40px;
    max-width: var(--content-max-width);
    width: 100%;
    margin: 0 auto;
    border-top: 1px solid var(--border-primary);
}

.page-nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 14px;
    transition: all var(--transition);
    max-width: 45%;
}

.page-nav-btn:hover {
    border-color: var(--border-accent);
    color: var(--accent-blue);
    background: var(--bg-hover);
}

.page-nav-btn.prev svg {
    flex-shrink: 0;
}

.page-nav-btn.next {
    margin-left: auto;
    text-align: right;
}

.page-nav-btn.next svg {
    flex-shrink: 0;
}

.page-nav-btn.hidden {
    visibility: hidden;
    pointer-events: none;
}

/* ============================================
   遮罩层（移动端）
   ============================================ */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 90;
}

.overlay.active {
    display: block;
}

/* ============================================
   响应式设计
   ============================================ */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .sidebar-toggle {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: flex;
    }

    .content-wrapper {
        padding: 24px 20px 40px;
    }

    .page-nav {
        padding: 20px;
    }
}

@media (max-width: 768px) {
    .home-hero h1 {
        font-size: 26px;
    }

    .home-hero .subtitle {
        font-size: 15px;
    }

    .home-stats {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stat-card {
        display: flex;
        align-items: center;
        gap: 16px;
        text-align: left;
        padding: 16px 20px;
    }

    .stat-number {
        font-size: 28px;
        margin-bottom: 0;
    }

    .page-content h1 {
        font-size: 22px;
    }

    .page-content h2 {
        font-size: 19px;
    }

    .page-nav-btn {
        padding: 8px 14px;
        font-size: 13px;
    }

    .page-nav-btn .nav-label {
        display: none;
    }
}

/* ============================================
   滚动条
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   动画
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-content {
    animation: fadeIn 0.3s ease;
}

/* 选中标记完成时的动画 */
@keyframes checkmark {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.btn-icon.just-marked {
    animation: checkmark 0.3s ease;
}
