/* ============================================================
   components.css — 按钮 / 卡片 / 徽标 / 表单 / 导航 / 图表容器
   ============================================================ */

/* 图标尺寸统一（仅 .icn 类；图表 SVG 保留自身宽高） */
.icn { width: 18px; height: 18px; flex: none; vertical-align: middle; }
.app-header .brand .logo svg,
.app-sidebar .side-brand .logo svg { width: 20px; height: 20px; }
.auth-logo svg { width: 26px; height: 26px; }
.stat-card .stat-icon svg { width: 18px; height: 18px; }
.quick-card .qc-icon svg { width: 22px; height: 22px; }
.child-card.add-card svg { width: 30px; height: 30px; margin-bottom: 8px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 10px 16px; font-size: 14px; font-weight: 600; line-height: 1;
  cursor: pointer; transition: background 0.15s, border-color 0.15s, transform 0.05s, opacity 0.15s;
  background: var(--c-surface); color: var(--c-text);
  white-space: nowrap; user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-600); }
.btn-ghost { background: transparent; border-color: var(--c-border-strong); color: var(--c-text-2); }
.btn-ghost:hover { background: var(--c-surface-2); color: var(--c-text); }
.btn-soft { background: var(--c-primary-050); color: var(--c-primary); }
.btn-soft:hover { background: var(--c-primary-100); }
.btn-danger { background: var(--c-danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--c-success); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-block { width: 100%; }
.btn-lg { padding: 14px 22px; font-size: 16px; border-radius: var(--radius); }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-icon { padding: 9px; border-radius: var(--radius-sm); width: 38px; height: 38px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  padding: 20px;
}
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-title { font-size: 16px; font-weight: 700; }
.card-sub { color: var(--c-text-2); font-size: 13px; }

/* ---------- 徽标 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  line-height: 1.6; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-mastered { background: var(--c-success-bg); color: var(--c-success); }
.badge-review { background: var(--c-warning-bg); color: var(--c-warning); }
.badge-wrong { background: var(--c-danger-bg); color: var(--c-danger); }
.badge-info { background: var(--c-info-bg); color: var(--c-info); }
.badge-neutral { background: var(--c-surface-2); color: var(--c-text-2); }
.badge-outline { background: transparent; border: 1px solid var(--c-border-strong); color: var(--c-text-2); }
.badge-outline::before { display: none; }

/* 掌握等级点 */
.level-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.label { display: block; font-size: 13px; font-weight: 600; color: var(--c-text-2); margin-bottom: 6px; }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--c-border-strong); border-radius: var(--radius-sm);
  padding: 11px 13px; font-size: 15px; background: var(--c-surface); color: var(--c-text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-primary-100);
}
.textarea { min-height: 96px; resize: vertical; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235b6270' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.hint { font-size: 12px; color: var(--c-text-3); margin-top: 4px; }

/* 单选 / 复选框组 */
.option-list { display: flex; flex-wrap: wrap; gap: 8px; }
.option-pill { cursor: pointer; }
.option-pill input { position: absolute; opacity: 0; pointer-events: none; }
.option-pill span {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px;
  border: 1px solid var(--c-border-strong); border-radius: 999px; font-size: 13px;
  font-weight: 500; color: var(--c-text-2); background: var(--c-surface); transition: all 0.15s;
}
.option-pill input:checked + span { background: var(--c-primary-050); border-color: var(--c-primary); color: var(--c-primary); }
.option-pill input:focus-visible + span { outline: 2px solid var(--c-primary); outline-offset: 2px; }

/* ---------- 标签 / 筛选 chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--c-border-strong); background: var(--c-surface); color: var(--c-text-2);
  padding: 6px 13px; border-radius: 999px; font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--c-primary); color: var(--c-primary); }
.chip.active { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }

/* ---------- 学科 Tab 栏（教练四页面统一组件） ---------- */
.subject-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.subject-tabs .chip { flex: none; }
.subject-tabs .chip.subject-chip.active { background: var(--sc, var(--c-primary)); border-color: var(--sc, var(--c-primary)); color: #fff; }

/* ---------- 语言切换 ---------- */
.lang-toggle {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: 999px;
  padding: 3px; cursor: pointer;
}
.lang-toggle button {
  border: none; background: transparent; padding: 5px 11px; border-radius: 999px;
  font-size: 13px; font-weight: 600; color: var(--c-text-2); cursor: pointer; line-height: 1.3;
}
.lang-toggle button.active { background: var(--c-surface); color: var(--c-text); box-shadow: var(--shadow-sm); }

/* ---------- 顶栏 / 侧栏 / 底部导航 ---------- */
.app-header {
  position: sticky; top: 0; z-index: 50; height: var(--header-h);
  background: rgba(255,255,255,0.86); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; gap: 12px; padding: 0 16px;
}
.app-header .brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; color: var(--c-text); }
.app-header .brand .logo {
  width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--c-primary), #7c6cf0);
  display: grid; place-items: center; color: #fff; flex: none;
}
.app-header .spacer { flex: 1; }
.page-title { font-size: 17px; font-weight: 700; }
.menu-btn { display: none; }

.layout { display: flex; min-height: 100vh; }
.app-sidebar {
  width: var(--sidebar-w); flex: none; position: sticky; top: 0; height: 100vh;
  background: var(--c-surface); border-right: 1px solid var(--c-border);
  padding: 20px 12px; display: flex; flex-direction: column; gap: 4px;
}
.app-sidebar .side-brand { display: flex; align-items: center; gap: 9px; padding: 4px 10px 20px; font-weight: 700; }
.app-sidebar .side-brand .logo {
  width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--c-primary), #7c6cf0);
  display: grid; place-items: center; color: #fff; flex: none;
}
.side-link {
  display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: var(--radius-sm);
  color: var(--c-text-2); font-weight: 550; font-size: 14px; cursor: pointer; transition: all 0.15s;
  border: none; background: transparent; width: 100%; text-align: left;
}
.side-link:hover { background: var(--c-surface-2); color: var(--c-text); }
.side-link.active { background: var(--c-primary-050); color: var(--c-primary); }
.side-link svg { width: 19px; height: 19px; flex: none; }
.side-divider { height: 1px; background: var(--c-border); margin: 8px 10px; }
.side-spacer { flex: 1; }

.app-main { flex: 1; min-width: 0; padding: 24px; }

.student-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; background: var(--c-surface); border-top: 1px solid var(--c-border);
  padding-bottom: env(safe-area-inset-bottom);
}
.student-nav .tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 4px 10px; border: none; background: transparent; color: var(--c-text-3);
  font-size: 11px; font-weight: 550; cursor: pointer;
}
.student-nav .tab svg { width: 22px; height: 22px; }
.student-nav .tab.active { color: var(--c-primary); }

/* 学生端平板优先：≥1024px 时底部导航居中为悬浮胶囊，避免横向拉伸 */
@media (min-width: 1024px) {
  .student-nav {
    left: 50%; right: auto; transform: translateX(-50%);
    width: 100%; max-width: 560px;
    border: 1px solid var(--c-border); border-bottom: none;
    border-radius: 20px 20px 0 0; box-shadow: 0 -4px 24px rgba(23, 26, 40, 0.10);
  }
}

/* ---------- 进度条 ---------- */
.progress { height: 8px; background: var(--c-border); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--c-primary); border-radius: 999px; transition: width 0.3s ease; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--c-border); vertical-align: middle; }
table.data th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--c-text-3); font-weight: 650; }
table.data tbody tr:hover { background: var(--c-surface-2); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 44px 20px; color: var(--c-text-3); }
.empty svg { width: 46px; height: 46px; margin: 0 auto 12px; opacity: 0.4; }
.empty .empty-title { font-weight: 650; color: var(--c-text-2); margin-bottom: 4px; }

/* ---------- 弹层 / Toast ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 90; background: rgba(20,22,34,0.45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal { background: var(--c-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 480px; padding: 24px; animation: fadeUp 0.2s ease; max-height: 90vh; overflow: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-close { border: none; background: var(--c-surface-2); border-radius: 8px; padding: 6px; cursor: pointer; display: grid; place-items: center; }
.modal-close:hover { background: var(--c-border); }

.toast-wrap { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); }
.toast { display: flex; align-items: center; gap: 10px; background: var(--c-text); color: #fff; padding: 12px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); font-size: 14px; animation: toastIn 0.25s ease; }
.toast.success { background: var(--c-success); }
.toast.error { background: var(--c-danger); }
.toast.info { background: var(--c-info); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* ---------- 图表容器 ---------- */
.chart-box { position: relative; width: 100%; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--c-text-2); }
.chart-legend .legend-item { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .legend-swatch { width: 10px; height: 10px; border-radius: 3px; }

/* ---------- 拖拽上传 ---------- */
.dropzone {
  border: 2px dashed var(--c-border-strong); border-radius: var(--radius-lg);
  padding: 32px 20px; text-align: center; color: var(--c-text-2); cursor: pointer;
  transition: all 0.15s; background: var(--c-surface-2);
}
.dropzone:hover, .dropzone.drag { border-color: var(--c-primary); background: var(--c-primary-050); color: var(--c-primary); }
.dropzone svg { width: 34px; height: 34px; margin: 0 auto 10px; opacity: 0.7; }
