/* ============================================
   冰蓝星碎 - 蓝色主题样式
   用户端 + 管理端通用
   ============================================ */
:root {
  --primary: #2563eb;
  --primary-light: #3b82f6;
  --primary-dark: #1d4ed8;
  --gradient: linear-gradient(90deg, #2563eb, #3b82f6);
  --gradient-soft: linear-gradient(135deg, #60a5fa, #2563eb);
  --bg-deep: #0b1c3f;
  --bg-mid: #123a7a;
  --bg-light: #eef4ff;
  --text: #1e293b;
  --text-sub: #64748b;
  --border: #e2e8f0;
  --danger: #ef4444;
  --success: #10b981;
  --warn: #f59e0b;
  --radius: 12px;
  --shadow: 0 8px 30px rgba(2, 12, 40, .12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1000px 500px at 85% -10%, rgba(96, 165, 250, .35), transparent 60%),
    radial-gradient(800px 400px at -10% 110%, rgba(37, 99, 235, .4), transparent 60%),
    linear-gradient(160deg, var(--bg-deep) 0%, var(--bg-mid) 55%, #1e5bb8 100%);
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { text-decoration: none; color: inherit; }
ul, ol { list-style: none; }

/* ---------- 顶部导航 ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 28, 63, .82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.navbar-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 16px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 1px;
}
.brand .logo {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--gradient-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  box-shadow: 0 4px 14px rgba(59, 130, 246, .5);
}
.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-links a, .nav-links span.btn {
  color: #dbeafe;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 14px;
  transition: background .2s;
  display: inline-flex; align-items: center; gap: 6px;
}
.nav-links a:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.nav-links a.active { background: var(--gradient); color: #fff; }
.nav-links .badge {
  font-size: 12px;
  color: #fff;
  background: rgba(255,255,255,.15);
  padding: 4px 10px;
  border-radius: 999px;
}
.nav-links .badge.danger { background: rgba(239, 68, 68, .85); }
.nav-links .badge.ok { background: rgba(16, 185, 129, .85); }

/* ---------- 主内容 ---------- */
.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 16px 60px;
  width: 100%;
  flex: 1;
}

/* ---------- Hero 搜索区 ---------- */
.hero {
  text-align: center;
  padding: 34px 0 10px;
}
.hero h1 {
  color: #fff;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 2px;
  text-shadow: 0 4px 24px rgba(0,0,0,.3);
}
.hero h1 span { background: linear-gradient(90deg,#93c5fd,#bfdbfe); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero p { color: rgba(219, 234, 254, .85); margin-top: 8px; font-size: 14px; }

.search-box {
  margin: 22px auto 0;
  max-width: 640px;
  display: flex;
  gap: 10px;
  background: rgba(255, 255, 255, .98);
  border-radius: 999px;
  padding: 7px 7px 7px 22px;
  box-shadow: var(--shadow);
}
.search-box input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  background: transparent;
  color: var(--text);
}
.search-box button {
  border: none;
  background: var(--gradient);
  color: #fff;
  padding: 12px 28px;
  border-radius: 999px;
  font-size: 15px;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  box-shadow: 0 4px 14px rgba(37, 99, 235, .4);
}
.search-box button:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(37, 99, 235, .5); }
.search-box button:disabled { opacity: .6; cursor: not-allowed; transform: none; }

/* 未登录 / 已过期 提示卡片 */
.gate-card {
  max-width: 640px;
  margin: 26px auto 0;
  background: rgba(255, 255, 255, .97);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  box-shadow: var(--shadow);
}
.gate-card .icon { font-size: 40px; }
.gate-card h3 { margin: 10px 0 6px; font-size: 18px; color: var(--text); }
.gate-card p { color: var(--text-sub); font-size: 14px; line-height: 1.8; }
.gate-card .actions { margin-top: 18px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 9px;
  padding: 10px 22px;
  font-size: 14px;
  cursor: pointer;
  transition: all .15s;
}
.btn-blue { background: var(--gradient); color: #fff; box-shadow: 0 4px 12px rgba(37,99,235,.35); }
.btn-blue:hover { opacity: .92; transform: translateY(-1px); }
.btn-ghost { background: transparent; color: #dbeafe; border: 1px solid rgba(255,255,255,.4); }
.btn-ghost:hover { background: rgba(255,255,255,.12); color:#fff; }
.btn-line { background: #fff; color: var(--primary); border: 1px solid var(--primary-light); }
.btn-line:hover { background: var(--bg-light); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .9; }
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- 搜索结果 ---------- */
.results { margin-top: 24px; }
.result-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255, 255, 255, .97);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: 0 3px 12px rgba(2, 12, 40, .08);
  transition: transform .15s, box-shadow .15s;
  animation: fadeUp .3s ease both;
}
.result-item:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.file-icon {
  width: 44px; height: 44px;
  border-radius: 11px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  background: var(--bg-light);
  color: var(--primary);
}
.file-info { flex: 1; min-width: 0; }
.file-name {
  font-size: 15px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.file-meta { margin-top: 4px; font-size: 12px; color: var(--text-sub); display: flex; gap: 12px; flex-wrap: wrap; }
.dl-btn {
  flex-shrink: 0;
  background: var(--gradient);
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: 9px;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(37, 99, 235, .35);
  transition: all .15s;
}
.dl-btn:hover { opacity: .9; transform: translateY(-1px); }
.dl-btn.loading { opacity: .6; pointer-events: none; }

/* 结果统计 */
.result-meta { color: rgba(219,234,254,.9); font-size: 13px; margin-bottom: 12px; }
.result-meta b { color: #fff; }

/* 空状态 */
.empty {
  text-align: center;
  color: rgba(219, 234, 254, .8);
  padding: 40px 0;
  font-size: 14px;
}
.empty .big { font-size: 40px; margin-bottom: 10px; }

/* ---------- 表单卡片(登录/注册/用户中心) ---------- */
.auth-wrap {
  max-width: 420px;
  margin: 30px auto;
  background: rgba(255, 255, 255, .97);
  border-radius: 16px;
  padding: 34px 32px;
  box-shadow: var(--shadow);
}
.auth-wrap h2 { font-size: 20px; color: var(--text); text-align: center; margin-bottom: 4px; }
.auth-wrap .sub { text-align: center; color: var(--text-sub); font-size: 13px; margin-bottom: 20px; }
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; color: var(--text-sub); margin-bottom: 6px; }
.field input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 14px;
  outline: none;
  transition: border .15s, box-shadow .15s;
  background: #f8fafc;
}
.field input:focus { border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(59,130,246,.15); background: #fff; }
.auth-foot { text-align: center; margin-top: 16px; font-size: 13px; color: var(--text-sub); }
.auth-foot a { color: var(--primary); font-weight: 600; }
.alert { border-radius: 9px; padding: 10px 14px; margin-bottom: 16px; font-size: 13px; line-height: 1.7; }
.alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-success { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.alert-info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* ---------- 用户中心 ---------- */
.center-card {
  background: rgba(255, 255, 255, .97);
  border-radius: 16px;
  padding: 26px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.center-card h3 { font-size: 16px; color: var(--text); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.vip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(90deg, #eff6ff, #dbeafe);
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 16px 18px;
  flex-wrap: wrap;
}
.vip-row .lbl { color: var(--primary-dark); font-size: 13px; }
.vip-row .val { color: var(--text); font-size: 15px; font-weight: 600; }
.vip-row .days {
  font-size: 26px; font-weight: 800; color: var(--primary);
}
.vip-row .days small { font-size: 13px; font-weight: 400; color: var(--text-sub); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.grid2 .cell { background: #f8fafc; border-radius: 10px; padding: 12px 14px; }
.grid2 .cell .k { font-size: 12px; color: var(--text-sub); }
.grid2 .cell .v { font-size: 14px; font-weight: 600; margin-top: 4px; color: var(--text); }

.card-input-row { display: flex; gap: 10px; margin-top: 14px; }
.card-input-row input {
  flex: 1;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 14px;
  outline: none;
  letter-spacing: 1px;
}
.card-input-row input:focus { border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }

/* 历史表格 */
.table-wrap { overflow-x: auto; }
table.list {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.list th {
  background: #f1f5f9;
  color: var(--text-sub);
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  white-space: nowrap;
}
table.list td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
table.list tr:hover td { background: #f8fafc; }

/* 状态标签 */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.tag-ok { background: #ecfdf5; color: #059669; }
.tag-warn { background: #fef3c7; color: #b45309; }
.tag-danger { background: #fee2e2; color: #b91c1c; }
.tag-info { background: #e0f2fe; color: #0369a1; }
.tag-gray { background: #f1f5f9; color: #64748b; }

/* ---------- 管理端 ---------- */
.admin-body { background: #f1f5f9; }
.admin-body .navbar { background: rgba(11, 28, 63, .95); }
.admin-layout { display: flex; flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 20px 16px 50px; gap: 18px; }
.admin-side {
  width: 200px;
  flex-shrink: 0;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 10px;
  align-self: flex-start;
  position: sticky;
  top: 78px;
}
.admin-side a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-radius: 9px;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 4px;
  transition: background .15s;
}
.admin-side a:hover { background: var(--bg-light); color: var(--primary); }
.admin-side a.active { background: var(--gradient); color: #fff; box-shadow: 0 4px 12px rgba(37,99,235,.3); }
.admin-main { flex: 1; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h2 { font-size: 19px; color: var(--text); }
.page-head .sub { font-size: 13px; color: var(--text-sub); margin-top: 3px; }

.panel {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}
.panel h3 { font-size: 15px; margin-bottom: 14px; color: var(--text); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.stat-card {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 16px;
}
.stat-card .num { font-size: 26px; font-weight: 800; color: var(--primary); }
.stat-card .lbl { font-size: 13px; color: var(--text-sub); margin-top: 2px; }

.form-inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.form-inline .field { margin-bottom: 0; }
.form-inline .field input { width: 150px; }
.form-inline .field input.wide { width: 300px; }
.form-inline .field label { margin-bottom: 4px; }

/* 批量卡密结果 */
.gen-result {
  background: #0f172a;
  border-radius: 10px;
  padding: 14px;
  margin-top: 14px;
  max-height: 260px;
  overflow-y: auto;
}
.gen-result .row { display: flex; justify-content: space-between; padding: 7px 8px; border-radius: 6px; font-size: 13px; color: #93c5fd; font-family: Consolas, monospace; }
.gen-result .row:nth-child(odd) { background: rgba(255,255,255,.05); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input, .toolbar select {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
}
.toolbar input:focus, .toolbar select:focus { border-color: var(--primary-light); }
.pager { display: flex; gap: 6px; justify-content: flex-end; margin-top: 14px; align-items: center; font-size: 13px; color: var(--text-sub); }
.pager a, .pager span {
  padding: 6px 12px;
  border-radius: 7px;
  border: 1px solid var(--border);
  color: var(--text);
  background: #fff;
}
.pager a:hover { border-color: var(--primary-light); color: var(--primary); }
.pager .cur { background: var(--gradient); color: #fff; border-color: transparent; }
#search-state .pager { justify-content: center; flex-wrap: wrap; }
#search-state .pager > span { white-space: nowrap; }
#search-state .pager a, #search-state .pager span {
  min-width: 34px;
  text-align: center;
}

/* ---------- 页脚 ---------- */
.footer {
  text-align: center;
  color: rgba(219, 234, 254, .6);
  font-size: 12px;
  padding: 20px 16px 28px;
  letter-spacing: .5px;
}
.footer a { color: rgba(219,234,254,.85); }

/* ---------- 弹窗确认 ---------- */
.mask {
  position: fixed; inset: 0;
  background: rgba(2, 8, 23, .55);
  display: none; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.mask.show { display: flex; }
.dialog {
  background: #fff;
  border-radius: 14px;
  max-width: 360px;
  width: 100%;
  padding: 24px;
  box-shadow: 0 24px 60px rgba(0,0,0,.3);
  text-align: center;
}
.dialog h4 { font-size: 16px; margin-bottom: 8px; }
.dialog p { font-size: 13px; color: var(--text-sub); line-height: 1.7; margin-bottom: 18px; }
.dialog .btns { display: flex; gap: 10px; justify-content: center; }

/* ---------- 加载动画 ---------- */
.spinner {
  width: 22px; height: 22px;
  border: 3px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  display: inline-block;
  animation: spin .7s linear infinite;
}
.loading-tip { text-align: center; color: rgba(219,234,254,.9); padding: 30px 0; font-size: 14px; display: flex; align-items: center; justify-content: center; gap: 10px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- 响应式 ---------- */
@media (max-width: 820px) {
  .hero h1 { font-size: 26px; }
  .search-box { flex-direction: column; border-radius: 18px; padding: 10px; background: rgba(255,255,255,.98); }
  .search-box input { padding: 10px 8px; }
  .search-box button { width: 100%; }
  .admin-layout { flex-direction: column; }
  .admin-side { width: 100%; position: static; display: flex; overflow-x: auto; gap: 6px; padding: 8px; }
  .admin-side a { flex-shrink: 0; margin-bottom: 0; }
  .grid2 { grid-template-columns: 1fr; }
  .nav-links a { padding: 6px 9px; font-size: 13px; }
  .nav-links .badge { display: none; }
  .result-item { padding: 12px; gap: 10px; }
  .file-name { font-size: 14px; }
  .dl-btn { padding: 8px 14px; font-size: 12px; }
}
