/* ============================================================
   AI实战局 · 私密学习平台
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --orange: #FF6B00;
  --orange-light: #FFF0E6;
  --orange-dark: #E05A00;
  --bg: #F8F9FA;
  --card-bg: #FFFFFF;
  --text: #1A1A1A;
  --text-secondary: #666666;
  --text-muted: #999999;
  --border: #E8E8E8;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --radius: 12px;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ============================================================
   SCREENS
   ============================================================ */
.screen { min-height: 100vh; }

/* ============================================================
   ACTIVATION SCREEN
   ============================================================ */
#activate-screen {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1A1A1A 0%, #2D2D2D 100%);
}
.activate-container { text-align: center; padding: 40px 20px; max-width: 480px; width: 100%; }
.logo {
  font-size: 36px; font-weight: 800; color: var(--orange);
  letter-spacing: 2px; margin-bottom: 8px;
}
.subtitle { font-size: 16px; color: #999; margin-bottom: 40px; }
.activate-box {
  background: var(--card-bg); border-radius: var(--radius);
  padding: 40px 32px; box-shadow: var(--shadow);
}
.activate-box h2 { font-size: 22px; margin-bottom: 8px; }
.activate-box .desc { font-size: 14px; color: var(--text-secondary); margin-bottom: 24px; }
.input-group { display: flex; gap: 8px; margin-bottom: 16px; }
.input-group input {
  flex: 1; padding: 14px 16px; border: 2px solid var(--border);
  border-radius: 8px; font-size: 18px; letter-spacing: 2px;
  text-transform: uppercase; text-align: center; outline: none;
  transition: border-color 0.2s;
}
.input-group input:focus { border-color: var(--orange); }
.input-group button {
  padding: 14px 32px; background: var(--orange); color: white;
  border: none; border-radius: 8px; font-size: 16px; font-weight: 600;
  cursor: pointer; transition: background 0.2s; white-space: nowrap;
}
.input-group button:hover { background: var(--orange-dark); }
.message { font-size: 14px; min-height: 24px; }
.message.success { color: #22C55E; }
.message.error { color: #EF4444; }

/* ============================================================
   HEADER
   ============================================================ */
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; background: var(--card-bg);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100;
}
.header-left { display: flex; align-items: center; gap: 12px; }
.header-title { font-size: 20px; font-weight: 700; color: var(--orange); }
.header-subtitle { font-size: 14px; color: var(--text-secondary); }
.header-right { display: flex; align-items: center; gap: 12px; }
.sidebar-toggle {
  display: none; background: none; border: none; font-size: 24px;
  cursor: pointer; color: var(--text); padding: 4px; line-height: 1;
}
.code-badge {
  padding: 4px 12px; background: var(--orange-light);
  color: var(--orange); border-radius: 20px; font-size: 12px;
  font-weight: 600; font-family: monospace; letter-spacing: 1px;
}
.btn-logout {
  padding: 8px 16px; background: transparent; color: var(--text-secondary);
  border: 1px solid var(--border); border-radius: 6px; font-size: 13px;
  cursor: pointer; transition: all 0.2s;
}
.btn-logout:hover { color: #EF4444; border-color: #EF4444; }

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
.main-layout { display: flex; height: calc(100vh - 57px); }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: 320px; min-width: 320px; background: var(--card-bg);
  border-right: 1px solid var(--border); overflow-y: auto;
}
.sidebar-header {
  padding: 20px 20px 12px;
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--border);
}
.sidebar-header h3 { font-size: 16px; }
.lesson-count { font-size: 13px; color: var(--text-muted); }
.chapter-list { padding: 12px; }
.chapter-group { margin-bottom: 8px; }
.chapter-title {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; cursor: pointer; border-radius: 8px;
  font-size: 14px; font-weight: 600; transition: background 0.2s;
}
.chapter-title:hover { background: var(--orange-light); }
.chapter-title .chapter-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; background: var(--orange); color: white;
  border-radius: 6px; font-size: 12px; font-weight: 700; margin-right: 8px;
}
.chapter-title .chapter-count { font-size: 12px; color: var(--text-muted); font-weight: 400; }
.lesson-list { padding-left: 8px; }
.lesson-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; cursor: pointer; border-radius: 6px;
  font-size: 13px; color: var(--text-secondary); transition: all 0.2s;
}
.lesson-item:hover { background: var(--orange-light); color: var(--text); }
.lesson-item.active { background: var(--orange-light); color: var(--orange); font-weight: 600; }
.lesson-item .lock-icon { font-size: 12px; }
.lesson-item .video-icon { font-size: 12px; color: var(--orange); }

/* ============================================================
   CONTENT
   ============================================================ */
.content { flex: 1; overflow-y: auto; padding: 32px; }
.welcome { text-align: center; padding-top: 80px; }
.welcome-icon { font-size: 64px; margin-bottom: 16px; }
.welcome h2 { font-size: 28px; margin-bottom: 8px; }
.welcome p { font-size: 16px; color: var(--text-secondary); margin-bottom: 32px; }
.course-stats { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.stat-card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 32px; min-width: 120px;
}
.stat-card .stat-num { font-size: 28px; font-weight: 700; color: var(--orange); }
.stat-card .stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* ============================================================
   LESSON SCREEN
   ============================================================ */
.lesson-header { margin-bottom: 20px; }
.lesson-header h2 { font-size: 24px; }
.lesson-badge {
  display: inline-block; padding: 4px 12px; background: var(--orange-light);
  color: var(--orange); border-radius: 20px; font-size: 12px; font-weight: 600;
  margin-top: 8px;
}
.video-container {
  background: #000; border-radius: var(--radius); overflow: hidden;
  margin-bottom: 20px; position: relative;
}
.video-container video { width: 100%; display: block; max-height: 70vh; }
.lesson-actions { margin-bottom: 24px; }
.btn-download {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px; background: var(--orange); color: white;
  border-radius: 8px; text-decoration: none; font-size: 15px; font-weight: 600;
  transition: background 0.2s;
}
.btn-download:hover { background: var(--orange-dark); }
.btn-icon { font-size: 18px; }

/* ============================================================
   ADMIN
   ============================================================ */
#admin-login {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1A1A1A 0%, #2D2D2D 100%);
}
.admin-sidebar { width: 220px; min-width: 220px; padding: 20px 12px; }
.admin-sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.admin-sidebar nav a {
  padding: 10px 16px; border-radius: 8px; text-decoration: none;
  color: var(--text-secondary); font-size: 14px; transition: all 0.2s;
}
.admin-sidebar nav a:hover { background: var(--orange-light); color: var(--text); }
.admin-sidebar nav a.tab-active { background: var(--orange); color: white; }
.admin-layout .content { padding: 24px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin: 20px 0; }
.stats-grid .stat-card { text-align: center; }
.code-generator {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; margin-bottom: 24px;
}
.code-generator h3 { margin-bottom: 16px; font-size: 16px; }
.gen-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.gen-form label { font-size: 13px; color: var(--text-secondary); }
.gen-form input {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 14px; width: 80px; outline: none;
}
.gen-form input:focus { border-color: var(--orange); }
.gen-form button {
  padding: 8px 24px; background: var(--orange); color: white;
  border: none; border-radius: 6px; font-size: 14px; font-weight: 600;
  cursor: pointer;
}
.gen-result {
  margin-top: 16px; padding: 16px; background: #F0FFF4; border-radius: 8px;
  font-size: 13px; display: none;
}
.gen-result .codes-display {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px;
}
.gen-result .code-tag {
  padding: 4px 10px; background: white; border: 1px solid #22C55E;
  border-radius: 4px; font-family: monospace; font-size: 12px; color: #22C55E;
}
.filter-bar { margin-bottom: 16px; }
.filter-bar select {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 14px; outline: none;
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--bg); font-weight: 600; color: var(--text-secondary); }
tr:hover td { background: var(--orange-light); }
.status-badge {
  display: inline-block; padding: 2px 8px; border-radius: 12px;
  font-size: 12px; font-weight: 600;
}
.status-unused { background: #F0FFF4; color: #22C55E; }
.status-partial { background: #FFFBEB; color: #D97706; }
.status-used { background: #FFF7ED; color: var(--orange); }
.status-disabled { background: #FEF2F2; color: #EF4444; }
.btn-disable {
  padding: 4px 12px; background: #FEF2F2; color: #EF4444;
  border: 1px solid #FECACA; border-radius: 4px; font-size: 12px; cursor: pointer;
}
.btn-disable:hover { background: #FEE2E2; }

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #DDD; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #BBB; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .sidebar { width: 260px; min-width: 260px; }
  .main-layout { flex-direction: column; }
  .sidebar { width: 100%; min-width: 100%; height: auto; max-height: 40vh; }
  .sidebar.collapsed { max-height: 0; min-height: 0; overflow: hidden; padding: 0; border: none; }
  .sidebar.collapsed .sidebar-header { display: none; }
  .sidebar.collapsed .chapter-list { display: none; }
  .sidebar-toggle { display: block; }
  .content { padding: 16px; }
  .input-group { flex-direction: column; }
  .gen-form { flex-direction: column; }
  table { font-size: 12px; }
  th, td { padding: 6px 8px; white-space: nowrap; }
  /* Table horizontal scroll */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .admin-layout .content { padding: 12px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stats-grid .stat-card { padding: 14px; }
  .stat-card .stat-num { font-size: 22px; }
}