/* ============================================================
   AI 音乐生成系统 - 后台样式（蓝白主题，响应式）
   ============================================================ */
:root {
  --navy-900: #101f4d;
  --navy-800: #14275e;
  --navy-700: #1a3378;
  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --cyan-500: #06b6d4;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5eaf5;
  --bg: #f4f7fd;
  --white: #fff;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(30,64,175,.08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font); color: var(--ink); background: var(--bg);
  font-size: 14px; line-height: 1.6; -webkit-font-smoothing: antialiased;
}
a { color: var(--blue-600); text-decoration: none; }
a:hover { color: var(--blue-700, #1d4ed8); }
[hidden] { display: none !important; }

/* ---------- 布局 ---------- */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 236px; z-index: 120;
  background: linear-gradient(180deg, var(--navy-900), var(--navy-700));
  color: #c7d7f5; display: flex; flex-direction: column;
  transition: transform .28s;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px; padding: 20px 20px 16px;
  color: #fff; font-weight: 700; font-size: 17px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.sidebar-brand .brand-icon {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--blue-500), var(--cyan-500));
  font-size: 18px; box-shadow: 0 6px 14px rgba(0,0,0,.22);
}
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.sidebar-nav .nav-group { font-size: 11px; color: rgba(199,215,245,.5); padding: 12px 12px 6px; letter-spacing: 1px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px; color: #c7d7f5;
  padding: 10px 12px; border-radius: 10px; font-size: 14px; margin-bottom: 2px;
  transition: .18s;
}
.sidebar-nav a .ico { width: 20px; text-align: center; flex: none; }
.sidebar-nav a:hover { background: rgba(255,255,255,.10); color: #fff; }
.sidebar-nav a.active { background: linear-gradient(135deg, var(--blue-500), var(--cyan-500)); color: #fff; box-shadow: 0 6px 16px rgba(37,99,235,.35); }
.sidebar-foot { padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.12); font-size: 12px; color: rgba(199,215,245,.55); }

.main { flex: 1; margin-left: 236px; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 90;
  background: rgba(255,255,255,.92); backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 0 24px; height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar h1 { font-size: 18px; color: var(--navy-800); }
.burger {
  display: none; width: 40px; height: 40px; border: 0; border-radius: 10px;
  background: #eff6ff; color: var(--blue-600); font-size: 19px; cursor: pointer;
}
.topbar-user { display: flex; align-items: center; gap: 10px; }
.topbar-user .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-600), var(--cyan-500));
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.topbar-user .u-name { font-weight: 600; }
.topbar-user .u-role { font-size: 12px; color: var(--muted); }
.topbar-user .u-links { display: flex; gap: 8px; }
.content { padding: 26px 24px 60px; flex: 1; max-width: 1240px; width: 100%; }
.sidebar-mask { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 110; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px 24px; margin-bottom: 20px;
}
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-title h2 { font-size: 17px; color: var(--navy-800); }
.card-title .sub { color: var(--muted); font-size: 13px; }

/* ---------- 统计卡片 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card {
  background: var(--white); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); display: flex; align-items: center; gap: 14px;
  border-left: 4px solid var(--blue-500);
}
.stat-card.s-blue { border-left-color: var(--blue-500); }
.stat-card.s-cyan { border-left-color: var(--cyan-500); }
.stat-card.s-green { border-left-color: #10b981; }
.stat-card.s-amber { border-left-color: #f59e0b; }
.stat-icon {
  width: 46px; height: 46px; border-radius: 13px; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 21px;
  background: #eff6ff; color: var(--blue-600);
}
.stat-card.s-cyan .stat-icon { background: #ecfeff; color: #0e7490; }
.stat-card.s-green .stat-icon { background: #ecfdf5; color: #059669; }
.stat-card.s-amber .stat-icon { background: #fffbeb; color: #d97706; }
.stat-num { font-size: 24px; font-weight: 800; color: var(--navy-800); line-height: 1.2; }
.stat-label { font-size: 13px; color: var(--muted); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.data-table th, .data-table td { text-align: left; padding: 11px 12px; border-bottom: 1px solid #eef2f7; vertical-align: middle; }
.data-table th { font-size: 12px; color: var(--muted); font-weight: 600; background: #f8fafc; white-space: nowrap; }
.data-table tr:hover td { background: #f8fbff; }
.data-table .num { text-align: center; width: 44px; }
.data-table .actions { white-space: nowrap; }
.data-table .actions a, .data-table .actions button {
  display: inline-block; padding: 4px 11px; border-radius: 8px; font-size: 12px;
  border: 1px solid var(--line); background: #fff; color: #4b5563; cursor: pointer; margin-right: 4px; transition: .15s;
}
.data-table .actions a:hover, .data-table .actions button:hover { border-color: var(--blue-500); color: var(--blue-600); }
.data-table .actions button.danger:hover { border-color: #f87171; color: #dc2626; }
.data-table .title-cell { font-weight: 600; color: var(--navy-800); max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-table .lyrics-cell { max-width: 260px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-row td { text-align: center; color: var(--muted); padding: 34px 0 !important; }

/* ---------- 徽章 ---------- */
.badge { padding: 3px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-cyan { background: #cffafe; color: #0e7490; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-gray { background: #f3f4f6; color: #4b5563; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-orange { background: #ffedd5; color: #c2410c; }
.badge-purple { background: #ede9fe; color: #6d28d9; }

/* ---------- 表单 ---------- */
.opt-grid { display: flex; flex-wrap: wrap; gap: 16px 24px; margin: 4px 0 14px; }
.opt-grid .opt { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #374151; }
.opt-grid .opt input { width: auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-group { margin-bottom: 4px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 6px; }
.form-group label em { color: #ef4444; font-style: normal; }
input[type="text"], input[type="password"], input[type="email"], input[type="number"],
select, textarea {
  width: 100%; padding: 10px 13px; border: 1px solid var(--line); border-radius: 10px;
  background: #fbfdff; outline: none; transition: .2s; color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(59,130,246,.15); background: #fff;
}
textarea { resize: vertical; }
.form-actions { margin-top: 18px; display: flex; gap: 12px; flex-wrap: wrap; }
.form-hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.form-row-inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.form-row-inline input[type="text"], .form-row-inline select { width: auto; }

/* ---------- 批量操作栏 ---------- */
.batch-bar { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); }
.batch-bar .form-actions { margin-top: 0; align-items: center; }
.batch-hint { font-size: 12px; color: var(--muted); }
.batch-ids { display: none; }
.data-table .row-check { width: 15px; height: 15px; accent-color: var(--blue-600); cursor: pointer; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 22px; border-radius: 999px; border: 0; cursor: pointer;
  font-size: 14px; font-weight: 600; transition: .18s; white-space: nowrap;
}
.btn-primary { background: linear-gradient(135deg, var(--blue-600), var(--cyan-500)); color: #fff; box-shadow: 0 6px 16px rgba(37,99,235,.3); }
.btn-primary:hover { transform: translateY(-1px); color: #fff; }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-outline { background: #fff; color: var(--blue-600); border: 1px solid var(--blue-400); }
.btn-outline:hover { background: #eff6ff; }
.btn-danger { background: #fff; color: #dc2626; border: 1px solid #fca5a5; }
.btn-danger:hover { background: #fef2f2; }
.btn-danger-solid { background: linear-gradient(135deg, #dc2626, #f97316); color: #fff; }
.btn-sm { padding: 6px 15px; font-size: 13px; }
.btn-block { width: 100%; }

/* ---------- 筛选条 ---------- */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filter-bar input[type="text"], .filter-bar select { width: auto; min-width: 150px; }

/* ---------- 分页 ---------- */
.pagination { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 18px; }
.pagination a, .pagination span {
  padding: 6px 13px; border-radius: 8px; background: #fff; color: #4b5563;
  border: 1px solid var(--line); font-size: 13px;
}
.pagination a:hover { border-color: var(--blue-500); color: var(--blue-600); }
.pagination .current { background: var(--blue-600); color: #fff; border-color: var(--blue-600); }

/* ---------- 提示 ---------- */
.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; font-size: 14px; }
.flash-success { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.flash-error { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.flash-info { background: #e0f2fe; color: #0369a1; border: 1px solid #7dd3fc; }

/* ---------- 图表 ---------- */
.chart-bars { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 8px; }
.chart-bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart-bar .bar {
  width: 100%; max-width: 42px; border-radius: 7px 7px 3px 3px;
  background: linear-gradient(180deg, var(--blue-500), var(--cyan-500));
  min-height: 4px; transition: .3s;
}
.chart-bar .bar-label { font-size: 11px; color: var(--muted); }
.chart-bar .bar-val { font-size: 12px; font-weight: 700; color: var(--navy-800); }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 300; background: rgba(15,23,42,.55);
  display: flex; align-items: center; justify-content: center; padding: 18px;
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.modal {
  position: relative; width: 100%; max-width: 760px; max-height: 88vh; overflow: auto;
  background: #fff; border-radius: 16px; padding: 24px 26px; box-shadow: 0 30px 80px rgba(15,23,42,.35);
}
.modal-close {
  position: absolute; top: 12px; right: 14px; width: 34px; height: 34px;
  border: 0; border-radius: 50%; background: #f3f4f6; color: #374151; font-size: 20px; cursor: pointer;
}
.modal-close:hover { background: #fee2e2; color: #dc2626; }
.modal h3 { color: var(--navy-800); margin-bottom: 14px; }
.modal pre {
  font-family: inherit; white-space: pre-wrap; word-break: break-word;
  background: #f7faff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; max-height: 52vh; overflow: auto;
}

/* ---------- 登录页 ---------- */
.login-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(150deg, #1e3a8a 0%, #2563eb 45%, #06b6d4 100%);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 400px; background: #fff; border-radius: 20px;
  padding: 36px 34px; box-shadow: 0 30px 80px rgba(15,23,42,.4);
}
.login-logo {
  width: 58px; height: 58px; margin: 0 auto 14px; border-radius: 17px;
  background: linear-gradient(135deg, var(--blue-600), var(--cyan-500));
  color: #fff; font-size: 28px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 24px rgba(37,99,235,.4);
}
.login-card h1 { text-align: center; font-size: 21px; color: var(--navy-800); }
.login-card .sub { text-align: center; color: var(--muted); font-size: 13px; margin: 4px 0 22px; }
.login-card .form-group { margin-bottom: 16px; }
.login-actions { margin-top: 20px; }
.login-foot { text-align: center; margin-top: 18px; font-size: 13px; color: var(--muted); }
.login-error { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; border-radius: 10px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px; }

/* ---------- 生成页 ---------- */
.gen-layout { display: grid; grid-template-columns: 400px 1fr; gap: 20px; align-items: start; }
.gen-result-panel { position: sticky; top: 84px; }
.gen-loading-overlay { text-align: center; padding: 30px 0; color: var(--muted); }
.spinner {
  width: 38px; height: 38px; margin: 0 auto 12px; border-radius: 50%;
  border: 4px solid #dbeafe; border-top-color: var(--blue-600);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.tab-nav { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tab-nav button {
  border: 0; background: none; padding: 9px 16px; cursor: pointer; font-size: 14px;
  color: var(--muted); border-bottom: 2px solid transparent; font-weight: 600;
}
.tab-nav button.active { color: var(--blue-600); border-bottom-color: var(--blue-600); }
.textarea-monospace { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; font-size: 13px; line-height: 1.7; }
.kbd-hint { font-size: 12px; color: var(--muted); }

/* ---------- 会员系统 ---------- */
.admin-hr { border: 0; border-top: 1px dashed var(--line); margin: 20px 0; }
.points-inline { color: var(--blue-600); }
.text-green { color: #16a34a !important; }
.text-red { color: #dc2626 !important; }
.admin-list { padding-left: 20px; line-height: 2; color: #374151; }
.admin-list code {
  background: #f3f4f6; border: 1px solid var(--line); border-radius: 6px;
  padding: 1px 8px; font-size: 13px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .gen-layout { grid-template-columns: 1fr; }
  .gen-result-panel { position: static; }
}
@media (max-width: 992px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 60px rgba(15,23,42,.4); }
  .sidebar-mask.show { display: block; }
  .main { margin-left: 0; }
  .burger { display: inline-flex; align-items: center; justify-content: center; }
  .content { padding: 18px 14px 50px; }
}
@media (max-width: 680px) {
  .topbar { padding: 0 14px; }
  .topbar-user .u-name, .topbar-user .u-role { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .filter-bar input[type="text"] { width: 100%; min-width: 0; }
}

/* ---------- 公告图片 ---------- */
.notice-imgs { display: flex; flex-wrap: wrap; gap: 12px; }
.notice-img-item {
  display: inline-flex; flex-direction: column; gap: 5px;
  font-size: 12px; color: var(--muted); cursor: pointer;
}
.notice-img-item img {
  width: 130px; height: 96px; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--line); background: #f8fafc;
}
.notice-img-item span { display: inline-flex; align-items: center; gap: 5px; }
