/* ============================================================
   剪映卡密系统 样式表（前台 + 后台）
   ============================================================ */
:root {
  --pink: #ec4899;
  --pink-deep: #be185d;
  --purple: #8b5cf6;
  --grad: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
  --ink: #1f2937;
  --gray: #6b7280;
  --line: #e5e7eb;
  --bg-soft: #f7f8fb;
  --blue: #3b82f6;
  --green: #10b981;
  --red: #ef4444;
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--ink); font-size: 14px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
a { color: var(--pink-deep); text-decoration: none; }

/* ---------- 通用 ---------- */
.input, .textarea, select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 14px; outline: none; background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .textarea:focus, select:focus {
  border-color: var(--pink); box-shadow: 0 0 0 3px rgba(236, 72, 153, .12);
}
.textarea { resize: vertical; font-family: inherit; line-height: 1.7; }
.input-sm { width: auto; }
.form-label { display: block; font-weight: 600; color: #374151; margin: 6px 0 7px; font-size: 13px; }
.btn-primary {
  width: 100%; margin-top: 20px; padding: 13px; border: none; border-radius: 11px;
  background: var(--grad); color: #fff; font-size: 15px; font-weight: 600;
  box-shadow: 0 8px 20px rgba(236, 72, 153, .28); transition: transform .12s, box-shadow .12s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(236, 72, 153, .36); }
.btn-primary:active { transform: translateY(0); }
.btn-small {
  padding: 9px 16px; border: none; border-radius: 9px; background: var(--grad);
  color: #fff; font-weight: 600; font-size: 13px; display: inline-block;
}
.btn-small.ghost { background: #fff; color: var(--pink-deep); border: 1px solid #f9a8d4; }
.btn-small.danger { background: #fff; color: var(--red); border: 1px solid #fecaca; }
.alert { padding: 11px 15px; border-radius: 10px; margin-bottom: 16px; font-size: 13px; }
.alert-ok { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.alert-bad { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.muted { color: #9ca3af; }
.small { font-size: 12px; }
.tip { color: var(--gray); background: #fdf2f8; border: 1px solid #fce7f3;
       border-radius: 10px; padding: 11px 14px; margin-bottom: 18px; font-size: 13px; }
.panel { background: #fff; border-radius: var(--radius); padding: 24px;
         box-shadow: 0 4px 18px rgba(17, 24, 39, .05); border: 1px solid #f3f4f6; }
.row2 { display: flex; gap: 14px; } .row2 > div { flex: 1; }

/* ---------- 登录页 ---------- */
.login-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: linear-gradient(135deg, #fce7f3 0%, #ede9fe 55%, #e0f2fe 100%);
}
.login-card {
  width: 100%; max-width: 400px; background: #fff; border-radius: 20px; padding: 40px 34px;
  box-shadow: 0 24px 60px rgba(190, 120, 160, .22);
}
.login-logo { text-align: center; font-size: 22px; font-weight: 700; color: var(--pink-deep); }
.login-sub { text-align: center; color: #9ca3af; font-size: 13px; margin: 6px 0 28px; }
.login-card label { display: block; font-size: 13px; color: #4b5563; margin: 16px 0 6px; }
.login-card input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 14px; outline: none;
}
.login-card input:focus { border-color: var(--pink); }

/* ---------- 后台布局 ---------- */
.admin-body { background: var(--bg-soft); }
.admin-wrap { display: flex; min-height: 100vh; }
.sidebar {
  width: 224px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 22px 14px; position: sticky; top: 0; height: 100vh;
}
.brand { font-size: 18px; font-weight: 700; color: var(--pink-deep); padding: 0 12px 22px; }
.brand span { display: block; font-size: 12px; color: #9ca3af; font-weight: 400; margin-top: 2px; }
.sidebar nav { flex: 1; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 10px;
  color: #4b5563; font-size: 14px; margin-bottom: 4px; transition: background .12s;
}
.sidebar nav a:hover { background: #fdf2f8; }
.sidebar nav a.active { background: var(--grad); color: #fff; font-weight: 600;
  box-shadow: 0 6px 16px rgba(236, 72, 153, .25); }
.sidebar .ico { font-size: 16px; }
.side-foot { border-top: 1px solid var(--line); padding-top: 14px; }
.admin-name { font-size: 13px; color: var(--gray); padding: 0 12px 10px; }
.logout-btn { width: 100%; padding: 9px; border: 1px solid var(--line); background: #fff;
              border-radius: 9px; color: #6b7280; font-size: 13px; }
.logout-btn:hover { border-color: #fca5a5; color: var(--red); }
.main { flex: 1; padding: 28px 32px; min-width: 0; }
.page-h1 { font-size: 21px; font-weight: 700; margin-bottom: 20px; }
.page-h2 { font-size: 16px; margin: 26px 0 14px; }

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.stat-card { background: #fff; border-radius: var(--radius); padding: 20px;
             border: 1px solid #f3f4f6; box-shadow: 0 4px 14px rgba(17,24,39,.04); }
.stat-card .num { font-size: 27px; font-weight: 700; }
.stat-card .lbl { color: var(--gray); font-size: 13px; margin-top: 4px; }
.stat-card.c1 .num { color: var(--pink); } .stat-card.c2 .num { color: var(--blue); }
.stat-card.c3 .num { color: var(--green); } .stat-card.c4 .num { color: #9ca3af; }
.stat-card.c5 .num { color: #f59e0b; } .stat-card.c6 .num { color: var(--purple); }

/* 筛选栏 */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.filter-bar .input { width: auto; flex: 1; min-width: 160px; }

/* 表格 */
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td {
  padding: 12px 10px; text-align: left; border-bottom: 1px solid #f3f4f6; vertical-align: middle;
}
.data-table th { color: #6b7280; font-weight: 600; white-space: nowrap; background: #fafafa; }
.data-table tbody tr:hover { background: #fefbff; }
.data-table .empty { text-align: center; color: #9ca3af; padding: 36px; }
.card-no-cell { font-weight: 700; letter-spacing: .5px; white-space: nowrap; }
.cmd-cell { max-width: 260px; }
.cmd-text { color: #374151; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.url-link { font-size: 12px; color: var(--blue); word-break: break-all; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.st0 { background: #eff6ff; color: #2563eb; }
.st1 { background: #ecfdf5; color: #059669; }
.st2 { background: #f3f4f6; color: #6b7280; }
.link-btn { background: none; border: none; color: var(--pink-deep); font-size: 12px; padding: 2px 4px; }
.link-btn:hover { text-decoration: underline; }
.danger-text { color: var(--red); }
.ops { white-space: nowrap; }
.batch-actions { margin-top: 14px; display: flex; gap: 14px; align-items: center; }
.pagination { margin-top: 18px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pagination a { padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.pagination a.cur { background: var(--grad); color: #fff; border-color: transparent; }

/* 生成卡密行内表单 */
.gen-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.gen-row .input { flex: 1; min-width: 130px; width: auto; }
.gen-row .btn-small { padding: 11px 22px; }

/* 备注内联输入 */
.remark-form { margin: 0; }
.remark-input { padding: 6px 9px !important; font-size: 12px !important; width: 96px !important;
                border-radius: 7px !important; text-align: left !important; }

/* 卡密类型徽章 */
.type-badge { display: inline-block; padding: 3px 11px; border-radius: 20px;
              font-size: 12px; font-weight: 600; white-space: nowrap; }
.t-day { background: #fff7ed; color: #ea580c; }
.t-week { background: #eff6ff; color: #2563eb; }
.t-month { background: #f5f3ff; color: #7c3aed; }

/* 名额（已用/上限） */
.quota-full { color: var(--red); }
.max-form { display: inline; margin: 0 4px; }
.max-form .remark-input { width: 64px !important; }

/* ============================================================
   前台激活页
   ============================================================ */
.front-body {
  min-height: 100vh; padding: 28px 18px;
  background: linear-gradient(160deg, #fff1f7 0%, #f5f0ff 48%, #eef6ff 100%);
  display: flex; align-items: flex-start; justify-content: center;
}
.front-deco { position: fixed; pointer-events: none; font-size: 120px; opacity: .08; }
.front-deco.d1 { top: -20px; left: -24px; }
.front-deco.d2 { bottom: -30px; right: -16px; }
.front-card {
  width: 100%; max-width: 460px; background: rgba(255,255,255,.92); backdrop-filter: blur(6px);
  border-radius: 22px; padding: 34px 28px; margin-top: 6vh;
  box-shadow: 0 24px 60px rgba(190, 120, 160, .2); border: 1px solid rgba(255,255,255,.8);
}
.front-badge {
  width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 18px;
  background: var(--grad); display: flex; align-items: center; justify-content: center;
  font-size: 30px; box-shadow: 0 10px 24px rgba(236,72,153,.32);
}
.front-title { text-align: center; font-size: 21px; font-weight: 700; color: var(--pink-deep); }
.front-notice { text-align: center; color: var(--gray); font-size: 13px; margin: 10px 0 24px; line-height: 1.8; }
.activate-form input {
  width: 100%; padding: 15px 16px; font-size: 16px; letter-spacing: 1px;
  border: 1.5px solid #f0d5e6; border-radius: 12px; text-align: center; font-weight: 600;
}
.activate-form input:focus { border-color: var(--pink); box-shadow: 0 0 0 4px rgba(236,72,153,.12); }
.front-msg { margin-top: 14px; font-size: 13px; border-radius: 10px; padding: 10px 14px; display: none; }
.front-msg.show { display: block; }
.front-msg.err { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.front-msg.ok { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }

/* 步骤条 */
.steps { display: flex; justify-content: space-between; margin: 22px 0 4px; }
.step { flex: 1; text-align: center; font-size: 12px; color: #b0b4bd; position: relative; }
.step .dot {
  width: 26px; height: 26px; border-radius: 50%; background: #f1f2f5; color: #9ca3af;
  line-height: 26px; margin: 0 auto 6px; font-weight: 700; font-size: 13px;
}
.step.on .dot { background: var(--grad); color: #fff; }
.step.on { color: var(--pink-deep); font-weight: 600; }
.step:not(:last-child)::after {
  content: ''; position: absolute; top: 13px; left: calc(50% + 18px); right: calc(-50% + 18px);
  height: 2px; background: #f1f2f5;
}

/* 激活结果 */
.result-box { display: none; margin-top: 22px; }
.result-box.show { display: block; animation: fadeUp .35s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.result-tip { font-size: 13px; color: #047857; background: #ecfdf5; border: 1px solid #a7f3d0;
              border-radius: 10px; padding: 10px 13px; margin-bottom: 14px; }

/* 卡密信息区 */
.info-box { background: #fafafa; border: 1px solid #f1f1f4; border-radius: 12px;
            padding: 4px 14px; margin-bottom: 16px; }
.info-row { display: flex; justify-content: space-between; align-items: center;
            padding: 9px 0; font-size: 13px; border-bottom: 1px solid #f1f1f4; gap: 12px; }
.info-row:last-child { border-bottom: none; }
.info-row span { color: #9ca3af; flex-shrink: 0; }
.info-row b { color: #374151; font-weight: 600; text-align: right; word-break: break-all; }
.command-box {
  background: #fdf2f8; border: 1px dashed #f9a8d4; border-radius: 12px;
  padding: 14px; font-size: 13px; color: #831843; line-height: 1.8;
  word-break: break-all; max-height: 150px; overflow-y: auto; user-select: all;
}
.action-btns { display: flex; gap: 10px; margin-top: 16px; }
.action-btns button, .action-btns a {
  flex: 1; text-align: center; padding: 13px 8px; border-radius: 11px; font-weight: 600; font-size: 14px;
}
.btn-open { background: var(--grad); color: #fff; border: none;
            box-shadow: 0 8px 20px rgba(236,72,153,.28); }
.btn-copy { background: #fff; color: var(--pink-deep); border: 1.5px solid #f9a8d4; }
.auto-jump { font-size: 12px; color: #9ca3af; text-align: center; margin-top: 12px; }
.auto-jump a { color: var(--pink-deep); }
.front-footer { text-align: center; color: #b6b9c0; font-size: 12px; margin-top: 26px; line-height: 1.8; }

/* loading */
.spinner { display: inline-block; width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.5);
           border-top-color: #fff; border-radius: 50%; vertical-align: -2px; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 响应式 */
@media (max-width: 860px) {
  .sidebar { width: 68px; padding: 18px 10px; }
  .brand { font-size: 0; padding: 0 0 18px; } .brand span { display: none; }
  .sidebar nav a span.ico { font-size: 20px; }
  .sidebar nav a { justify-content: center; padding: 12px; }
  .sidebar nav a:not(.active) { color: #4b5563; }
  .admin-name, .logout-btn { display: none; }
  .main { padding: 20px 14px; }
}
@media (max-width: 560px) {
  .sidebar { display: none; }
  .row2 { flex-direction: column; gap: 0; }
  .front-card { padding: 28px 20px; }
}
