/* ============================================================
   智谱清言主题 — 对照 chatglm.cn 网页版
   纯白画布 / 品牌蓝 #3859FF / 浅蓝侧栏 /
   白卡输入框 + 蓝色圆角发送键
   ============================================================ */
body.theme-glm {
  --provider-sidebar-width: 280px;
  --provider-content-width: 800px;
  --font-body: -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-display: inherit;

  --bg-main: #ffffff;
  --bg-sidebar: #f3f6fd;
  --bg-panel: #ffffff;
  --bg-menu: #ffffff;
  --fg: #1c2333;
  --fg-dim: #8b93a8;
  --border: #e5eaf6;
  --accent: #3859ff;

  --sidebar-w: var(--provider-sidebar-width);
  --chat-w: var(--provider-content-width);

  --item-hover: rgba(28, 35, 51, .05);
  --item-active: rgba(56, 89, 255, .1);
  --radius-btn: 12px;
  --radius-item: 10px;

  --newchat-fg: #ffffff;
  --newchat-bg: #3859ff;
  --newchat-bg-hover: #2b48e0;
  --newchat-border: none;

  --avatar-bg: #b7c4f2;
  --avatar-fg: #ffffff;
  --avatar-radius: 50%;
  --avatar-ai-bg: #e7edff;
  --avatar-ai-fg: #3859ff;

  --user-bubble: #eaf0ff;
  --user-bubble-fg: #1c2333;
  --user-bubble-radius: 12px;
  --user-bubble-pad: 10px 15px;

  --composer-bg: #ffffff;
  --composer-border: 1px solid #dde3f5;
  --composer-radius: 16px;
  --composer-shadow: 0 6px 22px rgba(28, 35, 51, .05);
  --composer-focus: #a9bafd;

  --send-bg: #3859ff;
  --send-fg: #ffffff;
  --send-radius: 12px;

  --search-bg: rgba(28, 35, 51, .05);

  --welcome-size: 26px;
  --welcome-weight: 600;

  --code-bg: #f7f9fe;
  --code-bar-bg: #ecf0fa;
  --code-inline-bg: rgba(56, 89, 255, .08);
  --scrollbar: rgba(28, 35, 51, .16);
}

/* ---- 顶栏保留模型选择 ---- */
body.theme-glm .composer-picker { display: none; }

/* ---- 问候语 ---- */
body.theme-glm .welcome-icon { color: #3859ff; margin-bottom: 12px; }
body.theme-glm .welcome-sub { font-size: 14.5px; }

/* ---- 细节 ---- */
body.theme-glm .brand-icon { color: #3859ff; }
body.theme-glm .brand-name { font-weight: 700; }
body.theme-glm .new-chat-btn { justify-content: center; font-weight: 500; }
body.theme-glm .msg-user .msg-content { border: 1px solid #dfe8ff; }
body.theme-glm .composer:focus-within { box-shadow: 0 0 0 3px rgba(56, 89, 255, .12); }

/* ---- 弹层按钮 ---- */
body.theme-glm .primary-btn, body.theme-glm .login-card button:not(.auth-tab) { background: #3859ff; }

/* ---- 智谱清言快捷能力条 ---- */
body.theme-glm .glm-quick-bar {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 8px;
  max-width: var(--provider-content-width);
  margin: 16px auto 0;
  padding: 0 20px;
}

body.theme-glm .glm-quick-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-panel);
  color: var(--fg);
  font: inherit;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
}

body.theme-glm .glm-quick-item:hover { background: var(--item-hover); }
body.theme-glm .glm-quick-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
body.theme-glm .glm-quick-item:disabled,
body.theme-glm .glm-quick-item[aria-disabled="true"] {
  color: var(--fg-dim);
  cursor: not-allowed;
  opacity: .62;
}
body.theme-glm .glm-quick-item:disabled:hover,
body.theme-glm .glm-quick-item[aria-disabled="true"]:hover { background: var(--bg-panel); }

body.theme-glm .composer-wrap {
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
}

@media (max-width: 680px) {
  body.theme-glm .topbar {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }

  body.theme-glm .glm-quick-bar {
    justify-content: flex-start;
    overflow-x: auto;
    max-width: 100%;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  body.theme-glm .glm-quick-item { flex: 0 0 auto; }
  body.theme-glm .composer-wrap {
    padding-right: max(12px, env(safe-area-inset-right));
    padding-left: max(12px, env(safe-area-inset-left));
  }
}

@media (prefers-reduced-motion: reduce) {
  body.theme-glm *,
  body.theme-glm *::before,
  body.theme-glm *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}

@media (forced-colors: active) {
  body.theme-glm .glm-quick-item,
  body.theme-glm .composer {
    border-color: CanvasText;
    background: Canvas;
    color: CanvasText;
    box-shadow: none;
  }

  body.theme-glm .glm-quick-item:focus-visible {
    outline: 2px solid Highlight;
  }

  body.theme-glm .glm-quick-item:disabled,
  body.theme-glm .glm-quick-item[aria-disabled="true"] { color: GrayText; }
}

/* Official GLM wait: three blue waveform bars. */
body.theme-glm .waiting-glm {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  height: 14px;
}
body.theme-glm .waiting-elapsed {
  font-size: 12px;
  color: #7d8ba7;
}
body.theme-glm .waiting-glm i {
  display: block;
  width: 3px;
  height: 6px;
  border-radius: 999px;
  background: #3859ff;
  animation: glm-waiting-wave 900ms infinite ease-in-out;
}
body.theme-glm .waiting-glm i:nth-child(2) { animation-delay: .12s; }
body.theme-glm .waiting-glm i:nth-child(3) { animation-delay: .24s; }
@keyframes glm-waiting-wave {
  0%, 100% { height: 5px; opacity: .45; }
  50% { height: 14px; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  body.theme-glm .waiting-glm i { animation: none; height: 8px; opacity: 1; }
}
