/* ============================================================
   components.css — 圆角卡片 / 按钮 / 列表 /
   三色优先级标签 / 输入框 通用组件
   ============================================================ */

/* ---------- 卡片 ---------- */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow), var(--card-shadow-inner);
  padding: var(--pad-card);
  margin-bottom: var(--gap);
  position: relative;
  overflow: hidden;
}
/* 双层柔光日签内层 */
.card--layered::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: calc(var(--radius-card) - 6px);
  background: var(--card-bg-2);
  z-index: 0;
  pointer-events: none;
}
.card > * {
  position: relative;
  z-index: 1;
}

/* ---------- 按钮 ---------- */
.btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  border: none;
  border-radius: var(--radius-pill);
  padding: 10px 18px;
  cursor: pointer;
  background: var(--accent-soft);
  color: var(--accent-deep);
  transition: transform 0.12s ease, background 0.2s, opacity 0.2s;
}
.btn:active {
  transform: scale(0.96);
}
.btn--primary {
  background: var(--accent);
  color: #fff;
}
.btn--ghost {
  background: transparent;
  border: 1px solid var(--input-border);
  color: var(--text-sub);
}
.btn--block {
  display: block;
  width: 100%;
  text-align: center;
}
.btn--sm {
  padding: 6px 12px;
  font-size: 12.5px;
}

/* ---------- 输入框 / 文本域 ---------- */
.field {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  font-weight: 300;
  color: var(--text-main);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  outline: none;
  transition: border 0.2s, box-shadow 0.2s;
}
.field:focus {
  border-color: var(--accent);
}
textarea.field {
  resize: none;
  line-height: 1.6;
}
input[type="time"].field {
  width: auto;
  flex: 1;
}

/* ---------- 列表 ---------- */
.list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--divider);
}
.list-item:last-child {
  border-bottom: none;
}

/* ---------- 三色优先级标签 ---------- */
.prio {
  font-size: 11px;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-weight: 400;
  white-space: nowrap;
}
.prio--high { background: var(--prio-high); color: #fff; }
.prio--mid  { background: var(--prio-mid);  color: #fff; }
.prio--low  { background: var(--prio-low);  color: #fff; }

/* 优先级点（列表左侧小圆点） */
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot--high { background: var(--prio-high); }
.dot--mid  { background: var(--prio-mid); }
.dot--low  { background: var(--prio-low); }

/* ---------- 待办勾选框 ---------- */
.check {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid var(--input-border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, border 0.2s;
}
.check svg { width: 13px; height: 13px; stroke: #fff; stroke-width: 3; opacity: 0; }
.check.done {
  background: var(--accent);
  border-color: var(--accent);
}
.check.done svg { opacity: 1; }

/* ---------- 习惯打卡按钮组 ---------- */
.habit-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.habit-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: var(--radius-pill);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  font-size: 13.5px;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
}
.habit-chip svg { width: 16px; height: 16px; stroke: var(--text-sub); fill: none; }
.habit-chip.checked {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.habit-chip.checked svg { stroke: #fff; }

/* ---------- 统计数字 ---------- */
.stat-row {
  display: flex;
  gap: 12px;
}
.stat {
  flex: 1;
  text-align: center;
  background: var(--input-bg);
  border-radius: var(--radius-sm);
  padding: 10px 6px;
}
.stat .num {
  font-size: 22px;
  font-weight: 400;
  color: var(--accent-deep);
}
.stat .lbl {
  font-size: 11px;
  color: var(--text-sub);
  margin-top: 2px;
}

/* ---------- 空状态 ---------- */
.empty {
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
  padding: 22px 0;
}

/* ---------- 顶部折叠金句卡专属 ---------- */
.quote-card { cursor: pointer; }
.quote-card .quote-text {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-main);
  transition: opacity 0.25s;
}
.quote-card .quote-author {
  font-size: 12px;
  color: var(--text-sub);
  text-align: right;
  margin-top: 6px;
}
.quote-card.collapsed .quote-text,
.quote-card.collapsed .quote-author {
  display: none;
}
.quote-toggle { color: var(--text-faint); }
.quote-refresh {
  color: var(--text-faint);
  cursor: pointer;
  display: inline-flex;
  transition: color 0.2s, transform 0.3s;
}
.quote-refresh:hover { color: var(--accent-deep); }
.quote-refresh:active { transform: rotate(120deg); }

/* ---------- 小工具行 ---------- */
.row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.muted { color: var(--text-sub); font-size: 12.5px; }
.spacer { flex: 1; }

/* ---------- 弹层（简单 modal） ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(74, 85, 79, 0.32);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}
.modal-mask.show { display: flex; }
.modal {
  background: var(--card-bg);
  border-radius: var(--radius-card);
  padding: 20px;
  width: 100%;
  max-width: 340px;
  box-shadow: var(--card-shadow);
}
.modal h3 { margin: 0 0 14px; font-weight: 400; font-size: 16px; }

/* ---------- 月历方格 ---------- */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-head {
  margin-bottom: 6px;
}
.cal-head span {
  text-align: center;
  font-size: 11px;
  color: var(--text-faint);
}
.cal-cell {
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 2px;
  position: relative;
  overflow: hidden;
}
/* 完成度着色（--r 为 0~1） */
.cal-cell::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  opacity: calc(var(--r, 0) * 0.22);
  z-index: 0;
}
.cal-cell.full::before { opacity: 0.34; }
.cal-cell.cal-out { opacity: 0.4; }
.cal-cell > * { position: relative; z-index: 1; }
.cal-num { font-size: 11px; color: var(--text-main); font-weight: 400; }
.cal-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  justify-content: center;
  max-width: 100%;
}
.cal-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--input-border);
}
.cal-dot.on { background: var(--accent-deep); }

/* ---------- 待办勾选框 ---------- */
.tcheck {
  width: 20px;
  height: 20px;
  border-radius: 7px;
  border: 1.5px solid var(--input-border);
  background: var(--input-bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
  color: #fff;
  transition: background 0.15s, border 0.15s;
}
.tcheck.on {
  background: var(--accent);
  border-color: var(--accent);
}

/* ---------- 作息小标签 ---------- */
.tag-chip {
  font-size: 12px;
  padding: 5px 13px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text-sub);
  cursor: pointer;
  transition: background 0.15s, border 0.15s, color 0.15s;
  user-select: none;
}
.tag-chip.on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-deep);
}

/* ---------- 皮肤选项 ---------- */
.theme-opt { transition: border 0.2s, background 0.2s; }
.theme-opt.active { border-color: var(--accent); background: var(--accent-soft); }
.theme-opt.disabled { opacity: 0.6; }

/* ---------- 习惯图标选择器 ---------- */
.hb-ic { color: var(--text-sub); transition: background 0.15s; }
.hb-ic:hover { background: var(--input-bg); }
.hb-ic.active { background: var(--accent-soft); color: var(--accent-deep); }

/* ---------- 轻提示 toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%) translateY(10px);
  background: var(--text-main);
  color: #fff;
  font-size: 13px;
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 200;
  max-width: 80%;
  text-align: center;
}
.toast.show { opacity: 0.94; transform: translateX(-50%) translateY(0); }

/* ---------- 日期 / 月份 切换导航（P0-1） ---------- */
.date-nav,
.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
}
.dn-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--accent-deep);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s, background 0.2s;
}
.dn-btn.disabled {
  opacity: 0.35;
  cursor: default;
}
.dn-mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
}
.dn-label {
  font-size: 15px;
  font-weight: 400;
  color: var(--text-main);
}
.dn-today {
  font-size: 11.5px;
  color: var(--accent-deep);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
}
