/* ═══════════════════════════════════════════════════════════════
 * 侧边栏 · 工具分组（技能 / 插件）+ 选择浮窗（P0）
 * 适配实仓主题变量（深/浅色自动联动），不引入硬编码配色。
 * ═══════════════════════════════════════════════════════════════ */

/* 工具分组入口（挂在 #sidebar-tools） */
.tool-group {
  display: flex;
  align-items: center;
  padding: 9px 14px;
  margin: 2px 8px;
  cursor: pointer;
  border-radius: 8px;
  transition: background .18s, border-color .18s;
  user-select: none;
}
.tool-group:hover { background: var(--hover-bg, var(--primary-dim)); }
.tool-group .icon { margin-right: 10px; font-size: 16px; line-height: 1; }
.tool-group .name { flex: 1; font-size: 14px; color: var(--text); }
.tool-group .count {
  font-size: 12px;
  color: var(--text-dim);
  background: var(--surface-2, rgba(127,127,127,.16));
  padding: 2px 9px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* 选择浮窗 */
.picker-modal {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(2px);
}
.picker-content {
  position: relative;
  background: var(--surface, #1e1e2e);
  border: 1px solid var(--border, #333);
  border-radius: 14px;
  /* 左右固定：不随卡片内容变宽 */
  width: min(900px, 92vw);
  max-width: 900px;
  /* 防止顶穿屏幕：内容超出后只做纵向滚动 */
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow, 0 8px 32px rgba(0,0,0,.5));
}
.picker-header {
  flex: 0 0 auto;
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border, #333);
}
.picker-header h3 { margin: 0; font-size: 16px; color: var(--text); font-weight: 600; }
.picker-close {
  background: none; border: none; color: var(--text-dim, #888);
  font-size: 24px; cursor: pointer; padding: 0;
  width: 32px; height: 32px; border-radius: 6px; line-height: 1;
}
.picker-close:hover { background: var(--hover-bg, rgba(127,127,127,.18)); color: var(--text); }
.picker-grid {
  flex: 1 1 auto;
  min-height: 0;
  padding: 16px;
  /* 上下滚动、左右固定 */
  overflow-y: auto;
  overflow-x: hidden;
  display: grid;
  /* auto-fill + minmax：按可用宽度自动排 2~3 列，绝不横向溢出 */
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb, rgba(127,127,127,.38)) transparent;
}
/* 精致滚动条（WebKit） */
.picker-grid::-webkit-scrollbar { width: 8px; height: 8px; }
.picker-grid::-webkit-scrollbar-track { background: transparent; }
.picker-grid::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb, rgba(127,127,127,.38));
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.picker-grid::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-thumb-hover, rgba(127,127,127,.58));
  background-clip: padding-box;
}
.picker-item {
  /* min-width:0 是关键：否则长文本的 min-content 会撑爆网格列 */
  min-width: 0;
  display: flex; align-items: flex-start;
  padding: 12px;
  background: var(--surface-2, rgba(127,127,127,.10));
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all .2s;
}
.picker-item:hover { border-color: var(--primary, #409eff); }
/* 「即将上线」占位类目：保留可点击（点了给提示），仅做轻度视觉区分 */
.picker-item.is-soon {
  border-style: dashed;
  border-color: var(--border, rgba(127,127,127,.32));
  background: var(--surface-2, rgba(127,127,127,.06));
}
.picker-item.is-soon:hover { border-color: #f0a020; }
.picker-item.is-soon .picker-item-icon { filter: grayscale(.35); opacity: .9; }
.picker-item-badge {
  flex: 0 0 auto;
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.6;
  color: #d48806;
  background: rgba(250, 173, 20, .16);
  border: 1px solid rgba(250, 173, 20, .45);
  border-radius: 999px;
  vertical-align: middle;
}
.picker-item-icon { flex: 0 0 auto; font-size: 24px; margin-right: 12px; line-height: 1.2; }
.picker-item-info { flex: 1 1 auto; min-width: 0; }
.picker-item-name {
  display: flex; align-items: center; min-width: 0;
  font-size: 14px; color: var(--text); font-weight: 500; margin-bottom: 3px;
}
.picker-item-title {
  min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.picker-item.is-soon .picker-item-name { color: var(--text-dim, #888); }
/* 描述默认 2 行截断；完整内容走 title 悬浮提示 */
.picker-item-desc {
  font-size: 12px; color: var(--text-dim, #888);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  word-break: break-word;
}
.picker-empty { grid-column: 1 / -1; text-align: center; padding: 32px; color: var(--text-dim, #666); }

/* 还有内容时的底部渐隐提示（overlay 滚动条环境也能看出可滚动） */
.picker-content::after {
  content: "";
  position: absolute;
  left: 1px; right: 1px; bottom: 1px;
  height: 36px;
  border-radius: 0 0 13px 13px;
  background: linear-gradient(to top, var(--surface, #1e1e2e) 12%, rgba(0,0,0,0));
  opacity: 0;
  transition: opacity .18s;
  pointer-events: none;
}
.picker-content.show-more::after { opacity: 1; }

/* 窄屏：单列，弹窗更贴边 */
@media (max-width: 640px) {
  .picker-content { width: 94vw; max-height: 86vh; }
  .picker-grid { grid-template-columns: 1fr; gap: 10px; padding: 12px; }
}

/* 底部「＋技能」选择面板的分组小标题（window_manager.js 复用 .skill-picker） */
.skill-picker .pick-sub {
  font-size: 12px; color: var(--text-dim);
  padding: 8px 2px 6px; font-weight: 600;
}

/* 插件 H5 浮窗面板 */
#panel-plugin.active { display: flex; flex-direction: column; height: 100%; }
.plugin-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  flex-shrink: 0;
}
.plugin-head-icon { font-size: 18px; }
.plugin-head-name { font-size: 15px; color: var(--text); font-weight: 600; }
.plugin-head-session {
  font-size: 12px; color: var(--text-dim);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 2px 10px;
}
.plugin-head-btn {
  margin-left: auto;
  font-size: 13px; cursor: pointer;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 5px 12px;
}
.plugin-head-btn + .plugin-head-btn { margin-left: 8px; }
.plugin-head-btn:hover { border-color: var(--primary); color: var(--primary); }
.plugin-frame-wrap { flex: 1 1 auto; min-height: 0; position: relative; }
.plugin-frame { width: 100%; height: 100%; border: 0; background: #fff; }

/* native 插件面板（视频剪辑 等：电脑端本地处理） */
#panel-native-plugin.active { display: flex; flex-direction: column; height: 100%; }
.native-plugin-body {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  padding: 16px 18px; display: flex; flex-direction: column; gap: 14px;
}
.np-upload { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.np-hint { font-size: 13px; color: var(--text-dim); }
.np-files { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 4px; }
.np-file-item { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px; padding: 6px 10px; font-size: 13px; }
.np-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-file-ops { display: flex; gap: 4px; flex: none; }
.np-file-ops button { background: rgba(255,255,255,0.08); border: 0; color: var(--text);
  border-radius: 6px; width: 26px; height: 24px; cursor: pointer; font-size: 12px; }
.np-file-ops button:hover { background: rgba(255,255,255,0.16); }

.np-ops { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.np-op { font-size: 14px; color: var(--text); cursor: pointer; user-select: none; }
.np-op input { margin-right: 4px; }
.np-extra { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.np-field { font-size: 13px; color: var(--text-dim); display: inline-flex; align-items: center; gap: 6px; }
.np-field input, .np-field select {
  width: 90px; padding: 4px 8px; font-size: 13px;
  color: var(--text); background: var(--input-bg, var(--surface));
  border: 1px solid var(--border); border-radius: 6px;
}
.np-field select { width: auto; min-width: 72px; }
.np-field textarea { width: 100%; min-height: 64px; resize: vertical; border-radius: 8px; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.06); color: var(--text); padding: 8px 10px; font-size: 13px; }
.np-sub {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 12px; border: 1px dashed var(--border); border-radius: 8px;
  background: var(--surface-2);
}
.np-sub-title { font-size: 13px; color: var(--text); font-weight: 600; }
.np-log {
  white-space: pre-wrap; word-break: break-all;
  font-family: monospace; font-size: 12px;
  color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; min-height: 44px;
}
.np-actions {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 10px;
}
.np-btn {
  font-size: 13px; padding: 6px 12px; cursor: pointer;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px;
  transition: background .15s, border-color .15s;
}
.np-btn:hover { border-color: var(--accent, #409eff); }
.np-btn-primary {
  color: #fff; background: var(--accent, #409eff); border-color: var(--accent, #409eff);
}
.np-btn-primary:hover { filter: brightness(1.08); }
