/* ========== 卡密商城 全局样式 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f4f6fb;
  color: #1f2733;
  line-height: 1.6;
}
a { color: #4f6ef7; text-decoration: none; }
code { background: #eef1f8; padding: 2px 6px; border-radius: 4px; font-size: 13px; word-break: break-all; }
.wrap { max-width: 980px; margin: 0 auto; padding: 20px 16px 60px; }

/* ---------- 前台头部 ---------- */
.site-header { text-align: center; padding: 40px 0 28px; }
.site-header h1 { font-size: 30px; color: #2b3a67; letter-spacing: 1px; }
.site-header .sub { color: #8a94a6; margin-top: 8px; }

/* ---------- 商品卡片 ---------- */
.goods-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.goods-card {
  display: block; background: #fff; border-radius: 14px; padding: 22px;
  box-shadow: 0 2px 12px rgba(31,45,87,.06);
  transition: transform .15s, box-shadow .15s;
}
.goods-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(31,45,87,.12); }
.goods-name { font-size: 16px; font-weight: 600; color: #1f2733; }
.goods-price { font-size: 26px; font-weight: 700; color: #ff4d4f; margin: 10px 0 6px; }
.goods-price::before { content: '¥'; font-size: 16px; }
.goods-stock { color: #8a94a6; font-size: 13px; }
.goods-btn {
  display: block; text-align: center; margin-top: 14px; padding: 10px;
  background: linear-gradient(135deg,#4f6ef7,#6a5cf0); color: #fff; border-radius: 8px;
  font-weight: 600;
}

/* ---------- 详情页 ---------- */
.back { display: inline-block; margin-bottom: 16px; color: #4f6ef7; }
.detail { background: #fff; border-radius: 14px; padding: 28px; box-shadow: 0 2px 12px rgba(31,45,87,.06); }
.detail h1 { font-size: 22px; }
.detail-price { font-size: 32px; font-weight: 700; color: #ff4d4f; margin: 14px 0 6px; }
.detail-stock { color: #8a94a6; font-size: 14px; margin-bottom: 14px; }
.detail-intro { background: #f7f8fc; border-radius: 8px; padding: 14px; margin-bottom: 20px; font-size: 14px; color: #4a5568; white-space: pre-wrap; }
.pay-methods { display: flex; gap: 12px; margin-bottom: 16px; }
.method {
  flex: 1; padding: 12px; border-radius: 10px; border: 2px solid #dfe3ee; background: #fff;
  font-size: 15px; font-weight: 600; cursor: pointer; color: #4a5568;
}
.method.active { border-color: #4f6ef7; color: #4f6ef7; background: #f0f3ff; }
.method-alipay.active { border-color: #1677ff; color: #1677ff; background: #f0f7ff; }
.method-wxpay.active { border-color: #07c160; color: #07c160; background: #f0fbf5; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block; border: none; cursor: pointer; border-radius: 8px;
  padding: 10px 18px; background: #4f6ef7; color: #fff; font-size: 14px; font-weight: 600;
}
.btn:hover { opacity: .9; }
.btn-big { width: 100%; padding: 13px; font-size: 16px; }
.btn-plain { background: #eef1f8; color: #3a4563; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-danger { background: #ff4d4f; }
.btn.active { background: #2b3a99; }

/* ---------- 支付跳转页 ---------- */
.pay-page { text-align: center; padding-top: 80px; }
.pay-page h2 { margin-bottom: 12px; }
.pay-page p { color: #8a94a6; margin-bottom: 8px; }

/* ---------- 结果页 ---------- */
.result-page { text-align: center; padding-top: 60px; }
.result-icon {
  width: 72px; height: 72px; line-height: 72px; border-radius: 50%; margin: 0 auto 18px;
  font-size: 34px; color: #fff; text-align: center;
}
.result-icon.ok { background: #07c160; }
.result-icon.waiting { background: #f5a623; }
.result-icon.fail { background: #ff4d4f; }
.result-page h1 { margin-bottom: 14px; }
.card-box {
  max-width: 420px; margin: 26px auto; background: #0f1222; color: #7cffb2;
  border-radius: 12px; padding: 20px; font-family: Menlo, Consolas, monospace;
}
.card-label { color: #7c8db5; font-size: 12px; margin-bottom: 8px; }
.card-content { font-size: 17px; word-break: break-all; margin-bottom: 14px; min-height: 24px; }
.tip { color: #8a94a6; font-size: 13px; margin: 12px 0; }
.empty { color: #8a94a6; text-align: center; padding: 30px 0; }
.site-footer { text-align: center; color: #aab3c5; font-size: 13px; margin-top: 40px; }

/* ---------- 后台 ---------- */
.admin-wrap { display: flex; min-height: 100vh; }
.admin-side {
  width: 200px; background: #141a33; color: #fff; padding: 22px 0; flex-shrink: 0;
}
.admin-side h2 { font-size: 18px; padding: 0 20px 18px; border-bottom: 1px solid #242c4d; }
.admin-side nav a {
  display: block; padding: 12px 20px; color: #9aa3c2; font-size: 14px; border-left: 3px solid transparent;
}
.admin-side nav a:hover { color: #fff; background: #1c2342; }
.admin-main { flex: 1; padding: 26px 30px; overflow-x: auto; }
.admin-main h1 { font-size: 22px; margin-bottom: 18px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 14px; margin-bottom: 24px; }
.stat { background: #fff; border-radius: 12px; padding: 18px; text-align: center; box-shadow: 0 2px 10px rgba(31,45,87,.05); }
.stat .num { font-size: 24px; font-weight: 700; color: #2f3a66; }
.stat div:last-child { color: #8a94a6; font-size: 13px; margin-top: 4px; }

.panel { background: #fff; border-radius: 12px; padding: 20px; margin-bottom: 20px; box-shadow: 0 2px 8px rgba(20,45,87,.05); }
.panel h3 { margin-bottom: 14px; font-size: 16px; color: #2f3a66; }
.panel h3 small { color: #8a94a6; font-weight: normal; font-size: 12px; }
.panel p { margin-bottom: 8px; font-size: 14px; color: #4a5568; }
.panel .tip { color: #8a94a6; font-size: 12px; }

.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(20,45,87,.05); }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid #eef1f8; text-align: left; font-size: 13px; vertical-align: middle; }
.table th { background: #f7f8fc; color: #4a5568; font-weight: 600; }
.table tr:hover { background: #fafbff; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 20px; background: #eef1f8; color: #4a5568; font-size: 12px; }
.tag.paid { background: #e6f9ef; color: #07a15a; }

.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.inline-form input, .inline-form select, .inline-form textarea { flex: 1; min-width: 140px; }
.form label { display: block; margin-bottom: 14px; font-size: 14px; color: #4a5568; }
.form input { display: block; width: 100%; margin-top: 6px; }

input, select, textarea {
  padding: 9px 12px; border: 1px solid #dfe3ee; border-radius: 8px; font-size: 14px;
  background: #fff; color: #1f2733; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: #4f6ef7; }
textarea { width: 100%; font-family: Menlo, Consolas, monospace; font-size: 13px; }
.import-form textarea { margin: 10px 0; }
.row-input { padding: 6px 8px; min-width: 120px; }
.msg { background: #e6f9ef; color: #0a7a4a; border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; font-size: 14px; }

/* ---------- 登录页 ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box { background: #fff; border-radius: 16px; padding: 40px; width: 340px; box-shadow: 0 8px 30px rgba(20,45,87,.1); }
.login-box h1 { font-size: 22px; text-align: center; margin-bottom: 24px; color: #2f3a66; }
.login-box input { width: 100%; margin-bottom: 12px; }
.login-err { color: #ff4d4f; text-align: center; font-size: 13px; margin-bottom: 10px; }

/* ---------- 移动端适配 ---------- */
@media (max-width: 720px) {
  .admin-wrap { flex-direction: column; }
  .admin-side { width: 100%; }
  .admin-side nav a { display: inline-block; border-left: none; padding: 10px 12px; }
  .admin-main { padding: 16px; }
  .goods-grid { grid-template-columns: 1fr 1fr; }
}