/* ════════════════════════════════════════════════════════════
   20. 助手头像选择器弹窗(P406 创建 / P420 砍色板段)

   P420 设计契约:
   - 两段结构(原三段):预览 → 图标网格 → 取消/保存
   - 砍掉色板段(.ap-themes / .ap-swatch) — 头像配色由版面主题自动适配
   - 实时预览:选图标立即更新大头像
   - 头像配色完全消费 5 原色派生变量,深浅自动跟随

   P414 主题规范收敛沿用:无 fallback 硬编码;裸 rgba 归一到 --bg-* / --shadow-overlay;
   无 [data-theme="light"] 组件例外,浅色走变量自动跟随。
   ════════════════════════════════════════════════════════════ */

/* ─── 遮罩 + 居中容器 ───────────────────────────── */
.ap-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: var(--shadow-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: ap-fade-in 0.18s ease both;
}

@keyframes ap-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

body.ap-locked { overflow: hidden; }

/* ─── 主面板 ──────────────────────────────────── */
.ap-panel {
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow-ambient);
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: ap-zoom-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes ap-zoom-in {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

/* ─── 头部 ─────────────────────────────────────── */
.ap-header { text-align: center; }
.ap-header h2 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-main);
  margin: 0 0 6px;
}
.ap-header p {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}

/* ─── 预览区 ───────────────────────────────────── */
.ap-preview-wrap {
  display: flex;
  justify-content: center;
  padding: 8px 0 4px;
}

/* ─── 区段(色板 / 图标网格) ────────────────────── */
.ap-section { display: flex; flex-direction: column; gap: 10px; }
.ap-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ─── 图标网格(20 个,auto-fill 自适应)─── */
.ap-icons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 8px;
}
.ap-icon-cell {
  aspect-ratio: 1;
  border-radius: 11px;
  background: var(--bg-surface-hover);
  border: 1px solid transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.ap-icon-cell svg { width: 22px; height: 22px; }
.ap-icon-cell:hover {
  color: var(--text-main);
  background: var(--bg-hover);
}
/* P420:选中态由 --brand-primary 表达(与左栏卡片选中金线语义一致),
   不再消费已废弃的 --avatar-color */
.ap-icon-cell.active {
  color: var(--brand-primary);
  background: var(--bg-base);
  border-color: var(--brand-primary);
}

/* ─── 底部按钮 ─────────────────────────────────── */
.ap-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}
.ap-btn {
  height: 40px;
  padding: 0 22px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.ap-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ap-btn-cancel {
  background: transparent;
  color: var(--text-secondary);
}
.ap-btn-cancel:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-main);
}
/* 保存按钮:用 --text-main 当背景 — 深浅色自动反色的中性 CTA(深色米白底 / 浅色墨黑底) */
.ap-btn-save {
  background: var(--text-main);
  color: var(--bg-base);
}
.ap-btn-save:hover:not(:disabled) { transform: translateY(-1px); }

/* ─── 错误提示 ─────────────────────────────────── */
.ap-error {
  font-size: 13px;
  color: var(--error-color);
  text-align: center;
  padding: 6px 0;
}

/* P414:浅色主题组件例外全删,走 --bg-* / --shadow-overlay / --border-* 变量自动跟随。 */
