/*
  ChangoPaperQuery 视觉系统 2.0
  版本: 20260101_v11 - 文献详情全屏优化：浅米黄背景、全屏布局、按钮移至DOI右侧
*/

:root {
  --cpq-primary: #0d6efd;
  --cpq-sidebar-width: 160px;
  --cpq-right-width: 320px;
  --cpq-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --cpq-border-radius: 8px;
}

/* ========== 全宽布局：解除 base.html 的 main.container 限制 ========== */
main.cpq-host-main {
  max-width: 100% !important;
  width: 100% !important;
  padding-left: 12px !important;
  padding-right: 12px !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* --- 三主题适配变量 --- */
.mode-light .paper-query-page {
  --cpq-card-bg: rgba(255, 255, 255, 0.9);
  --cpq-border: rgba(0, 0, 0, 0.08);
  --cpq-text: #212529;
  --cpq-text-muted: #6c757d;
  --cpq-accent: #0d6efd;
  --cpq-hover: rgba(13, 110, 253, 0.05);
}

.mode-dark .paper-query-page {
  --cpq-card-bg: rgba(30, 30, 30, 0.8);
  --cpq-border: rgba(255, 255, 255, 0.1);
  --cpq-text: #e9ecef;
  --cpq-text-muted: #adb5bd;
  --cpq-accent: #3d8bfd;
  --cpq-hover: rgba(255, 255, 255, 0.05);
}

.mode-scifi .paper-query-page {
  --cpq-card-bg: rgba(10, 25, 41, 0.7);
  --cpq-border: rgba(0, 243, 255, 0.2);
  --cpq-text: #00f3ff;
  --cpq-text-muted: rgba(0, 243, 255, 0.6);
  --cpq-accent: #00f3ff;
  --cpq-hover: rgba(0, 243, 255, 0.1);
  --cpq-glow: 0 0 10px rgba(0, 243, 255, 0.3);
}

.mode-scifi .paper-query-page .form-select,
.mode-scifi .paper-query-page .form-control {
  background: rgba(10, 25, 41, 0.9) !important;
  color: #e6f4ff !important;
  border: 1px solid rgba(0, 243, 255, 0.25) !important;
  box-shadow: inset 0 0 8px rgba(0, 243, 255, 0.12);
}

.mode-scifi .paper-query-page .form-select option {
  background: rgba(10, 25, 41, 0.95);
  color: #e6f4ff;
}

.mode-scifi .paper-query-page .form-control::placeholder {
  color: rgba(230, 244, 255, 0.6);
}

.mode-scifi .paper-query-page .form-check-input {
  background-color: rgba(10, 25, 41, 0.9);
  border-color: rgba(0, 243, 255, 0.5);
  box-shadow: 0 0 6px rgba(0, 243, 255, 0.2);
}

.mode-scifi .paper-query-page .text-muted {
  color: rgba(230, 244, 255, 0.7) !important;
}

.mode-scifi .paper-query-page #cpqDetailKeywords {
  padding: 6px;
  background: rgba(10, 25, 41, 0.6);
  border-radius: 8px;
}

.mode-scifi .paper-query-page #cpqDetailKeywords .badge {
  background: rgba(0, 243, 255, 0.12) !important;
  color: #e6f4ff !important;
  border: 1px solid rgba(0, 243, 255, 0.35) !important;
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.25);
}

.paper-query-page {
  color: var(--cpq-text);
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
}

/* 玻璃拟态卡片 */
.cpq-glass-card {
  background: var(--cpq-card-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--cpq-border);
  border-radius: var(--cpq-border-radius);
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
  transition: var(--cpq-transition);
  display: flex;
  flex-direction: column;
}

.mode-scifi .cpq-glass-card { box-shadow: var(--cpq-glow); }

/* 主布局 - 高度增加100% */
.cpq-main-layout {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  align-items: stretch;
  height: calc(200vh - 220px); /* 从 100vh 改为 200vh，增加100% */
  max-height: none; /* 移除最大高度限制 */
}

/* 左侧历史侧边栏 - 极致紧凑 */
.cpq-history-sidebar {
  width: var(--cpq-sidebar-width);
  transition: var(--cpq-transition);
  flex-shrink: 0;
}

.cpq-history-sidebar.collapsed {
  width: 0;
  margin-right: -12px;
  opacity: 0;
  pointer-events: none;
}

.cpq-history-list {
  flex-grow: 1;
  overflow-y: auto;
}

.cpq-history-item {
  padding: 6px 8px !important;
  font-size: 0.75rem;
  border-bottom: 1px solid var(--cpq-border) !important;
  background: transparent !important;
  color: var(--cpq-text) !important;
  cursor: pointer;
}

.cpq-history-item:hover { background: var(--cpq-hover) !important; }

/* 展开历史的浮动条 */
.cpq-history-toggle-strip {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 60px;
  background: var(--cpq-card-bg);
  border: 1px solid var(--cpq-border);
  border-left: none;
  border-radius: 0 8px 8px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 100;
  box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

/* 右侧侧边栏 - 改为自适应高度 */
.cpq-right-sidebar {
  width: var(--cpq-right-width);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  align-self: flex-start; /* 改为从顶部开始 */
  position: sticky; /* 添加粘性定位 */
  top: 12px; /* 距离顶部12px */
  max-height: calc(100vh - 24px); /* 最大高度为视口高度减去间距 */
}

/* 文献详情卡片 - 浮动高度，自适应内容 */
.cpq-detail-card {
  padding: 12px;
  max-height: calc(100vh - 24px); /* 最大高度限制 */
  overflow-y: auto; /* 内容过多时滚动 */
  display: flex;
  flex-direction: column;
}

/* 文献详情内容区域 - 自适应高度 */
.cpq-detail-content {
  flex: 1;
  overflow-y: auto;
  max-height: calc(100vh - 200px); /* 预留标题和按钮空间 */
}

/* 表格优化 */
.cpq-main-content {
  flex-grow: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.table-container {
  flex-grow: 1;
  overflow-y: auto;
}

.table { color: var(--cpq-text) !important; margin-bottom: 0; }
.table thead th { 
  font-size: 0.75rem; 
  background: var(--cpq-card-bg) !important; 
  border-bottom: 2px solid var(--cpq-border) !important;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.cpq-row:hover { background: var(--cpq-hover) !important; }

/* ==================== 文献选中状态样式（v10新增）==================== */

/* 被勾选的文献行 - 轻微的背景色变化 */
.cpq-row.cpq-row-checked {
  background: rgba(255, 193, 7, 0.08) !important;
  border-left: 2px solid rgba(255, 193, 7, 0.6);
}

.cpq-row.cpq-row-checked:hover {
  background: rgba(255, 193, 7, 0.12) !important;
}

/* 当前激活的文献行（显示详情的）- 轻微的左边框 */
.cpq-row.cpq-row-active {
  background: rgba(13, 110, 253, 0.06) !important;
  border-left: 3px solid var(--cpq-accent);
}

.cpq-row.cpq-row-active:hover {
  background: rgba(13, 110, 253, 0.1) !important;
}

/* 同时被勾选和激活的行 */
.cpq-row.cpq-row-checked.cpq-row-active {
  background: rgba(13, 110, 253, 0.08) !important;
  border-left: 3px solid var(--cpq-accent);
  box-shadow: inset 0 0 0 1px rgba(255, 193, 7, 0.3);
}

/* 浅色主题 */
.mode-light .cpq-row.cpq-row-checked {
  background: rgba(255, 193, 7, 0.1) !important;
  border-left: 2px solid rgba(255, 152, 0, 0.7);
}

.mode-light .cpq-row.cpq-row-checked:hover {
  background: rgba(255, 193, 7, 0.15) !important;
}

.mode-light .cpq-row.cpq-row-active {
  background: rgba(13, 110, 253, 0.08) !important;
  border-left: 3px solid #0d6efd;
}

.mode-light .cpq-row.cpq-row-active:hover {
  background: rgba(13, 110, 253, 0.12) !important;
}

/* 暗色主题 */
.mode-dark .cpq-row.cpq-row-checked,
[data-bs-theme="dark"] .cpq-row.cpq-row-checked {
  background: rgba(255, 193, 7, 0.1) !important;
  border-left: 2px solid rgba(255, 193, 7, 0.5);
}

.mode-dark .cpq-row.cpq-row-checked:hover,
[data-bs-theme="dark"] .cpq-row.cpq-row-checked:hover {
  background: rgba(255, 193, 7, 0.15) !important;
}

.mode-dark .cpq-row.cpq-row-active,
[data-bs-theme="dark"] .cpq-row.cpq-row-active {
  background: rgba(61, 139, 253, 0.12) !important;
  border-left: 3px solid #3d8bfd;
}

.mode-dark .cpq-row.cpq-row-active:hover,
[data-bs-theme="dark"] .cpq-row.cpq-row-active:hover {
  background: rgba(61, 139, 253, 0.18) !important;
}

/* 科幻主题 */
.mode-scifi .cpq-row.cpq-row-checked {
  background: rgba(0, 243, 255, 0.06) !important;
  border-left: 2px solid rgba(0, 243, 255, 0.4);
  box-shadow: inset 0 0 8px rgba(0, 243, 255, 0.08);
}

.mode-scifi .cpq-row.cpq-row-checked:hover {
  background: rgba(0, 243, 255, 0.1) !important;
}

.mode-scifi .cpq-row.cpq-row-active {
  background: rgba(0, 243, 255, 0.1) !important;
  border-left: 3px solid #00f3ff;
  box-shadow: inset 0 0 12px rgba(0, 243, 255, 0.1), 0 0 6px rgba(0, 243, 255, 0.15);
}

.mode-scifi .cpq-row.cpq-row-active:hover {
  background: rgba(0, 243, 255, 0.15) !important;
  box-shadow: inset 0 0 15px rgba(0, 243, 255, 0.12), 0 0 8px rgba(0, 243, 255, 0.2);
}

.mode-scifi .cpq-row.cpq-row-checked.cpq-row-active {
  background: rgba(0, 243, 255, 0.12) !important;
  border-left: 3px solid #00f3ff;
  box-shadow: inset 0 0 15px rgba(0, 243, 255, 0.12), 0 0 10px rgba(0, 243, 255, 0.25);
}

.cpq-abstract {
  font-size: 0.8rem;
  line-height: 1.4;
  background: rgba(0,0,0,0.03);
  padding: 8px;
  border-radius: 4px;
  max-height: none; /* 移除高度限制，改为自适应 */
  overflow-y: visible; /* 移除滚动条，自然显示 */
}

/* 科幻主题下的摘要背景 */
.mode-scifi .cpq-abstract {
  background: rgba(10, 25, 41, 0.6);
  border: 1px solid rgba(0, 243, 255, 0.2);
}

/* 分区徽标紧凑化 */
.badge-partition {
  padding: 2px 5px;
  font-size: 0.65rem;
  border-radius: 4px;
}

/* 按钮动画 */
.btn-modern {
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  transition: var(--cpq-transition);
}

.btn-modern:hover { transform: translateY(-1px); }

/* 额外检索项样式 */
.cpq-extra-keywords-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cpq-keyword-item {
  display: flex;
  align-items: center;
  gap: 6px;
  animation: cpqFadeIn 0.2s ease;
}

@keyframes cpqFadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

.cpq-keyword-item select {
  width: 80px;
  flex-shrink: 0;
}

.cpq-keyword-item input {
  flex: 1;
  min-width: 100px;
}

.cpq-keyword-item .btn-remove-keyword {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
}

/* 查询预览样式 - 主题适配 */
.cpq-query-preview {
  background: rgba(0, 0, 0, 0.03);
  color: #6c757d;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.cpq-query-preview code {
  color: #495057;
  background: rgba(0, 0, 0, 0.05);
  padding: 2px 4px;
  border-radius: 3px;
}

/* 浅色主题 - 查询预览 */
.mode-light .cpq-query-preview {
  background: #f8f9fa;
  color: #6c757d;
  border-color: rgba(0, 0, 0, 0.1);
}

.mode-light .cpq-query-preview code {
  color: #495057;
  background: rgba(0, 0, 0, 0.05);
}

/* 暗色主题 - 查询预览 */
.mode-dark .cpq-query-preview {
  background: rgba(255, 255, 255, 0.05);
  color: #adb5bd;
  border-color: rgba(255, 255, 255, 0.1);
}

.mode-dark .cpq-query-preview code {
  color: #e9ecef;
  background: rgba(255, 255, 255, 0.08);
}

/* 科幻主题 - 查询预览（重要修复）*/
.mode-scifi .cpq-query-preview {
  background: rgba(10, 25, 41, 0.85) !important;
  color: rgba(0, 243, 255, 0.9) !important;
  border: 1px solid rgba(0, 243, 255, 0.3) !important;
  box-shadow: inset 0 0 10px rgba(0, 243, 255, 0.1), 0 0 8px rgba(0, 243, 255, 0.15);
}

.mode-scifi .cpq-query-preview code {
  color: #e6f4ff !important;
  background: rgba(0, 243, 255, 0.12) !important;
  border: 1px solid rgba(0, 243, 255, 0.25);
  box-shadow: 0 0 6px rgba(0, 243, 255, 0.2);
}

.mode-scifi .cpq-query-preview .fas {
  color: #00f3ff;
  text-shadow: 0 0 8px rgba(0, 243, 255, 0.6);
}

/* 帮助图标样式 */
.cpq-help-icon {
  cursor: pointer;
  opacity: 0.6;
  transition: all 0.2s ease;
  font-size: 0.75rem;
  vertical-align: middle;
  margin-left: 3px;
}

.cpq-help-icon:hover {
  opacity: 1;
  transform: scale(1.15);
}

/* 帮助模态框样式 - 修复透明背景问题 */
#cpqHelpModal .modal-content {
  background: var(--bs-modal-bg, #fff) !important;
  backdrop-filter: none !important;
}

#cpqHelpModal .modal-body {
  max-height: 70vh;
  overflow-y: auto;
}

/* 帮助模态框卡片 - 适配主题 */
.cpq-help-card {
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  background: rgba(248, 249, 250, 0.95) !important;
  transition: transform 0.2s ease;
}

.cpq-help-card:hover {
  transform: translateY(-2px);
}

/* 帮助模态框表格 - 适配主题 */
.cpq-help-table {
  background: transparent;
}

.cpq-help-table thead th {
  background: rgba(0, 0, 0, 0.05);
  border-bottom: 2px solid rgba(0, 0, 0, 0.1);
}

/* Scopus 颜色 */
.text-purple {
  color: #6f42c1 !important;
}

/* ===== 暗色主题适配 ===== */
.mode-dark #cpqHelpModal .modal-content,
[data-bs-theme="dark"] #cpqHelpModal .modal-content {
  background: #1e1e2e !important;
  color: #e0e0e0;
}

.mode-dark #cpqHelpModal .modal-header,
[data-bs-theme="dark"] #cpqHelpModal .modal-header {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.mode-dark #cpqHelpModal p,
.mode-dark #cpqHelpModal span:not(.badge),
[data-bs-theme="dark"] #cpqHelpModal p,
[data-bs-theme="dark"] #cpqHelpModal span:not(.badge) {
  color: #c0c0c0;
}

.mode-dark .cpq-help-card,
[data-bs-theme="dark"] .cpq-help-card {
  background: rgba(30, 30, 46, 0.95) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

.mode-dark .cpq-help-card .card-title,
[data-bs-theme="dark"] .cpq-help-card .card-title {
  color: #e0e0e0 !important;
}

.mode-dark .cpq-help-table,
[data-bs-theme="dark"] .cpq-help-table {
  color: #e0e0e0;
}

.mode-dark .cpq-help-table thead th,
[data-bs-theme="dark"] .cpq-help-table thead th {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #fff !important;
  border-bottom-color: rgba(255, 255, 255, 0.15);
}

.mode-dark .cpq-help-table tbody td,
[data-bs-theme="dark"] .cpq-help-table tbody td {
  color: #c0c0c0;
  border-color: rgba(255, 255, 255, 0.08);
}

.mode-dark .cpq-help-table .table-active,
[data-bs-theme="dark"] .cpq-help-table .table-active {
  background: rgba(255, 255, 255, 0.05) !important;
  color: #e0e0e0 !important;
}

.mode-dark #cpqHelpModal .alert-info,
[data-bs-theme="dark"] #cpqHelpModal .alert-info {
  background: rgba(13, 110, 253, 0.15);
  border-color: rgba(13, 110, 253, 0.3);
  color: #8bb4f0;
}

.mode-dark #cpqHelpModal .alert-secondary,
[data-bs-theme="dark"] #cpqHelpModal .alert-secondary {
  background: rgba(108, 117, 125, 0.2);
  border-color: rgba(108, 117, 125, 0.3);
  color: #a0a0a0;
}

.mode-dark #cpqHelpModal .text-muted,
[data-bs-theme="dark"] #cpqHelpModal .text-muted {
  color: #888 !important;
}

/* ===== 浅色主题强化 ===== */
.mode-light #cpqHelpModal .modal-content,
[data-bs-theme="light"] #cpqHelpModal .modal-content {
  background: #ffffff !important;
}

.mode-light .cpq-help-card,
[data-bs-theme="light"] .cpq-help-card {
  background: #f8f9fa !important;
}

.mode-light .cpq-help-table thead th,
[data-bs-theme="light"] .cpq-help-table thead th {
  background: #e9ecef !important;
  color: #212529 !important;
}

/* ==================== 已选文献清单模态框样式（问题2和3修复）==================== */

/* 默认样式（白天主题）- 保持原有的橙黄色 */
.cpq-cart-modal-header {
  background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%) !important;
  border-bottom: none;
}

.cpq-cart-modal-header .modal-title {
  color: #212529 !important;
}

.cpq-cart-modal-badge {
  background: rgba(255, 255, 255, 0.9) !important;
  color: #212529 !important;
}

.cpq-cart-modal-actions {
  background: #f8f9fa !important;
}

/* 黑夜主题 - 深色背景 */
[data-bs-theme="dark"] .cpq-cart-modal-header {
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .cpq-cart-modal-header .modal-title {
  color: #ffffff !important;
}

[data-bs-theme="dark"] .cpq-cart-modal-badge {
  background: rgba(255, 193, 7, 0.2) !important;
  color: #ffc107 !important;
  border: 1px solid #ffc107;
}

[data-bs-theme="dark"] .cpq-cart-modal-close {
  filter: invert(1) brightness(2);
}

[data-bs-theme="dark"] .cpq-cart-modal-actions {
  background: #1a1a1a !important;
  border-bottom-color: rgba(255, 255, 255, 0.1) !important;
}

[data-bs-theme="dark"] .cpq-cart-modal {
  background: #212529 !important;
}

/* 科幻主题 - 深色背景 + 科幻光效 */
.mode-scifi .cpq-cart-modal-header {
  background: linear-gradient(135deg, 
    rgba(10, 25, 41, 0.95) 0%, 
    rgba(15, 35, 55, 0.95) 100%) !important;
  border-bottom: 1px solid rgba(0, 243, 255, 0.3);
  box-shadow: 0 2px 10px rgba(0, 243, 255, 0.2);
}

.mode-scifi .cpq-cart-modal-header .modal-title {
  color: #00f3ff !important;
  text-shadow: 0 0 10px rgba(0, 243, 255, 0.5);
}

.mode-scifi .cpq-cart-modal-badge {
  background: rgba(0, 243, 255, 0.15) !important;
  color: #00f3ff !important;
  border: 1px solid #00f3ff;
  box-shadow: 0 0 8px rgba(0, 243, 255, 0.4);
}

.mode-scifi .cpq-cart-modal-close {
  filter: brightness(0) saturate(100%) invert(75%) sepia(74%) saturate(2578%) hue-rotate(157deg) brightness(103%) contrast(101%);
}

.mode-scifi .cpq-cart-modal-actions {
  background: rgba(10, 25, 41, 0.6) !important;
  border-bottom: 1px solid rgba(0, 243, 255, 0.2) !important;
  backdrop-filter: blur(10px);
}

.mode-scifi .cpq-cart-modal {
  background: rgba(10, 25, 41, 0.95) !important;
  border: 1px solid rgba(0, 243, 255, 0.3);
}

.mode-scifi .cpq-cart-modal .modal-body {
  background: rgba(10, 25, 41, 0.8);
}

/* ==================== 摘要Tab样式（v7新增）==================== */

.cpq-abstract-tabs-header {
  padding-bottom: 8px;
  border-bottom: 2px solid var(--cpq-border) !important;
}

.cpq-abstract-tabs {
  display: flex;
  gap: 8px;
}

.cpq-abstract-tab {
  background: none;
  border: none;
  padding: 6px 12px;
  font-size: 0.8rem;
  color: var(--cpq-text);
  opacity: 0.6;
  cursor: pointer;
  border-radius: 4px 4px 0 0;
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
}

.cpq-abstract-tab:hover {
  opacity: 0.8;
  background: var(--cpq-hover);
}

.cpq-abstract-tab.active {
  opacity: 1;
  font-weight: 600;
  color: var(--cpq-accent);
  background: rgba(13, 110, 253, 0.1);
}

.cpq-abstract-tab.active::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--cpq-accent);
}

.cpq-tab-badge {
  color: #28a745;
  font-size: 0.7rem;
}

.cpq-abstract-tab-content {
  position: relative;
  min-height: 100px;
}

.cpq-abstract-pane {
  display: none;
  animation: cpqFadeIn 0.3s ease;
}

.cpq-abstract-pane.active {
  display: block;
}

@keyframes cpqFadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 黑夜主题 */
[data-bs-theme="dark"] .cpq-abstract-tab.active {
  background: rgba(13, 110, 253, 0.2);
  color: #4dabf7;
}

[data-bs-theme="dark"] .cpq-abstract-tab.active::after {
  background: #4dabf7;
}

/* 科幻主题 */
.mode-scifi .cpq-abstract-tab {
  color: rgba(0, 243, 255, 0.6);
}

.mode-scifi .cpq-abstract-tab:hover {
  background: rgba(0, 243, 255, 0.1);
  color: rgba(0, 243, 255, 0.8);
}

.mode-scifi .cpq-abstract-tab.active {
  color: #00f3ff;
  background: rgba(0, 243, 255, 0.15);
  text-shadow: 0 0 8px rgba(0, 243, 255, 0.4);
}

.mode-scifi .cpq-abstract-tab.active::after {
  background: #00f3ff;
  box-shadow: 0 0 8px rgba(0, 243, 255, 0.6);
}

.mode-scifi .cpq-tab-badge {
  color: #00f3ff;
}

/* ==================== 已选清单增强样式（v8新增）==================== */

/* 全屏模式 */
.cpq-cart-modal-fullscreen .modal-dialog {
  max-width: 100vw !important;
  margin: 0 !important;
  height: 100vh;
}

.cpq-cart-modal-fullscreen .modal-content {
  height: 100vh;
  border-radius: 0 !important;
}

.cpq-cart-modal-fullscreen .cpq-cart-enhanced-list {
  max-height: calc(100vh - 150px) !important;
}

/* 增强的清单列表 */
.cpq-cart-enhanced-list {
  max-height: 60vh;
  overflow-y: auto;
}

.cpq-cart-enhanced-item {
  padding: 16px !important;
  border-bottom: 1px solid var(--cpq-border) !important;
  transition: background 0.2s ease;
}

.cpq-cart-enhanced-item:hover {
  background: var(--cpq-hover) !important;
}

.cpq-cart-enhanced-item-header {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.cpq-cart-enhanced-item-content {
  flex: 1;
  min-width: 0;
}

.cpq-cart-enhanced-item-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 6px;
  color: var(--cpq-text);
}

.cpq-cart-enhanced-item-meta {
  font-size: 0.8rem;
  color: var(--cpq-text);
  opacity: 0.7;
  margin-bottom: 8px;
}

.cpq-cart-enhanced-item-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.cpq-cart-enhanced-item-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.cpq-cart-keyword-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 0.7rem;
  background: rgba(13, 110, 253, 0.1);
  color: var(--cpq-accent);
  border-radius: 12px;
  border: 1px solid rgba(13, 110, 253, 0.2);
}

.cpq-cart-enhanced-item-actions {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--cpq-border);
  flex-wrap: wrap;
}

.cpq-cart-action-btn {
  padding: 4px 10px;
  font-size: 0.75rem;
  border-radius: 4px;
  border: 1px solid var(--cpq-border);
  background: transparent;
  color: var(--cpq-text);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

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

.cpq-cart-action-btn.danger {
  color: #dc3545;
  border-color: #dc3545;
}

.cpq-cart-action-btn.danger:hover {
  background: rgba(220, 53, 69, 0.1);
}

/* 黑夜主题 */
[data-bs-theme="dark"] .cpq-cart-keyword-tag {
  background: rgba(66, 153, 225, 0.2);
  color: #4dabf7;
  border-color: rgba(66, 153, 225, 0.3);
}

/* 科幻主题 */
.mode-scifi .cpq-cart-keyword-tag {
  background: rgba(0, 243, 255, 0.1);
  color: #00f3ff;
  border-color: rgba(0, 243, 255, 0.3);
  box-shadow: 0 0 4px rgba(0, 243, 255, 0.2);
}

.mode-scifi .cpq-cart-action-btn:hover {
  background: rgba(0, 243, 255, 0.1);
  border-color: #00f3ff;
  color: #00f3ff;
  box-shadow: 0 0 8px rgba(0, 243, 255, 0.3);
}

/* ==================== 摘要模态框样式（v8新增）==================== */

.cpq-abstract-modal-tabs {
  padding: 0;
  background: var(--cpq-card-bg);
}

.cpq-abstract-modal-tab {
  flex: 1;
  padding: 12px 16px;
  border: none;
  background: none;
  color: var(--cpq-text);
  opacity: 0.6;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 3px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.cpq-abstract-modal-tab:hover {
  opacity: 0.8;
  background: var(--cpq-hover);
}

.cpq-abstract-modal-tab.active {
  opacity: 1;
  font-weight: 600;
  color: var(--cpq-accent);
  border-bottom-color: var(--cpq-accent);
}

.cpq-abstract-modal-cached {
  color: #28a745;
  font-size: 0.9rem;
}

.cpq-abstract-modal-translate {
  padding: 8px 12px;
}

.cpq-abstract-modal-content {
  min-height: 200px;
  max-height: 60vh;
  overflow-y: auto;
}

.cpq-abstract-modal-pane {
  display: none;
  animation: cpqFadeIn 0.3s ease;
}

.cpq-abstract-modal-pane.active {
  display: block;
}

.cpq-abstract-modal-text {
  line-height: 1.8;
  font-size: 0.9rem;
  color: var(--cpq-text);
  white-space: pre-wrap;
}

.cpq-abstract-modal-empty {
  display: none;
}

.cpq-abstract-modal-pane[data-pane="translated"] .cpq-abstract-modal-text:empty + .cpq-abstract-modal-empty {
  display: block;
}

/* 黑夜主题 */
[data-bs-theme="dark"] .cpq-abstract-modal-tab.active {
  color: #4dabf7;
  border-bottom-color: #4dabf7;
}

/* 科幻主题 */
.mode-scifi .cpq-abstract-modal-tab.active {
  color: #00f3ff;
  border-bottom-color: #00f3ff;
  text-shadow: 0 0 8px rgba(0, 243, 255, 0.4);
}

.mode-scifi .cpq-abstract-modal-cached {
  color: #00f3ff;
}

/* ==================== 文献详情全屏模态框样式（v9新增）==================== */

/* 全屏模态框对话框 */
#cpqFullDetailModal .modal-dialog {
  max-width: 100vw !important;
  width: 100vw !important;
  height: 100vh !important;
  margin: 0 !important;
}

/* 模态框整体 - 全屏 + 浅米黄色背景 */
.cpq-full-detail-modal {
  background: #fefcf3; /* 浅米黄色 */
  border-radius: 0;
  overflow: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 模态框头部 */
.cpq-full-detail-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-bottom: none;
  padding: 20px 32px;
}

.cpq-full-detail-icon {
  font-size: 1.5rem;
  color: white;
  opacity: 0.9;
}

.cpq-full-detail-header .modal-title {
  color: white;
  font-size: 1.2rem;
  font-weight: 600;
}

.cpq-full-detail-source-badge {
  background: rgba(255, 255, 255, 0.2) !important;
  color: white !important;
  font-size: 0.85rem;
  padding: 6px 14px;
  border-radius: 14px;
}

.cpq-full-detail-action-btn {
  color: white !important;
  opacity: 0.8;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.cpq-full-detail-action-btn:hover {
  opacity: 1;
  transform: scale(1.1);
}

.cpq-full-detail-close {
  filter: brightness(0) invert(1);
  opacity: 0.8;
}

.cpq-full-detail-close:hover {
  opacity: 1;
}

/* 标题区域 */
.cpq-full-detail-title-section {
  padding: 32px 48px 24px;
  background: linear-gradient(to bottom, rgba(102, 126, 234, 0.08), transparent);
}

.cpq-full-detail-title {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.6;
  color: var(--cpq-text);
  margin: 0;
}

/* 元信息区域 */
.cpq-full-detail-meta-section {
  padding: 0 48px 28px;
  border-bottom: 1px solid var(--cpq-border);
}

.cpq-full-detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.cpq-full-detail-meta-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cpq-full-detail-meta-label {
  font-size: 0.9rem;
  color: var(--cpq-text);
  opacity: 0.6;
  font-weight: 500;
}

.cpq-full-detail-meta-value {
  font-size: 1.05rem;
  color: var(--cpq-text);
  line-height: 1.5;
}

.cpq-full-detail-doi {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.95rem;
  color: var(--cpq-accent);
  word-break: break-all;
}

/* DOI行右侧的操作按钮组（移动自底部） */
.cpq-full-detail-doi-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.cpq-full-detail-doi-btn {
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 6px;
  border: none;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  cursor: pointer;
}

.cpq-full-detail-doi-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.cpq-full-detail-doi-btn-ris {
  background: #6366f1;
  color: white;
}

.cpq-full-detail-doi-btn-apa {
  background: #ec4899;
  color: white;
}

.cpq-full-detail-doi-btn-doi {
  background: #06b6d4;
  color: white;
}

.cpq-full-detail-doi-btn-link {
  background: #64748b;
  color: white;
}

.cpq-full-detail-doi-btn-oa {
  background: #f59e0b;
  color: white;
}

.cpq-full-detail-doi-btn-scihub {
  background: #10b981;
  color: white;
}

.cpq-full-detail-doi-btn:disabled,
.cpq-full-detail-doi-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* 徽章区域 */
.cpq-full-detail-badges-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 18px 22px;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 14px;
}

.cpq-full-detail-badges-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cpq-full-detail-badges-label {
  font-size: 0.9rem;
  color: var(--cpq-text);
  opacity: 0.6;
  font-weight: 600;
}

.cpq-full-detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cpq-full-detail-badges .badge {
  font-size: 0.9rem;
  padding: 7px 14px;
  border-radius: 8px;
  font-weight: 500;
}

/* 关键词区域 */
.cpq-full-detail-keywords-section {
  padding: 24px 48px;
  border-bottom: 1px solid var(--cpq-border);
}

.cpq-full-detail-section-header {
  font-size: 1rem;
  font-weight: 600;
  color: var(--cpq-text);
  margin-bottom: 16px;
  opacity: 0.8;
}

.cpq-full-detail-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.cpq-full-detail-keywords .badge {
  font-size: 0.95rem;
  padding: 8px 16px;
  border-radius: 18px;
  font-weight: 400;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.12), rgba(118, 75, 162, 0.12)) !important;
  color: var(--cpq-accent) !important;
  border: 1px solid rgba(102, 126, 234, 0.2);
  transition: all 0.2s ease;
}

.cpq-full-detail-keywords .badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

/* 摘要区域 */
.cpq-full-detail-abstract-section {
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.cpq-full-detail-abstract-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 48px;
  background: rgba(0, 0, 0, 0.02);
  border-bottom: 1px solid var(--cpq-border);
}

.cpq-full-detail-abstract-tabs {
  display: flex;
  gap: 10px;
}

.cpq-full-detail-tab {
  background: none;
  border: none;
  padding: 10px 20px;
  font-size: 1rem;
  color: var(--cpq-text);
  opacity: 0.6;
  cursor: pointer;
  border-radius: 10px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cpq-full-detail-tab:hover {
  opacity: 0.8;
  background: rgba(0, 0, 0, 0.05);
}

.cpq-full-detail-tab.active {
  opacity: 1;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.cpq-full-detail-cached {
  color: #28a745;
  font-size: 0.85rem;
}

.cpq-full-detail-tab.active .cpq-full-detail-cached {
  color: rgba(255, 255, 255, 0.9);
}

.cpq-full-detail-translate-btn {
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.cpq-full-detail-translate-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(17, 153, 142, 0.3);
  color: white;
}

.cpq-full-detail-abstract-content {
  padding: 32px 48px;
  flex: 1;
  overflow-y: auto;
}

.cpq-full-detail-abstract-pane {
  display: none;
  animation: cpqFadeIn 0.3s ease;
}

.cpq-full-detail-abstract-pane.active {
  display: block;
}

.cpq-full-detail-abstract-text {
  font-size: 1.1rem;
  line-height: 2;
  color: var(--cpq-text);
  white-space: pre-wrap;
}

.cpq-full-detail-abstract-zh {
  font-style: italic;
  color: var(--cpq-text);
  opacity: 0.9;
}

.cpq-full-detail-translate-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--cpq-text);
  opacity: 0.5;
}

.cpq-full-detail-translate-empty i {
  opacity: 0.3;
  font-size: 4rem;
}

.cpq-full-detail-translate-empty p {
  margin: 12px 0 0;
  font-size: 1.1rem;
}

/* 模态框底部 - 隐藏（按钮已移至DOI右侧） */
.cpq-full-detail-footer {
  display: none;
}

/* ===== 暗色主题适配 ===== */
[data-bs-theme="dark"] .cpq-full-detail-modal {
  background: #1a1a2e;
}

[data-bs-theme="dark"] .cpq-full-detail-title-section {
  background: linear-gradient(to bottom, rgba(102, 126, 234, 0.15), transparent);
}

[data-bs-theme="dark"] .cpq-full-detail-badges-section {
  background: rgba(255, 255, 255, 0.03);
}

[data-bs-theme="dark"] .cpq-full-detail-abstract-header {
  background: rgba(255, 255, 255, 0.03);
}

[data-bs-theme="dark"] .cpq-full-detail-tab:hover {
  background: rgba(255, 255, 255, 0.08);
}

[data-bs-theme="dark"] .cpq-full-detail-keywords .badge {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2)) !important;
  border-color: rgba(102, 126, 234, 0.3);
}

[data-bs-theme="dark"] .cpq-full-detail-doi-btn {
  opacity: 0.9;
}

[data-bs-theme="dark"] .cpq-full-detail-doi-btn:hover {
  opacity: 1;
}

/* ===== 科幻主题适配 ===== */
.mode-scifi .cpq-full-detail-modal {
  background: rgba(10, 25, 41, 0.95);
  border: 1px solid rgba(0, 243, 255, 0.3);
}

.mode-scifi .cpq-full-detail-header {
  background: linear-gradient(135deg, rgba(0, 243, 255, 0.2) 0%, rgba(0, 180, 230, 0.15) 100%);
  border-bottom: 1px solid rgba(0, 243, 255, 0.3);
}

.mode-scifi .cpq-full-detail-icon,
.mode-scifi .cpq-full-detail-header .modal-title {
  color: #00f3ff;
  text-shadow: 0 0 10px rgba(0, 243, 255, 0.5);
}

.mode-scifi .cpq-full-detail-source-badge {
  background: rgba(0, 243, 255, 0.15) !important;
  color: #00f3ff !important;
  border: 1px solid rgba(0, 243, 255, 0.4);
  box-shadow: 0 0 8px rgba(0, 243, 255, 0.3);
}

.mode-scifi .cpq-full-detail-action-btn {
  color: #00f3ff !important;
}

.mode-scifi .cpq-full-detail-close {
  filter: brightness(0) saturate(100%) invert(75%) sepia(74%) saturate(2578%) hue-rotate(157deg);
}

.mode-scifi .cpq-full-detail-title-section {
  background: linear-gradient(to bottom, rgba(0, 243, 255, 0.08), transparent);
}

.mode-scifi .cpq-full-detail-title {
  color: #e6f4ff;
}

.mode-scifi .cpq-full-detail-meta-section,
.mode-scifi .cpq-full-detail-keywords-section {
  border-color: rgba(0, 243, 255, 0.2);
}

.mode-scifi .cpq-full-detail-badges-section {
  background: rgba(0, 243, 255, 0.05);
  border: 1px solid rgba(0, 243, 255, 0.15);
}

.mode-scifi .cpq-full-detail-abstract-header {
  background: rgba(0, 243, 255, 0.05);
  border-color: rgba(0, 243, 255, 0.2);
}

.mode-scifi .cpq-full-detail-tab.active {
  background: linear-gradient(135deg, rgba(0, 243, 255, 0.3), rgba(0, 180, 230, 0.2));
  color: #00f3ff;
  text-shadow: 0 0 8px rgba(0, 243, 255, 0.5);
}

.mode-scifi .cpq-full-detail-translate-btn {
  background: linear-gradient(135deg, rgba(0, 243, 255, 0.3), rgba(0, 180, 230, 0.2));
  color: #00f3ff;
  border: 1px solid rgba(0, 243, 255, 0.4);
}

.mode-scifi .cpq-full-detail-translate-btn:hover {
  box-shadow: 0 0 15px rgba(0, 243, 255, 0.4);
  color: #00f3ff;
}

.mode-scifi .cpq-full-detail-keywords .badge {
  background: rgba(0, 243, 255, 0.1) !important;
  color: #00f3ff !important;
  border-color: rgba(0, 243, 255, 0.3);
  box-shadow: 0 0 6px rgba(0, 243, 255, 0.2);
}

.mode-scifi .cpq-full-detail-keywords .badge:hover {
  box-shadow: 0 0 12px rgba(0, 243, 255, 0.4);
}

.mode-scifi .cpq-full-detail-footer {
  background: rgba(0, 243, 255, 0.03);
  border-color: rgba(0, 243, 255, 0.2);
}

.mode-scifi .cpq-full-detail-doi-btn {
  background: rgba(0, 243, 255, 0.15);
  color: #00f3ff;
  border: 1px solid rgba(0, 243, 255, 0.4);
}

.mode-scifi .cpq-full-detail-doi-btn:hover {
  background: rgba(0, 243, 255, 0.25);
  box-shadow: 0 0 12px rgba(0, 243, 255, 0.4);
  color: #00f3ff;
}

/* 响应式适配 */
@media (max-width: 1100px) {
  .cpq-history-sidebar { display: none; }
  .cpq-right-sidebar { width: 280px; }
}

@media (max-width: 768px) {
  .cpq-full-detail-meta-grid {
    grid-template-columns: 1fr;
  }
  
  .cpq-full-detail-actions {
    flex-direction: column;
  }
  
  .cpq-full-detail-btn {
    width: 100%;
    justify-content: center;
  }
}
