/* 学境 OS v0.1 样式 */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --primary: #4a6cf7;
  --primary-dark: #3a56d4;
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #1a1a2e;
  --text-secondary: #6b7280;
  --border: #e5e7eb;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 12px;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  padding-bottom: 70px;
}
#app { max-width: 640px; margin: 0 auto; min-height: 100vh; }

/* 顶部 */
#header {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}
.logo { font-size: 20px; font-weight: 700; }
.logo span { color: var(--primary); }
.view-switcher { display: flex; gap: 4px; background: rgba(255,255,255,0.1); border-radius: 8px; padding: 3px; }
.view-btn {
  background: transparent; border: none; color: rgba(255,255,255,0.6);
  padding: 6px 14px; border-radius: 6px; font-size: 12px; cursor: pointer;
  transition: all 0.2s;
}
.view-btn.active { background: var(--primary); color: #fff; }
#date-display { font-size: 12px; opacity: 0.7; }

/* 卡片 */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin: 12px 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.card h3 { font-size: 15px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.badge { background: var(--primary); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }

/* 情绪选择 */
.emotion-picker { display: flex; justify-content: space-around; gap: 8px; }
.emotion-btn {
  background: var(--bg); border: 2px solid transparent; border-radius: 12px;
  padding: 12px 8px; font-size: 28px; cursor: pointer; transition: all 0.2s;
  flex: 1;
}
.emotion-btn:active, .emotion-btn.selected { border-color: var(--primary); background: rgba(74,108,247,0.1); transform: scale(1.05); }
.feedback { margin-top: 8px; font-size: 12px; color: var(--text-secondary); min-height: 18px; }

/* 任务列表 */
.tasks-list { display: flex; flex-direction: column; gap: 8px; }
.task-item {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  background: var(--bg); border-radius: 10px; cursor: pointer; transition: all 0.2s;
}
.task-item:active { transform: scale(0.98); }
.task-priority { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.task-priority.high { background: var(--danger); }
.task-priority.medium { background: var(--warning); }
.task-priority.low { background: var(--success); }
.task-info { flex: 1; min-width: 0; }
.task-type { font-size: 13px; font-weight: 600; }
.task-detail { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.task-arrow { color: var(--text-secondary); font-size: 18px; }

/* 快速操作 */
.quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.action-btn {
  background: var(--bg); border: none; border-radius: 12px; padding: 16px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  cursor: pointer; transition: all 0.2s;
}
.action-btn:active { transform: scale(0.95); background: rgba(74,108,247,0.1); }
.action-icon { font-size: 24px; }
.action-btn span:last-child { font-size: 12px; color: var(--text); font-weight: 500; }

/* 统计 */
.stats-row { display: flex; justify-content: space-around; }
.stat-item { text-align: center; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

/* 底部导航 */
#bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #fff; border-top: 1px solid var(--border);
  display: flex; justify-content: space-around; padding: 8px 0;
  max-width: 640px; margin: 0 auto; z-index: 100;
}
.nav-btn {
  background: none; border: none; display: flex; flex-direction: column;
  align-items: center; gap: 2px; padding: 6px 16px; cursor: pointer;
  color: var(--text-secondary); transition: color 0.2s;
}
.nav-btn.active { color: var(--primary); }
.nav-icon { font-size: 20px; }
.nav-label { font-size: 10px; }

/* 视图切换 */
.view { display: none; }
.view.active { display: block; }

/* 父母端 */
.weak-points, .parent-actions { display: flex; flex-direction: column; gap: 8px; }
.weak-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; background: var(--bg); border-radius: 8px;
}
.weak-subject { font-size: 11px; color: var(--text-secondary); }
.weak-name { font-size: 13px; font-weight: 600; }
.weak-level { font-size: 11px; padding: 2px 8px; border-radius: 10px; }
.weak-level.high { background: #fee2e2; color: #dc2626; }
.weak-level.medium { background: #fef3c7; color: #d97706; }

/* 通用 */
.loading, .empty { text-align: center; color: var(--text-secondary); padding: 20px; font-size: 13px; }

/* Toast */
#toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.8); color: #fff; padding: 10px 20px;
  border-radius: 20px; font-size: 13px; z-index: 1000;
  opacity: 0; transition: opacity 0.3s; pointer-events: none;
}
#toast.show { opacity: 1; }

/* 弹窗 */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); z-index: 200;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-content {
  background: #fff; width: 100%; max-width: 640px;
  border-radius: 16px 16px 0 0; padding: 20px;
  max-height: 80vh; overflow-y: auto;
  animation: slideUp 0.3s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-secondary);
}
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 16px; padding-right: 30px; }

/* 表单 */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; background: var(--bg);
}
.form-textarea { min-height: 80px; resize: vertical; }
.btn-primary {
  background: var(--primary); color: #fff; border: none;
  padding: 12px 24px; border-radius: 8px; font-size: 14px;
  font-weight: 600; cursor: pointer; width: 100%;
}
.btn-primary:active { background: var(--primary-dark); }

/* AI答疑 */
.ai-chat { display: flex; flex-direction: column; gap: 10px; max-height: 400px; overflow-y: auto; }
.ai-msg { padding: 10px 14px; border-radius: 12px; max-width: 85%; line-height: 1.6; white-space: pre-wrap; }
.ai-msg.user { background: var(--primary); color: #fff; align-self: flex-end; }
.ai-msg.ai { background: var(--bg); align-self: flex-start; }
.ai-input-row { display: flex; gap: 8px; margin-top: 12px; }
.ai-input { flex: 1; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }
.ai-send { background: var(--primary); color: #fff; border: none; padding: 10px 16px; border-radius: 8px; cursor: pointer; }

/* 响应式 */
@media (min-width: 640px) {
  body { padding-bottom: 0; }
  #bottom-nav { display: none; }
  .modal-content { border-radius: 16px; margin: auto; max-width: 500px; }
  .modal-overlay { align-items: center; }
}
