* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f7fa;
    color: #333;
}

.container {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: 220px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 0;
    position: fixed;
    height: 100vh;
}

.logo {
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.logo h2 { font-size: 20px; }

.menu {
    padding: 20px 0;
}

.menu-item {
    display: block;
    padding: 12px 20px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: all 0.3s;
}

.menu-item:hover, .menu-item.active {
    background: rgba(255,255,255,0.15);
    color: white;
}

/* 主内容 */
.main-content {
    flex: 1;
    margin-left: 220px;
    padding: 30px;
}

.page { display: none; }
.page.active { display: block; }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

h1 { margin-bottom: 20px; color: #2c3e50; }

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.stat-card.running { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; }

.stat-number { font-size: 36px; font-weight: bold; }
.stat-label { margin-top: 5px; opacity: 0.8; }

/* 卡片 */
.card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.card h3 { margin-bottom: 15px; color: #2c3e50; }

/* 表格 */
.table {
    width: 100%;
    border-collapse: collapse;
}

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

.table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #666;
}

.table tbody tr:hover { background: #f8f9fa; }

/* 状态标签 */
.status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
}

.status-running { background: #e3f2fd; color: #1976d2; }
.status-completed { background: #e8f5e9; color: #388e3c; }
.status-failed { background: #ffebee; color: #d32f2f; }
.status-stopped { background: #fff3e0; color: #f57c00; }

/* 按钮 */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    background: #e0e0e0;
    color: #333;
    text-decoration: none;
}

.btn:hover { opacity: 0.85; }

.btn-primary { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; }
.btn-success { background: #4caf50; color: white; }
.btn-danger { background: #f44336; color: white; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 12px 30px; font-size: 16px; }

/* 表单 */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-actions {
    margin-top: 20px;
    text-align: right;
}

.form-actions .btn { margin-left: 10px; }

/* 弹窗 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show { display: flex; }

.modal-content {
    background: white;
    border-radius: 10px;
    width: 500px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h2 { font-size: 18px; }

.close {
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.close:hover { color: #333; }

.modal-content form { padding: 20px; }

/* 日志容器 */
.log-container {
    background: #1a1a2e;
    color: #eee;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.8;
    padding: 20px;
    height: calc(100vh - 200px);
    min-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    border-radius: 8px;
}

.log-container::-webkit-scrollbar { width: 8px; }
.log-container::-webkit-scrollbar-track { background: #16213e; }
.log-container::-webkit-scrollbar-thumb { background: #4a5568; border-radius: 4px; }

.log-line { margin: 4px 0; padding: 2px 0; }
.log-time { color: #718096; }
.log-info { color: #63b3ed; }
.log-warning { color: #fbd38d; }
.log-error { color: #fc8181; background: rgba(252, 129, 129, 0.1); padding: 2px 4px; border-radius: 3px; }
.log-success { color: #68d391; }
.log-debug { color: #a0aec0; }
.log-chapter { color: #b794f4; font-weight: 500; }
.log-progress { color: #4fd1c5; }
.log-section { margin: 15px 0 10px; padding: 8px 0; border-top: 1px solid #4a5568; color: #f6e05e; }

/* 章节进度网格 */
.chapter-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chapter-item { 
    padding: 6px 12px; 
    border-radius: 6px; 
    font-size: 12px;
    background: #2d3748;
}
.chapter-done { background: #276749; color: #9ae6b4; }
.chapter-progress { background: #744210; color: #fbd38d; }

/* 消息提示 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 6px;
    color: white;
    z-index: 2000;
    animation: slideIn 0.3s;
}

.toast-success { background: #4caf50; }
.toast-error { background: #f44336; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* 空状态 */
.empty {
    text-align: center;
    padding: 40px;
    color: #999;
}

/* 课程列表 */
.course-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 10px;
}

.course-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
}

.course-item:hover { background: #f8f9fa; }
.course-item:last-child { border-bottom: none; }

.course-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 12px;
}

.course-item .course-info { flex: 1; }
.course-item .course-name { font-weight: 500; color: #333; }
.course-item .course-teacher { font-size: 13px; color: #888; margin-top: 3px; }
.course-item .course-progress { 
    font-size: 12px; 
    padding: 3px 8px; 
    border-radius: 10px;
    background: #e3f2fd;
    color: #1976d2;
}

.select-all-bar {
    padding: 10px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
    margin: -10px -10px 10px -10px;
    border-radius: 6px 6px 0 0;
}

.select-all-bar label {
    cursor: pointer;
    font-weight: 500;
}
