/* ==================== 世界书页面 - 简洁现代化风格 ==================== */

.worldbook-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0; /* sidebar-content已有padding，这里不需要 */
  gap: 8px;
  background: var(--color-bg-primary);
  overflow-y: auto;
}

/* ==================== 全局世界书区域 - SillyTavern 风格 ==================== */
.global-books-display {
  padding: 8px;
  background: var(--color-bg-secondary);
  border-radius: 6px;
  border: 1px solid var(--color-border);
}

.global-books-header {
  display: flex;
  align-items: center;
  padding: 6px 8px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--color-border-light);
}

.global-books-header .title-text {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.global-books-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  /* 使用 line-height 控制行高,更灵活 */
  max-height: calc(2.4em + 6px); /* 两行 (1.2em × 2) + gap */
  overflow-x: auto;
  overflow-y: hidden;
  align-content: flex-start;
  padding-bottom: 4px;
}

/* 自定义滚动条样式 */
.global-books-list::-webkit-scrollbar {
  height: 4px;
}

.global-books-list::-webkit-scrollbar-track {
  background: var(--color-bg-tertiary);
  border-radius: 2px;
}

.global-books-list::-webkit-scrollbar-thumb {
  background: var(--color-scrollbar);
  border-radius: 2px;
  transition: all 0.2s ease;
}

.global-books-list::-webkit-scrollbar-thumb:hover {
  background: var(--color-scrollbar-hover);
}

.global-book-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-size: 11px;
  line-height: 1.2; /* 设置行高,用于父容器计算 */
  color: var(--color-text-primary);
  transition: all 0.15s ease;
  cursor: default;
  white-space: nowrap;
}

.global-book-item:hover {
  border-color: var(--color-accent);
  background: var(--color-accent-light);
}

.global-book-name {
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 10px;
  border-radius: 2px;
  transition: all 0.15s ease;
  line-height: 1;
  flex-shrink: 0;
}

.btn-icon:hover {
  background: var(--color-danger);
  color: white;
}

.no-global-books {
  font-size: 11px;
  color: var(--color-text-muted);
  text-align: center;
  padding: 8px;
  font-style: italic;
}

/* ==================== 世界书管理区域 ==================== */
.worldbook-management {
  background: var(--color-bg-secondary);
  border-radius: 4px;
  border: 1px solid var(--color-border-light);
  overflow: hidden;
  margin-top: 8px; /* 与全局世界书保持间距 */
  position: relative; /* 确保正常文档流 */
  z-index: var(--z-base-content); /* ✅ 基础内容层 */
  /* 最小高度 = header(33px) + actions(37px) + selector(37px) + entries最小内容(约200px) */
  min-height: 307px;
  display: flex;
  flex-direction: column;
}

.worldbook-header {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: var(--color-bg-tertiary);
  border-bottom: 1px solid var(--color-border-light);
}

.worldbook-header .title-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-primary);
}

/* 操作按钮组 */
.worldbook-actions {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border-light);
}

.action-btn {
  padding: 6px 12px;
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  color: var(--color-text-secondary);
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s ease;
  font-weight: 500;
  flex: 1;
  min-width: 70px;
}

.action-btn:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: white;
}

.action-btn:active {
  transform: scale(0.98);
}

/* ✅ 排序按钮 - 仿照预设的操作按钮 */
.sort-toggle-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  color: var(--color-text-secondary);
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.sort-toggle-btn:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: white;
  transform: translateY(-1px);
}

.sort-toggle-btn:active {
  transform: scale(0.95) translateY(0);
}

/* 世界书选择区域 */
.worldbook-selector {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  align-items: center;
  border-bottom: 1px solid var(--color-border-light);
}

.dropdown {
  position: relative;
  flex: 1;
}

.dropdown-btn {
  width: 100%;
  padding: 6px 10px;
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  color: var(--color-text-primary);
  cursor: pointer;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  transition: all 0.15s ease;
  font-weight: 500;
}

.dropdown-btn:hover {
  border-color: var(--color-accent);
}

.dropdown-btn:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-accent-light);
}

.dropdown-menu {
  position: fixed;
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  margin-top: 4px;
  max-height: 200px;
  overflow-y: auto;
  z-index: var(--z-dropdown-menu); /* ✅ 组件层 - 下拉菜单 */
  box-shadow: var(--shadow-md);
}

.dropdown-item {
  padding: 6px 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 12px;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border-light);
}

.dropdown-item:last-child {
  border-bottom: none;
}

.dropdown-item:hover {
  background: var(--color-bg-tertiary);
}

.dropdown-item.active {
  background: var(--color-accent-light);
  color: var(--color-accent);
  font-weight: 600;
}

/* ✅ 世界书下拉菜单项内容布局 */
.dropdown-item-content {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.global-checkbox {
  cursor: pointer;
  flex-shrink: 0;
}

.book-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.current-indicator {
  color: var(--color-accent);
  font-weight: bold;
  font-size: 14px;
  flex-shrink: 0;
}

/* ==================== 条目列表区域 ==================== */
.entries-container {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
}

/* 分页控制栏 */
.pagination-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--color-border-light);
  margin-bottom: 6px;
}

.pagination-info {
  font-size: 11px;
  color: var(--color-text-muted);
  font-weight: 500;
}

/* ✅ 页码跳转容器 */
.page-jump-container {
  display: flex;
  gap: 4px;
  align-items: center;
}

.page-jump-input {
  width: 50px;
  padding: 4px 6px;
  font-size: 11px;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  text-align: center;
  outline: none;
  transition: all 0.15s ease;
}

.page-jump-input:hover {
  border-color: var(--color-accent);
}

.page-jump-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-accent-light);
}

.btn-jump {
  padding: 4px 8px;
  font-size: 11px;
  min-width: 40px;
}

.page-size-select {
  padding: 3px 6px;
  font-size: 11px;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  cursor: pointer;
  outline: none;
  transition: all 0.15s ease;
}

.page-size-select:hover {
  border-color: var(--color-accent);
}

.page-size-select:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-accent-light);
}

/* 新版紧凑条目样式 */
.entry-item-compact {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 40px; /* ✅ 减小高度，单行显示 */
}

.entry-item-compact:hover {
  border-color: var(--color-accent);
  background: var(--color-bg-tertiary);
}

.entry-item-compact.active {
  background: var(--color-accent-light);
  border-color: var(--color-accent);
  border-left: 2px solid var(--color-accent);
}

.entry-item-compact.disabled {
  opacity: 0.6;
}

/* 单行布局容器 */
.entry-row-single {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  overflow: hidden;
}

.entry-name-compact {
  flex: 1; /* ✅ 占据剩余空间 */
  font-weight: 500;
  font-size: 12px;
  color: var(--color-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.2px;
  min-width: 0;
}

/* Token数量（仅数字）- 固定宽度容纳6位数字 */
.entry-tokens-inline {
  font-size: 10px;
  color: var(--color-text-muted);
  font-weight: 600;
  padding: 2px 5px;
  background: var(--color-bg-tertiary);
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
  width: 45px; /* ✅ 固定宽度，可容纳6位数字 */
  text-align: right; /* ✅ 右对齐数字 */
}

/* 内联位置下拉框 - 固定在右侧 */
.position-select-inline {
  padding: 2px 4px;
  font-size: 10px;
  color: var(--color-text-secondary);
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  cursor: pointer;
  outline: none;
  transition: all 0.15s ease;
  width: 70px; /* ✅ 去掉箭头后更窄 */
  flex-shrink: 0;
  appearance: none; /* ✅ 隐藏默认箭头 */
  -webkit-appearance: none;
  -moz-appearance: none;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
}

.position-select-inline:hover {
  border-color: var(--color-accent);
}

.position-select-inline:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-accent-light);
}

/* 状态指示器 - 小圆点 - 固定在右侧（点击切换启用/禁用） */
.status-dot {
  width: 12px; /* ✅ 稍微大一点，更容易点击 */
  height: 12px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.3); /* ✅ 更明显的边框 */
}

.status-dot.enabled {
  background: #10b981; /* 绿色 - 启用 */
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5); /* ✅ 更强的发光 */
}

.status-dot.enabled:hover {
  background: #059669;
  transform: scale(1.3); /* ✅ 更大的放大效果 */
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.7);
}

.status-dot.enabled:active {
  transform: scale(1.1);
}

.status-dot.disabled {
  background: #6b7280; /* 灰色 - 禁用 */
  opacity: 0.4;
  border-color: rgba(255, 255, 255, 0.2);
}

.status-dot.disabled:hover {
  background: #4b5563;
  opacity: 0.7;
  transform: scale(1.3);
  border-color: rgba(255, 255, 255, 0.4);
}

.status-dot.disabled:active {
  transform: scale(1.1);
}

/* 分页导航 */
.pagination-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  margin-top: 6px;
  border-top: 1px solid var(--color-border-light);
}

.page-btn {
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-accent);
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.page-btn:hover:not(:disabled) {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: white;
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-indicator {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-primary);
  padding: 3px 10px;
  background: var(--color-bg-tertiary);
  border-radius: 3px;
}

/* 加载和错误状态 */
.loading, .error {
  padding: 12px;
  text-align: center;
  font-size: 12px;
  color: var(--color-text-muted);
}

.error {
  color: var(--color-danger);
}

/* 添加条目按钮 */
.entries-container > .btn.btn-primary {
  margin-top: 6px;
  width: 100%;
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
  background: var(--color-accent);
  border: none;
  border-radius: 4px;
  color: white;
  cursor: pointer;
  transition: all 0.15s ease;
}

.entries-container > .btn.btn-primary:hover {
  background: var(--color-accent-dark);
}

.entries-container > .btn.btn-primary:active {
  transform: scale(0.98);
}

/* 删除按钮 */
.btn.btn-danger {
  padding: 6px 12px;
  background: var(--color-danger);
  border: none;
  border-radius: 4px;
  color: white;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.btn.btn-danger:hover {
  background: var(--color-danger-dark);
}

.btn.btn-danger:active {
  transform: scale(0.98);
}

/* ==================== 响应式设计 ==================== */

/* 小屏幕 (< 768px) */
@media (max-width: 768px) {
  .worldbook-content {
    padding: 6px;
    gap: 6px;
  }

  .worldbook-actions {
    flex-wrap: wrap;
  }

  .action-btn {
    min-width: calc(50% - 3px);
  }

  .global-book-name-compact {
    max-width: 80px;
  }

  .entry-name-compact {
    font-size: 11px;
  }
}

/* 中等屏幕 (768px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  .worldbook-content {
    padding: 8px;
  }

  .global-book-name-compact {
    max-width: 120px;
  }
}

/* 大屏幕 (> 1024px) */
@media (min-width: 1025px) {
  .worldbook-content {
    padding: 10px;
    gap: 8px;
  }

  .global-book-name-compact {
    max-width: 150px;
  }
}

/* ==================== 编辑面板样式 (保持不变) ==================== */
.edit-panel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.3); /* ✅ 降低透明度，不使用模糊 */
  /* backdrop-filter: blur(4px); */ /* ✅ 移除模糊效果，允许操作旁边区域 */
  z-index: var(--z-edit-panel-overlay); /* ✅ 弹窗层 - 遮罩 */
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  pointer-events: none; /* ✅ 允许点击穿透到下层元素 */
}

.edit-panel-overlay.open {
  opacity: 1;
  visibility: visible;
}

.edit-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: 90vw;
  max-width: 1200px;
  height: 85vh;
  max-height: 900px;
  background: var(--color-bg-primary);
  z-index: var(--z-edit-panel-content); /* ✅ 弹窗层 - 编辑面板 */
  padding: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
}

.edit-panel.open {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  visibility: visible;
}

.edit-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-border);
  background: linear-gradient(135deg, var(--color-bg-secondary) 0%, var(--color-bg-tertiary) 100%);
  flex-shrink: 0;
}

.edit-panel-header h2 {
  font-size: 18px;
  color: var(--color-text-primary);
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.saving-indicator {
  font-size: 12px;
  color: var(--color-accent);
  font-weight: 500;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s ease;
}

.close-btn:hover {
  background: var(--color-danger-light);
  border-color: var(--color-danger);
  color: var(--color-danger);
  transform: rotate(90deg);
}

.edit-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* 美化滚动条 */
.edit-panel-content::-webkit-scrollbar {
  width: 8px;
}

.edit-panel-content::-webkit-scrollbar-track {
  background: var(--color-bg-secondary);
  border-radius: 4px;
}

.edit-panel-content::-webkit-scrollbar-thumb {
  background: var(--color-scrollbar);
  border-radius: 4px;
  transition: all 0.2s ease;
}

.edit-panel-content::-webkit-scrollbar-thumb:hover {
  background: var(--color-scrollbar-hover);
}

.form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: stretch; /* ✅ 确保所有子元素高度一致 */
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.compact {
  flex: 1;
  min-width: 150px;
  display: flex;
  flex-direction: column;
}

/* ✅ 统一输入框和选择框的高度 */
.form-input {
  padding: 9px 12px;
  font-size: 13px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  transition: all 0.2s ease;
  height: 38px; /* ✅ 固定高度 */
  line-height: 1.4;
  box-sizing: border-box;
}

.form-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
  display: block;
  margin-bottom: 2px;
}

.form-input:hover {
  border-color: var(--color-accent-light);
}

.form-input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-light);
  transform: translateY(-1px);
}

/* select 特殊优化 */
select.form-input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.content-textarea {
  flex: 1;
  min-height: 250px;
  resize: vertical;
  line-height: 1.8;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 13px;
}

.trigger-config-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 12px;
}

.trigger-selector {
  flex: 0 0 auto;
  min-width: 160px;
  max-width: 200px;
}

.trigger-selector .form-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  display: block;
}

.trigger-config-panel {
  flex: 1;
  min-width: 300px;
  padding-left: 12px;
  border-left: 2px solid var(--color-border-light);
}

.keyword-config {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ✅ 编辑面板底部操作栏 */
.edit-panel-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--color-border);
  background: linear-gradient(135deg, var(--color-bg-secondary) 0%, var(--color-bg-tertiary) 100%);
  flex-shrink: 0;
}

.edit-panel-footer .btn {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.edit-panel-footer .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.edit-panel-footer .btn:active {
  transform: translateY(0);
}

/* ✅ 条件触发配置样式 */
.condition-config {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 条件块样式 */
.condition-block {
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 12px;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.condition-block:hover {
  border-color: var(--color-accent);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
  transform: translateY(-1px);
}

.condition-header {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border-light);
}

.condition-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.condition-label::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 12px;
  background: var(--color-accent);
  border-radius: 2px;
}

.condition-fields {
  display: flex;
  gap: 8px;
  align-items: center;
}

.condition-fields .form-input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  font-size: 12px;
  height: 36px;
}

.condition-fields select.form-input {
  flex: 0 0 auto;
  min-width: 95px;
  max-width: 110px;
}

/* 条件预览 */
.condition-preview {
  background: linear-gradient(135deg, var(--color-accent-ultra-light) 0%, rgba(102, 126, 234, 0.05) 100%);
  border: 1px solid var(--color-accent-light);
  border-left: 3px solid var(--color-accent);
  border-radius: 6px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
}

.preview-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-secondary);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}

.preview-label::before {
  content: '📋';
  font-size: 12px;
}

.preview-code {
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 12px;
  color: var(--color-accent);
  font-weight: 600;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.5);
  padding: 4px 8px;
  border-radius: 4px;
}

/* ==================== 分页控件样式 ==================== */
.pagination-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  margin-top: 8px;
  border-top: 1px solid var(--color-border-light);
}

.pagination-info {
  font-size: 12px;
  color: var(--color-text-secondary);
  font-weight: 500;
}

.pagination-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-pagination {
  padding: 6px 12px;
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  color: var(--color-text-primary);
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s ease;
  font-weight: 500;
}

.btn-pagination:hover:not(:disabled) {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: white;
}

.btn-pagination:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.page-size-select {
  padding: 6px 10px;
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  color: var(--color-text-primary);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.page-size-select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-accent-light);
}

/* ✅ 排序下拉菜单 - 仿照预设的操作下拉菜单 */
.sort-dropdown-menu {
  position: fixed;
  margin-top: 4px;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  box-shadow: var(--shadow-lg);
  z-index: var(--z-sort-panel); /* ✅ 组件层 - 排序面板 */
  min-width: 160px;
  padding: 4px;
}

.sort-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sort-label {
  font-size: 10px;
  color: var(--color-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 8px 2px;
}

.sort-option {
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sort-option:hover {
  background: var(--color-bg-tertiary);
  color: var(--color-text-primary);
}

.sort-option.active {
  background: var(--color-accent-light);
  color: var(--color-accent);
  font-weight: 600;
}

.sort-divider {
  height: 1px;
  background: var(--color-border-light);
  margin: 4px 0;
}

.sort-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  border-radius: 4px;
}

.sort-checkbox-label:hover {
  background: var(--color-bg-tertiary);
  color: var(--color-text-primary);
}

.sort-checkbox-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: var(--color-accent);
}
