/* 家庭积分系统 - 全局样式 */
:root {
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #1e293b;
  --text-light: #64748b;
  --border: #e2e8f0;
  --study: #8b5cf6;
  --life: #14b8a6;
  --radius: 16px;
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* 顶部导航 */
.navbar {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.navbar .brand {
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.navbar .nav-links {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.navbar .nav-links a {
  color: rgba(255,255,255,0.9);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  transition: all 0.2s;
}
.navbar .nav-links a:hover, .navbar .nav-links a.active {
  background: rgba(255,255,255,0.2);
  color: white;
}
.navbar .user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
}
.navbar .user-info .avatar { font-size: 24px; }

/* 容器 */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
}

/* 卡片 */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 网格 */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* 统计卡片 */
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-card .stat-icon { font-size: 36px; margin-bottom: 8px; }
.stat-card .stat-value { font-size: 32px; font-weight: 800; color: var(--primary); }
.stat-card .stat-label { font-size: 14px; color: var(--text-light); margin-top: 4px; }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 24px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  min-height: 48px;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-outline { background: transparent; border: 2px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 8px 16px; font-size: 14px; min-height: 36px; border-radius: 8px; }
.btn-block { width: 100%; }

/* 表单 */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 15px;
}
.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  transition: border-color 0.2s;
  background: white;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* 徽章/标签 */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}
.badge-study { background: #ede9fe; color: var(--study); }
.badge-life { background: #ccfbf1; color: var(--life); }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-approved { background: #d1fae5; color: #065f46; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-delivered { background: #dbeafe; color: #1e40af; }
.badge-points { background: #fef3c7; color: #92400e; }

/* 任务卡片 */
.task-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
  transition: transform 0.2s;
}
.task-card:hover { transform: translateX(4px); }
.task-card.study { border-left-color: var(--study); }
.task-card.life { border-left-color: var(--life); }
.task-card .task-icon { font-size: 32px; flex-shrink: 0; }
.task-card .task-info { flex: 1; min-width: 0; }
.task-card .task-title { font-weight: 700; font-size: 16px; margin-bottom: 2px; }
.task-card .task-desc { font-size: 13px; color: var(--text-light); }
.task-card .task-points {
  font-weight: 800;
  color: var(--warning);
  font-size: 18px;
  flex-shrink: 0;
}
.task-card .task-status { flex-shrink: 0; }

/* 积分显示 */
.points-display {
  font-size: 48px;
  font-weight: 800;
  color: var(--warning);
  line-height: 1;
}
.points-display .unit { font-size: 20px; color: var(--text-light); font-weight: 500; }

/* 进度条 */
.progress-bar {
  background: var(--border);
  border-radius: 10px;
  height: 14px;
  overflow: hidden;
  margin: 8px 0;
}
.progress-bar .progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 10px;
  transition: width 0.5s ease;
}

/* 列表项 */
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-item .item-icon { font-size: 28px; flex-shrink: 0; }
.list-item .item-info { flex: 1; min-width: 0; }
.list-item .item-title { font-weight: 600; font-size: 15px; }
.list-item .item-meta { font-size: 13px; color: var(--text-light); }
.list-item .item-action { flex-shrink: 0; }

/* 徽章墙 */
.badge-item {
  text-align: center;
  padding: 16px 8px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}
.badge-item .badge-icon { font-size: 40px; margin-bottom: 6px; }
.badge-item .badge-name { font-weight: 700; font-size: 14px; }
.badge-item .badge-desc { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.badge-item.locked { opacity: 0.35; filter: grayscale(1); }

/* 排行榜 */
.ranking-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.ranking-item .rank-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
}
.ranking-item:nth-child(1) .rank-num { background: #fef3c7; color: #92400e; }
.ranking-item:nth-child(2) .rank-num { background: #f1f5f9; color: #475569; }
.ranking-item:nth-child(3) .rank-num { background: #fed7aa; color: #9a3412; }
.ranking-item .rank-avatar { font-size: 24px; }
.ranking-item .rank-name { flex: 1; font-weight: 600; }
.ranking-item .rank-points { font-weight: 800; color: var(--warning); }

/* Flash消息 */
.flash {
  padding: 14px 18px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}
.flash-success { background: #d1fae5; color: #065f46; }
.flash-error { background: #fee2e2; color: #991b1b; }

/* 登录页 */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
}
.login-box {
  background: white;
  border-radius: 24px;
  padding: 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-box .login-title {
  text-align: center;
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 8px;
}
.login-box .login-subtitle {
  text-align: center;
  color: var(--text-light);
  margin-bottom: 24px;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
}
.empty-state .empty-icon { font-size: 56px; margin-bottom: 12px; }

/* 分页标题 */
.section-title {
  font-size: 20px;
  font-weight: 800;
  margin: 24px 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 表格 */
.table-wrap { overflow-x: auto; }
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.data-table th, table.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
table.data-table th { background: #f1f5f9; font-weight: 700; }
table.data-table tr:hover { background: #f8fafc; }

/* 积分流水正负色 */
.points-positive { color: var(--success); font-weight: 700; }
.points-negative { color: var(--danger); font-weight: 700; }

/* 底部操作栏 */
.action-bar {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* 响应式 */
@media (max-width: 640px) {
  .navbar { padding: 10px 14px; flex-wrap: wrap; gap: 8px; }
  .navbar .brand { font-size: 17px; }
  .navbar .nav-links a { padding: 6px 10px; font-size: 14px; }
  .container { padding: 14px; }
  .card { padding: 16px; }
  .points-display { font-size: 36px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* 横屏iPad优化 */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
  .container { max-width: 900px; }
}
