/* heatmap-star.css  -- 热力星图统一视图样式 */

/* ── Section 容器 ── */
#sec-heatmap {
  padding: 0;
}

/* ── 控制栏 ── */
.hs-ctrl {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px 6px 0 0;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 20;
}

.hs-ctrl-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.hs-ctrl-row:last-child {
  border-bottom: none;
}

/* 布局模式按钮组 */
.hs-layout-group {
  display: flex;
  gap: 2px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px;
}
.hs-layout-btn {
  padding: 3px 10px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text2);
  font-size: 12px;
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.hs-layout-btn.on {
  background: var(--gold);
  color: #111;
  font-weight: 600;
}

/* 搜索框 */
.hs-search-wrap {
  position: relative;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}
.hs-search {
  width: 180px;
  padding: 4px 10px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-size: 12px;
  outline: none;
  font-family: 'Noto Sans SC', sans-serif;
}
.hs-search-count {
  font-size: 11px;
  color: var(--text3);
  white-space: nowrap;
}
.hs-fullscreen-btn {
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

/* 时间轴行 */
.hs-date-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.hs-date-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}
.hs-date-btn {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hs-date-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}
.hs-date-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: .5px;
  min-width: 90px;
  text-align: center;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--bg);
}
.hs-slider-wrap {
  flex: 1;
  min-width: 120px;
}
.hs-slider {
  width: 100%;
  accent-color: var(--gold);
}

/* 编码控制行 */
.hs-enc-row {
  gap: 12px;
  flex-wrap: wrap;
}
.hs-enc-group {
  display: flex;
  align-items: center;
  gap: 4px;
}
.hs-enc-label {
  font-size: 11px;
  color: var(--text3);
  white-space: nowrap;
}
.hs-select {
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-size: 11px;
  cursor: pointer;
  outline: none;
}
.hs-filter-group {
  display: flex;
  gap: 2px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px;
}
.hs-filter-btn {
  padding: 2px 8px;
  border-radius: 3px;
  border: none;
  background: transparent;
  color: var(--text2);
  font-size: 11px;
  cursor: pointer;
}
.hs-filter-btn.on {
  background: var(--gold);
  color: #111;
  font-weight: 600;
}

/* 活跃度阈值 */
.hs-thresh-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}
.hs-thresh-slider {
  width: 80px;
  accent-color: var(--gold);
}
.hs-thresh-val {
  font-size: 11px;
  color: var(--text3);
  min-width: 20px;
}

/* ── 统计条 ── */
.hs-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: none;
  font-size: 12px;
  flex-wrap: wrap;
}
.hs-stat-up   { color: #e05c5c; font-weight: 600; }
.hs-stat-dn   { color: #4aab6d; font-weight: 600; }
.hs-stat-fl   { color: var(--text3); }
.hs-stat-sep  { color: var(--text4); }
.hs-stat-avg  { font-weight: 600; }
.hs-stat-filter { color: var(--text3); margin-left: auto; font-size: 11px; }

/* ── 主画布区 ── */
.hs-canvas-wrap {
  position: relative;
  width: 100%;
  height: calc(100vh - 220px);
  min-height: 480px;
  background: transparent;
  border: 1px solid var(--line);
  border-top: none;
  overflow: hidden;
}
#hs-chart {
  width: 100%;
  height: 100%;
}

/* 加载态 */
.hs-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(10,10,15,.85);
  z-index: 10;
  color: rgba(200,200,220,.8);
  font-size: 13px;
}
.hs-spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.1);
  border-top-color: var(--gold, #b8892e);
  animation: hs-spin 1s linear infinite;
}
@keyframes hs-spin { to { transform: rotate(360deg); } }

.hs-error-toast {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(200,50,50,.9);
  color: #fff;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 12px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 80%;
}
.hs-error-retry {
  cursor: pointer;
  text-decoration: underline;
  white-space: nowrap;
}

/* ── 图例 ── */
.hs-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 6px 6px;
  font-size: 11px;
  color: var(--text3);
}
.hs-legend-bar {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  margin: 0 4px;
}
.hs-legend-bar.change {
  background: linear-gradient(to right,#00c853,#2e7d32,#1b5e20,#2a2a3a,#5a1515,#b71c1c,#ff1744);
}
.hs-legend-bar.activity {
  background: linear-gradient(to right,#1565c0,#1976d2,#2a2a3a,#c62828,#e53935);
}
.hs-legend-date {
  margin-left: auto;
  color: rgba(136,136,170,.5);
}

/* ── 移动端 DOM 行业网格 ── */
.hs-mobile-grid {
  display: none;
  padding: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 6px 6px;
  min-height: 300px;
}
.hs-ind-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px;
}
.hs-ind-card {
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  transition: filter .15s;
  border: 1px solid rgba(255,255,255,.08);
  min-height: 64px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.hs-ind-card:hover { filter: brightness(1.25); }
.hs-ind-name {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,.9);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hs-ind-meta {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: rgba(255,255,255,.55);
  margin-top: 4px;
}

/* ── 全屏模式 ── */
#sec-heatmap.hs-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  overflow-y: auto;
  border-radius: 0;
  padding: 0 12px 12px;
}
#sec-heatmap.hs-fullscreen .hs-canvas-wrap {
  height: calc(100vh - 140px);
}

/* ── 桌面端：控制栏右边距，避免被量化信号速递卡（sb-card，第4列25%）遮挡 ── */
@media (min-width: 993px) {
  #sec-heatmap .hs-ctrl,
  #sec-heatmap .hs-stats,
  #sec-heatmap .hs-legend {
    margin-right: calc(25% + 10px);
  }
}

/* ── 响应式 ── */
@media (max-width: 768px) {
  .hs-canvas-wrap {
    display: none;
  }
  .hs-mobile-grid {
    display: block;
  }
  .hs-enc-row {
    display: none;
  }
  .hs-search {
    width: 140px;
  }
  .hs-slider-wrap {
    min-width: 80px;
  }
}

@media (max-width: 480px) {
  .hs-ctrl-row {
    padding: 5px 8px;
  }
  .hs-layout-btn {
    padding: 2px 7px;
    font-size: 11px;
  }
}
