:root {
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --accent-color: #e74c3c;
    --success-color: #27ae60;
    --light-color: #ecf0f1;
    --dark-color: #2c3e50;
    --text-color: #333;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    overflow-x: hidden;
    position: relative;
}

/* Bing背景图片样式 */
.bing-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: opacity 1s ease;
}

/* 内容遮罩层 */
.content-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.1) 100%
    );
    backdrop-filter: blur(5px);
    z-index: -1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
    margin-left: 320px; /* 为侧边栏留出空间 */
    transition: margin-left 0.3s ease;
}

/* 更新header背景为半透明 */
header {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px 0;
    background: linear-gradient(
        135deg,
        rgba(52, 152, 219, 0.9) 0%,
        rgba(44, 62, 80, 0.9) 100%
    );
    color: white;
    border-radius: 15px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.background-info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
}

.background-info span {
    font-size: 0.9rem;
    opacity: 0.8;
}

.refresh-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.refresh-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* 更新卡片背景为半透明 */
.lesson-card {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border-left: 5px solid var(--primary-color);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.refresh-btn.refreshing i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.logo i {
    font-size: 2.5rem;
    color: var(--accent-color);
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-top: 10px;
}

.lesson-nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.nav-btn {
    padding: 12px 25px;
    background: var(--card-bg);
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.nav-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.nav-btn.active {
    background: var(--primary-color);
    color: white;
}

.lessons-container {
    min-height: 500px;
}

.lesson {
    display: none;
    animation: fadeIn 0.5s ease;
}

.lesson.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.lesson h2 {
    color: var(--secondary-color);
    margin-bottom: 25px;
    font-size: 2rem;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 3px solid var(--primary-color);
}

.lesson h2 i {
    color: var(--primary-color);
}

.lesson-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.lesson-card h3 {
    color: var(--secondary-color);
    margin-bottom: 15px;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.lesson-card h3::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--accent-color);
    border-radius: 50%;
}

.explanation {
    margin-bottom: 20px;
    padding: 15px;
    background: var(--light-color);
    border-radius: 10px;
    border-left: 4px solid var(--success-color);
}

.explanation p {
    margin-bottom: 10px;
    font-size: 1.1rem;
    color: var(--dark-color);
}

.explanation ul {
    list-style-type: none;
    padding-left: 0;
}

.explanation li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.explanation li:last-child {
    border-bottom: none;
}

.explanation li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--success-color);
    font-weight: bold;
}

.code-toggle {
    width: 100%;
    padding: 12px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.code-toggle:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.code-toggle i {
    transition: var(--transition);
}

.code-toggle.active i {
    transform: rotate(180deg);
}

.code-block {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease;
    margin-top: 0;
}

.code-block.active {
    max-height: 1000px;
    margin-top: 15px;
}

.code-block pre {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0;
}

.code-block code {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
}

footer {
    text-align: center;
    margin-top: 50px;
    padding: 20px;
    color: var(--text-color);
    border-top: 1px solid #ddd;
}

/* 回到顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--accent-color);
    transform: translateY(-3px);
}

/* 进度条 */
.progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    z-index: 1000;
}

.progress-bar {
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    width: 0%;
    transition: width 0.3s ease;
}

/* 资源链接按钮 */
.resource-link {
    background: var(--success-color) !important;
    border-color: var(--success-color) !important;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.resource-link:hover {
    background: #219653 !important;
}

/* 文件结构演示 */
.file-structure-demo {
    margin: 20px 0;
}

.file-tree {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 20px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    overflow-x: auto;
    margin: 15px 0;
}

/* 演示区域样式 */
.demo-section {
    margin-top: 20px;
    padding: 20px;
    background: var(--light-color);
    border-radius: 10px;
    border-left: 4px solid var(--primary-color);
}

.demo-section h4 {
    margin-bottom: 15px;
    color: var(--secondary-color);
}

/* 导航栏演示 */
.demo-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1rem 2rem;
    border-radius: 8px;
}

.demo-nav-logo {
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
}

.demo-nav-menu {
    display: flex;
    list-style: none;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
}

.demo-nav-menu li a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.demo-nav-menu li a:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* 页脚样式优化 */
.footer-content {
    text-align: center;
}

/* ===== 侧边栏样式 ===== */

/* 侧边栏开关按钮（移动端） */
.sidebar-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    z-index: 1001;
    display: none;
}

.sidebar-toggle:hover {
    background: var(--accent-color);
    transform: scale(1.1);
}

/* 侧边栏样式 */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 300px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    transition: var(--transition);
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* 进度概览 */
.progress-summary {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.progress-circle {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 15px;
}

.circle-bg {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #f0f0f0;
    position: absolute;
}

.circle-progress {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(var(--primary-color) 0%, #f0f0f0 0%);
    position: absolute;
    transition: background 0.5s ease;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.progress-text span {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--secondary-color);
}

.progress-text small {
    font-size: 0.8rem;
    color: var(--dark-color);
    opacity: 0.7;
}

/* 侧边栏导航 */
.sidebar-nav {
    padding: 20px 0;
}

.nav-section {
    margin-bottom: 25px;
}

.nav-section h4 {
    padding: 0 20px 10px;
    margin: 0;
    color: var(--secondary-color);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    display: flex;
    align-items: flex-start;
    padding: 12px 20px;
    cursor: pointer;
    transition: var(--transition);
    border-left: 3px solid transparent;
    position: relative;
}

.nav-item:hover {
    background: rgba(52, 152, 219, 0.1);
    border-left-color: var(--primary-color);
}

.nav-item.active {
    background: rgba(52, 152, 219, 0.15);
    border-left-color: var(--primary-color);
}

.nav-item .progress-dot {
    margin-top: 4px;
    margin-right: 12px;
    font-size: 0.6rem;
    color: #ddd;
    transition: var(--transition);
}

.nav-item.active .progress-dot,
.nav-item.completed .progress-dot {
    color: var(--success-color);
}

.nav-item .progress-dot.in-progress {
    color: var(--primary-color);
    animation: pulse 2s infinite;
}

.nav-item > span {
    flex: 1;
    font-weight: 600;
    color: var(--dark-color);
}

.nav-item small {
    position: absolute;
    left: 55px;
    top: 35px;
    font-size: 0.8rem;
    color: var(--text-color);
    opacity: 0.7;
}

.nav-item.resource-link a {
    display: flex;
    align-items: flex-start;
    text-decoration: none;
    color: inherit;
    width: 100%;
}

.nav-item.resource-link i {
    margin-top: 4px;
    margin-right: 12px;
    color: var(--primary-color);
}

/* 侧边栏页脚 */
.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(0, 0, 0, 0.02);
}

.completion-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 15px;
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--dark-color);
    opacity: 0.7;
}

.reset-progress {
    width: 100%;
    padding: 10px;
    background: rgba(231, 76, 60, 0.1);
    color: var(--accent-color);
    border: 1px solid rgba(231, 76, 60, 0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.reset-progress:hover {
    background: rgba(231, 76, 60, 0.2);
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .container {
        margin-left: 0;
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    /* 当侧边栏打开时，添加遮罩层 */
    .sidebar.open ~ .container::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .logo {
        flex-direction: column;
        gap: 10px;
    }
    
    .logo h1 {
        font-size: 2rem;
    }
    
    .lesson-nav {
        flex-direction: column;
        align-items: center;
    }
    
    .nav-btn {
        width: 100%;
        max-width: 300px;
    }
    
    .lesson h2 {
        font-size: 1.6rem;
    }
    
    .lesson-card {
        padding: 20px;
    }
    
    .sidebar {
        width: 280px;
    }
    
    .progress-circle {
        width: 100px;
        height: 100px;
    }
}

/* 进度点动画 */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.2);
    }
}

/* 学习进度标记 */
.lesson-marker {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ddd;
    transition: var(--transition);
}

.lesson-marker.completed {
    background: var(--success-color);
}

.lesson-marker.in-progress {
    background: var(--primary-color);
    animation: pulse 2s infinite;
}

/* 演示按钮样式 */
.demo-btn {
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.demo-btn:hover {
    background: var(--accent-color);
    transform: translateY(-2px);
}