/* ===== components.css：按钮/卡片/标签/弹窗/toast/表单/进度条/星级/时间轴 ===== */

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); padding: 14px;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  border-radius: 9px; padding: 7px 14px; font-size: 13px; cursor: pointer;
  transition: filter .15s, background .15s;
  user-select: none; white-space: nowrap;
}
.btn:hover { filter: brightness(.97); }
.btn:active { filter: brightness(.92); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.danger  { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn.ghost   { background: transparent; border-color: transparent; color: var(--accent); }
.btn.sm { padding: 4px 10px; font-size: 12px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn {
  border: none; background: transparent; cursor: pointer; color: var(--muted);
  width: 28px; height: 28px; border-radius: 7px; display: inline-flex;
  align-items: center; justify-content: center; flex: none;
}
.icon-btn:hover { background: var(--card2); color: var(--accent); }
.icon-btn svg { width: 16px; height: 16px; }

/* ---------- 标签 ---------- */
.tag {
  display: inline-block; padding: 1px 9px; border-radius: 999px;
  font-size: 11px; line-height: 20px; background: var(--card2); color: var(--muted);
  border: 1px solid var(--border);
}
.tag.op      { background: var(--accent-soft); color: var(--accent); border: none; }
.tag.emo     { background: var(--lesson-bg); color: var(--lesson); border: none; }
.tag.ok      { background: var(--ok-soft); color: var(--ok); border: none; }
.tag.warn    { background: var(--warn-soft); color: var(--warn); border: none; }
.tag.danger  { background: var(--danger-soft); color: var(--danger); border: none; }
.tag.accent  { background: var(--accent-soft); color: var(--accent); border: none; }

/* ---------- 表单 ---------- */
.form-item { margin-bottom: 12px; }
.form-item > label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.form-item .hint { font-size: 11px; color: var(--muted); margin-top: 3px; }
.form-item input[type=text], .form-item input[type=number], .form-item input[type=date],
.form-item input[type=password], .form-item select, .form-item textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--card2); outline: none;
}
.form-item input:focus, .form-item select:focus, .form-item textarea:focus {
  border-color: var(--accent);
}
.form-item textarea { resize: vertical; min-height: 60px; }
.form-row { display: flex; gap: 10px; }
.form-row > .form-item { flex: 1; }

/* chips 多选 */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips .chip {
  padding: 4px 12px; border-radius: 999px; font-size: 12px; cursor: pointer;
  border: 1px solid var(--border); background: var(--card2); color: var(--muted);
  user-select: none;
}
.chips .chip.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); font-weight: 600; }
.chips.emo .chip.on { background: var(--lesson-bg); color: var(--lesson); border-color: var(--lesson); }

/* 星级 */
.stars { display: flex; gap: 2px; }
.stars .star { cursor: pointer; font-size: 22px; color: var(--track); line-height: 1; user-select: none; }
.stars .star.on { color: #f2b01e; }

/* ---------- 弹窗 ---------- */
.dialog-overlay {
  position: fixed; inset: 0; z-index: 100; background: var(--overlay);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn .18s ease;
}
@media (min-width: 641px) { .dialog-overlay { align-items: center; } }
.dialog {
  background: var(--card); width: 100%; max-width: 520px; max-height: 88vh;
  border-radius: 16px 16px 0 0; display: flex; flex-direction: column;
  animation: slideUp .2s ease;
}
@media (min-width: 641px) { .dialog { border-radius: 14px; } }
.dialog.wide { max-width: 680px; }
.dialog-head {
  display: flex; align-items: center; padding: 14px 16px 10px; gap: 8px;
  border-bottom: 1px solid var(--border);
}
.dialog-head h3 { font-size: 15px; flex: 1; }
.dialog-body { padding: 14px 16px; overflow-y: auto; }
.dialog-foot {
  display: flex; gap: 8px; justify-content: flex-end; padding: 12px 16px;
  border-top: 1px solid var(--border);
}
@keyframes slideUp { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }

/* ---------- toast ---------- */
#toast-root { position: fixed; top: 62px; left: 0; right: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  background: var(--card); color: var(--text); border: 1px solid var(--border);
  box-shadow: var(--shadow); border-radius: 10px; padding: 8px 16px; font-size: 13px;
  animation: slideUp .2s ease; max-width: 86vw;
}
.toast.ok   { border-left: 3px solid var(--ok); }
.toast.warn { border-left: 3px solid var(--warn); }

/* ---------- 进度条（观察池） ---------- */
.price-range { margin-top: 8px; }
.price-range .track {
  position: relative; height: 8px; border-radius: 999px; background: var(--track);
}
.price-range .track.invalid { background: repeating-linear-gradient(45deg, var(--track), var(--track) 4px, transparent 4px, transparent 8px); }
.price-range .cur-line {
  position: absolute; top: -4px; bottom: -4px; width: 3px; border-radius: 2px;
  background: var(--accent); transform: translateX(-50%); box-shadow: 0 0 0 3px var(--accent-soft);
  transition: left .4s ease;
}
.price-range .ends { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 5px; }
.price-range .range-badge { font-size: 11px; margin-top: 4px; }

/* ---------- 时间轴（复盘） ---------- */
.timeline { position: relative; padding-left: 22px; }
.timeline::before {
  content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px;
  width: 2px; background: var(--border); border-radius: 2px;
}
.timeline > li { position: relative; margin-bottom: 16px; }
.timeline > li::before {
  content: ""; position: absolute; left: -21px; top: 6px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--card); border: 3px solid var(--accent);
}

/* ---------- 高亮块（理由蓝 / 教训橙） ---------- */
.hl-reason {
  background: var(--reason-bg); color: var(--reason); border-radius: 8px;
  padding: 7px 10px; font-size: 13px; margin-top: 8px;
  display: flex; gap: 6px; align-items: baseline;
}
.hl-lesson {
  background: var(--lesson-bg); color: var(--lesson); border-radius: 8px;
  padding: 7px 10px; font-size: 13px; margin-top: 8px;
  display: flex; gap: 6px; align-items: baseline;
}
.hl-reason .k, .hl-lesson .k { font-size: 11px; font-weight: 700; flex: none; opacity: .8; }

/* ---------- 定位高亮闪烁 ---------- */
@keyframes flashBg { 0% { background: var(--flash); } 100% { background: transparent; } }
.flash { animation: flashBg 2s ease forwards; border-radius: 10px; }

/* ---------- 空状态 ---------- */
.empty {
  text-align: center; color: var(--muted); padding: 44px 16px; font-size: 13px;
}
.empty .big { font-size: 34px; margin-bottom: 8px; opacity: .55; }

/* ---------- 免责声明 ---------- */
.disclaimer {
  margin-top: 12px; padding: 8px 10px; border-radius: 8px;
  background: var(--card2); color: var(--muted); font-size: 11px; line-height: 1.6;
}

/* ---------- 列表行通用 ---------- */
.row-item { border-left: 3px solid transparent; }
.row-item.expired { border-left-color: var(--danger); }
.divider { height: 1px; background: var(--border); margin: 12px 0; }
