/* =========================================================
   接单积分平台 - 全局样式
   设计规范：
   - 主色 #2563eb（品牌蓝）
   - 成功 #16a34a（成功绿）
   - 警告 #d97706（警告橙）
   - 危险 #dc2626（危险红）
   - 圆角 12px，按钮 10px
   - 阴影柔和，hover 有微动效
   ========================================================= */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --text: #1f2937;
  --text-secondary: #4b5563;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --bg: #f3f5f9;
  --card-shadow: 0 1px 3px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.06);
  --card-shadow-hover: 0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--primary-hover); text-decoration: underline; }
code {
  background: #eef2ff;
  color: #4338ca;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 13px;
  font-family: "SF Mono", Consolas, monospace;
}

/* =========================================================
   顶部跑马灯（嵌入顶栏内）
   ========================================================= */
.topbar .topbar-marquee {
  width: 100%;
  height: 28px;
  font-size: 12px;
  line-height: 28px;
  overflow: hidden;
  border-bottom: 1px solid #fcd34d;
  margin: -14px -28px 12px -28px;
}
.topbar .topbar-marquee .marquee-track {
  display: block;
  white-space: nowrap;
  width: max-content;
  animation: marquee-scroll 35s linear infinite;
  will-change: transform;
}
.topbar .topbar-marquee:hover .marquee-track {
  animation-play-state: paused;
}
.topbar .topbar-marquee .marquee-text {
  display: inline-block;
  padding: 0 50px;
}

@keyframes marquee-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* =========================================================
   顶栏
   ========================================================= */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-main {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  width: 100%;
}
.topbar .brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-right: auto;
  letter-spacing: .3px;
}
.topbar .brand::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
  margin-right: 10px;
  vertical-align: middle;
}
.topbar .stat {
  color: var(--text-muted);
  font-size: 14px;
}
.topbar .stat b {
  color: var(--primary);
  font-weight: 600;
}

/* =========================================================
   按钮（统一样式规范
   ========================================================= */
.btn,
button.btn,
a.btn,
input[type=submit].btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: all .2s ease;
  line-height: 1.4;
  white-space: nowrap;
  user-select: none;
}
.btn:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37,99,235,.25);
}
.btn:active {
  transform: translateY(0);
}
.btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37,99,235,.2);
}

/* Ghost 按钮 */
.btn.ghost {
  background: #fff;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn.ghost:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
  box-shadow: none;
  transform: translateY(-1px);
}

/* 危险按钮 */
.btn.danger {
  background: var(--danger);
  border-color: var(--danger);
}
.btn.danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
  box-shadow: 0 4px 12px rgba(220,38,38,.25);
}

/* 成功按钮 */
.btn.success {
  background: var(--success);
  border-color: var(--success);
}
.btn.success:hover {
  background: #15803d;
  border-color: #15803d;
  box-shadow: 0 4px 12px rgba(22,163,74,.25);
}

/* 小按钮 */
.btn.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 8px;
}

/* 禁用状态 */
.btn.disabled,
.btn:disabled {
  background: #9ca3af;
  border-color: #9ca3af;
  cursor: not-allowed;
  opacity: .7;
  transform: none !important;
  box-shadow: none !important;
}

/* =========================================================
   容器
   ========================================================= */
.container {
  max-width: 1120px;
  margin: 24px auto;
  padding: 0 20px;
}

/* =========================================================
   卡片
   ========================================================= */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  box-shadow: var(--card-shadow);
  transition: box-shadow .2s ease, transform .2s ease;
}
.card:hover {
  box-shadow: var(--card-shadow-hover);
}
.card h3 {
  margin-bottom: 12px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.card.muted {
  color: var(--text-muted);
  background: #fafafa;
}

/* 任务网格（任务卡 */
.task-grid,
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.grid .card {
  margin-bottom: 0;
}

/* =========================================================
   任务卡片（任务广场）
   ========================================================= */
.task-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.task-card .task-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.task-card .task-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0;
  line-height: 1.4;
  flex: 1;
}
.task-card .task-reward {
  font-size: 22px;
  font-weight: 700;
  color: var(--success);
  white-space: nowrap;
}
.task-card .task-reward small {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}
.task-card .task-meta {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.task-card .meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
}
.task-card .meta-item b {
  color: var(--text);
  font-weight: 600;
}
.task-card .task-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 4px;
  align-items: center;
}

.task-card .task-target {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: var(--primary-light);
  border-radius: 8px;
  margin-bottom: 4px;
}
.task-card .task-target code {
  background: #fff;
  padding: 4px 10px;
  font-size: 13px;
}
.task-card .btn-copy {
  padding: 4px 10px;
  font-size: 12px;
}

/* 已接单卡片：变淡 + 左边绿色标记条 */
.task-card.task-taken {
  opacity: 0.75;
  border-left: 4px solid var(--success);
  background: linear-gradient(to right, rgba(34,197,94,0.04), transparent 30%);
}
.task-card.task-taken .task-title {
  color: var(--text-muted);
}

/* 已接单状态标签 */
.task-status {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 8px;
  vertical-align: middle;
  line-height: 1.6;
}
.task-status.taken {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

/* 筛选按钮组 */
.task-filter {
  display: inline-flex;
  background: var(--card-alt);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.filter-btn {
  background: transparent;
  border: none;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.filter-btn:hover {
  color: var(--text);
  background: rgba(255,255,255,0.5);
}
.filter-btn.active {
  background: #fff;
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* =========================================================
   订单卡片（我的任务）
   ========================================================= */
.order-card {
  margin-bottom: 14px;
}
.order-card .order-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 10px;
}
.order-card .order-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 200px;
}
.order-card .order-title {
  font-size: 16px;
  color: var(--text);
}
.order-card .order-reward {
  color: var(--success);
  font-weight: 600;
  font-size: 14px;
}
.order-card .order-meta {
  margin-bottom: 8px;
}
.order-card .order-screenshot {
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.order-card .review-note {
  background: var(--warning-light);
  color: var(--warning);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 8px;
}
.order-card .order-time {
  font-size: 12px;
  margin-bottom: 4px;
}
.order-card .order-actions {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* =========================================================
   任务卡片
   ========================================================= */
.task {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.card .meta {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 4px;
}
.card .meta b {
  color: var(--text);
  font-weight: 600;
}

/* =========================================================
   统计卡片网格
   ========================================================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.stats-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.stats-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 20px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  transition: box-shadow .2s, transform .2s;
}
.stat-card:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-1px);
}
.stat-card .stat-label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .3px;
  text-transform: uppercase;
}
.stat-card .stat-num,
.stat-card .stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 540px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card .stat-value, .stat-card .stat-num { font-size: 20px; }
}
.invite-card .invite-code {
  color: var(--primary);
  font-family: "SF Mono", Consolas, monospace;
  letter-spacing: 2px;
  font-size: 32px;
}
.invite-stats .btn-sm {
  margin-top: 6px;
  align-self: flex-start;
}

/* =========================================================
   表格
   ========================================================= */
table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
}
th, td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  text-align: left;
  font-size: 14px;
  vertical-align: middle;
}
th {
  background: #fafbfc;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: .3px;
}
tr:last-child td { border-bottom: none; }
tr:hover td {
  background: #fafbff;
}
.thumb {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform .2s;
}
.thumb:hover {
  transform: scale(1.05);
}

/* =========================================================
   状态徽章
   ========================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
}
.badge.accepted {
  background: var(--warning-light);
  color: var(--warning);
}
.badge.submitted {
  background: var(--primary-light);
  color: var(--primary);
}
.badge.approved {
  background: var(--success-light);
  color: var(--success);
}
.badge.rejected {
  background: var(--danger-light);
  color: var(--danger);
}

/* =========================================================
   表单
   ========================================================= */
label {
  display: block;
  margin-bottom: 14px;
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}
input[type=text],
input[type=password],
input[type=number],
input[type=email],
input[type=file],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 14px;
  margin-top: 6px;
  background: #fff;
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
  font-family: inherit;
}
input[type=file] {
  padding: 8px 12px;
  cursor: pointer;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.6;
}

/* =========================================================
   登录/注册 认证页
   ========================================================= */
.auth-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 50%, #fef3c7 100%);
}
.auth-wrap .card {
  width: 100%;
  max-width: 420px;
  padding: 36px 32px;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,.08);
}
.auth-wrap h1 {
  font-size: 24px;
  margin-bottom: 6px;
  text-align: center;
  font-weight: 700;
}
.auth-wrap .btn {
  width: 100%;
  padding: 11px;
  font-size: 15px;
  margin-top: 4px;
}
.auth-switch {
  text-align: center;
  font-size: 14px;
  margin-top: 18px;
  color: var(--text-muted);
}

/* =========================================================
   后台布局
   ========================================================= */
.admin {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 230px;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  color: #fff;
  padding: 20px 0;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar .logo {
  padding: 0 24px 20px;
  font-weight: 700;
  font-size: 18px;
  border-bottom: 1px solid #334155;
  margin-bottom: 12px;
  letter-spacing: .5px;
}
.sidebar .logo::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  margin-right: 10px;
  vertical-align: middle;
  box-shadow: 0 0 8px #22c55e;
}
.sidebar a {
  display: block;
  color: #cbd5e1;
  padding: 12px 24px;
  font-size: 14px;
  border-left: 3px solid transparent;
  transition: all .2s;
}
.sidebar a:hover {
  background: #1e293b;
  color: #fff;
  text-decoration: none;
  border-left-color: #3b82f6;
}
.sidebar a.active {
  background: rgba(59,130,246,.15);
  color: #fff;
  border-left-color: #3b82f6;
  font-weight: 500;
}
.admin-main {
  flex: 1;
  padding: 28px;
  overflow: auto;
  background: var(--bg);
}
.admin-main h2 {
  margin-bottom: 20px;
  font-size: 22px;
  font-weight: 700;
}

/* =========================================================
   工具条
   ========================================================= */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.toolbar .right {
  margin-left: auto;
}

/* =========================================================
   搜索栏（后台筛选行）
   ========================================================= */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.search-bar select,
.search-bar input[type=text] {
  width: auto;
  min-width: 140px;
  margin-top: 0;
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 8px;
}
.search-bar .btn {
  padding: 8px 16px;
  font-size: 13px;
}

/* =========================================================
   数据表格（后台）
   ========================================================= */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  font-size: 13px;
}
.data-table th {
  background: #f8fafc;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .4px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  color: var(--text);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f8faff; }

/* 分页 */
.pagination {
  display: flex;
  gap: 6px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  background: #fff;
  text-decoration: none;
  transition: all .15s;
}
.page-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  text-decoration: none;
}
.page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

/* =========================================================
   消息提示
   ========================================================= */
.msg {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
}
.msg.ok {
  background: var(--success-light);
  color: var(--success);
  border-color: #bbf7d0;
}
.msg.err {
  background: var(--danger-light);
  color: var(--danger);
  border-color: #fecaca;
}
.msg.warn {
  background: var(--warning-light);
  color: var(--warning);
  border-color: #fde68a;
}

/* =========================================================
   模态框
   ========================================================= */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  animation: fadeIn .2s ease;
}
.modal img {
  max-width: 92vw;
  max-height: 90vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* =========================================================
   辅助类
   ========================================================= */
.muted {
  color: var(--text-muted);
  font-size: 13px;
}

/* 滚动条美化 */
::-webkit-scrollbar { width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* 响应式 */
@media (max-width: 768px) {
  .topbar { padding: 12px 16px; }
  .topbar .brand { font-size: 16px; }
  .container { padding: 0 14px; margin: 16px auto; }
  .card { padding: 16px; }
  .admin { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    padding: 12px 0;
  }
  .sidebar .logo {
    padding: 0 16px 12px;
    margin-bottom: 8px;
  }
  .sidebar a {
    padding: 10px 16px;
    font-size: 13px;
  }
  .admin-main { padding: 16px; }
  .grid, .task-grid {
    grid-template-columns: 1fr;
  }
  th, td {
    padding: 10px 12px;
    font-size: 13px;
  }
  .invite-card .invite-code {
    font-size: 26px;
  }
}
