/* ============================================
   闲赚网 - 主样式表
   ============================================ */

:root {
  --primary: #00b967;
  --primary-dark: #009e58;
  --primary-light: #e6f9f1;
  --secondary: #ff9500;
  --bg: #f5f7fa;
  --card-bg: #fff;
  --text: #1a1a2e;
  --text-light: #6b7280;
  --text-lighter: #9ca3af;
  --border: #e5e7eb;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #10b981;
  --info: #3b82f6;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.1);
  --header-h: 60px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 14px;
}

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

img { max-width: 100%; display: block; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* ============ 顶部导航 ============ */
.header {
  background: #fff;
  height: var(--header-h);
  box-shadow: var(--shadow);
  position: sticky; top: 0; z-index: 100;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); }
.logo { font-size: 22px; font-weight: 800; color: var(--primary); display: flex; align-items: center; gap: 6px; }
.logo span { color: var(--text); font-size: 14px; font-weight: 400; }

.nav { display: flex; gap: 4px; align-items: center; }
.nav a { padding: 8px 14px; border-radius: 8px; color: var(--text); font-weight: 500; font-size: 15px; }
.nav a:hover, .nav a.active { background: var(--primary-light); color: var(--primary); }

.header-right { display: flex; align-items: center; gap: 12px; }
.header-balance { background: var(--primary-light); color: var(--primary); padding: 5px 12px; border-radius: 20px; font-weight: 600; font-size: 13px; }
.header-notif { position: relative; font-size: 22px; cursor: pointer; }
.header-notif .badge { position: absolute; top: -4px; right: -6px; background: var(--danger); color: #fff; font-size: 10px; min-width: 16px; height: 16px; line-height: 16px; text-align: center; border-radius: 8px; padding: 0 4px; }
.header-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 700; cursor: pointer; }

.mobile-menu-btn { display: none; background: none; border: none; font-size: 24px; cursor: pointer; }

/* ============ 按钮 ============ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 20px; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; border: none; transition: all .2s; text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-outline { background: #fff; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ============ 卡片 ============ */
.card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.card-title { font-size: 17px; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; }

/* ============ 表单 ============ */
.form-group { margin-bottom: 18px; }
.form-label { display: block; margin-bottom: 6px; font-weight: 600; color: var(--text); font-size: 14px; }
.form-label .req { color: var(--danger); }
.form-input, .form-textarea, .form-select {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 14px; transition: border-color .2s; background: #fff; font-family: inherit;
}
.form-input:focus, .form-textarea:focus, .form-select:focus { outline: none; border-color: var(--primary); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.form-error { color: var(--danger); font-size: 12px; margin-top: 4px; }

/* ============ 标签 ============ */
.tag { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.tag-green { background: #d1fae5; color: #065f46; }
.tag-orange { background: #fef3c7; color: #92400e; }
.tag-blue { background: #dbeafe; color: #1e40af; }
.tag-red { background: #fee2e2; color: #991b1b; }
.tag-gray { background: #f3f4f6; color: #6b7280; }

/* ============ 首页 ============ */
.hero { background: linear-gradient(135deg, var(--primary), #00d97e); color: #fff; border-radius: 16px; padding: 40px 32px; text-align: center; margin-bottom: 24px; }
.hero h1 { font-size: 30px; margin-bottom: 10px; }
.hero p { font-size: 16px; opacity: .9; margin-bottom: 24px; }
.hero .btn { background: #fff; color: var(--primary); }
.hero .btn:hover { background: #f0f0f0; }

.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: var(--radius); padding: 20px; text-align: center; box-shadow: var(--shadow); }
.stat-card .num { font-size: 28px; font-weight: 800; color: var(--primary); }
.stat-card .label { font-size: 13px; color: var(--text-light); margin-top: 4px; }

.section-title { font-size: 20px; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; }
.section-title a { font-size: 14px; font-weight: 400; }

/* ============ 任务列表 ============ */
.task-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; }
.task-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; transition: transform .2s, box-shadow .2s; border: 1px solid var(--border); }
.task-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.task-card .task-header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 10px; }
.task-card .task-title { font-size: 16px; font-weight: 700; color: var(--text); flex: 1; }
.task-card .task-cat { font-size: 12px; color: var(--text-light); background: var(--bg); padding: 2px 8px; border-radius: 4px; white-space: nowrap; margin-left: 8px; }
.task-card .task-desc { color: var(--text-light); font-size: 13px; margin-bottom: 12px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.task-card .task-meta { display: flex; justify-content: space-between; align-items: center; }
.task-card .task-reward { color: var(--primary); font-size: 20px; font-weight: 800; }
.task-card .task-reward span { font-size: 14px; font-weight: 400; }
.task-card .task-info { font-size: 12px; color: var(--text-lighter); }
.task-card .task-progress { margin-top: 10px; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.task-card .task-progress-bar { height: 100%; background: var(--primary); border-radius: 2px; transition: width .3s; }

/* ============ 表格 ============ */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
.table th { font-weight: 700; color: var(--text-light); font-size: 13px; background: var(--bg); }
.table tr:hover { background: #fafbfc; }
.table-center td, .table-center th { text-align: center; }

/* ============ 个人中心 ============ */
.dashboard { display: grid; grid-template-columns: 220px 1fr; gap: 24px; margin-top: 24px; }
.dashboard-sidebar { background: #fff; border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); height: fit-content; }
.dashboard-sidebar .user-info { text-align: center; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.dashboard-sidebar .user-info .avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; margin: 0 auto 8px; }
.dashboard-sidebar .user-info .name { font-weight: 700; font-size: 16px; }
.dashboard-sidebar .menu-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: var(--text); font-weight: 500; margin-bottom: 2px; }
.dashboard-sidebar .menu-item:hover, .dashboard-sidebar .menu-item.active { background: var(--primary-light); color: var(--primary); }
.dashboard-sidebar .menu-item .icon { font-size: 18px; }
.dashboard-content { min-width: 0; }

/* 钱包卡片 */
.wallet-card { background: linear-gradient(135deg, #1a1a2e, #2d3436); color: #fff; border-radius: 16px; padding: 28px; margin-bottom: 16px; }
.wallet-card .label { font-size: 13px; opacity: .7; }
.wallet-card .balance { font-size: 36px; font-weight: 800; margin: 4px 0 16px; }
.wallet-card .wallet-actions { display: flex; gap: 12px; }
.wallet-card .wallet-actions .btn { background: rgba(255,255,255,.15); color: #fff; }
.wallet-card .wallet-actions .btn:hover { background: rgba(255,255,255,.25); }

/* ============ 管理后台 ============ */
.admin-layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.admin-sidebar { background: #1a1a2e; color: #fff; padding: 0; }
.admin-sidebar .admin-logo { padding: 20px; font-size: 20px; font-weight: 800; text-align: center; border-bottom: 1px solid rgba(255,255,255,.1); color: var(--primary); }
.admin-sidebar .admin-menu-item { display: block; padding: 12px 20px; color: rgba(255,255,255,.7); font-weight: 500; transition: all .2s; }
.admin-sidebar .admin-menu-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.admin-sidebar .admin-menu-item.active { background: var(--primary); color: #fff; }
.admin-main { background: var(--bg); }
.admin-header { background: #fff; padding: 0 24px; height: 56px; display: flex; align-items: center; justify-content: space-between; box-shadow: var(--shadow); }
.admin-header .page-title { font-size: 18px; font-weight: 700; }
.admin-content { padding: 24px; }

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-box { background: #fff; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.stat-box .stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: 12px; }
.stat-box .stat-value { font-size: 24px; font-weight: 800; }
.stat-box .stat-label { font-size: 13px; color: var(--text-light); }

/* ============ 分页 ============ */
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 24px; }
.pagination a, .pagination span { padding: 8px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; background: #fff; }
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .disabled { color: var(--text-lighter); cursor: not-allowed; }

/* ============ 提示框 ============ */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #d1fae5; color: #065f46; }
.alert-danger { background: #fee2e2; color: #991b1b; }
.alert-warning { background: #fef3c7; color: #92400e; }
.alert-info { background: #dbeafe; color: #1e40af; }

/* ============ 模态框 ============ */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.5); display: none; align-items: center; justify-content: center; z-index: 1000; }
.modal-overlay.show { display: flex; }
.modal { background: #fff; border-radius: 16px; padding: 28px; max-width: 480px; width: 90%; max-height: 80vh; overflow-y: auto; }
.modal h3 { font-size: 18px; margin-bottom: 16px; }
.modal-close { float: right; cursor: pointer; font-size: 22px; color: var(--text-light); }

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

/* ============ 页脚 ============ */
.footer { text-align: center; padding: 24px 0; color: var(--text-light); font-size: 13px; margin-top: 40px; border-top: 1px solid var(--border); }
.footer a { color: var(--text-light); }

/* ============ 响应式 ============ */
@media (max-width: 768px) {
  .nav { display: none; }
  .mobile-menu-btn { display: block; }
  .nav.open { display: flex; position: absolute; top: var(--header-h); left: 0; right: 0; flex-direction: column; background: #fff; padding: 8px; box-shadow: var(--shadow-lg); }
  .nav.open a { width: 100%; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .task-grid { grid-template-columns: 1fr; }
  .dashboard { grid-template-columns: 1fr; }
  .dashboard-sidebar { display: none; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { display: none; }
  .hero { padding: 28px 16px; }
  .hero h1 { font-size: 22px; }
}
