/* ============================================================
   EngAI · Bot 商店（store.html）
   风格基线与 app.css :root 对齐；本页不引入 app.css，避免全局布局打架。
   ============================================================ */

:root {
  --bg: #08080A;
  --bg-2: #0A0A0C;
  --panel: #101012;
  --panel-2: #141416;
  --line: #232327;
  --line-2: #1C1C20;
  --line-3: #2A2A30;
  --text: #F2F2F4;
  --text-2: #A8A8B0;
  --text-3: #6E6E76;
  --accent: #C8102E;
  --accent-2: #E11D38;
  --ok: #22C55E;
  --warn: #F59E0B;
  --gray: #6E6E76;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --font: "Inter", "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }
.back-home { display: inline-block; margin-bottom: 6px; color: var(--text-2); font-size: 13px; text-decoration: none; }
.back-home:hover { color: var(--text); }
.store-shell, .store-side, .store-grid, .toolbar, .tag-row { min-width: 0; max-width: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

/* ---------- 布局骨架 ---------- */
.store-shell {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
}

/* ---------- 左侧类目栏 ---------- */
.store-side {
  border-right: 1px solid var(--line);
  background: var(--bg-2);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.side-brand { padding: 0 10px; }
.side-mark { font-weight: 800; font-size: 15px; letter-spacing: -0.01em; }
.side-mark .ai { color: var(--accent-2); }
.side-sub { display: block; font-size: 11px; color: var(--text-3); margin-top: 2px; }

.cat-list { display: flex; flex-direction: column; gap: 2px; }

.cat-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-2);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  min-width: 0;
}
.cat-btn svg { width: 16px; height: 16px; opacity: 0.8; flex: 0 0 auto; }
.cat-btn:hover { color: var(--text); background: var(--panel); }
.cat-btn.on {
  color: var(--text);
  background: linear-gradient(90deg, rgba(200, 16, 46, 0.18), rgba(200, 16, 46, 0.04));
  box-shadow: inset 2px 0 0 var(--accent);
}
.cat-count { margin-left: auto; font-size: 11px; color: var(--text-3); flex: 0 0 auto; }

/* ---------- 主区 ---------- */
.store-main {
  padding: 26px 28px 60px;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  min-width: 0;
}

.store-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.head-title h1 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.head-sub { margin: 6px 0 0; color: var(--text-2); font-size: 13px; max-width: 560px; }
.head-stats { font-size: 12px; color: var(--text-3); }
.head-stats b { color: var(--text); }

/* ---------- 工具栏 ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.search-box { position: relative; flex: 1 1 240px; min-width: 0; }
.search-box svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--text-3);
}
.search-box input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 36px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  min-width: 0;
}
.search-box input:focus { border-color: var(--accent); }
.search-box input::placeholder { color: var(--text-3); }

.tool-group { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}
.switch input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }

.view-switch {
  display: flex;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  padding: 2px;
}
.view-btn {
  border: 0;
  background: transparent;
  color: var(--text-3);
  font-family: inherit;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.view-btn.on { background: rgba(200, 16, 46, 0.16); color: var(--accent-2); font-weight: 600; }

/* ---------- 行业标签 ---------- */
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.tag-chip {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text-2);
  border-radius: 999px;
  padding: 5px 11px;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.tag-chip.on {
  background: rgba(200, 16, 46, 0.16);
  border-color: var(--accent);
  color: var(--text);
}

/* ---------- 卡片网格 ---------- */
.store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr));
  gap: 14px;
}

.card {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
}

/* 卡面形象带：这条活是谁干的，就直接用谁的脸。
   通栏出血（负 margin 吃掉 .card 的 16px padding），底部渐隐把图收进卡片底色。 */
.card-art {
  position: relative;
  margin: -16px -16px 2px;
  height: 104px;
  overflow: hidden;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--panel-2);
}
.card-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.94) contrast(1.03);
  transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.card:hover .card-art img { transform: scale(1.035); }
.card-art::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 52px;
  background: linear-gradient(to top, var(--panel) 12%, transparent);
  pointer-events: none;
}
.card-art-cap {
  position: absolute;
  left: 12px; bottom: 8px;
  z-index: 2;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-2);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.65);
}

.card-top { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }

.cat-ico {
  flex: 0 0 auto;
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
}
.cat-ico svg { width: 17px; height: 17px; }

.card-titles { min-width: 0; flex: 1; }
.card-title { margin: 0; font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.card-tagline { margin: 3px 0 0; font-size: 12.5px; color: var(--text-2); overflow-wrap: anywhere; }

.status-flag { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; margin-top: 3px; }
.status-text { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.status-dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; }
.status-dot.ready { background: var(--ok); box-shadow: 0 0 8px rgba(34, 197, 94, 0.6); }
.status-dot.partial { background: var(--warn); }
.status-dot.concept { background: var(--gray); }

.card-desc { margin: 0; font-size: 12.5px; color: var(--text-2); overflow-wrap: anywhere; }

.card-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.meta-tag {
  font-size: 11px;
  color: var(--text-3);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  padding: 2px 8px;
  overflow-wrap: anywhere;
}

.card-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.card-io { min-width: 0; font-size: 11px; color: var(--text-3); display: flex; flex-direction: column; gap: 2px; }
.card-io b { color: var(--text-2); font-weight: 600; }

.card-btn {
  height: 34px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  flex: 0 0 auto;
}
.card-btn.primary { background: var(--accent); color: #fff; box-shadow: 0 6px 20px rgba(200, 16, 46, 0.28); }
.card-btn.primary:hover { background: var(--accent-2); }
.card-btn.ghost { background: transparent; border-color: var(--line); color: var(--text-2); }
.card-btn.ghost:hover { color: var(--text); border-color: var(--accent); }
.card-btn.is-disabled {
  background: var(--panel-2);
  border-color: var(--line-2);
  color: var(--text-3);
  cursor: not-allowed;
}
.card-btn[disabled] { pointer-events: none; }

.installed-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ok); }
.installed-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }

/* ---------- 状态区：加载 / 错误 / 空态 ---------- */
.state-box {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-2);
  font-size: 13px;
}
.state-box .err-title { color: var(--accent-2); font-weight: 700; margin-bottom: 6px; }
.state-box .err-detail { color: var(--text-3); font-size: 12px; margin-top: 4px; }
.retry-btn {
  margin-top: 12px;
  height: 36px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}
.retry-btn:hover { border-color: var(--accent); }

.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr)); gap: 14px; }
.skel-card {
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.skel-line { height: 12px; border-radius: 6px; background: var(--panel-2); }
.skel-line.w60 { width: 60%; }
.skel-line.w40 { width: 40%; }
.skel-line.w80 { width: 80%; }

/* ---------- 轻提示 ---------- */
.toast {
  position: fixed;
  left: 50%; bottom: 28px;
  transform: translateX(-50%);
  background: var(--panel-2);
  border: 1px solid var(--line-3);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: var(--shadow);
  z-index: 80;
  max-width: 86vw;
  overflow-wrap: anywhere;
}
.toast.err { border-color: var(--accent); color: #FFB4BC; }

/* ---------- 窄屏：≤820px，类目栏变横向滑动条，不挤压正文 ---------- */
@media (max-width: 820px) {
  .store-shell { display: block; }

  .store-side {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
    height: auto;
    position: static;
    overflow: hidden;
    min-width: 0;
  }
  .side-brand { display: none; }
  .cat-list { flex-direction: row; overflow-x: auto; gap: 6px; scrollbar-width: thin; min-width: 0; max-width: 100%; }
  .cat-btn { white-space: nowrap; height: 34px; flex: 0 0 auto; }
  .cat-count { display: none; }

  .store-main { padding: 16px 14px 48px; min-width: 0; }
  .head-title h1 { font-size: 20px; }
  .store-grid, .skeleton-grid { grid-template-columns: 1fr; min-width: 0; }
  .toolbar { gap: 10px; }
  .search-box { flex: 1 1 100%; min-width: 0; }
  .tool-group { min-width: 0; }
}

/* 同一员工的多张岗位卡片：分组标题 + 能力说明 */
.store-group-h {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
  margin: 10px 0 2px;
  padding: 8px 2px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 13px;
}
.store-group-h:first-child { border-top: 0; margin-top: 0; }
.store-group-h strong { color: var(--text); font-weight: 600; }
.store-group-h span { color: var(--text-3); font-size: 12px; line-height: 1.5; }
.card-limit {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--warn, #e6b450);
  line-height: 1.55;
}
.card-share {
  margin: 0 0 8px;
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.5;
}

.card { cursor: pointer; }
.card:focus-visible { outline: 2px solid var(--accent, #c8102e); outline-offset: 2px; }
body.drawer-open { overflow: hidden; }
.drawer-root[hidden] { display: none !important; }
.drawer-root {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
}
.drawer-mask { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); }
.drawer {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  background: var(--bg, #141416);
  color: var(--text, #f3f3f3);
  border-left: 1px solid var(--line, rgba(255,255,255,.12));
  padding: 16px 18px 28px;
  overflow: auto;
  box-shadow: -12px 0 32px rgba(0,0,0,.28);
}
.drawer-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.drawer-kicker { margin: 0 0 4px; font-size: 11px; color: var(--text-3, #9a9a9a); letter-spacing: .04em; }
.drawer h2 { margin: 0; font-size: 18px; line-height: 1.35; overflow-wrap: anywhere; }
.drawer-status { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 13px; }
.drawer-bound { margin: 0 0 8px; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.drawer-foot { margin: 16px 0 0; font-size: 12px; color: var(--text-3, #9a9a9a); line-height: 1.55; }
@media (max-width: 430px) {
  .drawer-root { align-items: flex-end; }
  .drawer {
    width: 100%;
    max-height: 88vh;
    border-left: 0;
    border-top: 1px solid var(--line, rgba(255,255,255,.12));
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -12px 32px rgba(0,0,0,.28);
  }
}
