/* ============================================
   小多成长记 · components.css
   指标胶囊 / 区块卡 / 标签chips / 表单 / 按钮
   进度条 / 饼图 / 小芽卡 / 战报 / 未来7天 / 弹窗
   ============================================ */

/* ---------- 统计指标胶囊行 ---------- */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat-pill {
  background: var(--card); border: 1px solid var(--line-2);
  border-radius: var(--r-md); box-shadow: var(--shadow-1);
  padding: 10px 14px; display: flex; align-items: center; gap: 10px;
  min-height: 52px;
}
.stat-pill .s-ic {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  display: flex; align-items: center; justify-content: center;
}
.stat-pill .s-ic .ic { width: 19px; height: 19px; }
.stat-pill .s-num { font-size: 18px; font-weight: 800; line-height: 1.1; }
.stat-pill .s-label { font-size: 12px; color: var(--ink-2); }
.ic-green { background: var(--green-soft); color: var(--green-ink); }
.ic-orange { background: var(--orange-soft); color: var(--orange-ink); }
.ic-red { background: var(--red-soft); color: var(--red-ink); }
.ic-blue { background: var(--blue-soft); color: var(--blue); }
.ic-purple { background: var(--purple-soft); color: var(--purple); }

/* ---------- 区块卡片（含标题栏） ---------- */
.section-card { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow-1); border: 1px solid var(--line-2); overflow: hidden; }
.section-head {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 18px 10px;
}
.section-head .t { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.section-head .t .ic { width: 19px; height: 19px; color: var(--green-ink); }
.section-head .badge-num {
  background: var(--red); color: #fff; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 700; padding: 1px 8px; min-width: 22px; text-align: center;
}
.section-head .badge-num.green { background: var(--green); }
.section-head .head-action {
  margin-left: auto; display: flex; align-items: center; gap: 3px;
  color: var(--green-ink); font-size: 14px; font-weight: 600;
}
.section-head .head-action .ic { width: 15px; height: 15px; }
.section-body { padding: 4px 18px 16px; }

/* ---------- 标签 chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600; line-height: 1.6;
  white-space: nowrap;
}
.chip-green { background: var(--green-soft); color: var(--green-ink); }
.chip-red { background: var(--red-soft); color: var(--red-ink); }
.chip-orange { background: var(--orange-soft); color: var(--orange-ink); }
.chip-blue { background: var(--blue-soft); color: var(--blue); }
.chip-purple { background: var(--purple-soft); color: var(--purple); }
.chip-gray { background: var(--line-2); color: var(--ink-2); }

/* 筛选 chips（可点击） */
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-chip {
  padding: 6px 14px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--card);
  color: var(--ink-2); font-size: 14px; font-weight: 500;
  min-height: 34px; transition: all .15s;
}
.filter-chip.active { background: var(--green); color: #fff; border-color: var(--green); font-weight: 600; }
.filter-chip .cnt { font-size: 12px; opacity: .75; margin-left: 2px; }

/* 科目选择 chips（表单内） */
.subject-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.subject-chip {
  padding: 8px 16px; border-radius: var(--r-pill);
  border: 1.5px solid var(--line); background: var(--card);
  color: var(--ink); font-size: 15px; font-weight: 500;
  min-height: 40px; transition: all .15s;
}
.subject-chip.active { background: var(--green); border-color: var(--green); color: #fff; font-weight: 700; }

/* ---------- 按钮 ---------- */
.btn-primary {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; min-height: 48px;
  background: var(--green); color: #fff;
  border-radius: var(--r-md); font-size: 16px; font-weight: 700;
  box-shadow: 0 2px 6px rgba(15,110,92,.25);
  transition: background .15s, transform .05s;
}
.btn-primary:active { background: var(--green-dark); transform: scale(.985); }
.btn-primary .ic { width: 18px; height: 18px; }
.btn-primary.small { width: auto; min-height: 38px; padding: 0 16px; font-size: 14px; border-radius: var(--r-sm); }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  min-height: 38px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--card); color: var(--ink-2); font-size: 14px; font-weight: 600;
  transition: background .15s;
}
.btn-ghost:hover { background: var(--line-2); }
.btn-ghost .ic { width: 15px; height: 15px; }

.btn-danger { background: var(--red-soft); color: var(--red-ink); }
.btn-danger:hover { background: var(--red-line); }

/* ---------- 表单 ---------- */
.form-field { margin-bottom: 14px; }
.form-label { display: block; font-size: 13px; color: var(--ink-2); font-weight: 600; margin-bottom: 6px; }
.form-input, .form-textarea {
  width: 100%; min-height: 44px; padding: 10px 14px;
  border: 1.5px solid var(--line); border-radius: var(--r-md);
  background: var(--card); font-size: 16px; color: var(--ink);
  transition: border-color .15s;
}
.form-input:focus, .form-textarea:focus { outline: none; border-color: var(--green); }
.form-textarea { min-height: 80px; resize: vertical; line-height: 1.6; }
.form-input::placeholder, .form-textarea::placeholder { color: var(--ink-3); }

/* ---------- 条目列表 ---------- */
.list-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 4px; border-bottom: 1px solid var(--line-2);
}
.list-item:last-child { border-bottom: none; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-size: 15px; font-weight: 600; line-height: 1.45; word-break: break-word; }
.list-item .li-sub { font-size: 13px; color: var(--ink-2); margin-top: 3px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.list-item .li-right { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.list-item .li-action { display: flex; gap: 8px; flex: none; }
.li-del { color: var(--ink-3); width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 8px; }
.li-del:hover { color: var(--red-ink); background: var(--red-soft); }
.li-del .ic { width: 16px; height: 16px; }

/* 逾期文字 */
.overdue-tag { color: var(--red-ink); font-size: 13px; font-weight: 700; }
.review-tag { color: var(--orange-ink); font-size: 13px; font-weight: 700; }

/* ---------- 进度条 ---------- */
.progress-track { height: 8px; border-radius: 8px; background: var(--green-soft); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 8px; background: var(--green); transition: width .4s ease; }
.progress-fill.orange { background: var(--orange); }
.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-row .track { flex: 1; }
.progress-row .val { font-size: 13px; font-weight: 700; color: var(--ink); white-space: nowrap; }

/* ---------- 环形饼图（内联 SVG 用） ---------- */
.pie-wrap { position: relative; width: 54px; height: 54px; flex: none; }
.pie-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; line-height: 1.15;
}
.pie-center small { font-size: 9px; font-weight: 500; color: var(--ink-3); }

/* ---------- 小芽卡（角色卡） ---------- */
.sprout-card { position: relative; padding: 20px 18px; background: linear-gradient(135deg, #0F6E5C 0%, #12947C 100%); border-radius: var(--r-lg); color: #fff; overflow: hidden; }
.sprout-card::after { content: ""; position: absolute; right: -30px; top: -30px; width: 130px; height: 130px; border-radius: 50%; background: rgba(255,255,255,.08); }
.sprout-card::before { content: ""; position: absolute; right: 30px; bottom: -40px; width: 90px; height: 90px; border-radius: 50%; background: rgba(255,255,255,.06); }
.sprout-top { display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }
.sprout-avatar { width: 74px; height: 74px; flex: none; background: rgba(255,255,255,.14); border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 2px solid rgba(255,255,255,.35); }
.sprout-avatar .ic { width: 48px; height: 48px; }
.sprout-meta { flex: 1; min-width: 0; }
.sprout-level { font-size: 12px; font-weight: 600; opacity: .85; display: flex; align-items: center; gap: 5px; }
.sprout-level .lvl-badge { background: #fff; color: var(--green-ink); border-radius: var(--r-pill); padding: 1px 8px; font-weight: 800; font-size: 12px; }
.sprout-name { font-size: 20px; font-weight: 800; margin-top: 2px; }
.sprout-title { font-size: 13px; opacity: .9; margin-top: 1px; }
.sprout-exp { margin-top: 12px; position: relative; z-index: 1; }
.sprout-exp .track { height: 6px; border-radius: 6px; background: rgba(255,255,255,.25); overflow: hidden; }
.sprout-exp .fill { height: 100%; border-radius: 6px; background: #FFD27D; transition: width .4s; }
.sprout-exp .exp-text { display: flex; justify-content: space-between; font-size: 11px; opacity: .9; margin-top: 4px; }
.sprout-bubble {
  margin-top: 14px; position: relative; z-index: 1;
  background: rgba(255,255,255,.16); border-radius: var(--r-md);
  padding: 10px 14px; font-size: 14px; line-height: 1.5;
  backdrop-filter: blur(4px);
}
.sprout-bubble::before {
  content: ""; position: absolute; left: 26px; top: -8px;
  border: 8px solid transparent; border-bottom-color: rgba(255,255,255,.16);
  border-top: none;
}

/* ---------- 战报卡 ---------- */
.report-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.report-cell { text-align: center; padding: 10px 4px; border-radius: var(--r-md); background: var(--green-soft-2); }
.report-cell .n { font-size: 20px; font-weight: 800; color: var(--green-ink); }
.report-cell .l { font-size: 12px; color: var(--ink-2); margin-top: 1px; }

/* ---------- 未来 N 天 ---------- */
.day-row { display: flex; align-items: center; gap: 12px; padding: 9px 2px; border-bottom: 1px solid var(--line-2); }
.day-row:last-child { border-bottom: none; }
.day-badge { width: 42px; flex: none; text-align: center; }
.day-badge .d { font-size: 16px; font-weight: 800; line-height: 1.1; }
.day-badge .w { font-size: 11px; color: var(--ink-3); }
.day-badge.today .d, .day-badge.today .w { color: var(--green-ink); }
.day-events { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.day-event { font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.day-event .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.day-event .em { color: var(--ink); font-weight: 600; }
.day-count { flex: none; font-size: 12px; color: var(--ink-3); white-space: nowrap; }

/* ---------- 清零三连 ---------- */
.zero-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.zero-cell { text-align: center; padding: 14px 8px; }
.zero-cell .zc-ic { width: 44px; height: 44px; margin: 0 auto 8px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.zero-cell .zc-ic .ic { width: 22px; height: 22px; }
.zero-cell .zc-name { font-size: 14px; font-weight: 700; }
.zero-cell .zc-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

/* ---------- 成就卡 ---------- */
.achieve-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.achieve-item { border: 1px solid var(--line-2); border-radius: var(--r-md); padding: 12px; display: flex; align-items: center; gap: 10px; }
.achieve-item .a-ic { width: 40px; height: 40px; border-radius: 10px; flex: none; display: flex; align-items: center; justify-content: center; }
.achieve-item .a-ic .ic { width: 21px; height: 21px; }
.achieve-item .a-t { font-size: 14px; font-weight: 700; }
.achieve-item .a-s { font-size: 12px; color: var(--ink-3); }

/* 本周打卡行 */
.week-row { display: flex; justify-content: space-between; gap: 6px; }
.week-day { flex: 1; text-align: center; }
.week-day .w { font-size: 11px; color: var(--ink-3); }
.week-day .dot {
  width: 26px; height: 26px; margin: 4px auto 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--line-2); color: var(--ink-3); font-size: 12px;
}
.week-day.done .dot { background: var(--green); color: #fff; }
.week-day.today .dot { border: 2px solid var(--green); color: var(--green-ink); background: var(--green-soft); font-weight: 800; }

/* ---------- 顶部“进行中的项目/日历” 小卡 ---------- */
.ongoing-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.ongoing-card .og-ic { width: 42px; height: 42px; border-radius: 11px; flex: none; display: flex; align-items: center; justify-content: center; }
.ongoing-card .og-ic .ic { width: 22px; height: 22px; }
.ongoing-card .og-main { flex: 1; min-width: 0; }
.ongoing-card .og-title { font-size: 15px; font-weight: 700; }
.ongoing-card .og-sub { font-size: 12px; color: var(--ink-2); margin-top: 1px; }

/* ---------- 日历 ---------- */
.calendar-card { padding: 16px 18px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-title { font-size: 17px; font-weight: 800; }
.cal-nav { display: flex; gap: 4px; align-items: center; }
.cal-nav .icon-btn { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; color: var(--ink-2); }
.cal-nav .icon-btn:hover { background: var(--line-2); }
.cal-nav .icon-btn .ic { width: 17px; height: 17px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: 12px; color: var(--ink-3); font-weight: 600; padding: 6px 0; }
.cal-cell {
  position: relative; min-height: 52px; border-radius: 10px;
  border: 1px solid transparent; text-align: center; padding: 6px 2px 4px;
  font-size: 14px; cursor: pointer; transition: background .12s;
}
.cal-cell:hover { background: var(--green-soft-2); }
.cal-cell.other { color: var(--ink-3); opacity: .5; }
.cal-cell.today { border-color: var(--green); font-weight: 800; }
.cal-cell .dnum { font-weight: 600; }
.cal-cell.today .dnum { color: var(--green-ink); }
.cal-dots { display: flex; justify-content: center; gap: 3px; margin-top: 3px; }
.cal-dots .c-dot { width: 5px; height: 5px; border-radius: 50%; }
.cal-dot-hw { background: var(--green); }
.cal-dot-mem { background: var(--blue); }
.cal-dot-mis { background: var(--orange); }
.cal-legend { display: flex; gap: 14px; justify-content: center; margin-top: 12px; font-size: 12px; color: var(--ink-2); }
.cal-legend span { display: flex; align-items: center; gap: 5px; }
.cal-legend .c-dot { width: 8px; height: 8px; border-radius: 50%; }

/* ---------- 弹窗 ---------- */
.overlay { position: fixed; inset: 0; z-index: 200; background: rgba(31,35,33,.45); display: none; align-items: center; justify-content: center; padding: 20px; }
.overlay.show { display: flex; }
.modal { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow-2); width: 100%; max-width: 380px; padding: 22px; animation: popIn .18s ease; }
@keyframes popIn { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-title { font-size: 17px; font-weight: 800; text-align: center; }
.modal-text { font-size: 14px; color: var(--ink-2); text-align: center; margin-top: 8px; line-height: 1.6; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }

/* 数字键盘锁 */
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.kp-key { min-height: 54px; border-radius: 12px; background: var(--green-soft-2); font-size: 20px; font-weight: 700; color: var(--ink); display: flex; align-items: center; justify-content: center; }
.kp-key:active { background: var(--green-soft); }
.kp-dots { display: flex; justify-content: center; gap: 12px; margin: 14px 0 6px; }
.kp-dots i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); }
.kp-dots i.filled { background: var(--green); border-color: var(--green); }
.kp-err { text-align: center; color: var(--red-ink); font-size: 13px; min-height: 18px; margin-top: 4px; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: rgba(31,35,33,.92); color: #fff; border-radius: var(--r-pill);
  padding: 9px 18px; font-size: 14px; box-shadow: var(--shadow-2);
  animation: toastIn .2s ease; max-width: 86vw;
}
.toast.ok { background: rgba(15,110,92,.95); }
.toast.err { background: rgba(220,76,76,.95); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- 撒花动画 ---------- */
.confetti { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 250; overflow: hidden; }
.confetti i { position: absolute; width: 10px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall {
  to { transform: translateY(110vh) rotate(720deg); opacity: .9; }
}

/* ---------- 小芽摇摆 ---------- */
@keyframes sway { 0%,100% { transform: rotate(-4deg); } 50% { transform: rotate(5deg); } }
.sway { animation: sway 2.6s ease-in-out infinite; transform-origin: 50% 90%; }

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 30px 16px; color: var(--ink-3); font-size: 14px; }
.empty .ic { width: 40px; height: 40px; margin: 0 auto 10px; opacity: .45; display: block; }

/* ---------- 记忆/错题 操作双按钮 ---------- */
.dual-btn { display: flex; gap: 8px; }
.dual-btn .btn { flex: 1; min-height: 40px; border-radius: var(--r-sm); font-size: 14px; font-weight: 700; }
.btn-no { background: var(--red-soft); color: var(--red-ink); }
.btn-yes { background: var(--green-soft); color: var(--green-ink); }
.btn-no:active { background: var(--red-line); }
.btn-yes:active { background: var(--green-line); }

/* 详情浮层（正确思路 / 详情） */
.detail-panel { padding: 12px 18px 18px; background: var(--green-soft-2); border-top: 1px solid var(--green-line); font-size: 14px; line-height: 1.7; color: var(--ink); }
.detail-panel .dp-title { font-weight: 700; color: var(--green-ink); margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.detail-panel .dp-title .ic { width: 15px; height: 15px; }

/* 语音输入/附加小按钮 */
.attach-btn { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--green-ink); font-weight: 600; min-height: 34px; padding: 0 8px; }
.attach-btn .ic { width: 15px; height: 15px; }

@media (max-width: 767px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .zero-grid { grid-template-columns: repeat(3, 1fr); }
  .achieve-grid { grid-template-columns: 1fr; }
  .cal-cell { min-height: 46px; }
}
