/* ===== 面板组件补充样式 ===== */

/* 历史记录项 */
.history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
}

.history-item:hover { background: var(--bg-hover); }
.history-item.current { background: var(--accent-light); color: var(--accent); }

.history-item-icon { font-size: 12px; }
.history-item-label { font-size: 11px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-item-time { font-size: 10px; color: var(--text-muted); }

/* 贴纸 */
.sticker-thumb {
  aspect-ratio: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.sticker-thumb:hover {
  border-color: var(--accent);
  transform: scale(1.05);
}

/* 右键菜单 */
.context-menu {
  position: fixed;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  min-width: 160px;
  padding: 4px 0;
  overflow: hidden;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  color: var(--text-primary);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.context-menu-item:hover { background: var(--bg-hover); color: var(--accent); }
.context-menu-item.danger:hover { background: rgba(244,67,54,0.1); color: var(--error); }

.context-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* 图层拖拽状态 */
.layer-item.drag-over {
  border-color: var(--accent);
  background: var(--accent-light);
}

/* 渐变生成状态 */
.generating-pulse {
  animation: generating-pulse 1s ease-in-out infinite;
}

@keyframes generating-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* 空状态 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px 12px;
  color: var(--text-muted);
  text-align: center;
}

.empty-state-icon { font-size: 28px; opacity: 0.5; }
.empty-state-text { font-size: 12px; line-height: 1.5; }
.empty-state-action {
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  padding: 5px 14px;
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 4px;
}
.empty-state-action:hover { background: var(--accent); color: #fff; }

/* 拖放区域高亮 */
.drop-zone-active {
  border-color: var(--accent) !important;
  background: var(--accent-light) !important;
}

/* 工具提示 */
[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 2000;
}

/* 快速操作条 */
.quick-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
}

.quick-action-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
}

.quick-action-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

/* 分隔线 */
.divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

/* 标签 */
.badge {
  display: inline-flex;
  align-items: center;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: var(--radius-lg);
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
}

.badge.new { background: rgba(76, 175, 80, 0.15); color: var(--success); }
.badge.hot { background: rgba(255, 152, 0, 0.15); color: var(--warning); }

/* 进度条组件 */
.progress-bar {
  height: 3px;
  background: var(--bg-card);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* 素材上传后的预览 */
.uploaded-material {
  position: relative;
}

.uploaded-material .delete-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  background: var(--error);
  color: #fff;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 10px;
}

.uploaded-material:hover .delete-btn { display: flex; }

/* 选中对象的快速工具条 */
.object-quick-toolbar {
  position: absolute;
  top: -36px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  box-shadow: var(--shadow);
  z-index: 100;
}

.object-quick-btn {
  width: 24px;
  height: 24px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-secondary);
  transition: var(--transition);
}

.object-quick-btn:hover { background: var(--accent-light); color: var(--accent); }

/* ===================================================
   素材库面板 (panel-materials)
   =================================================== */

/* 面板通用顶栏扩展 */
.panel-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  line-height: 1;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--accent); border-color: var(--accent-border); }

/* 搜索行 */
.material-search-row {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  transition: var(--transition);
}
.search-box:focus-within {
  border-color: var(--accent-border);
  background: var(--bg-card);
}

.search-icon { color: var(--text-muted); flex-shrink: 0; }

.search-input-inner {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 12px;
  color: var(--text-primary);
}
.search-input-inner::placeholder { color: var(--text-muted); }

.search-clear-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  transition: var(--transition);
}
.search-clear-btn:hover { color: var(--text-primary); }

/* 主类型 Tabs（全部 / 我的 / 内置） */
.mat-type-tabs {
  display: flex;
  gap: 0;
  padding: 8px 10px 0;
  border-bottom: 1px solid var(--border);
}

.mat-type-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 4px 8px;
  font-size: 11px;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition);
}
.mat-type-btn:hover { color: var(--text-secondary); }
.mat-type-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.mat-type-icon { font-size: 16px; line-height: 1; }

/* 细分类横向滚动条 */
.mat-cat-bar {
  display: flex;
  gap: 5px;
  padding: 8px 10px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}
.mat-cat-bar::-webkit-scrollbar { display: none; }

.mat-cat-chip {
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 3px 10px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.mat-cat-chip:hover { border-color: var(--accent-border); color: var(--accent); }
.mat-cat-chip.active {
  background: var(--accent-light);
  border-color: var(--accent-border);
  color: var(--accent);
  font-weight: 600;
}

/* 排序 & 视图切换工具栏 */
.mat-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 10px;
  border-bottom: 1px solid var(--border);
}

.mat-sort-select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 6px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
}
.mat-sort-select:focus { border-color: var(--accent-border); }

.view-toggle {
  display: flex;
  gap: 2px;
}

.view-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}
.view-btn:hover { color: var(--text-primary); }
.view-btn.active { background: var(--accent-light); border-color: var(--accent-border); color: var(--accent); }

/* 拖放上传区 */
.mat-dropzone {
  margin: 8px 10px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-tertiary);
  transition: var(--transition);
  cursor: pointer;
}
.mat-dropzone:hover,
.mat-dropzone.drag-active {
  border-color: var(--accent);
  background: var(--accent-light);
}

.mat-dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 12px;
  text-align: center;
}

.dropzone-title {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.dropzone-hint {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.4;
}

.dropzone-btn {
  display: inline-block;
  margin-top: 6px;
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
  padding: 4px 12px;
  font-size: 11px;
  cursor: pointer;
  transition: var(--transition);
}
.dropzone-btn:hover { background: var(--accent); color: #fff; }

/* 素材分区标签行 */
.mat-section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mat-count {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1px 6px;
  font-size: 10px;
  color: var(--text-muted);
  font-weight: normal;
}

/* 素材网格（覆盖旧样式） */
.material-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  padding: 4px 10px 10px;
  overflow-y: auto;
  max-height: 260px;
}

/* 列表视图 */
.material-grid.list-view {
  grid-template-columns: 1fr;
  max-height: 260px;
}

.mat-item {
  position: relative;
  aspect-ratio: 1;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  group: true;
}
.mat-item:hover { border-color: var(--accent); transform: scale(1.03); box-shadow: 0 4px 12px rgba(124,92,252,0.25); }
.mat-item.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-border); }

.mat-item img, .mat-item canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* SVG/图标素材 */
.mat-item.icon-type {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  font-size: 28px;
}

/* 素材悬浮操作层 */
.mat-item-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.mat-item:hover .mat-item-overlay { opacity: 1; }

.mat-overlay-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 10px;
  color: #fff;
  cursor: pointer;
  transition: var(--transition);
  backdrop-filter: blur(4px);
}
.mat-overlay-btn:hover { background: var(--accent); border-color: var(--accent); }
.mat-overlay-btn.danger:hover { background: var(--error); border-color: var(--error); }

/* 列表视图的素材项 */
.material-grid.list-view .mat-item {
  aspect-ratio: unset;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  height: 48px;
  border-radius: var(--radius-sm);
}
.material-grid.list-view .mat-item img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.material-grid.list-view .mat-item-name {
  flex: 1;
  font-size: 11px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.material-grid.list-view .mat-item-overlay { display: none; }

/* 我的上传素材标记 */
.mat-item .mat-badge-my {
  position: absolute;
  top: 3px;
  left: 3px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 1px 4px;
  font-size: 9px;
  line-height: 1.4;
  font-weight: 600;
  pointer-events: none;
}

.mat-item .mat-delete-btn {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  background: var(--error);
  color: #fff;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  line-height: 1;
  font-weight: bold;
  cursor: pointer;
  transition: var(--transition);
  z-index: 2;
}
.mat-item:hover .mat-delete-btn { display: flex; }

/* 加载更多 */
.mat-load-more {
  display: flex;
  justify-content: center;
  padding: 8px 10px;
}
.load-more-btn {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}
.load-more-btn:hover { background: var(--bg-hover); color: var(--accent); }


/* ===================================================
   贴纸面板 (panel-stickers)
   =================================================== */

/* 最近使用区 */
.sticker-recent-section {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}

.sticker-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.section-clear-btn {
  background: none;
  border: none;
  font-size: 10px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 1px 4px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.section-clear-btn:hover { color: var(--error); background: rgba(244,67,54,0.1); }

.sticker-recent-row {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  min-height: 36px;
  align-items: center;
}
.sticker-recent-row::-webkit-scrollbar { display: none; }

.sticker-empty-recent {
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 0;
}

.sticker-recent-item {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 20px;
  cursor: pointer;
  transition: var(--transition);
}
.sticker-recent-item:hover { border-color: var(--accent); transform: scale(1.1); }

/* 分类标签横向滚动 */
.sticker-cat-bar {
  display: flex;
  gap: 5px;
  padding: 8px 10px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}
.sticker-cat-bar::-webkit-scrollbar { display: none; }

.sticker-cat-chip {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 3px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 3px 10px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.sticker-cat-chip:hover { border-color: var(--accent-border); color: var(--accent); }
.sticker-cat-chip.active {
  background: var(--accent-light);
  border-color: var(--accent-border);
  color: var(--accent);
  font-weight: 600;
}
.sticker-cat-chip span:first-child { font-size: 13px; line-height: 1; }

/* 贴纸数量标签栏 */
.sticker-count-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 10px;
  font-size: 11px;
}
.sticker-count-label { color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.sticker-count-num {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1px 7px;
  font-size: 10px;
  color: var(--text-muted);
}

/* 贴纸网格 */
.sticker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  padding: 4px 10px 8px;
  overflow-y: auto;
  max-height: 280px;
}

.sticker-item {
  aspect-ratio: 1;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  position: relative;
  user-select: none;
}
.sticker-item:hover { border-color: var(--accent); transform: scale(1.08); box-shadow: 0 4px 12px rgba(124,92,252,0.25); }
.sticker-item:active { transform: scale(0.96); }

/* 贴纸悬浮工具提示 */
.sticker-item[data-name]:hover::after {
  content: attr(data-name);
  position: absolute;
  bottom: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 200;
}

/* 热门贴纸标记 */
.sticker-item .hot-mark {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  background: linear-gradient(135deg,#ff6b35,#f7c948);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  line-height: 1;
}

/* 贴纸加载骨架 */
.sticker-skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* 贴纸上传区 */
.sticker-upload-area {
  margin: 6px 10px 10px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-tertiary);
  transition: var(--transition);
}
.sticker-upload-area:hover { border-color: var(--accent-border); background: var(--accent-light); }

.sticker-upload-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
}

.sticker-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.sticker-upload-btn:hover { background: var(--accent); color: #fff; }

.sticker-upload-hint {
  font-size: 10px;
  color: var(--text-muted);
}

/* 贴纸搜索无结果 */
.sticker-no-results, .mat-no-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 24px 12px;
  color: var(--text-muted);
  text-align: center;
  grid-column: 1 / -1;
}
.sticker-no-results .no-result-icon, .mat-no-results .no-result-icon { font-size: 28px; opacity: 0.5; }
.sticker-no-results .no-result-text, .mat-no-results .no-result-text { font-size: 12px; }

/* tab-panel 内容区滚动优化 */
#panel-materials, #panel-stickers {
  overflow-y: auto;
  overflow-x: hidden;
}
