/* 卡密与积分管理系统 样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --primary: #4a6cf7;
  --primary-d: #3b5bdb;
  --text: #2d3748;
  --muted: #718096;
  --border: #e2e8f0;
  --green: #38a169;
  --red: #e53e3e;
  --orange: #dd6b20;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
}
body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }

/* ===== 登录页 ===== */
.login-page {
  color: #fff; overflow: hidden; position: relative;
  background: #0b1020 url("../img/login-bg.jpg") no-repeat center center / cover fixed;
}
/* 背景图之上的暗色遮罩，确保文字可读 */
.login-page::before {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at 25% 30%, rgba(11,16,32,.55) 0%, rgba(11,16,32,.82) 60%, rgba(11,16,32,.92) 100%),
    linear-gradient(135deg, rgba(91,124,250,.18), rgba(122,77,216,.18));
}
.login-stage { position: relative; z-index: 2; min-height: 100vh; display: flex; }

/* 背景装饰光晕（保留作为氛围层） */
.bg-decor { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }
.bg-decor .blob { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .35; }
.bg-decor .blob-1 { width: 520px; height: 520px; background: #5b7cfa; top: -120px; left: -120px; animation: float1 14s ease-in-out infinite; }
.bg-decor .blob-2 { width: 460px; height: 460px; background: #7a4dd8; bottom: -140px; right: 8%; animation: float2 18s ease-in-out infinite; }
.bg-decor .blob-3 { width: 380px; height: 380px; background: #1f9d8f; top: 40%; left: 38%; animation: float3 22s ease-in-out infinite; }
.bg-decor .grid-mask {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
          mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
}
@keyframes float1 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(60px,40px)} }
@keyframes float2 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(-50px,-60px)} }
@keyframes float3 { 0%,100%{transform:translate(0,0) scale(1)} 50%{transform:translate(40px,-30px) scale(1.08)} }

/* 左侧品牌区 */
.brand-panel {
  position: relative; z-index: 1;
  flex: 1.15; display: flex; align-items: center; justify-content: center;
  padding: 60px; color: #fff;
}
.brand-inner { max-width: 480px; width: 100%; }
.brand-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 56px; }
.brand-logo .logo-mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg,#5b7cfa,#7a4dd8);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 22px; color: #fff;
  box-shadow: 0 8px 24px rgba(91,124,250,.45);
}
.brand-logo .logo-text { font-size: 16px; font-weight: 500; letter-spacing: 1px; color: rgba(255,255,255,.85); }
.brand-title { font-size: 42px; line-height: 1.25; font-weight: 700; margin-bottom: 20px; letter-spacing: .5px;
  background: linear-gradient(120deg,#fff 30%,#b9c6ff); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.brand-desc { color: rgba(255,255,255,.7); line-height: 1.8; font-size: 15px; margin-bottom: 36px; max-width: 420px; }
.brand-feats { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 14px 22px; margin-bottom: 48px; }
.brand-feats li { display: flex; align-items: center; gap: 10px; font-size: 14px; color: rgba(255,255,255,.78); }
.brand-feats .dot { width: 8px; height: 8px; border-radius: 50%; background: #5b7cfa; box-shadow: 0 0 12px #5b7cfa; flex-shrink: 0; }
.brand-footer { color: rgba(255,255,255,.45); font-size: 12px; letter-spacing: .3px; }

/* 右侧表单区 */
.form-panel {
  position: relative; z-index: 1;
  flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px;
  overflow-y: auto; max-height: 100vh;
}
.login-card {
  width: 100%; max-width: 420px;
  background: rgba(255,255,255,.04);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px; padding: 44px 40px;
  box-shadow: 0 30px 80px rgba(0,0,0,.45);
  animation: cardIn .6s cubic-bezier(.2,.8,.2,1);
}
@keyframes cardIn { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:translateY(0)} }

.login-head { text-align: center; margin-bottom: 28px; }
.login-head .head-icon {
  width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg,#5b7cfa,#7a4dd8); color: #fff;
  box-shadow: 0 12px 28px rgba(91,124,250,.45);
}
.login-head h2 { font-size: 24px; font-weight: 600; color: #fff; margin-bottom: 6px; }
.login-head .head-sub { color: rgba(255,255,255,.55); font-size: 13px; }

.login-alert {
  display: flex; align-items: center; gap: 8px;
  background: rgba(229,62,62,.12); border: 1px solid rgba(229,62,62,.35);
  color: #ffb4b4; padding: 10px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 18px;
}
.login-alert.login-ok {
  background: rgba(56,161,105,.14); border-color: rgba(56,161,105,.4); color: #a7e8c5;
}
.login-alert svg { flex-shrink: 0; }
.login-form .req { color: #ff8a8a; margin-left: 2px; }
.login-form .opt { color: rgba(255,255,255,.45); font-size: 11px; margin-left: 4px; padding: 1px 6px; border: 1px solid rgba(255,255,255,.2); border-radius: 4px; font-weight: 400; }
.input-wrap.input-with-btn input { padding-right: 120px; }
.input-wrap .btn-code {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: rgba(91,124,250,.16); color: #b9c6ff; border: 1px solid rgba(91,124,250,.3);
  padding: 6px 12px; border-radius: 8px; font-size: 12px; cursor: pointer; white-space: nowrap;
  transition: all .2s;
}
.input-wrap .btn-code:hover:not(:disabled) { background: rgba(91,124,250,.28); color: #fff; }
.input-wrap .btn-code:disabled { opacity: .6; cursor: not-allowed; }

.login-form .field { margin-bottom: 18px; }
.login-form label { display: block; font-size: 13px; color: rgba(255,255,255,.7); margin-bottom: 8px; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .input-icon {
  position: absolute; left: 14px; color: rgba(255,255,255,.4); display: flex; pointer-events: none;
  transition: color .2s;
}
.input-wrap input {
  width: 100%; padding: 13px 14px 13px 44px;
  background: rgba(255,255,255,.06); color: #fff;
  border: 1px solid rgba(255,255,255,.12); border-radius: 10px; font-size: 14px;
  transition: all .2s;
}
.input-wrap input::placeholder { color: rgba(255,255,255,.35); }
.input-wrap input:focus {
  outline: none; border-color: #5b7cfa; background: rgba(91,124,250,.08);
  box-shadow: 0 0 0 4px rgba(91,124,250,.15);
}
.input-wrap input:focus ~ .input-icon,
.input-wrap:focus-within .input-icon { color: #8aa6ff; }
.toggle-pwd {
  position: absolute; right: 12px; background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,.4); display: flex; padding: 4px; transition: color .2s;
}
.toggle-pwd:hover { color: #fff; }

.form-row { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 24px; }
.remember { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: rgba(255,255,255,.7); user-select: none; }
.remember input { position: absolute; opacity: 0; width: 0; height: 0; }
.remember .check-box {
  width: 16px; height: 16px; border-radius: 4px;
  border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.05);
  display: inline-flex; align-items: center; justify-content: center; transition: all .2s; flex-shrink: 0;
}
.remember input:checked + .check-box { background: #5b7cfa; border-color: #5b7cfa; }
.remember input:checked + .check-box::after {
  content: ''; width: 4px; height: 8px; border: 2px solid #fff; border-top: 0; border-left: 0; transform: rotate(45deg) translate(-1px,-1px);
}
.link { color: #8aa6ff; font-size: 13px; text-decoration: none; transition: color .2s; }
.link:hover { color: #b9c6ff; text-decoration: underline; }

.btn-login {
  width: 100%; padding: 14px; border: none; border-radius: 10px; cursor: pointer;
  background: linear-gradient(135deg,#5b7cfa,#7a4dd8); color: #fff; font-size: 15px; font-weight: 500;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 10px 24px rgba(91,124,250,.4);
  transition: transform .15s, box-shadow .2s, opacity .2s; letter-spacing: 1px;
}
.btn-login:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(91,124,250,.55); }
.btn-login:active { transform: translateY(0); opacity: .92; }

.form-foot { text-align: center; margin-top: 22px; font-size: 13px; color: rgba(255,255,255,.55); }

/* 响应式 */
@media (max-width: 960px) {
  .login-stage { flex-direction: column; }
  .brand-panel { flex: none; padding: 40px 24px 20px; }
  .brand-logo { margin-bottom: 24px; }
  .brand-title { font-size: 30px; margin-bottom: 14px; }
  .brand-desc { font-size: 14px; margin-bottom: 22px; }
  .brand-feats { margin-bottom: 8px; grid-template-columns: 1fr; gap: 10px; }
  .brand-footer { display: none; }
  .form-panel { padding: 24px; flex: 1; }
  .login-card { padding: 32px 24px; max-width: 100%; }
}
@media (max-width: 480px) {
  .brand-title { font-size: 26px; }
  .login-card { border-radius: 16px; padding: 28px 20px; }
}

/* ===== 后台布局 ===== */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: #2c3e50; color: #cbd5e0; flex-shrink: 0; }
.sidebar .brand { padding: 20px; font-size: 16px; font-weight: 600; color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .menu { padding: 12px 0; }
.sidebar .menu a { display: block; padding: 11px 20px; color: #cbd5e0; text-decoration: none; }
.sidebar .menu a:hover, .sidebar .menu a.active { background: rgba(255,255,255,.08); color: #fff; border-left: 3px solid var(--primary); padding-left: 17px; }
.main { flex: 1; display: flex; flex-direction: column; }
.topbar { background: var(--card); padding: 0 24px; height: 56px; display: flex; align-items: center; justify-content: space-between; box-shadow: var(--shadow); }
.topbar .points { background: #ebf4ff; color: var(--primary); padding: 5px 14px; border-radius: 20px; font-weight: 600; }
.topbar .user { color: var(--muted); }
.topbar .logout { color: var(--red); text-decoration: none; margin-left: 12px; }
.content { padding: 24px; flex: 1; }

/* ===== 通用组件 ===== */
.card { background: var(--card); border-radius: 8px; box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
input, select { padding: 7px 10px; border: 1px solid var(--border); border-radius: 5px; font-size: 13px; background: #fff; }
input:focus, select:focus { outline: none; border-color: var(--primary); }
.btn { padding: 8px 16px; border: none; border-radius: 5px; cursor: pointer; font-size: 13px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); }
.btn-ghost { background: #edf2f7; color: var(--text); }
.btn-ghost:hover { background: #e2e8f0; }
.btn-danger { background: var(--red); color: #fff; }
.btn-success { background: var(--green); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; background: #f7fafc; }
tr:hover { background: #f7fafc; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 12px; }
.tag-unused { background: #e6fffa; color: #2c7a7b; }
.tag-used { background: #ebf4ff; color: #2b6cb0; }
.tag-void { background: #fff5f5; color: #c53030; }
.tag-expired { background: #fffaf0; color: #c05621; }
.tag-active { background: #e6fffa; color: #2c7a7b; }
.tag-disabled { background: #fff5f5; color: #c53030; }
.tag-deleted { background: #edf2f7; color: #718096; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card { background: var(--card); border-radius: 8px; padding: 18px; box-shadow: var(--shadow); }
.stat-card .num { font-size: 26px; font-weight: 700; color: var(--primary); }
.stat-card .lbl { color: var(--muted); margin-top: 4px; }
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 16px; align-items: center; }
.pagination .btn { min-width: 32px; }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: var(--card); border-radius: 8px; padding: 24px; width: 480px; max-height: 80vh; overflow: auto; }
.modal h3 { margin-bottom: 16px; }
.form-row { margin-bottom: 12px; }
.form-row label { display: block; margin-bottom: 4px; color: var(--muted); }
.form-row input, .form-row select { width: 100%; }
.msg { padding: 8px 12px; border-radius: 5px; margin-bottom: 12px; }
.msg-ok { background: #f0fff4; color: #2f855a; }
.msg-err { background: #fff5f5; color: #c53030; }
.hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.empty { text-align: center; padding: 30px; color: var(--muted); }
