/* ==================== CSS 变量 ==================== */
:root {
  --primary: #07C160;
  --primary-light: #e8f8ef;
  --primary-dark: #059a4a;
  --danger: #ee4d2d;
  --danger-light: #fef0ed;
  --warning: #ff976a;
  --bg: #f5f6fa;
  --bg-card: #ffffff;
  --bg-elevated: #ffffff;
  --text: #1a1a2e;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --border: #e5e7eb;
  --border-light: #f0f0f5;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --font: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --max-width: 640px;
  --header-h: 56px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================== 基础重置 ==================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-tap-highlight-color: transparent; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ==================== 落地页 ==================== */
.landing-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  background: linear-gradient(135deg, #e8f8ef 0%, #f5f6fa 40%, #eef1ff 100%);
}

.landing-hero { text-align: center; margin-bottom: 2.5rem; }

.landing-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.landing-hero h1 {
  font-size: 2.2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), #0ea5e9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.75rem;
}

.landing-subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

.landing-actions { text-align: center; margin-bottom: 3rem; }

.landing-hint {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.landing-features {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 500px;
}

.feature-card {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.2rem;
  box-shadow: var(--shadow-sm);
  flex: 1;
  min-width: 140px;
}

.feature-icon { font-size: 1.5rem; }
.feature-text { font-size: 0.85rem; font-weight: 600; line-height: 1.4; }
.feature-text small { font-weight: 400; color: var(--text-tertiary); }

/* ==================== 头部 ==================== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 1rem;
  height: var(--header-h);
}

.header-title {
  font-size: 1.15rem;
  font-weight: 700;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-title-wrap { flex: 1; min-width: 0; }

.header-progress {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 0.1rem;
}

.header-actions { display: flex; gap: 0.25rem; flex-shrink: 0; }

/* ==================== 主内容区 ==================== */
.main-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem;
  padding-bottom: 6rem;
}

/* ==================== 按钮 ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(7, 193, 96, 0.3);
}
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 16px rgba(7, 193, 96, 0.35); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--border-light); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-text { color: var(--danger); }

.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn-lg { padding: 0.85rem 2rem; font-size: 1rem; border-radius: var(--radius-md); }
.btn-icon-only { padding: 0.4rem; border-radius: 50%; }

.btn-icon { font-size: 1.1rem; }

/* ==================== FAB ==================== */
.fab {
  position: fixed;
  bottom: 2rem;
  right: max(1.5rem, calc((100vw - var(--max-width)) / 2 + 1rem));
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(7, 193, 96, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  z-index: 50;
}
.fab:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(7, 193, 96, 0.5); }
.fab:active { transform: scale(0.95); }

/* ==================== 清单列表 ==================== */
.checklist-grid { display: flex; flex-direction: column; gap: 0.75rem; }

.checklist-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
}
.checklist-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary); transform: translateY(-1px); }

.checklist-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.checklist-card-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  flex: 1;
}

.checklist-card-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary);
  flex-shrink: 0;
  margin-left: 0.5rem;
}

.checklist-card-badge.completed {
  background: var(--primary);
  color: #fff;
}

.checklist-card-badge.overdue {
  background: var(--danger-light);
  color: var(--danger);
}

.checklist-progress-bar {
  height: 4px;
  background: var(--border-light);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.checklist-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #34d399);
  border-radius: 2px;
  transition: width 0.4s ease;
}

.checklist-progress-fill.done { background: var(--primary); }

.checklist-card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-tertiary);
}

.checklist-card-dates { display: flex; gap: 0.75rem; }

/* ==================== 空状态 ==================== */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
}

.empty-icon { font-size: 3.5rem; margin-bottom: 1rem; opacity: 0.6; }
.empty-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.4rem; }
.empty-desc { font-size: 0.9rem; color: var(--text-tertiary); }

/* ==================== 分类与待办项 ==================== */
.category-section {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.category-header {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  cursor: pointer;
  user-select: none;
  gap: 0.5rem;
  transition: background var(--transition);
}
.category-header:hover { background: var(--border-light); }

.category-arrow {
  transition: transform var(--transition);
  color: var(--text-tertiary);
  flex-shrink: 0;
}
.category-arrow.collapsed { transform: rotate(-90deg); }

.category-name {
  flex: 1;
  font-weight: 600;
  font-size: 0.95rem;
}

.category-count {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-right: 0.25rem;
}

.category-actions {
  display: flex;
  gap: 0.15rem;
  opacity: 0;
  transition: opacity var(--transition);
}
.category-header:hover .category-actions { opacity: 1; }

/* 移动端始终显示操作按钮 */
@media (max-width: 640px) {
  .category-actions { opacity: 1; }
}

.category-body { padding: 0 0.5rem 0.5rem; }
.category-body.collapsed { display: none; }

.item-row {
  display: flex;
  align-items: flex-start;
  padding: 0.55rem 0.5rem;
  border-radius: var(--radius-sm);
  gap: 0.6rem;
  transition: background var(--transition);
  cursor: default;
}
.item-row:hover { background: var(--border-light); }

.item-checkbox {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  margin-top: 1px;
}
.item-checkbox:hover { border-color: var(--primary); }
.item-checkbox.checked {
  background: var(--primary);
  border-color: var(--primary);
}
.item-checkbox.checked::after {
  content: '';
  width: 6px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-top: -1px;
}

.item-content { flex: 1; min-width: 0; }

.item-text {
  font-size: 0.9rem;
  line-height: 1.5;
  word-break: break-word;
  transition: all var(--transition);
}
.item-text.done {
  text-decoration: line-through;
  color: var(--text-tertiary);
}

.item-desc {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  margin-top: 0.15rem;
  word-break: break-word;
}

.item-actions {
  display: flex;
  gap: 0.15rem;
  opacity: 0;
  transition: opacity var(--transition);
  flex-shrink: 0;
}
.item-row:hover .item-actions { opacity: 1; }

@media (max-width: 640px) {
  .item-actions { opacity: 1; }
}

/* 添加待办项输入 */
.add-item-row {
  display: flex;
  align-items: center;
  padding: 0.4rem 0.5rem;
  gap: 0.5rem;
}

.add-item-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font);
  font-size: 0.88rem;
  color: var(--text);
  outline: none;
  padding: 0.35rem 0;
}
.add-item-input::placeholder { color: var(--text-tertiary); }

.add-item-btn {
  color: var(--primary);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  border: none;
  background: none;
  font-family: var(--font);
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.add-item-btn:hover { background: var(--primary-light); }

/* ==================== 弹窗 ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

@media (min-width: 641px) {
  .modal-overlay { align-items: center; }
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 641px) {
  .modal { border-radius: var(--radius-xl); }
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-sm { max-width: 400px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.25rem 0.75rem;
}

.modal-header h2 { font-size: 1.1rem; font-weight: 700; }

.modal-body { padding: 0.5rem 1.25rem 1.25rem; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* ==================== 模板卡片 ==================== */
.template-card {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.9rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid var(--border-light);
  margin-bottom: 0.6rem;
}
.template-card:hover { border-color: var(--primary); background: var(--primary-light); }

.template-icon { font-size: 2rem; flex-shrink: 0; }
.template-info { flex: 1; min-width: 0; }
.template-title { font-weight: 600; font-size: 0.95rem; }
.template-desc { font-size: 0.8rem; color: var(--text-tertiary); margin-top: 0.15rem; }
.template-stats { font-size: 0.72rem; color: var(--text-tertiary); margin-top: 0.3rem; }

/* ==================== 输入框 ==================== */
.input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg);
  transition: border-color var(--transition);
  outline: none;
}
.input:focus { border-color: var(--primary); }
.input::placeholder { color: var(--text-tertiary); }

.input-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}

.mt-sm { margin-top: 0.75rem; }

/* ==================== Toast ==================== */
.toast {
  position: fixed;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 300;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  white-space: nowrap;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ==================== 确认删除按钮样式 ==================== */
.btn-confirm-delete {
  background: var(--danger);
  color: #fff;
  font-size: 0.78rem;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  animation: fadeIn 0.2s ease;
}

/* ==================== 响应式 ==================== */
@media (min-width: 641px) {
  .landing-hero h1 { font-size: 2.8rem; }
  .landing-subtitle { font-size: 1.15rem; }
  .checklist-grid { gap: 0.85rem; }
}

@media (max-width: 380px) {
  .landing-features { flex-direction: column; }
  .header-title { font-size: 1rem; }
}
