/* ============================================
   学习管理中心（LMC / Learning Hub）样式
   参考 Deadline Quest 设计：今日任务 + 截止时间线 + 进度看板
   ============================================ */

.lmc-wrap {
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
  color: var(--text-primary, #1a2f1d);
  /* 字体继承 body 的 var(--font-sans)（LXGW WenKai），不再硬编码 -apple-system 栈 */
}

.lmc-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light, #ece8e1);
}
.lmc-header h1 {
  margin: 0 0 4px 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--color-deep, #1a3a2a);
}
.lmc-subtitle {
  font-size: 13px;
  color: var(--text-muted, #8a8a8a);
}

.lmc-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
}
@media (max-width: 900px) {
  .lmc-grid { grid-template-columns: 1fr; }
}
.lmc-col { display: flex; flex-direction: column; gap: 16px; }

.lmc-card {
  background: var(--surface-base, #fff);
  border: 1px solid var(--border-light, #ece8e1);
  border-radius: var(--radius-lg, 12px);
  padding: 16px;
  box-shadow: var(--shadow-sm, 0 2px 6px rgba(0, 0, 0, 0.03));
}
.lmc-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light, #ece8e1);
}
.lmc-card-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-deep, #1a3a2a);
}
.lmc-log-count {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--color-warm, #c4956a);
  background: rgba(196, 149, 106, 0.1);
  border: 0.5px solid rgba(196, 149, 106, 0.2);
  vertical-align: middle;
}

.lmc-btn {
  border: none;
  border-radius: var(--radius-md, 8px);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.lmc-btn-sm { padding: 4px 8px; font-size: 12px; }
.lmc-btn-primary {
  background: linear-gradient(135deg, var(--color-primary, #4a7c59), var(--color-primary-light, #6ba07a));
  color: var(--color-text-inverse, #fff);
}
.lmc-btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-md, 0 4px 12px rgba(74, 124, 89, 0.25)); }
.lmc-btn-ghost {
  background: var(--surface-secondary, #faf7f2);
  color: var(--text-primary, #1a2f1d);
}
.lmc-btn-ghost:hover { background: var(--surface-tertiary, #f0ebe2); }

.lmc-empty {
  text-align: center;
  padding: 30px 16px;
  color: var(--text-muted, #8a8a8a);
  font-size: 13px;
}

/* ---------- 任务列表 ---------- */
.lmc-task-list { display: flex; flex-direction: column; gap: 10px; }
.lmc-task {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border-light, #ece8e1);
  border-radius: 10px;
  background: var(--surface-base, #fff);
  transition: all 0.2s;
}
.lmc-task:hover { border-color: var(--color-sage, #4a7c59); box-shadow: var(--shadow-sm, 0 2px 8px rgba(74, 124, 89, 0.08)); }
.lmc-task.lmc-due-soon { border-color: var(--state-warning, #d4a030); background: var(--state-warning-bg, #fdf8ec); }
.lmc-task.lmc-due-overdue { border-color: var(--state-error, #c0553a); background: var(--state-error-bg, #fdf0ec); }

.lmc-task-icon {
  font-size: 24px;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface-secondary, #faf7f2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.lmc-task-body { flex: 1; min-width: 0; }
.lmc-task-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #1a2f1d);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.lmc-task-priority { font-size: 12px; }
.lmc-task-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted, #8a8a8a);
}
.lmc-due.lmc-due-soon { color: var(--state-warning, #d4a030); font-weight: 600; }
.lmc-due.lmc-due-overdue { color: var(--state-error, #c0553a); font-weight: 600; }
.lmc-task-source { font-size: 10px; opacity: 0.7; }

.lmc-task-progress {
  margin-top: 6px;
  height: 4px;
  background: var(--surface-secondary, #faf7f2);
  border-radius: 2px;
  overflow: hidden;
}
.lmc-task-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-sage, #4a7c59), var(--color-primary-light, #6ba07a));
  transition: width 0.3s;
}

.lmc-task-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.lmc-badge {
  padding: 2px 6px;
  border-radius: var(--radius-sm, 4px);
  font-size: 10px;
  font-weight: 600;
}
.lmc-badge-pending { background: var(--state-info-bg, #edf3f9); color: var(--state-info, #5a8cb8); }
.lmc-badge-running { background: var(--state-info-bg, #edf3f9); color: var(--state-info, #5a8cb8); }
.lmc-badge-done { background: var(--state-success-bg, #edf7f0); color: var(--state-success, #3a8c5c); }
.lmc-badge-failed { background: var(--state-error-bg, #fdf0ec); color: var(--state-error, #c0553a); }
.lmc-badge-aborted { background: var(--color-bg-warm, #f3f4f6); color: var(--text-muted, #6b7280); }

/* ---------- 时间线 ---------- */
.lmc-timeline { display: flex; flex-direction: column; padding-left: 8px; }
.lmc-tl-item {
  position: relative;
  padding: 8px 0 8px 24px;
  border-left: 2px dashed var(--border-light, #ece8e1);
  margin-left: 6px;
}
.lmc-tl-item:first-child { padding-top: 0; }
.lmc-tl-item:last-child { border-left-color: transparent; }
.lmc-tl-dot {
  position: absolute;
  left: -7px;
  top: 14px;
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full, 9999px);
  background: var(--color-sage, #4a7c59);
  border: 2px solid var(--color-surface, #fff);
  box-shadow: 0 0 0 1px var(--border-light, #ece8e1);
}
.lmc-tl-done .lmc-tl-dot { background: var(--state-success, #10b981); }
.lmc-tl-title { font-size: 13px; font-weight: 500; color: var(--text-primary, #1a2f1d); }
.lmc-tl-time { font-size: 11px; color: var(--text-muted, #8a8a8a); margin-top: 2px; }
.lmc-tl-done .lmc-tl-title { text-decoration: line-through; opacity: 0.6; }

/* ---------- 进度卡片 ---------- */
.lmc-prog-stat { text-align: center; margin-bottom: 12px; }
.lmc-prog-big {
  font-size: 36px;
  font-weight: 700;
  color: var(--color-deep, #1a3a2a);
  line-height: 1;
}
.lmc-prog-target { font-size: 18px; color: var(--text-muted, #8a8a8a); }
.lmc-prog-label { font-size: 12px; color: var(--text-muted, #8a8a8a); margin-top: 4px; }
.lmc-prog-bar {
  height: 8px;
  background: var(--surface-secondary, #faf7f2);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}
.lmc-prog-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-sage, #4a7c59), var(--color-primary-light, #6ba07a));
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.lmc-prog-foot {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted, #8a8a8a);
}
.lmc-prog-done {
  margin-top: 10px;
  padding: 8px;
  background: var(--state-success-bg, #d1fae5);
  color: var(--state-success, #047857);
  border-radius: var(--radius-sm, 6px);
  text-align: center;
  font-weight: 600;
  font-size: 12px;
}

/* ---------- 抢救方案 ---------- */
.lmc-rescue-msg {
  font-size: 13px;
  color: var(--state-warning, #c2410c);
  margin-bottom: 10px;
  padding: 8px 10px;
  background: var(--state-warning-bg, #fff7ed);
  border-left: 3px solid var(--state-warning, #f59e0b);
  border-radius: var(--radius-sm, 4px);
}
.lmc-rescue-list {
  margin: 8px 0 12px 0;
  padding-left: 20px;
  font-size: 12px;
  color: var(--text-primary, #1a2f1d);
}
.lmc-rescue-list li { margin-bottom: 4px; line-height: 1.5; }

/* ---------- 日志 ---------- */
.lmc-logs { display: flex; flex-direction: column; gap: 4px; max-height: 280px; overflow-y: auto; }
.lmc-log-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 11px;
  background: var(--surface-secondary, #faf7f2);
}
.lmc-log-icon { flex-shrink: 0; }
.lmc-log-msg { flex: 1; color: var(--text-primary, #1a2f1d); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lmc-log-time { color: var(--text-muted, #8a8a8a); flex-shrink: 0; }
.lmc-log-success { background: var(--state-success-bg, #f0fdf4); }
.lmc-log-warning { background: var(--state-warning-bg, #fffbeb); }
.lmc-log-error { background: var(--state-error-bg, #fef2f2); }
.lmc-log-activity { background: var(--state-info-bg, #eff6ff); }

/* ---------- 模态框（替代 window.prompt/confirm） ---------- */
.lmc-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: lmc-fade-in 0.18s ease;
}
@keyframes lmc-fade-in { from { opacity: 0; } to { opacity: 1; } }

.lmc-modal {
  background: var(--color-surface, #fff);
  border-radius: var(--radius-xl, 14px);
  width: 100%;
  max-width: 420px;
  padding: 24px;
  box-shadow: var(--shadow-floating, 0 20px 60px rgba(0, 0, 0, 0.18));
  animation: lmc-pop-in 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.lmc-modal--wide { max-width: 560px; }
@keyframes lmc-pop-in {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.lmc-modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-deep, #1a3a2a);
  margin-bottom: 14px;
  font-family: var(--font-serif, serif);
}
.lmc-modal-body {
  font-size: 14px;
  color: var(--text-primary, #1a2f1d);
  line-height: 1.6;
  margin-bottom: 18px;
  white-space: pre-wrap;
}
.lmc-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- 表单 ---------- */
.lmc-form { display: flex; flex-direction: column; gap: 12px; }
.lmc-form-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary, #4a4a4a);
  font-weight: 500;
}
.lmc-form-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-light, #e5e7eb);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface-base, #fff);
  color: var(--text-primary, #1a2f1d);
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.lmc-form-input:focus {
  outline: none;
  border-color: var(--color-sage, #5a7d5c);
  box-shadow: 0 0 0 3px rgba(90, 125, 92, 0.12);
}
.lmc-form-input[type="datetime-local"],
.lmc-form-input[type="date"] {
  font-family: var(--font-mono, monospace);
  font-size: 13px;
}
textarea.lmc-form-input { resize: vertical; min-height: 60px; line-height: 1.5; }
.lmc-ai-tip {
  font-size: 12px;
  color: var(--text-muted, #6b7280);
  padding: 8px 10px;
  background: var(--state-info-bg, #eff6ff);
  border-left: 3px solid var(--state-info, #3b82f6);
  border-radius: var(--radius-sm, 4px);
  line-height: 1.5;
}

/* ---------- 任务来源标签 ---------- */
.lmc-task-source {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: var(--radius-sm, 4px);
  background: var(--color-bg-warm, #f3f4f6);
  color: var(--text-muted, #6b7280);
}

/* ---------- 任务操作按钮（图标列） ---------- */
.lmc-task-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.lmc-task-title:hover { color: var(--color-sage, #5a7d5c); }
