/* 炎武班学习中心 - 应用样式（沿用官网设计变量） */
:root {
  --lc-grad: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --header-h: 60px;
}

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

body.lc-body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  color: var(--text);
  background: var(--bg-alt);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 顶栏 ---------- */
.lc-header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center;
  padding: 0 16px;
  gap: 12px;
  z-index: 200;
}
.lc-brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); font-weight: 700; font-size: 17px; white-space: nowrap; }
.lc-brand .brand-icon { font-size: 22px; }
.lc-brand-sub { color: var(--text-muted); font-weight: 600; }
.lc-spacer { flex: 1; }
.lc-user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px;
  border-radius: 100px;
  background: rgba(102,126,234,0.08);
  cursor: default;
}
.lc-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--lc-grad);
  color: white; font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.lc-chip-name { font-size: 13px; font-weight: 600; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-chip-role { font-size: 11px; color: #764ba2; background: rgba(118,75,162,0.1); padding: 2px 8px; border-radius: 100px; font-weight: 600; white-space: nowrap; }
.lc-logout-btn {
  border: none; background: transparent; cursor: pointer;
  color: var(--text-muted); font-size: 13px; padding: 8px;
  border-radius: var(--radius-sm); transition: all var(--transition);
}
.lc-logout-btn:hover { color: var(--error); background: rgba(244,67,54,0.08); }

/* ---------- 布局 ---------- */
.lc-layout { display: flex; min-height: 100vh; padding-top: var(--header-h); }

.lc-side-nav {
  width: 210px; flex-shrink: 0;
  position: sticky; top: var(--header-h);
  height: calc(100vh - var(--header-h));
  padding: 16px 12px;
  border-right: 1px solid var(--border-light);
  background: white;
  display: flex; flex-direction: column; gap: 4px;
}
.lc-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  border: none; background: none; width: 100%; text-align: left; font-family: inherit;
}
.lc-nav-item:hover { background: rgba(102,126,234,0.06); color: var(--text); }
.lc-nav-item.active { background: var(--lc-grad); color: white; box-shadow: 0 4px 14px rgba(102,126,234,0.35); }
.lc-nav-badge {
  margin-left: auto;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 100px;
  background: var(--error); color: white;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.lc-nav-item.active .lc-nav-badge { background: rgba(255,255,255,0.3); }

.lc-main { flex: 1; min-width: 0; padding: 24px 28px 96px; max-width: 980px; margin: 0 auto; }

/* ---------- 视图 ---------- */
.lc-view { display: none; animation: lcFade 0.25s ease; }
.lc-view.active { display: block; }
@keyframes lcFade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.lc-view-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.lc-view-title { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.lc-view-desc { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ---------- 卡片列表 ---------- */
.lc-card-list { display: flex; flex-direction: column; gap: 12px; }
.lc-card {
  background: white;
  border-radius: var(--radius);
  padding: 18px 20px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  position: relative;
}
.lc-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.lc-card.unread { border-left: 3px solid #667eea; }
.lc-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.lc-cat-badge { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 100px; }
.lc-cat-handout { background: rgba(79,172,254,0.15); color: #1976D2; }
.lc-cat-assignment { background: rgba(240,147,251,0.15); color: #d63a7c; }
.lc-cat-message { background: rgba(76,175,80,0.15); color: #388E3C; }
.lc-cat-exam { background: rgba(102,126,234,0.14); color: #4a56c7; }
.lc-card-title { font-size: 15px; font-weight: 700; flex: 1; min-width: 150px; }
.lc-dot-unread { width: 8px; height: 8px; border-radius: 50%; background: #f5576c; flex-shrink: 0; }
.lc-card-meta { font-size: 12px; color: var(--text-muted); display: flex; gap: 14px; flex-wrap: wrap; }
.lc-card-body-text { font-size: 14px; color: var(--text-secondary); margin-top: 10px; white-space: pre-wrap; word-break: break-word; }
.lc-scope-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.lc-scope-tag { font-size: 11px; background: rgba(118,75,162,0.08); color: #764ba2; padding: 2px 8px; border-radius: 6px; font-weight: 500; }
.lc-card-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.lc-msg-detail { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }

.lc-empty {
  text-align: center;
  padding: 64px 20px;
  background: white;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border);
  color: var(--text-muted);
}
.lc-empty-icon { font-size: 40px; margin-bottom: 12px; }
.lc-empty p { font-size: 14px; }

/* ---------- 表单 ---------- */
.lc-form-panel { background: white; border-radius: var(--radius-lg); padding: 26px; border: 1px solid var(--border-light); box-shadow: var(--shadow-sm); margin-bottom: 20px; }
.lc-form-panel h3 { font-size: 16px; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.lc-field { margin-bottom: 16px; }
.lc-field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.lc-field input[type="text"], .lc-field input[type="password"], .lc-field input[type="file"], .lc-field select, .lc-field textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  transition: all var(--transition);
  background: var(--bg);
}
.lc-field textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
.lc-field input:focus, .lc-field select:focus, .lc-field textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(25,118,210,0.1);
}
.lc-check-group { display: flex; flex-wrap: wrap; gap: 8px; }
.lc-check-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: 100px;
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: all var(--transition);
  background: var(--bg);
}
.lc-check-chip:hover { border-color: #667eea; }
.lc-check-chip.on { background: var(--lc-grad); border-color: transparent; color: white; box-shadow: 0 3px 10px rgba(102,126,234,0.35); }
.lc-check-all { border-style: dashed; }
.lc-sub-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; background: white; padding: 6px; border-radius: var(--radius); border: 1px solid var(--border-light); }
.lc-sub-tab { flex: 1; min-width: 90px; text-align: center; padding: 9px 10px; font-size: 13px; font-weight: 600; border: none; background: transparent; border-radius: var(--radius-sm); cursor: pointer; color: var(--text-secondary); transition: all var(--transition); font-family: inherit; }
.lc-sub-tab.active { background: var(--lc-grad); color: white; }

/* ---------- 富文本编辑器 ---------- */
.lc-editor-wrap { border: 1.5px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: white; }
.lc-editor-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; border-bottom: 1px solid var(--border-light); background: var(--bg-alt); }
.lc-ed-btn {
  min-width: 32px; height: 32px; padding: 0 8px;
  border: none; background: transparent; border-radius: 6px;
  font-size: 13px; font-weight: 600; cursor: pointer; color: var(--text-secondary);
  transition: all var(--transition); font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center;
}
.lc-ed-btn:hover { background: rgba(102,126,234,0.12); color: #667eea; }
.lc-editor-area {
  min-height: 220px; max-height: 420px; overflow-y: auto;
  padding: 14px 16px; font-size: 15px; line-height: 1.8; outline: none;
}
.lc-editor-area:focus { background: #fffefb; }
.lc-editor-area img { max-width: 100%; }
.lc-editor-area ul, .lc-editor-area ol { padding-left: 24px; }
.lc-editor-area blockquote { border-left: 3px solid #667eea; padding-left: 12px; color: var(--text-muted); margin: 8px 0; }
.lc-editor-note { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* ---------- 用户管理 ---------- */
.lc-user-table { width: 100%; border-collapse: collapse; font-size: 13px; background: white; border-radius: var(--radius); overflow: hidden; }
.lc-user-table th, .lc-user-table td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.lc-user-table th { font-size: 12px; color: var(--text-muted); font-weight: 600; background: var(--bg-alt); white-space: nowrap; }
.lc-user-table tr:last-child td { border-bottom: none; }
.lc-user-table .role-select { padding: 5px 8px; border-radius: 6px; border: 1.5px solid var(--border); font-family: inherit; font-size: 12px; background: white; cursor: pointer; }
.lc-row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.lc-link-danger { color: var(--error); background: none; border: none; cursor: pointer; font-size: 12px; font-weight: 600; font-family: inherit; padding: 4px 6px; border-radius: 6px; }
.lc-link-danger:hover { background: rgba(244,67,54,0.08); }
.lc-link-action { color: var(--primary); background: none; border: none; cursor: pointer; font-size: 12px; font-weight: 600; font-family: inherit; padding: 4px 6px; border-radius: 6px; }
.lc-link-action:hover { background: rgba(25,118,210,0.08); }

/* ---------- 结果面板 ---------- */
.lc-result-panel { background: rgba(76,175,80,0.08); border: 1px solid rgba(76,175,80,0.3); border-radius: var(--radius-sm); padding: 16px 18px; margin-top: 14px; }
.lc-result-title { font-size: 13px; font-weight: 700; color: #388E3C; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.lc-cred-row { display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 4px 0; flex-wrap: wrap; }
.lc-cred-key { color: var(--text-muted); width: 56px; }
.lc-cred-val { font-weight: 700; font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; background: rgba(0,0,0,0.05); padding: 2px 8px; border-radius: 6px; word-break: break-all; }

/* ---------- 模态框 ---------- */
.lc-modal-mask {
  position: fixed; inset: 0;
  background: rgba(26,26,46,0.55);
  backdrop-filter: blur(3px);
  z-index: 400;
  display: none;
  align-items: center; justify-content: center;
  padding: 20px;
}
.lc-modal-mask.show { display: flex; }
.lc-modal {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%; max-width: 860px;
  max-height: 88vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.lc-modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border-light); flex-shrink: 0; }
.lc-modal-title { font-size: 16px; font-weight: 800; flex: 1; }
.lc-modal-close { border: none; background: var(--bg-alt); width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 16px; color: var(--text-secondary); transition: all var(--transition); }
.lc-modal-close:hover { background: var(--border-light); color: var(--error); }
.lc-modal-meta { padding: 10px 20px 0; font-size: 12px; color: var(--text-muted); display: flex; gap: 14px; flex-wrap: wrap; }
.lc-modal-body { flex: 1; overflow-y: auto; }
.lc-modal-body iframe { width: 100%; height: 100%; border: none; }
.lc-modal-foot { padding: 12px 20px; border-top: 1px solid var(--border-light); display: flex; justify-content: flex-end; gap: 10px; flex-shrink: 0; background: white; }

/* ---------- Toast ---------- */
#lcToast {
  position: fixed; top: calc(var(--header-h) + 12px); left: 50%;
  transform: translateX(-50%) translateY(-16px);
  background: var(--bg-dark); color: white;
  padding: 10px 22px; border-radius: 100px;
  font-size: 14px; z-index: 999;
  opacity: 0; pointer-events: none;
  transition: all 0.25s ease;
  max-width: 86vw; text-align: center;
}
#lcToast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#lcToast.success { background: #43A047; }
#lcToast.error { background: #E53935; }

/* ---------- 底部导航（移动端） ---------- */
.lc-bottom-nav { display: none; }

@media (max-width: 900px) {
  .lc-side-nav { display: none; }
  .lc-main { padding: 16px 14px 92px; }
  .lc-user-chip .lc-chip-role { display: none; }
  .lc-bottom-nav {
    display: flex;
    position: fixed; bottom: 0; left: 0; right: 0;
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--border-light);
    z-index: 300;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    justify-content: space-around;
  }
  .lc-bn-item {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 6px 2px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 11px; font-weight: 600;
    border: none; background: none; cursor: pointer; font-family: inherit;
    border-radius: var(--radius-sm);
    position: relative;
  }
  .lc-bn-item .bn-icon { font-size: 20px; line-height: 1; }
  .lc-bn-item.active { color: #667eea; }
  .lc-bn-item.active .bn-icon { transform: scale(1.06); }
  .lc-bn-badge {
    position: absolute; top: 0; right: calc(50% - 20px);
    min-width: 17px; height: 17px; padding: 0 5px;
    border-radius: 100px;
    background: var(--error); color: white;
    font-size: 10px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
  }
}

@media (max-width: 480px) {
  .lc-brand span.brand-icon + b, .lc-brand-sub { display: none; }
  .lc-chip-name { max-width: 70px; }
}

/* ---------- 讲义分类筛选 ---------- */
.lc-cat-filter { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.lc-cat-chip {
  padding: 7px 14px;
  border: 1.5px solid var(--border);
  border-radius: 100px;
  font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  background: white; color: var(--text-secondary);
  transition: all var(--transition);
  display: inline-flex; align-items: center; gap: 5px;
}
.lc-cat-chip i { font-style: normal; font-size: 11px; color: var(--text-muted); font-weight: 600; }
.lc-cat-chip:hover { border-color: #667eea; color: #667eea; }
.lc-cat-chip.on { background: var(--lc-grad); border-color: transparent; color: white; box-shadow: 0 3px 10px rgba(102,126,234,0.35); }
.lc-cat-chip.on i { color: rgba(255,255,255,0.85); }

/* ---------- 讲义库视图切换 ---------- */
.lc-view-head-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.lc-view-switch {
  display: inline-flex;
  background: white;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 3px;
  box-shadow: var(--shadow-sm);
}
.lc-view-btn {
  width: 34px; height: 30px;
  border: none; background: transparent;
  border-radius: 6px;
  cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition);
}
.lc-view-btn:hover { color: var(--primary); background: rgba(25,118,210,0.06); }
.lc-view-btn.active {
  background: var(--lc-grad);
  color: white;
  box-shadow: 0 2px 6px rgba(102,126,234,0.35);
}
.lc-view-btn svg { width: 18px; height: 18px; display: block; }

/* 网格视图布局（id+class 选择器特异性高于 .lc-card-list，可覆盖 flex） */
#handoutList.grid-view {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
#handoutList.grid-view .lc-empty { grid-column: 1 / -1; }

/* 网格单元紧凑卡片 */
#handoutList.grid-view .lc-card-grid {
  padding: 14px;
  display: flex; flex-direction: column;
  gap: 8px;
}
.lc-card-grid-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lc-card-grid-title {
  font-size: 14px; font-weight: 700; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 38px; word-break: break-word;
}
.lc-card-grid-meta { font-size: 12px; color: var(--text-muted); display: flex; gap: 6px; flex-wrap: wrap; }
.lc-card-grid-actions { margin-top: auto; padding-top: 4px; }
.lc-grid-del {
  border: none; background: transparent; cursor: pointer; font-family: inherit;
  color: var(--text-muted); font-size: 13px;
  width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.lc-grid-del:hover { background: rgba(244,67,54,0.1); color: var(--error); }

@media (max-width: 1024px) {
  #handoutList.grid-view { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  #handoutList.grid-view { grid-template-columns: 1fr; }
}

/* ---------- 作业窗口/提交状态徽章 ---------- */
.lc-win-badge { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 100px; white-space: nowrap; flex-shrink: 0; }
.lc-win-open { background: rgba(76,175,80,0.12); color: #2E7D32; }
.lc-win-pending { background: rgba(255,167,38,0.15); color: #B8720A; }
.lc-win-closed { background: rgba(229,57,53,0.12); color: #C62828; }
.lc-sub-badge { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 100px; white-space: nowrap; }
.lc-sub-sent { background: rgba(25,118,210,0.12); color: #1565C0; }
.lc-sub-graded { background: rgba(76,175,80,0.14); color: #2E7D32; }
.lc-sub-none { background: rgba(0,0,0,0.06); color: var(--text-muted); }
.lc-sub-pending { background: rgba(255,167,38,0.16); color: #B8720A; }
.lc-sub-expired { background: rgba(229,57,53,0.14); color: #C62828; }

/* ---------- 作业详情附加区（学员提交） ---------- */
.lc-assign-extra { padding: 0 20px 20px; }
.lc-assign-extra iframe { height: 42vh !important; min-height: 240px; border-bottom: 1px dashed var(--border-light); }
.lc-submit-box { margin-top: 16px; background: var(--bg-alt); border: 1px solid var(--border-light); border-radius: var(--radius); padding: 16px 18px; }
.lc-submit-box h4 { font-size: 14px; font-weight: 800; margin-bottom: 10px; }
.lc-submit-hint { font-size: 13px; color: var(--text-secondary); line-height: 1.7; }
.lc-sub-status { font-size: 13px; color: var(--text-secondary); line-height: 1.8; margin-bottom: 8px; }
.lc-submit-form input[type="file"] { font-size: 13px; margin-bottom: 6px; }
.lc-grade-result { display: flex; align-items: center; gap: 12px; margin: 8px 0 4px; flex-wrap: wrap; }
.lc-grade-score { font-size: 20px; font-weight: 800; color: #2E7D32; background: rgba(76,175,80,0.12); padding: 4px 14px; border-radius: 10px; }
.lc-grade-meta { font-size: 12px; color: var(--text-muted); }
.lc-grade-comment { font-size: 13px; color: var(--text-secondary); background: white; border-left: 3px solid #667eea; padding: 8px 12px; border-radius: 0 8px 8px 0; margin-top: 8px; line-height: 1.7; }

/* ---------- 批改面板 ---------- */
.lc-grade-panel { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.lc-grade-row { border: 1px solid var(--border-light); border-radius: var(--radius); padding: 14px 16px; background: var(--bg-alt); }
.lc-grade-info { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; margin-bottom: 8px; }
.lc-grade-info .lc-grade-meta { width: 100%; }
.lc-grade-ops { display: flex; gap: 8px; flex-wrap: wrap; }
.lc-grade-form { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.lc-grade-score-input { width: 120px; padding: 9px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; font-family: inherit; background: white; }
.lc-grade-comment-input { flex: 1; min-width: 180px; padding: 9px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; font-family: inherit; background: white; }
.lc-grade-form input:focus { outline: none; border-color: var(--primary); }
