/* ===== Hot Electronics 培训系统 ===== */
:root {
  --primary: #1a56db;
  --primary-dark: #1340a0;
  --primary-light: #e8effd;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans SC', sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== 公开页 ===== */
.public-page { min-height: 100vh; }

/* 导航 */
.public-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 40px; background: #fff; border-bottom: 1px solid var(--gray-200);
}
.public-brand { display: flex; align-items: center; gap: 10px; }
.public-logo {
  width: 40px; height: 40px; background: var(--primary);
  color: #fff; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px;
}
.public-brand > div:last-child strong { display: block; font-size: 15px; }
.public-brand > div:last-child span { font-size: 12px; color: var(--gray-500); }
.public-nav nav { display: flex; gap: 4px; }
.public-nav nav button {
  border: none; background: none; padding: 8px 16px;
  font-size: 14px; color: var(--gray-600); cursor: pointer; border-radius: 6px;
}
.public-nav nav button:hover { background: var(--gray-100); color: var(--gray-900); }
.public-search { font-size: 13px; color: var(--gray-400); display: flex; align-items: center; gap: 6px; }

/* 英雄区 */
.public-hero {
  display: flex; max-width: 1200px; margin: 0 auto; padding: 40px; gap: 40px; align-items: center;
}
.slide-stage {
  flex: 1; position: relative; overflow: hidden; border-radius: var(--radius); min-height: 340px;
}
.slide-card {
  position: absolute; inset: 0; opacity: 0; transition: opacity 0.6s; display: flex; gap: 20px; align-items: center;
}
.slide-card.active { opacity: 1; position: relative; }
.slide-visual img { width: 280px; height: 200px; object-fit: cover; border-radius: 8px; }
.slide-copy span { display: block; font-size: 12px; color: var(--primary); font-weight: 600; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 1px; }
.slide-copy h1 { font-size: 22px; line-height: 1.3; margin-bottom: 10px; }
.slide-copy p { font-size: 13px; color: var(--gray-500); line-height: 1.7; }
.slide-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,0.9); border: none; width: 36px; height: 36px;
  border-radius: 50%; font-size: 20px; cursor: pointer; box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center;
}
.slide-arrow.prev { left: 10px; }
.slide-arrow.next { right: 10px; }
.slide-dots { display: flex; gap: 6px; justify-content: center; margin-top: 12px; }
.slide-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--gray-300); cursor: pointer; }
.slide-dots span.active { background: var(--primary); width: 24px; border-radius: 4px; }

/* 登录面板 */
.login-panel {
  width: 320px; background: #fff; border-radius: var(--radius); padding: 32px;
  box-shadow: var(--shadow-lg);
}
.login-panel span { font-size: 12px; color: var(--gray-400); text-transform: uppercase; letter-spacing: 1px; }
.login-panel h2 { font-size: 18px; margin: 6px 0 20px; }
.login-panel label {
  display: block; font-size: 13px; color: var(--gray-600); margin-bottom: 14px;
}
.login-panel label input {
  display: block; width: 100%; margin-top: 4px;
  padding: 10px 12px; border: 1px solid var(--gray-200); border-radius: 6px;
  font-size: 14px; outline: none; transition: border 0.2s;
}
.login-panel label input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.login-panel button[type="submit"] {
  width: 100%; padding: 11px; background: var(--primary); color: #fff;
  border: none; border-radius: 6px; font-size: 15px; cursor: pointer; font-weight: 600;
}
.login-panel button[type="submit"]:hover { background: var(--primary-dark); }
.login-panel p { font-size: 11px; color: var(--gray-400); margin-top: 12px; line-height: 1.5; }
.login-error { color: var(--danger); font-size: 13px; margin-bottom: 10px; display: none; }

/* 公共区块 */
.public-section-head {
  text-align: center; max-width: 600px; margin: 0 auto 30px;
}
.public-section-head span {
  display: block; font-size: 12px; color: var(--primary); font-weight: 600;
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px;
}
.public-section-head h2 { font-size: 22px; }
.public-section-head p { font-size: 13px; color: var(--gray-500); margin-top: 6px; }

/* 排名区域 */
.public-ranking { max-width: 1200px; margin: 0 auto; padding: 40px; }
.public-rank-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.public-rank-card {
  background: #fff; border-radius: var(--radius); padding: 24px;
  box-shadow: var(--shadow);
}
.public-rank-no { font-size: 12px; color: var(--gray-400); font-weight: 700; }
.public-rank-card > div:first-of-type { margin: 4px 0 14px; }
.public-rank-card strong { font-size: 16px; }
.public-rank-card dl { display: flex; gap: 20px; margin-bottom: 10px; }
.public-rank-card dl div dt { font-size: 11px; color: var(--gray-400); }
.public-rank-card dl div dd { font-size: 18px; font-weight: 700; }
.public-rank-card > p { font-size: 12px; color: var(--gray-500); line-height: 1.5; }

/* 公告 */
.public-news { max-width: 1200px; margin: 0 auto; padding: 0 40px 60px; }
.public-news h2 { font-size: 16px; margin-bottom: 16px; }
.news-list { display: flex; flex-direction: column; }
.news-row {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 0; border-bottom: 1px solid var(--gray-100);
}
.news-row time { font-size: 12px; color: var(--gray-400); white-space: nowrap; min-width: 140px; }
.news-row strong { font-size: 13px; font-weight: 500; }
.more-news {
  margin-top: 12px; border: none; background: none; color: var(--primary);
  font-size: 13px; cursor: pointer; padding: 0;
}
.more-news:hover { text-decoration: underline; }

/* ===== 内部布局 ===== */
.app-layout { display: flex; min-height: 100vh; }

/* 侧栏 */
.sidebar {
  width: 220px; background: var(--gray-900); color: #fff;
  display: flex; flex-direction: column; position: fixed; inset: 0; right: auto;
}
.sidebar-brand {
  padding: 20px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-brand .logo { width: 36px; height: 36px; background: var(--primary); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; }
.sidebar-brand div { font-size: 13px; font-weight: 600; }
.sidebar-brand small { display: block; font-size: 11px; opacity: 0.5; font-weight: 400; }
.sidebar-nav { flex: 1; padding: 12px 8px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  color: rgba(255,255,255,0.7); border-radius: 6px; font-size: 14px; margin-bottom: 2px;
  transition: all 0.15s;
}
.sidebar-nav a:hover, .sidebar-nav a.active { background: rgba(255,255,255,0.1); color: #fff; text-decoration: none; }
.sidebar-nav a .nav-icon { width: 20px; text-align: center; }
.sidebar-footer {
  padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 12px; color: rgba(255,255,255,0.5);
}
.sidebar-footer .user-name { color: #fff; font-weight: 600; }

/* 主内容 */
.main-content { margin-left: 220px; flex: 1; min-height: 100vh; }
.main-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 30px; background: #fff; border-bottom: 1px solid var(--gray-200);
  position: sticky; top: 0; z-index: 50;
}
.main-header h1 { font-size: 18px; font-weight: 600; }
.main-header .header-actions { display: flex; align-items: center; gap: 12px; }
.header-actions .logout-btn {
  border: 1px solid var(--gray-200); background: #fff; padding: 6px 14px;
  border-radius: 6px; font-size: 13px; cursor: pointer; color: var(--gray-600);
}
.header-actions .logout-btn:hover { background: var(--gray-50); }
.main-body { padding: 24px 30px; }

/* ===== 卡片 ===== */
.card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px;
}
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--gray-100); font-weight: 600; font-size: 14px; display: flex; justify-content: space-between; align-items: center; }
.card-body { padding: 20px; }

/* 统计卡片 */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: #fff; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.stat-card .stat-label { font-size: 12px; color: var(--gray-500); }
.stat-card .stat-value { font-size: 28px; font-weight: 700; margin-top: 4px; }
.stat-card .stat-sub { font-size: 12px; color: var(--gray-400); margin-top: 2px; }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { background: var(--gray-50); padding: 10px 12px; text-align: left; font-weight: 600; color: var(--gray-600); border-bottom: 2px solid var(--gray-200); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--gray-100); }
tr:hover td { background: var(--gray-50); }

/* ===== 标签 ===== */
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.tag-success { background: #d1fae5; color: #065f46; }
.tag-warning { background: #fef3c7; color: #92400e; }
.tag-danger { background: #fee2e2; color: #991b1b; }
.tag-info { background: var(--primary-light); color: var(--primary); }
.tag-gray { background: var(--gray-100); color: var(--gray-600); }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
  border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer;
  border: 1px solid var(--gray-200); background: #fff; color: var(--gray-700);
  transition: all 0.15s;
}
.btn:hover { background: var(--gray-50); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { width: 32px; height: 32px; padding: 0; justify-content: center; }

/* ===== 表单 ===== */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: var(--gray-600); margin-bottom: 4px; font-weight: 500; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--gray-200);
  border-radius: 6px; font-size: 14px; outline: none;
}
.form-input:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.form-textarea { min-height: 80px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ===== 模态框 ===== */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  z-index: 1000; align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
  background: #fff; border-radius: var(--radius); width: 90%; max-width: 520px;
  max-height: 85vh; overflow-y: auto; box-shadow: var(--shadow-lg);
}
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--gray-100); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 16px; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--gray-400); padding: 4px; }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--gray-100); display: flex; gap: 8px; justify-content: flex-end; }

/* ===== 课程模块网格 ===== */
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.module-card {
  background: #fff; border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); cursor: pointer; transition: all 0.2s;
}
.module-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.module-card .module-icon { font-size: 28px; margin-bottom: 8px; }
.module-card .module-title { font-size: 15px; font-weight: 600; }
.module-card .module-count { font-size: 12px; color: var(--gray-400); margin-top: 4px; }

/* ===== 课程列表 ===== */
.course-list { display: flex; flex-direction: column; }
.course-item {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 16px; border-radius: 8px; transition: background 0.15s;
  border: 1px solid var(--gray-100); margin-bottom: 8px;
}
.course-item:hover { background: var(--gray-50); }
.course-item .course-info { flex: 1; }
.course-item .course-info h4 { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.course-item .course-info p { font-size: 12px; color: var(--gray-500); }
.course-item .course-status { display: flex; align-items: center; gap: 6px; }
.course-status .status-dot { width: 8px; height: 8px; border-radius: 50%; }
.status-dot.done { background: var(--success); }
.status-dot.pending { background: var(--gray-300); }
.status-dot.fail { background: var(--danger); }

/* ===== 视频区 ===== */
.video-area {
  background: #000; border-radius: var(--radius); overflow: hidden;
  width: 100%; aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px;
}
.video-area iframe { width: 100%; height: 100%; border: none; }
.video-placeholder {
  display: flex; flex-direction: column; align-items: center; gap: 8px; color: rgba(255,255,255,0.6);
}
.video-placeholder .play-icon { font-size: 40px; }

/* ===== 答题区 ===== */
.quiz-question { margin-bottom: 20px; padding: 16px; background: var(--gray-50); border-radius: 8px; }
.quiz-question .q-title { font-weight: 600; margin-bottom: 10px; font-size: 14px; }
.quiz-options { display: flex; flex-direction: column; gap: 8px; }
.quiz-option {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: #fff; border: 1px solid var(--gray-200); border-radius: 6px;
  cursor: pointer; transition: all 0.15s;
}
.quiz-option:hover { border-color: var(--primary); background: var(--primary-light); }
.quiz-option.selected { border-color: var(--primary); background: var(--primary-light); }
.quiz-option.correct { border-color: var(--success); background: #d1fae5; }
.quiz-option.wrong { border-color: var(--danger); background: #fee2e2; }
.quiz-option input[type="radio"] { accent-color: var(--primary); }

/* ===== 结果面板 ===== */
.result-panel {
  text-align: center; padding: 30px; background: #fff;
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.result-panel .score-big { font-size: 56px; font-weight: 800; margin: 10px 0; }
.result-panel .score-label { font-size: 14px; color: var(--gray-500); }

/* ===== 路径进度 ===== */
.path-timeline { display: flex; gap: 0; margin-bottom: 24px; }
.path-step {
  flex: 1; text-align: center; padding: 14px; position: relative;
  background: var(--gray-100); border-radius: 0;
}
.path-step:first-child { border-radius: 8px 0 0 8px; }
.path-step:last-child { border-radius: 0 8px 8px 0; }
.path-step.done { background: #d1fae5; }
.path-step.active { background: var(--primary-light); }
.path-step .step-week { font-size: 12px; color: var(--gray-500); font-weight: 600; }
.path-step.done .step-week { color: var(--success); }
.path-step.active .step-week { color: var(--primary); }
.path-step .step-title { font-size: 13px; margin-top: 2px; }
.path-step .step-check { font-size: 16px; }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .public-nav { padding: 12px 16px; }
  .public-hero { flex-direction: column; padding: 20px; }
  .slide-stage { min-height: 260px; }
  .login-panel { width: 100%; }
  .public-rank-grid { grid-template-columns: 1fr; }
  .sidebar { width: 56px; }
  .sidebar-brand div, .sidebar-nav a span, .sidebar-footer { display: none; }
  .main-content { margin-left: 56px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .module-grid { grid-template-columns: 1fr 1fr; }
  .path-timeline { flex-direction: column; gap: 4px; }
  .path-step { border-radius: 8px !important; }
}

/* ===== Loading ===== */
.spinner {
  display: inline-block; width: 20px; height: 20px;
  border: 2px solid var(--gray-200); border-top-color: var(--primary);
  border-radius: 50%; animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 消息提示 ===== */
.toast {
  position: fixed; top: 20px; right: 20px; z-index: 2000;
  padding: 12px 20px; border-radius: 8px; font-size: 14px;
  color: #fff; box-shadow: var(--shadow-lg); display: none;
  max-width: 360px;
}
.toast.show { display: block; animation: slideIn 0.3s; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--primary); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== 课程文字内容区 ===== */
.course-content {
  font-size: 14px;
  line-height: 1.8;
  color: var(--gray-700);
}
.course-content p { margin-bottom: 12px; }
.course-content ul, .course-content ol { margin: 8px 0 12px 20px; }
.course-content li { margin-bottom: 4px; }
.course-content strong { color: var(--gray-900); }

/* ===== 侧栏子菜单 ===== */
.sidebar-nav .nav-group { display: flex; align-items: center; gap: 10px; padding: 10px 12px; color: rgba(255,255,255,0.7); border-radius: 6px; font-size: 14px; cursor: pointer; transition: all 0.15s; margin-bottom: 2px; }
.sidebar-nav .nav-group:hover { background: rgba(255,255,255,0.1); color: #fff; }
.sidebar-nav .nav-group .nav-arrow { margin-left: auto; font-size: 10px; transition: transform 0.2s; }
.sidebar-nav .nav-group.open .nav-arrow { transform: rotate(90deg); }
.sidebar-nav .sub-nav { display: none; padding-left: 8px; }
.sidebar-nav .sub-nav.open { display: block; }
.sidebar-nav .sub-nav a { padding-left: 32px !important; font-size: 13px; }

/* 404 */
.error-page { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 60vh; }
.error-page h1 { font-size: 64px; color: var(--gray-200); }
.error-page p { color: var(--gray-500); margin-bottom: 20px; }
