/* 全局样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif; background: #f0f2f5; color: #333; min-height: 100vh; padding-top: 56px; }
a { text-decoration: none; color: #1890ff; }

/* 导航栏 */
.navbar { background: #1a1a2e; color: #fff; padding: 0 24px; height: 56px; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 2px 8px rgba(0,0,0,.15); position: fixed; top: 0; left: 0; right: 0; z-index: 1001; }
.navbar .brand { font-size: 18px; font-weight: 700; letter-spacing: 1px; }
.navbar .nav-links { display: flex; gap: 20px; align-items: center; }
.navbar .nav-links a { color: #ccc; font-size: 14px; transition: .2s; }
.navbar .nav-links a:hover { color: #fff; }
.navbar .nav-links .active { color: #4fc3f7; }
.navbar .user-info { font-size: 13px; color: #aaa; display: flex; align-items: center; gap: 12px; }

/* 容器 */
.container { max-width: 1200px; margin: 0 auto; padding: 24px; }

/* 卡片 */
.card { background: #fff; border-radius: 12px; padding: 24px; margin-bottom: 16px; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.card h2 { font-size: 18px; margin-bottom: 16px; color: #1a1a2e; }
.card h3 { font-size: 15px; margin-bottom: 12px; }

/* 表单 */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 13px; color: #666; font-weight: 500; }
.form-group input, .form-group textarea, .form-group select { width: 100%; padding: 10px 12px; border: 1px solid #d9d9d9; border-radius: 8px; font-size: 14px; transition: .2s; }
.form-group input:focus, .form-group textarea:focus { border-color: #1890ff; outline: none; box-shadow: 0 0 0 2px rgba(24,144,255,.2); }
.form-group textarea { min-height: 80px; resize: vertical; }

.btn { padding: 10px 24px; border: none; border-radius: 8px; font-size: 14px; cursor: pointer; font-weight: 500; transition: .2s; display: inline-flex; align-items: center; gap: 6px; }
.btn-primary { background: #1890ff; color: #fff; }
.btn-primary:hover { background: #40a9ff; }
.btn-success { background: #52c41a; color: #fff; }
.btn-success:hover { background: #73d13d; }
.btn-danger { background: #ff4d4f; color: #fff; }
.btn-danger:hover { background: #ff7875; }
.btn-outline { background: #fff; color: #1890ff; border: 1px solid #1890ff; }
.btn-outline:hover { background: #e6f7ff; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 32px; font-size: 16px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #f0f0f0; }
th { background: #fafafa; font-weight: 600; color: #555; font-size: 12px; text-transform: uppercase; }
tr:hover { background: #fafafa; }

/* 状态标签 */
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; }
.tag-success { background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; }
.tag-warning { background: #fffbe6; color: #faad14; border: 1px solid #ffe58f; }
.tag-danger { background: #fff2f0; color: #ff4d4f; border: 1px solid #ffccc7; }
.tag-info { background: #e6f7ff; color: #1890ff; border: 1px solid #91d5ff; }

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 1px 4px rgba(0,0,0,.08); text-align: center; }
.stat-card .stat-value { font-size: 32px; font-weight: 700; color: #1a1a2e; }
.stat-card .stat-label { font-size: 13px; color: #999; margin-top: 4px; }

/* 课程网格 */
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.course-card { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.08); transition: .2s; cursor: pointer; }
.course-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.course-card .course-header { background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; padding: 20px; }
.course-card .course-body { padding: 16px; }
.course-card .course-title { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.course-card .course-meta { font-size: 12px; color: #999; display: flex; gap: 12px; }
.progress-bar { height: 6px; background: #f0f0f0; border-radius: 3px; margin-top: 12px; overflow: hidden; }
.progress-bar .fill { height: 100%; background: #52c41a; border-radius: 3px; transition: .3s; }

/* 视频区 */
.video-wrapper { background: #000; border-radius: 12px; overflow: hidden; margin-bottom: 16px; position: relative; aspect-ratio: 16/9; }
.video-wrapper video, .video-wrapper iframe { width: 100%; height: 100%; display: block; object-fit: contain; }
.video-wrapper .overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.7); z-index: 10; overflow-y: auto; padding: 16px; }
.video-wrapper .overlay.hidden { display: none; }
.video-cover { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.75); z-index: 10; }
/* 全屏按钮 */
.fullscreen-btn { position: absolute; bottom: 12px; right: 12px; z-index: 20; background: rgba(0,0,0,.5); color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 8px; padding: 6px 12px; font-size: 18px; cursor: pointer; transition: .2s; }
.fullscreen-btn:hover { background: rgba(0,0,0,.75); border-color: rgba(255,255,255,.5); }

/* 摄像头 */
.camera-container { position: relative; width: 320px; max-width: 100%; margin: 0 auto; border-radius: 12px; overflow: hidden; border: 2px solid #d9d9d9; }
.camera-container video { width: 100%; display: block; }
.camera-container canvas { display: none; }

/* 考试 */
.exam-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 0; border-bottom: 1px solid #f0f0f0; margin-bottom: 20px; }
.exam-timer { font-size: 20px; font-weight: 700; color: #ff4d4f; }
.question-card { background: #fff; border-radius: 12px; padding: 24px; margin-bottom: 16px; box-shadow: 0 1px 4px rgba(0,0,0,.08); display: none; }
.question-card.active { display: block; }
.question-num { font-size: 13px; color: #999; margin-bottom: 8px; }
.question-text { font-size: 16px; font-weight: 500; margin-bottom: 16px; line-height: 1.6; }
.option-item { padding: 12px 16px; border: 2px solid #f0f0f0; border-radius: 8px; margin-bottom: 8px; cursor: pointer; transition: .2s; display: flex; align-items: center; gap: 10px; }
.option-item:hover { border-color: #1890ff; background: #e6f7ff; }
.option-item.selected { border-color: #1890ff; background: #e6f7ff; font-weight: 500; }
.option-item .marker { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #d9d9d9; display: flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; }
.option-item.selected .marker { background: #1890ff; color: #fff; border-color: #1890ff; }

/* 人脸弹窗 */
.face-modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.face-modal.hidden { display: none; }
.face-modal .face-dialog { background: #fff; border-radius: 16px; padding: 24px; text-align: center; width: 400px; max-width: 90vw; }
.face-modal .face-dialog h3 { margin-bottom: 12px; }
.face-modal .face-status { margin-top: 12px; font-size: 14px; min-height: 20px; }

/* 顶部快捷操作栏 */
.top-actions { display: flex; justify-content: flex-end; gap: 12px; padding: 12px 24px 0; max-width: 1200px; margin: 0 auto; }
.top-actions .top-btn { padding: 6px 16px; background: #e6f7ff; color: #1890ff; border-radius: 6px; font-size: 13px; font-weight: 500; transition: .2s; }
.top-actions .top-btn:hover { background: #bae7ff; color: #096dd9; }

/* Toast */
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: #1a1a2e; color: #fff; padding: 12px 24px; border-radius: 8px; font-size: 14px; z-index: 2000; opacity: 0; transition: .3s; pointer-events: none; }
.toast.show { opacity: 1; }
.toast.success { background: #52c41a; }
.toast.error { background: #ff4d4f; }

/* 图表区 */
.chart-container { height: 300px; margin: 16px 0; }

/* 响应式 */
@media (max-width: 768px) {
    body { padding-top: 50px; }
    .container { padding: 12px; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .course-grid { grid-template-columns: 1fr; }
    .navbar { padding: 0 12px; height: auto; min-height: 56px; flex-wrap: wrap; }
    .navbar .nav-links { gap: 8px; font-size: 12px; }
    .navbar .brand { font-size: 15px; }
    .navbar .user-info { font-size: 11px; gap: 6px; }
    table { font-size: 12px; }
    th, td { padding: 8px 6px; }
    .btn { padding: 8px 16px; font-size: 13px; }
    .card { padding: 16px; }
    .video-wrapper { aspect-ratio: 4/3; border-radius: 8px; margin-bottom: 12px; }
    .video-wrapper .overlay { font-size: 13px; }
    .camera-container { width: 200px; }
    .face-modal .face-dialog { width: 100%; max-width: 95vw; padding: 16px; }
    .face-modal .face-dialog h3 { font-size: 15px; }
    .exam-header { flex-direction: column; gap: 8px; align-items: flex-start; }
    .exam-timer { font-size: 18px; }
    .question-card { padding: 16px; }
    .question-text { font-size: 15px; }
    .option-item { padding: 10px 12px; font-size: 14px; }
    .form-group input, .form-group textarea, .form-group select { font-size: 16px; }
    .chart-container { height: 220px; }
    .stat-card .stat-value { font-size: 24px; }
    .stat-card { padding: 14px; }
    /* 表格横向滚动 */
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* 手机端进一步优化 */
@media (max-width: 480px) {
    body { padding-top: 48px; }
    .stat-grid { grid-template-columns: 1fr; }
    .navbar .brand { font-size: 14px; }
    .navbar .nav-links a { font-size: 11px; }
    .top-actions { padding: 8px 12px 0; gap: 8px; }
    .top-actions .top-btn { padding: 4px 12px; font-size: 11px; }
    .btn-lg { padding: 12px 24px; font-size: 14px; }
    h2 { font-size: 17px; }
    .video-wrapper { aspect-ratio: 3/4; }
    .camera-container { width: 160px; }
}
