/* ==========================================================================
   AI学委 · Agent 工作台 — 全局令牌与外壳样式
   --------------------------------------------------------------------------
   说明：本文件只放两类东西
     1) 设计令牌（沿用现有站点的 index.css，保证视觉不跑偏）
     2) 三栏外壳的骨架布局（不依赖 Tailwind 的运行时生成，保证首屏不闪）
   其余所有视觉一律用 Tailwind 工具类写在 .vue 组件里。
   ========================================================================== */

:root {
  /* —— 沿用现有站点令牌（public/assets/index.css）—— */
  --surface: #f5f4ed;
  --surface-low: #f0f0e8;
  --surface-mid: #e8e8df;
  --ink: #2c2c2c;
  --ink-soft: #7a7a7a;
  --sage: #5c614e;
  --indigo: #5d5c7a;
  --outline: rgba(0, 0, 0, 0.06);

  /* —— 工作台专用：语义状态色（与 sage/indigo 同一饱和度家族）—— */
  --wb-ok: #5f7a52;
  --wb-ok-soft: #eef2e9;
  --wb-warn: #9a7b3f;
  --wb-warn-soft: #f7f1e4;
  --wb-err: #9c5548;
  --wb-err-soft: #f7ecea;
  --wb-run: #5d5c7a;
  --wb-run-soft: #ecebf2;

  /* —— 尺寸 —— */
  --wb-sidebar: 200px;
  --wb-aside: 320px;
  --wb-gutter: 1.5rem;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: Inter, ui-sans-serif, system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.font-serif,
.wb-serif {
  font-family: Newsreader, Georgia, "Songti SC", serif;
}

/* ---------- 三栏外壳：纯 CSS，避免 Tailwind 生成前的布局跳动 ---------- */

.wb-shell {
  display: flex;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  background: var(--surface);
}

.wb-sidebar {
  flex: 0 0 var(--wb-sidebar);
  width: var(--wb-sidebar);
  border-right: 1px solid var(--outline);
  background: color-mix(in srgb, var(--surface-low) 92%, white 8%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.wb-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.wb-aside {
  flex: 0 0 var(--wb-aside);
  width: var(--wb-aside);
  border-left: 1px solid var(--outline);
  background: color-mix(in srgb, var(--surface-low) 70%, white 30%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: flex-basis 0.24s ease, width 0.24s ease, opacity 0.18s ease;
}

.wb-aside.is-collapsed {
  flex-basis: 0;
  width: 0;
  border-left: 0;
  opacity: 0;
  pointer-events: none;
}

/* 对话流与输入框的居中宽度约束（Codex / Cursor 式） */
.wb-column {
  width: 100%;
  max-width: 48rem; /* max-w-3xl */
  margin: 0 auto;
  padding-inline: var(--wb-gutter);
}
.wb-column.flush {
  padding-inline: 0;
}

/* 对话流滚动容器：必须 min-height:0，否则在 flex 里不会收缩 */
.wb-flow {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.wb-scroll {
  overflow-y: auto;
  scrollbar-gutter: stable;
}

/* ---------- 滚动条：细、低调 ---------- */
.wb-scroll::-webkit-scrollbar,
.wb-thin::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.wb-scroll::-webkit-scrollbar-thumb,
.wb-thin::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 999px;
}
.wb-scroll::-webkit-scrollbar-track,
.wb-thin::-webkit-scrollbar-track {
  background: transparent;
}
.wb-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

/* ---------- 动画 ---------- */
@keyframes wbRiseIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.wb-rise {
  animation: wbRiseIn 0.26s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

@keyframes wbPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
.wb-pulse {
  animation: wbPulse 1.5s ease-in-out infinite;
}

@keyframes wbShimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.wb-shimmer {
  background: linear-gradient(
    90deg,
    var(--surface-mid) 25%,
    color-mix(in srgb, var(--surface-mid) 55%, white) 50%,
    var(--surface-mid) 75%
  );
  background-size: 200% 100%;
  animation: wbShimmer 1.6s linear infinite;
}

@keyframes wbSpin {
  to { transform: rotate(360deg); }
}
.wb-spin {
  animation: wbSpin 0.9s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .wb-rise,
  .wb-pulse,
  .wb-shimmer,
  .wb-spin {
    animation: none;
  }
}

/* ---------- 首屏遮罩：等 Tailwind 生成完再显示，避免无样式闪一下 ---------- */
#wb-boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 13px;
  letter-spacing: 0.04em;
  z-index: 999;
  transition: opacity 0.28s ease;
}
html.wb-ready #wb-boot {
  opacity: 0;
  pointer-events: none;
}

/* 启动遮罩内部：正常态一行字；失败态把原因摊开，便于定位 */
.wb-boot-inner {
  max-width: 640px;
  padding: 0 24px;
}
#wb-boot-msg {
  margin: 0;
}
#wb-boot-err {
  margin: 10px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 60vh;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  letter-spacing: 0;
  color: #9c5548;
  text-align: left;
}
