/* 车迷群积分 - 全局样式（移动端优先） */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #2b5e8c;
  --primary-dark: #1f4769;
  --success: #2e8b57;
  --danger: #c0392b;
  --bg: #f2f4f7;
  --card: #ffffff;
  --text: #2c3e50;
  --muted: #7f8c8d;
  --border: #e3e7ec;
  --radius: 10px;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.container { max-width: 760px; margin: 0 auto; padding: 12px; }

/* 顶部 */
.topbar { background: var(--primary); color: #fff; }
.topbar-inner {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px; flex-wrap: wrap; gap: 4px;
}
.brand { color: #fff; font-weight: 700; font-size: 18px; text-decoration: none; }
.user-info { font-size: 13px; opacity: .92; }

/* 导航 */
.navbar { background: var(--primary-dark); }
.nav-links { display: flex; flex-wrap: wrap; gap: 2px; }
.nav-links a {
  color: #dbe6f0; text-decoration: none; font-size: 14px;
  padding: 8px 12px; border-radius: 6px;
}
.nav-links a:hover { background: rgba(255,255,255,.12); color: #fff; }
.nav-links a.nav-admin { color: #ffd479; }

/* 汉堡按钮与抽屉（默认桌面端隐藏） */
.menu-toggle {
  display: none; background: none; border: none; color: #fff;
  font-size: 24px; cursor: pointer; padding: 0 4px; line-height: 1;
}
.drawer, .drawer-overlay { display: none; }

/* 卡片与布局 */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 600px) { .grid { grid-template-columns: 1fr 1fr; } }

h2 { font-size: 19px; margin-bottom: 6px; }
h3 { font-size: 16px; margin-bottom: 8px; }
.center { text-align: center; }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0; }

/* 表单 */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 14px; margin-bottom: 4px; font-weight: 600; }
input[type="text"], input[type="password"], input[type="number"], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 15px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
input[type="file"] { width: 100%; font-size: 14px; }
.input-sm { width: 100%; padding: 6px 8px; font-size: 13px; }
.input-num { max-width: 80px; }

/* 按钮 */
.btn {
  display: inline-block; border: 1px solid var(--border); background: #fff;
  color: var(--text); padding: 8px 16px; border-radius: 8px; cursor: pointer;
  font-size: 14px; text-decoration: none; text-align: center;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { opacity: .9; color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .9; color: #fff; }
.btn-block { display: block; width: 100%; }
.btn-lg { padding: 12px 32px; font-size: 16px; }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }

/* 提示 */
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 14px; }
.alert-success { background: #e8f5ee; color: #1e6b44; border: 1px solid #b7e0c9; }
.alert-error { background: #fdecea; color: #a43b2f; border: 1px solid #f5c6c0; }

/* 登录/注册 */
.auth-card { max-width: 400px; margin: 24px auto; }
.auth-card h2 { text-align: center; }
.auth-card .hint { text-align: center; }

/* 主界面 */
.score-card { text-align: center; }
.score-num { font-size: 44px; font-weight: 800; color: var(--primary); }
.score-label { color: var(--muted); margin-bottom: 8px; }
.level-badge {
  display: inline-block; background: #eef3f9; color: var(--primary);
  padding: 3px 14px; border-radius: 20px; font-size: 14px; font-weight: 600;
}
.progress { height: 8px; background: #e9eef3; border-radius: 5px; margin: 12px 0 6px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); border-radius: 5px; }

.actions { margin-top: 4px; }
.action-card {
  display: block; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; text-decoration: none; color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.action-card:hover { border-color: var(--primary); }
.action-title { font-size: 17px; font-weight: 700; }

.stat-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.stat-row:last-child { border-bottom: none; }

/* 积分流水 */
.log-list { list-style: none; }
.log-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 14px;
}
.log-list li:last-child { border-bottom: none; }
.log-reason { flex: 1; }
.log-time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.log-amount { color: var(--success); font-weight: 700; white-space: nowrap; }
.log-amount.neg { color: var(--danger); }

/* 打卡日历 */
.cal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.cal-header h2 { margin: 0; font-size: 18px; }
.cal-nav { color: var(--primary); text-decoration: none; font-size: 14px; padding: 4px 8px; }
.calendar { width: 100%; border-collapse: collapse; }
.calendar th { font-size: 12px; color: var(--muted); padding: 6px 2px; font-weight: 600; }
.calendar td { text-align: center; padding: 4px 0; }
.cal-day {
  position: relative; height: 44px; border-radius: 8px; font-size: 14px;
}
.day-num { line-height: 44px; }
.cal-empty { background: transparent; }
.is-today { background: #eaf2fa; font-weight: 700; color: var(--primary); }
.is-checked { background: #e8f5ee; color: var(--success); }
.is-future { color: #c6ccd3; }
.check-mark { position: absolute; bottom: 2px; right: 4px; font-size: 11px; font-weight: 700; }
.cal-legend { display: flex; gap: 16px; margin-top: 10px; font-size: 13px; color: var(--muted); align-items: center; flex-wrap: wrap; }
.cal-month-total { margin-left: auto; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: middle; }
.dot-checked { background: #e8f5ee; border: 1px solid var(--success); }
.dot-today { background: #eaf2fa; border: 1px solid var(--primary); }

/* 申报 */
.app-item { border-bottom: 1px dashed var(--border); padding: 12px 0; }
.app-item:last-child { border-bottom: none; }
.app-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.app-points { color: var(--success); font-weight: 700; font-size: 14px; margin: 2px 0; }
.app-content { white-space: pre-wrap; font-size: 14px; margin: 6px 0; }
.app-images { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.app-images img {
  width: 120px; height: 120px; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--border); cursor: pointer;
}
.review-form { margin-top: 10px; border-top: 1px dashed var(--border); padding-top: 10px; }
.review-actions { display: flex; gap: 10px; }
.list-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; flex-wrap: wrap; gap: 8px; }

/* 徽章 */
.badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; white-space: nowrap; }
.badge-pending { background: #fff7e6; color: #b57e10; }
.badge-approved { background: #e8f5ee; color: #1e6b44; }
.badge-rejected { background: #fdecea; color: #a43b2f; }
.badge-admin { background: #eef3f9; color: var(--primary); }
.badge-banned { background: #fdecea; color: #a43b2f; }
.tag { margin-left: 6px; font-size: 12px; color: var(--muted); }

/* 封禁与申诉 */
.ban-info { font-size: 15px; line-height: 2; margin: 14px 0; }
.alert-pending { background: #fff7e6; color: #b57e10; border: 1px solid #f3e3b8; padding: 12px 14px; border-radius: 8px; margin-bottom: 12px; }

/* 表格 */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px 6px; border-bottom: 2px solid var(--border); white-space: nowrap; }
.table td { padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tbody tr:hover { background: #fafbfc; }
.actions-cell { display: flex; gap: 6px; flex-wrap: wrap; }
.points-adjust { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.points-adjust .input-num { width: 64px; }
.points-reason { width: 120px !important; }

/* 后台 */
.stats { margin-bottom: 4px; }
.stat-card { text-align: center; }
.stat-num { font-size: 30px; font-weight: 800; color: var(--primary); }
.stat-label { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.admin-nav { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-nav a { font-size: 14px; color: var(--primary); text-decoration: none; padding: 4px 10px; border: 1px solid var(--border); border-radius: 6px; }
.admin-nav a:hover { border-color: var(--primary); }

/* 页签 */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tab { padding: 6px 16px; border-radius: 8px; font-size: 14px; text-decoration: none; color: var(--text); background: #fff; border: 1px solid var(--border); }
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* 排行榜 */
.rank { font-size: 18px; }
.rank-1 { filter: drop-shadow(0 0 2px rgba(212, 175, 55, .6)); }
.rank-2 { filter: drop-shadow(0 0 2px rgba(170, 170, 170, .5)); }
.rank-3 { filter: drop-shadow(0 0 2px rgba(205, 127, 50, .5)); }
.row-me { background: #eaf2fa; }
.row-me td { font-weight: 600; }

/* 规则编辑 */
.rule-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rule-form input { width: auto; flex: 1 1 140px; }
.switch-label { display: flex; align-items: center; gap: 4px; font-size: 13px; cursor: pointer; }

/* ============ 手机版（≤600px） ============ */
@media (max-width: 600px) {
  /* 顶部：汉堡按钮显示，用户名信息隐藏（抽屉头部展示） */
  .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .user-info { display: none; }
  .brand { font-size: 16px; }
  .topbar-inner { padding: 10px 12px; }

  /* 顶部导航隐藏，改用右侧抽屉菜单 */
  .navbar { display: none; }

  /* 抽屉菜单：右侧滑入 */
  .drawer-overlay {
    display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45);
    z-index: 99; opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility .25s ease;
  }
  .drawer-overlay.show { opacity: 1; visibility: visible; }
  .drawer {
    display: block; position: fixed; top: 0; right: 0; bottom: 0; width: 280px; max-width: 82%;
    background: #fff; z-index: 100; box-shadow: -4px 0 16px rgba(0,0,0,.15);
    transform: translateX(100%); transition: transform .28s ease;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
  }
  .drawer.open { transform: translateX(0); }
  .drawer-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px; background: var(--primary); color: #fff; position: sticky; top: 0; z-index: 1;
  }
  .drawer-user { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .drawer-close { background: none; border: none; color: #fff; font-size: 20px; cursor: pointer; padding: 0 2px; line-height: 1; }
  .drawer-nav { display: flex; flex-direction: column; padding: 8px 0; }
  .drawer-nav a {
    color: var(--text); text-decoration: none; font-size: 15px;
    padding: 14px 20px; border-bottom: 1px solid var(--border);
  }
  .drawer-nav a:hover { background: #f2f6fa; }
  .drawer-nav a.nav-admin { color: var(--primary); font-weight: 600; }
  body.drawer-locked { overflow: hidden; }

  /* 表格横向滚动（管理后台等宽表） */
  .table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  .table th, .table td { white-space: nowrap; }
  .table td .btn-sm { white-space: nowrap; }

  /* 用户管理表：手机端转为卡片式，操作区独占一行 */
  .users-table { display: block; overflow-x: visible; white-space: normal; }
  .users-table thead { display: none; }
  .users-table tbody { display: block; }
  .users-table tr {
    display: block; border: 1px solid var(--border); border-radius: 8px;
    margin-bottom: 10px; padding: 8px 10px; background: var(--card);
  }
  .users-table td {
    display: flex; align-items: center; gap: 8px;
    white-space: normal; padding: 4px 0; border: none;
  }
  .users-table td::before {
    content: attr(data-label); font-size: 12px; color: var(--muted);
    flex-shrink: 0; min-width: 64px;
  }
  .users-table td.actions-cell {
    display: block; border-top: 1px dashed var(--border) !important;
    margin-top: 6px; padding-top: 8px;
  }
  .users-table td.actions-cell::before { display: none; }
  .users-table td.actions-cell form { margin-bottom: 8px; }

  /* 卡片内边距收紧 */
  .card { padding: 12px; }
  .container { padding: 10px; }

  /* 主界面分数 */
  .score-num { font-size: 38px; }

  /* 操作按钮全宽，方便点按 */
  .actions .action-card { padding: 14px; }
  .btn { padding: 10px 14px; }

  /* 登录/注册卡片 */
  .auth-card { max-width: 100%; margin: 12px auto; }

  /* 打卡日历格子 */
  .cal-day { height: 40px; }
  .day-num { line-height: 40px; }

  /* 申报图片 */
  .app-images img { width: 96px; height: 96px; }

  /* 商城图片 */
  .mall-img { aspect-ratio: 16/10; }

  /* 订单图片 */
  .order-img { width: 64px; height: 64px; }

  /* 表单控件加大触控区域 */
  input[type="text"], input[type="password"], input[type="number"], select, textarea {
    padding: 12px; font-size: 16px;  /* 16px 防止 iOS 聚焦缩放 */
  }

  /* 后台统计卡片 */
  .stat-num { font-size: 26px; }

  /* 加减分/封禁表单换行排列 */
  .points-adjust { flex-direction: column; align-items: stretch; }
  .points-adjust .input-num { width: 100%; max-width: none; }
  .points-reason { width: 100% !important; }
  .points-adjust .btn { width: 100%; }

  /* 页脚 */
  .site-footer {
    margin-top: 20px;
    padding: 16px 0 calc(16px + env(safe-area-inset-bottom));
    font-size: 12px;
    line-height: 1.8;
  }
}

/* 积分商城 */
.mall-balance { font-size: 15px; }
.mall-balance strong { color: var(--primary); font-size: 20px; }
.mall-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 600px) { .mall-grid { grid-template-columns: 1fr 1fr; } }
.mall-item { display: flex; flex-direction: column; }
.mall-img { width: 100%; aspect-ratio: 4/3; overflow: hidden; border-radius: 8px; margin-bottom: 10px; background: #f0f2f5; }
.mall-img img { width: 100%; height: 100%; object-fit: cover; }
.mall-img-empty { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; }
.mall-info { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.mall-title { font-size: 16px; font-weight: 700; }
.mall-desc { font-size: 13px; color: var(--muted); flex: 1; }
.mall-price { color: var(--danger); font-weight: 700; font-size: 16px; }
.mall-item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.mall-form { display: flex; flex-direction: column; gap: 10px; }
.mall-form-row { display: flex; flex-wrap: wrap; gap: 8px; }
.mall-form-row input[type="text"], .mall-form-row input[type="number"] { flex: 1 1 200px; width: auto; }
.mall-form-row input[type="file"] { flex: 1 1 220px; }
.mall-edit { margin-top: 10px; border-top: 1px dashed var(--border); padding-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.mall-edit-footer { display: flex; justify-content: space-between; align-items: center; }
.mall-delete { margin-top: 8px; text-align: right; }

/* 页脚 */
.site-footer { margin-top: 28px; padding: 18px 0; text-align: center; color: var(--muted); font-size: 13px; }
.footer-brand { font-weight: 700; color: var(--text); }
.footer-note { margin-top: 4px; }

/* 联系我们 */
.contact-card { text-align: center; }
.contact-img { margin: 0 auto 12px; max-width: 320px; }
.contact-img img { width: 100%; height: auto; border-radius: 8px; }

/* 订单 */
.order-body { display: flex; gap: 12px; margin-top: 8px; }
.order-img { width: 80px; height: 80px; flex-shrink: 0; overflow: hidden; border-radius: 8px; background: #f0f2f5; }
.order-img img { width: 100%; height: 100%; object-fit: cover; }
.order-info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.order-price { color: var(--danger); font-weight: 700; font-size: 15px; }
