/* ============================================================
   aijsheji.art — AI 设计智能体 · 全局设计系统
   深色主题 + 紫色主强调色
   ============================================================ */

:root {
  --bg-0: #0b0b12;
  --bg-1: #12121c;
  --bg-2: #181826;
  --bg-3: #1f1f30;
  --bg-card: #171726;
  --bg-hover: #222235;
  --border: #26263a;
  --border-soft: #2c2c42;

  --txt-1: #f2f2f7;
  --txt-2: #b8b8cc;
  --txt-3: #7a7a93;

  --accent: #7c5cff;
  --accent-2: #9d7bff;
  --accent-soft: rgba(124, 92, 255, 0.14);
  --accent-glow: rgba(124, 92, 255, 0.45);

  --green: #34d399;
  --green-soft: rgba(52, 211, 153, 0.14);
  --red: #f87171;
  --red-soft: rgba(248, 113, 113, 0.14);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.14);
  --blue: #60a5fa;
  --blue-soft: rgba(96, 165, 250, 0.14);
  --cyan: #22d3ee;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.55);
  --shadow-accent: 0 8px 30px var(--accent-glow);

  --sidebar-w: 248px;
  --transition: 0.18s cubic-bezier(0.4, 0, 0.2, 1);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

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

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg-0);
  color: var(--txt-1);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2c2c42; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #3a3a56; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; }
ul, ol { list-style: none; }

/* ---------- 图标 ---------- */
.icon { display: inline-flex; align-items: center; justify-content: center; flex: none; }
.icon svg { width: 1em; height: 1em; }

/* ---------- 布局骨架 ---------- */
.app-shell { display: flex; min-height: 100vh; }

/* ---------- 侧边导航 ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 30;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 11px;
  padding: 20px 20px 18px;
}
.brand-logo {
  width: 38px; height: 38px; flex: none;
  border-radius: 11px;
  background: linear-gradient(135deg, #7c5cff, #b06aff);
  display: grid; place-items: center;
  box-shadow: var(--shadow-accent);
}
.brand-logo .icon { font-size: 20px; color: #fff; }
.brand-name { font-size: 17px; font-weight: 700; letter-spacing: -0.3px; }
.brand-name span { color: var(--accent-2); }
.brand-sub { font-size: 11px; color: var(--txt-3); margin-top: 1px; }

.nav-group { padding: 6px 14px; }
.nav-group-label {
  font-size: 11px; color: var(--txt-3); text-transform: uppercase;
  letter-spacing: 0.08em; padding: 14px 10px 6px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--txt-2); font-weight: 500;
  transition: var(--transition); margin-bottom: 2px;
  position: relative; cursor: pointer; width: 100%; text-align: left;
}
.nav-item .icon { font-size: 17px; color: var(--txt-3); transition: var(--transition); }
.nav-item:hover { background: var(--bg-hover); color: var(--txt-1); }
.nav-item:hover .icon { color: var(--txt-1); }
.nav-item.active { background: var(--accent-soft); color: #fff; }
.nav-item.active .icon { color: var(--accent-2); }
.nav-item .badge {
  margin-left: auto; font-size: 10px; padding: 2px 7px; border-radius: 20px;
  background: var(--accent-soft); color: var(--accent-2); font-weight: 600;
}

.sidebar-footer { margin-top: auto; padding: 16px 20px; border-top: 1px solid var(--border); }
.user-mini { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, #f472b6, #a855f7);
  display: grid; place-items: center; font-size: 14px; font-weight: 700; color: #fff;
}
.user-mini .meta { min-width: 0; }
.user-mini .name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-mini .credits { font-size: 11px; color: var(--amber); display: flex; align-items: center; gap: 4px; }
.user-mini .credits .icon { font-size: 12px; }

/* ---------- 主内容区 ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 64px; flex: none;
  display: flex; align-items: center; gap: 16px;
  padding: 0 28px;
  background: rgba(11, 11, 18, 0.75);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar .page-title { font-size: 17px; font-weight: 700; }
.topbar .crumbs { font-size: 12px; color: var(--txt-3); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.page-content { padding: 28px; max-width: 1280px; width: 100%; margin: 0 auto; }
.page-content.wide { max-width: 1440px; }

/* ---------- 通用元素 ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: var(--transition);
}
.card.pad { padding: 22px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 10px;
  font-weight: 600; font-size: 14px;
  transition: var(--transition); white-space: nowrap;
}
.btn .icon { font-size: 16px; }
.btn-primary {
  background: linear-gradient(135deg, #7c5cff, #9467ff);
  color: #fff; box-shadow: var(--shadow-accent);
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.06); box-shadow: 0 12px 34px var(--accent-glow); }
.btn-ghost { background: var(--bg-2); color: var(--txt-1); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-hover); border-color: #3b3b58; }
.btn-soft { background: var(--accent-soft); color: var(--accent-2); }
.btn-soft:hover { background: rgba(124, 92, 255, 0.24); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-danger:hover { background: rgba(248, 113, 113, 0.24); }
.btn-sm { padding: 7px 13px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 13px 24px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 20px;
}
.tag-green { background: var(--green-soft); color: var(--green); }
.tag-red { background: var(--red-soft); color: var(--red); }
.tag-amber { background: var(--amber-soft); color: var(--amber); }
.tag-blue { background: var(--blue-soft); color: var(--blue); }
.tag-accent { background: var(--accent-soft); color: var(--accent-2); }
.tag-gray { background: var(--bg-3); color: var(--txt-3); }

.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot-green { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot-red { background: var(--red); }
.dot-amber { background: var(--amber); }
.dot-gray { background: var(--txt-3); }

.input, .select, .textarea {
  width: 100%; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 14px; color: var(--txt-1);
  font-size: 14px; transition: var(--transition); outline: none;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--txt-3); }
.textarea { resize: vertical; min-height: 100px; }
.select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a7a93' stroke-width='2.5'><path d='M6 9l6 6 6-6'/></svg>"); background-repeat: no-repeat; background-position: right 13px center; padding-right: 36px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; color: var(--txt-2); }
.field .hint { font-size: 12px; color: var(--txt-3); margin-top: 5px; }

/* 开关 */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; background: var(--bg-3);
  border-radius: 30px; transition: var(--transition); cursor: pointer;
}
.switch .slider:before {
  content: ""; position: absolute; width: 18px; height: 18px;
  left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: var(--transition);
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider:before { transform: translateX(20px); }

/* 表单开关行 */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; padding: 12px 14px; color: var(--txt-3);
  font-weight: 600; font-size: 12px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tbl td { padding: 13px 14px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: var(--transition); }
.tbl tbody tr:hover { background: var(--bg-hover); }
.tbl .mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 12px; color: var(--txt-2); }
.tbl .actions { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  color: var(--txt-2); transition: var(--transition); font-size: 15px;
}
.icon-btn:hover { background: var(--bg-3); color: var(--txt-1); }
.icon-btn.danger:hover { background: var(--red-soft); color: var(--red); }

/* 徽章/统计 */
.stat-card { position: relative; overflow: hidden; }
.stat-card .icon-wrap {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  font-size: 22px; margin-bottom: 14px;
}

/* 图表占位 */
.chart-box { position: relative; }
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 200px; padding-top: 10px; }
.bar-chart .bar {
  flex: 1; border-radius: 8px 8px 4px 4px; background: linear-gradient(180deg, var(--accent-2), var(--accent));
  position: relative; min-height: 6px; transition: var(--transition);
}
.bar-chart .bar:hover { filter: brightness(1.15); }
.bar-chart .bar .bar-val {
  position: absolute; top: -22px; left: 50%; transform: translateX(-50%);
  font-size: 11px; color: var(--txt-2); white-space: nowrap;
}
.bar-x { display: flex; gap: 10px; margin-top: 8px; }
.bar-x span { flex: 1; text-align: center; font-size: 11px; color: var(--txt-3); }

/* 甜甜圈图 */
.donut { display: flex; align-items: center; gap: 22px; }
.donut .ring { position: relative; width: 140px; height: 140px; flex: none; }
.donut .ring svg { transform: rotate(-90deg); }
.donut .ring .ring-center {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
}
.donut .ring-center .v { font-size: 22px; font-weight: 700; }
.donut .ring-center .l { font-size: 11px; color: var(--txt-3); }
.legend { display: flex; flex-direction: column; gap: 10px; }
.legend-item { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.legend-item .sw { width: 10px; height: 10px; border-radius: 3px; }
.legend-item .pct { margin-left: auto; color: var(--txt-3); font-size: 12px; }

/* 弹窗 */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px); z-index: 100;
  display: grid; place-items: center; padding: 24px;
  opacity: 0; pointer-events: none; transition: var(--transition);
}
.modal-overlay.show { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--bg-1); border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 100%; max-width: 560px;
  box-shadow: var(--shadow-lg); overflow: hidden;
  transform: translateY(14px) scale(0.98); transition: var(--transition);
  max-height: 88vh; display: flex; flex-direction: column;
}
.modal-overlay.show .modal { transform: translateY(0) scale(1); }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 17px; font-weight: 700; }
.modal-body { padding: 24px; overflow-y: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 24px; border-top: 1px solid var(--border);
}
.modal .close-x { font-size: 22px; color: var(--txt-3); width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; }
.modal .close-x:hover { background: var(--bg-3); color: var(--txt-1); }

/* Toast */
.toast-wrap { position: fixed; top: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--bg-1); border: 1px solid var(--border);
  border-radius: 12px; padding: 13px 18px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 10px; font-size: 14px;
  animation: toastIn 0.28s ease; max-width: 360px;
}
.toast .icon { font-size: 18px; }
.toast.out { animation: toastOut 0.28s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }

/* 空状态 */
.empty { text-align: center; padding: 50px 20px; color: var(--txt-3); }
.empty .icon { font-size: 44px; margin-bottom: 14px; opacity: 0.6; }
.empty p { font-size: 14px; }

/* Tab */
.tabs { display: flex; gap: 4px; background: var(--bg-2); padding: 4px; border-radius: 12px; width: max-content; }
.tabs .tab {
  padding: 8px 18px; border-radius: 9px; font-size: 13px; font-weight: 600;
  color: var(--txt-2); transition: var(--transition); white-space: nowrap;
}
.tabs .tab:hover { color: var(--txt-1); }
.tabs .tab.active { background: var(--bg-3); color: #fff; box-shadow: var(--shadow-sm); }

/* 搜索框 */
.search-box { position: relative; }
.search-box .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--txt-3); font-size: 16px; }
.search-box .input { padding-left: 38px; }

/* 分页 */
.pagination { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.page-btn { min-width: 32px; height: 32px; padding: 0 8px; border-radius: 8px; display: grid; place-items: center; background: var(--bg-2); border: 1px solid var(--border); color: var(--txt-2); font-size: 13px; }
.page-btn:hover { background: var(--bg-hover); }
.page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* 分类筛选 chips */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 18px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 20px; font-size: 13px; font-weight: 600;
  background: var(--bg-2); border: 1px solid var(--border); color: var(--txt-2);
  transition: var(--transition); cursor: pointer;
}
.chip:hover { background: var(--bg-hover); color: var(--txt-1); border-color: #3b3b58; }
.chip.active { background: var(--accent-soft); color: var(--accent-2); border-color: var(--accent); }
.chip .chip-count { font-size: 11px; color: var(--txt-3); background: var(--bg-3); border-radius: 10px; padding: 1px 7px; }
.chip.active .chip-count { background: var(--accent); color: #fff; }

/* 素材管理卡片网格 */
.mat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.mat-grid > .empty { grid-column: 1 / -1; }
.mat-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px; transition: var(--transition);
}
.mat-card:hover { border-color: #3b3b58; box-shadow: var(--shadow-sm); }
.mat-thumb {
  width: 56px; height: 56px; flex: none; border-radius: 10px; overflow: hidden;
  background: var(--bg-3); display: grid; place-items: center;
}
.mat-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mat-thumb.noimg { background: var(--accent-soft); }
.mat-info { flex: 1; min-width: 0; }
.mat-title {
  font-size: 14px; font-weight: 600; color: var(--txt-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 7px;
}
.mat-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.mat-meta .small.muted .icon { font-size: 12px; margin-right: 3px; vertical-align: -1px; }

/* 响应式 */
@media (max-width: 1080px) {
  .sidebar { position: fixed; left: -260px; transition: var(--transition); }
  .sidebar.open { left: 0; }
}
