/* ─── 字体 & 变量 ──────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700&display=swap');

:root {
  --orange:       #FF8C00;
  --orange-light: #FFB347;
  --orange-pale:  #FFF3E0;
  --orange-hover: #E67E00;
  --yellow:       #FFD54F;
  --yellow-pale:  #FFFDE7;
  --cream:        #FFFEF7;
  --bg:           #FFF8F0;
  --white:        #FFFFFF;
  --text:         #3D2B1F;
  --text-soft:    #7A5C4A;
  --text-muted:   #B08070;
  --border:       #F0D8C0;
  --border-soft:  #F8EDE0;
  --deep-color:   #6B8E6B;
  --deep-pale:    #EEF5EE;
  --daily-color:  #E8A030;
  --daily-pale:   #FFF8EC;
  --shadow:       0 2px 12px rgba(200,120,60,0.08);
  --shadow-hover: 0 6px 24px rgba(200,120,60,0.15);
  --radius:       16px;
  --radius-sm:    10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Noto Sans SC', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
}

/* ─── 侧边栏 ────────────────────────────────────── */
.sidebar {
  width: 220px;
  min-height: 100vh;
  background: var(--white);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  box-shadow: 2px 0 16px rgba(200,120,60,0.06);
  z-index: 100;
}

.sidebar-header {
  padding: 28px 20px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-soft);
}

.logo {
  font-size: 32px;
  animation: bloom 3s ease-in-out infinite;
}

@keyframes bloom {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50%       { transform: scale(1.1) rotate(5deg); }
}

.logo-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}

.logo-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.nav-links {
  list-style: none;
  padding: 16px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-link {
  display: block;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-soft);
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.nav-link:hover {
  background: var(--orange-pale);
  color: var(--orange);
}

.nav-link.active {
  background: var(--orange-pale);
  color: var(--orange);
  font-weight: 600;
}

.sidebar-footer {
  padding: 20px;
  text-align: center;
  font-size: 24px;
  opacity: 0.3;
}

/* ─── 主内容 ─────────────────────────────────────── */
.main {
  margin-left: 220px;
  flex: 1;
  padding: 40px;
  max-width: 1000px;
}

.page { display: none; }
.page.active { display: block; }

.page-header {
  margin-bottom: 32px;
}

.page-header h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 13px;
}

/* ─── 工具栏 ─────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.input-search {
  border: 1.5px solid var(--border);
  border-radius: 24px;
  padding: 9px 18px;
  font-size: 13px;
  outline: none;
  width: 220px;
  background: var(--white);
  color: var(--text);
  transition: border 0.2s;
  font-family: inherit;
}

.input-search:focus { border-color: var(--orange); }

.tab-buttons {
  display: flex;
  background: var(--border-soft);
  border-radius: 24px;
  padding: 3px;
  gap: 2px;
}

.tab-btn {
  border: none;
  background: transparent;
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-soft);
  transition: all 0.2s;
  font-family: inherit;
}

.tab-btn.active {
  background: var(--white);
  color: var(--orange);
  box-shadow: 0 1px 6px rgba(200,120,60,0.12);
}

/* ─── 按钮 ───────────────────────────────────────── */
.btn {
  border: none;
  border-radius: 24px;
  padding: 10px 22px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  white-space: nowrap;
}

.btn-primary {
  background: var(--orange);
  color: white;
  box-shadow: 0 3px 12px rgba(255,140,0,0.30);
}

.btn-primary:hover {
  background: var(--orange-hover);
  box-shadow: 0 5px 18px rgba(255,140,0,0.40);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-soft);
  border: 1.5px solid var(--border);
}

.btn-ghost:hover { background: var(--border-soft); }

.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
}

.btn-danger {
  background: #FFE8E8;
  color: #C0392B;
  border: none;
}

.btn-danger:hover { background: #FFCCCC; }

/* ─── 卡片 ───────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-soft);
}

.card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 16px;
}

/* ─── 主页 Dashboard ─────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* 打卡卡片 */
.home-checkin-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
}
.home-checkin-item:last-child { border-bottom: none; }

.home-checkin-check {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
  background: white;
  font-size: 12px;
}

.home-checkin-check.done {
  background: var(--orange);
  border-color: var(--orange);
  color: white;
}

.home-checkin-name { flex: 1; font-size: 14px; font-weight: 500; }
.home-checkin-freq { font-size: 11px; color: var(--text-muted); }

/* 记忆卡片 */
.home-memory-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-soft);
}
.home-memory-item:last-child { border-bottom: none; }
.home-memory-layer { display: inline-block; font-size: 10px; padding: 2px 8px; border-radius: 10px; margin-bottom: 3px; }
.layer-deep  { background: var(--deep-pale);  color: var(--deep-color);  }
.layer-daily { background: var(--daily-pale); color: var(--daily-color); }
.home-memory-title { font-size: 13px; font-weight: 500; }
.home-memory-content { font-size: 12px; color: var(--text-soft); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 事件卡片 */
.home-event-item {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-soft);
  align-items: flex-start;
}
.home-event-item:last-child { border-bottom: none; }
.home-event-date {
  background: var(--orange-pale);
  color: var(--orange);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.home-event-title { font-size: 13px; font-weight: 500; }

/* 日记卡片 */
.home-diary-preview { font-size: 13px; color: var(--text-soft); line-height: 1.7; }
.home-diary-meta { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; }

/* ─── 记忆库 ─────────────────────────────────────── */
.memories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.memory-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-soft);
  transition: all 0.2s;
  position: relative;
}

.memory-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.memory-card.deep  { border-top: 3px solid var(--deep-color); }
.memory-card.daily { border-top: 3px solid var(--orange-light); }

.memory-layer-badge {
  display: inline-block;
  font-size: 10px;
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}

.memory-card.deep  .memory-layer-badge { background: var(--deep-pale);  color: var(--deep-color);  }
.memory-card.daily .memory-layer-badge { background: var(--daily-pale); color: var(--daily-color); }

.memory-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.memory-content {
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.memory-tags {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag {
  background: var(--orange-pale);
  color: var(--orange);
  font-size: 10px;
  padding: 2px 9px;
  border-radius: 10px;
  font-weight: 500;
}

.memory-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
}

.memory-date { font-size: 11px; color: var(--text-muted); }
.memory-keep { font-size: 10px; color: var(--deep-color); background: var(--deep-pale); padding: 2px 8px; border-radius: 10px; }
.memory-expires { font-size: 10px; color: var(--text-muted); }

.memory-actions { display: flex; gap: 6px; }
.icon-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  padding: 3px 6px;
  border-radius: 6px;
  transition: background 0.2s;
  color: var(--text-muted);
}
.icon-btn:hover { background: var(--border-soft); }

/* ─── 日记本 ─────────────────────────────────────── */
.diary-list { display: flex; flex-direction: column; gap: 16px; }

.diary-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-soft);
  transition: all 0.2s;
}

.diary-card:hover { box-shadow: var(--shadow-hover); }

.diary-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.diary-title { font-size: 16px; font-weight: 600; }
.diary-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.author-badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 600;
}

.author-yuanyuan  { background: #FDE8F5; color: #C2558C; }
.author-xiaojuhua { background: var(--orange-pale); color: var(--orange); }

.mood-badge {
  background: var(--yellow-pale);
  color: #B8860B;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 12px;
}

.diary-date { font-size: 11px; color: var(--text-muted); }

.diary-content {
  font-size: 14px;
  color: var(--text-soft);
  line-height: 1.8;
  white-space: pre-wrap;
}

/* ─── 打卡 ───────────────────────────────────────── */
.habits-container { display: flex; flex-direction: column; gap: 20px; }

.habit-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-soft);
}

.habit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.habit-name { font-size: 18px; font-weight: 700; }
.habit-freq {
  font-size: 11px;
  padding: 4px 12px;
  border-radius: 12px;
  font-weight: 600;
}
.freq-daily  { background: var(--orange-pale); color: var(--orange); }
.freq-weekly { background: var(--deep-pale);   color: var(--deep-color); }

.habit-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.habit-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.habit-day-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
}

.checkin-dot {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  font-size: 16px;
  background: var(--white);
}

.checkin-dot.today { border-color: var(--orange-light); border-width: 2.5px; }
.checkin-dot.done  { background: var(--orange); border-color: var(--orange); }
.checkin-dot.done::after { content: '✓'; color: white; font-weight: bold; font-size: 14px; }

.checkin-dot:hover { transform: scale(1.1); }

.habit-notes { margin-top: 12px; }
.habit-note {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  background: var(--yellow-pale);
  border-radius: 10px;
  margin-bottom: 8px;
  border-left: 3px solid var(--yellow);
}
.note-author { font-size: 11px; font-weight: 600; color: var(--orange); flex-shrink: 0; }
.note-text   { font-size: 13px; color: var(--text-soft); }

.habit-actions { display: flex; gap: 8px; margin-top: 14px; }

/* ─── 日历 ───────────────────────────────────────── */
.calendar-list { display: flex; flex-direction: column; gap: 12px; }

.event-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-soft);
  display: flex;
  gap: 18px;
  align-items: flex-start;
  transition: all 0.2s;
}

.event-card:hover { box-shadow: var(--shadow-hover); }

.event-date-block {
  background: var(--orange-pale);
  border-radius: 12px;
  padding: 10px 14px;
  text-align: center;
  min-width: 56px;
  flex-shrink: 0;
}

.event-date-day   { font-size: 22px; font-weight: 700; color: var(--orange); line-height: 1; }
.event-date-month { font-size: 11px; color: var(--orange-light); font-weight: 600; margin-top: 2px; }

.event-info { flex: 1; }
.event-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.event-desc  { font-size: 13px; color: var(--text-soft); }
.event-remind { font-size: 11px; color: var(--text-muted); margin-top: 6px; }
.event-time  { font-size: 12px; color: var(--orange); font-weight: 500; }

/* ─── 模态框 ─────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(60,30,10,0.25);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--white);
  border-radius: 20px;
  width: 90%;
  max-width: 500px;
  max-height: 85vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(100,50,0,0.2);
  animation: modal-in 0.2s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}

.modal-header {
  padding: 22px 24px 16px;
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--border-soft);
}

.modal-header h3 { font-size: 17px; font-weight: 700; }

.modal-close {
  border: none; background: none; cursor: pointer;
  font-size: 16px; color: var(--text-muted);
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.modal-close:hover { background: var(--border-soft); }

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  display: flex; justify-content: flex-end; gap: 10px;
  border-top: 1px solid var(--border-soft);
}

/* ─── 表单元素 ───────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-soft); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.04em; }

.form-input, .form-textarea, .form-select {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  background: var(--white);
  color: var(--text);
  transition: border 0.2s;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--orange);
}

.form-textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0;
}
.toggle-label { font-size: 13px; color: var(--text); }

/* ─── 空状态 ─────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-text { font-size: 14px; }

/* ─── 滚动条 ─────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--orange-light); }

/* ─── 工具提示 ───────────────────────────────────── */
.loading { text-align: center; padding: 40px; color: var(--text-muted); font-size: 13px; }

/* ─── 认识天数 ───────────────────────────────────── */
.days-together {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--orange-pale), var(--yellow-pale));
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 8px 18px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--orange);
  font-weight: 600;
}

.days-together .days-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--orange);
  line-height: 1;
}

/* ─── 导航徽标 ───────────────────────────────────── */
.nav-badge {
  display: inline-block;
  background: #FF4757;
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  padding: 0 4px;
  line-height: 16px;
  text-align: center;
  vertical-align: middle;
  margin-left: 4px;
}
.nav-badge:empty { display: none; }

/* ─── 月历视图 ───────────────────────────────────── */
.cal-month-label {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  padding: 0 8px;
  min-width: 100px;
  text-align: center;
}

.cal-grid-wrap {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-soft);
  margin-bottom: 8px;
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 8px;
}
.cal-weekdays span {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 4px 0;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  font-size: 13px;
  color: var(--text-soft);
}

.cal-cell:hover { background: var(--orange-pale); color: var(--orange); }
.cal-cell.other-month { color: var(--border); cursor: default; }
.cal-cell.other-month:hover { background: transparent; }
.cal-cell.today { background: var(--orange-pale); color: var(--orange); font-weight: 700; }
.cal-cell.selected { background: var(--orange); color: white !important; font-weight: 700; }
.cal-cell.has-event::after {
  content: '';
  position: absolute;
  bottom: 3px;
  width: 5px; height: 5px;
  background: var(--orange);
  border-radius: 50%;
}
.cal-cell.selected.has-event::after { background: white; }

.cal-day-events {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px 20px;
  border: 1.5px solid var(--orange-light);
  margin-bottom: 8px;
}
.cal-day-events.hidden { display: none; }
.cal-day-events-title { font-size: 13px; font-weight: 700; color: var(--orange); margin-bottom: 10px; }

/* ─── 主页引言 ───────────────────────────────────── */
.home-quote {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
  letter-spacing: 0.02em;
}

/* ─── 日记展开提示 ───────────────────────────────── */
.diary-expand-hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--orange);
  font-weight: 500;
}

/* ─── 便签未读样式 ───────────────────────────────── */
.habit-note.unread {
  border-left-color: var(--orange);
  background: #FFF8EC;
}
.note-unread-dot {
  width: 7px; height: 7px;
  background: #FF4757;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}
