/* ===== 阶段3 v0.7.9.27 ===== */

/* === 顶栏整体 === */
.jjls-topbar {
  position: sticky; top: 0; z-index: 1000;
  background: linear-gradient(180deg, #0b1220, #0f172a);
  box-shadow: 0 2px 16px rgba(0,0,0,0.5);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.jjls-topbar header.header {
  position: static !important; box-shadow: none !important;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

/* === Nav Tabs === */
.jjls-nav-tabs { display: flex; gap: 4px; align-items: center; margin-right: 6px; }
.jjls-nav-tab {
  padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 12px;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
  color: #cbd5e1; transition: all 0.15s; white-space: nowrap;
  font-weight: 500; font-family: inherit; line-height: 1.2;
}
.jjls-nav-tab:hover {
  background: rgba(59,130,246,0.15); color: #fff; border-color: rgba(59,130,246,0.4);
  transform: translateY(-1px);
}
.jjls-nav-tab.active {
  background: linear-gradient(135deg,#3b82f6,#1d4ed8); color: #fff;
  border-color: transparent; box-shadow: 0 2px 8px rgba(59,130,246,0.4);
}
.jjls-nav-tab.pulse-once { animation: jjlsPulseOnce 0.5s; }
@keyframes jjlsPulseOnce { 50% { transform: scale(1.08); } }
.jjls-nav-tab .badge {
  display:inline-block; min-width:18px; padding:1px 6px; margin-left:5px;
  border-radius:9px; background:rgba(255,255,255,0.18); font-size:10px;
  font-weight: 600;
}

/* === 进度条行（无任务时折叠为 0 高度）=== */
.jjls-topbar-progress {
  max-height: 0; overflow: hidden; transition: max-height 0.25s ease;
}
.jjls-topbar-progress.show { max-height: 36px; }
.jjls-progress-bar {
  height: 32px; padding: 0 16px;
  display: flex; align-items: center; gap: 10px;
  background: rgba(59,130,246,0.08);
  border-top: 1px solid rgba(59,130,246,0.15);
  font-size: 11px; color: #cbd5e1;
}
.jjls-progress-bar .pulse {
  width: 7px; height: 7px; border-radius: 50%; background: #10b981;
  animation: jjlsPulse 1.2s infinite;
}
@keyframes jjlsPulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:0.3;transform:scale(1.5)} }
#jjlsProgLabel { min-width: 140px; }
.jjls-pb-track {
  flex: 1; height: 6px; background: rgba(255,255,255,0.06);
  border-radius: 3px; overflow: hidden; min-width: 200px;
}
.jjls-pb-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #3b82f6, #06b6d4, #10b981);
  background-size: 200% 100%; animation: jjlsPbShine 2s linear infinite;
  border-radius: 3px; transition: width 0.4s;
}
.jjls-pb-fill.done { background: #10b981; animation: none; }
@keyframes jjlsPbShine { 0%{background-position:0% 0%} 100%{background-position:200% 0%} }
#jjlsProgPct { min-width: 38px; text-align: right; font-weight: 600; }

/* === 公告条迁入顶栏第3行 === */
.jjls-topbar-announce {
  padding: 0; background: rgba(15,23,42,0.4);
  border-top: 1px solid rgba(255,255,255,0.03);
}
.jjls-topbar-announce > * {
  margin: 0 !important; border-radius: 0 !important;
  max-width: none !important;
}

/* === SPA 页面紧贴顶栏 === */
[data-jjls-page="home"],
[data-jjls-page="hunter"],
[data-jjls-page="results"] {
  padding-top: 8px;
}
[data-jjls-page="home"] > *:first-child,
[data-jjls-page="hunter"] > *:first-child { margin-top: 0 !important; }

/* === 日志折叠 === */
.log-panel { transition: max-height 0.25s; }
.log-panel.jjls-collapsed { max-height: 36px !important; overflow: hidden; }
.log-panel.jjls-collapsed .log-content { display: none; }
.jjls-log-toggle {
  cursor: pointer; padding: 2px 8px; font-size: 11px;
  background: rgba(255,255,255,0.05); border-radius: 4px; color: #94a3b8;
  border: 1px solid rgba(255,255,255,0.08);
}
.jjls-log-toggle:hover { color: #e2e8f0; background: rgba(255,255,255,0.1); }

/* === 打分结果嵌入页 === */
.jjls-rp-container.jjls-rp-inline {
  max-width: 1600px; margin: 16px auto; background: #0f172a;
  border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; overflow: hidden;
}
.jjls-rp-header {
  padding: 14px 20px;
  background: linear-gradient(135deg, rgba(59,130,246,0.15), rgba(29,78,216,0.05));
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; gap: 16px;
}
.jjls-rp-title { font-size: 16px; font-weight: 600; color: #f1f5f9; }
.jjls-rp-meta { font-size: 11px; color: #94a3b8; }
.jjls-rp-toolbar {
  padding: 10px 20px; background: rgba(15,23,42,0.6);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
}

/* 下拉框 + 按钮配色 */
.jjls-rp-toolbar select,
.jjls-rp-toolbar button {
  padding: 6px 12px; font-size: 12px;
  background: rgba(30, 41, 59, 0.95) !important;
  color: #e2e8f0 !important;
  border: 1px solid rgba(148,163,184,0.3); border-radius: 5px;
  cursor: pointer; min-width: 100px;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%2394a3b8' d='M0 0l5 6 5-6z'/></svg>") !important;
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  padding-right: 28px !important;
}
.jjls-rp-toolbar select:hover,
.jjls-rp-toolbar button:hover {
  background-color: rgba(51, 65, 85, 0.95) !important;
  border-color: rgba(59,130,246,0.5);
}
.jjls-rp-toolbar select option {
  background: #1e293b !important; color: #e2e8f0 !important; padding: 8px !important;
}
.jjls-rp-toolbar .btn-export {
  background: linear-gradient(135deg,#ff6b6b,#ff4d4d) !important;
  border:none !important; color:#fff !important;
  background-image: none !important; padding-right: 12px !important;
}
.jjls-rp-toolbar .btn-export:hover { filter: brightness(1.1); }
.jjls-rp-toolbar .grade-tabs { display: flex; gap: 4px; margin-right: auto; }
.jjls-rp-toolbar .grade-tab {
  padding: 5px 12px; font-size: 12px; cursor: pointer;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 5px; color: #94a3b8; user-select: none;
}
.jjls-rp-toolbar .grade-tab.active { background: linear-gradient(135deg,#3b82f6,#1d4ed8); color:#fff; border-color: transparent; }
.jjls-rp-toolbar .grade-tab.grade-s.active { background: linear-gradient(135deg,#fbbf24,#f59e0b); color:#000; }
.jjls-rp-toolbar .grade-tab.grade-a.active { background: linear-gradient(135deg,#cbd5e1,#94a3b8); color:#000; }
.jjls-rp-toolbar .grade-tab.grade-b.active { background: linear-gradient(135deg,#d97706,#a16207); color:#fff; }

/* === 表格 === */
.jjls-rp-body { padding: 16px 20px; min-height: 400px; }
.jjls-rp-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.jjls-rp-table thead th {
  position: sticky; top: 0; background: rgba(30,41,59,0.95);
  padding: 8px 6px; text-align: left; color: #cbd5e1;
  border-bottom: 1px solid rgba(255,255,255,0.08); font-weight: 600; font-size: 11px;
  white-space: nowrap; cursor: pointer; user-select: none;
}
.jjls-rp-table thead th:hover { background: rgba(59,130,246,0.15); }
.jjls-rp-table thead th .sort-ind { color: #3b82f6; margin-left: 3px; }
.jjls-rp-table tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.04); cursor: pointer;
  transition: background 0.1s;
}
.jjls-rp-table tbody tr:hover { background: rgba(59,130,246,0.08); }
.jjls-rp-table tbody td { padding: 7px 6px; color: #e2e8f0; }
.jjls-rp-table .col-grade { font-weight: 700; text-align: center; }
.jjls-rp-table .col-grade.S { color: #fbbf24; }
.jjls-rp-table .col-grade.A { color: #cbd5e1; }
.jjls-rp-table .col-grade.B { color: #d97706; }
.jjls-rp-table .col-grade.C { color: #64748b; }
.jjls-rp-table .col-score { font-weight: 600; }
.jjls-rp-table .col-pct.up { color: #ef4444; }
.jjls-rp-table .col-pct.down { color: #10b981; }
.jjls-rp-table .col-fav { width: 30px; text-align: center; }
.jjls-rp-table .col-fav span { cursor: pointer; opacity: 0.4; font-size: 14px; }
.jjls-rp-table .col-fav span.on { opacity: 1; color: #fbbf24; }
.jjls-rp-table .col-fav span:hover { opacity: 1; }

.jjls-rp-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px;
}
.jjls-rp-pager {
  padding: 12px 20px; display: flex; justify-content: center; align-items: center; gap: 8px;
  border-top: 1px solid rgba(255,255,255,0.05); background: rgba(15,23,42,0.4);
  font-size: 12px; color: #94a3b8;
}
.jjls-rp-pager button {
  padding: 4px 10px; cursor: pointer; background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 4px; color: #e2e8f0;
}
.jjls-rp-pager button:disabled { opacity: 0.3; cursor: not-allowed; }
.jjls-rp-pager .page-info { margin: 0 8px; }
.jjls-rp-empty { text-align: center; padding: 60px 20px; color: #64748b; font-size: 14px; }

/* === 兜底：隐藏页面原生的全局进度条（避免与顶栏进度条重复）=== */
.global-progress:not(.jjls-progress-bar),
#globalProgress:not(#jjlsProgressBar) {
  display: none !important;
}
/* hunter 子节点保护：被切回时确保可见 */
#jjlsHunterArea[style=""] > .workspace-anchor,
#jjlsHunterArea > .workspace-anchor { display: block !important; }
#jjlsHunterArea > .main-container { display: grid !important; }

/* === v0.7.9.30 切页性能优化 === */
[data-jjls-page] {
  contain: layout style;
}
.jjls-page-hidden {
  display: none !important;
}
.jjls-page-active {
  /* content-visibility 让浏览器只渲染可见区 */
  content-visibility: auto;
  contain-intrinsic-size: auto 800px;
}
/* 防止页面切换时整体抖动 */
body { scrollbar-gutter: stable; }

/* hunter 内 ECharts 容器减少重排成本 */
#jjlsHunterArea .panel,
#jjlsHunterArea .main-container,
#jjlsHunterArea .kline-container {
  will-change: auto;
  transform: translateZ(0);
}

/* === 模型卡片徽章组 v0.7.9.32 === */
.mm-meta-chips {
  display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0;
}
.mm-mchip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 12px; font-size: 11px;
  border: 1px solid; font-weight: 500; line-height: 1.4;
  white-space: nowrap;
}
.mm-mchip b { font-weight: 600; opacity: 0.85; font-size: 10.5px; }

.mm-meta-tags {
  display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0;
}
.mm-tag-chip {
  display: inline-block; padding: 2px 8px;
  background: #1e3a5f; color: #60a5fa;
  border-radius: 10px; font-size: 10.5px;
  border: 1px solid #3b5a85; font-weight: 500;
}

.mm-meta-foot {
  font-size: 10.5px; margin-top: 5px;
  color: #94a3b8; line-height: 1.5;
}

/* === v0.7.9.34 回测占位面板 === */
.mm-bt-panel.mm-bt-empty { padding: 16px; }
.mm-bt-empty-tip {
  color: #94a3b8; font-size: 12px; padding: 18px;
  background: rgba(148,163,184,0.06); border-radius: 6px;
  text-align: center; border: 1px dashed rgba(148,163,184,0.2);
}
