/**
 * A股热力树图 — 复用 market_dashboard 视觉，仅补图表区
 */

body.ash-page {
  /* md-page tokens 已由 market_dashboard.css 提供 */
}

body.ash-page .sa-site-bar__actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

.sa-toolbar-btn.is-spinning i { animation: ash-spin 0.8s linear infinite; }
@keyframes ash-spin { to { transform: rotate(360deg); } }

/* —— 工具条卡 —— */
.ash-toolbar-card {
  margin-bottom: 14px;
  padding: 16px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ash-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: flex-end;
}

.ash-tool {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.ash-tool-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--md-faint, #bfbfbf);
}

.ash-tool--meta {
  margin-left: auto;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-bottom: 2px;
}

.ash-stat {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 8px;
  background: var(--md-soft, #f0f1f5);
  font-size: 12px;
  font-weight: 700;
  color: var(--md-text, #1a2330);
  font-variant-numeric: tabular-nums;
}

.ash-stat.is-up { color: #FF3B30; background: rgba(255, 59, 48, 0.1); }
.ash-stat.is-down { color: #248A3D; background: rgba(52, 199, 89, 0.12); }
.ash-stat.is-flat,
.ash-stat--muted { color: #8E8E93; font-weight: 600; }

.ash-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.ash-filter-row > .ash-tool-label {
  flex: 0 0 36px;
}

.ash-capsules {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 0;
  flex: 1 1 auto;
}

/* 筛选胶囊：包含=蓝，排除=红 */
.ash-capsules .md-capsule.inc.on,
.ash-capsules .md-capsule.inc.active {
  background: var(--md-primary, #1a56a7);
  border-color: var(--md-primary, #1a56a7);
  color: #fff;
  box-shadow: 0 2px 8px rgba(26, 86, 167, 0.25);
}

.ash-capsules .md-capsule.exc.on,
.ash-capsules .md-capsule.exc.active {
  background: var(--md-up, #cf1322);
  border-color: var(--md-up, #cf1322);
  color: #fff;
  box-shadow: 0 2px 8px rgba(207, 19, 34, 0.22);
}

.ash-legend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 2px;
  max-width: 320px;
}

.ash-legend-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--md-faint, #bfbfbf);
  flex: 0 0 auto;
}

.ash-legend-bar {
  flex: 1 1 auto;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    #248A3D 0%,
    #34C759 18%,
    #B8F0C8 36%,
    #E5E5EA 50%,
    #FFC2BC 64%,
    #FF3B30 82%,
    #C41E3A 100%
  );
  box-shadow: inset 0 0 0 1px rgba(60, 60, 67, 0.08);
}

.ash-legend-ends {
  display: flex;
  gap: 8px;
  font-size: 11px;
  flex: 0 0 auto;
}

.ash-legend-ends i {
  font-style: normal;
  font-weight: 600;
}

.ash-legend-ends i:nth-child(1) { color: #248A3D; }
.ash-legend-ends i:nth-child(2) { color: #8E8E93; }
.ash-legend-ends i:nth-child(3) { color: #FF3B30; }

/* —— 图表卡 —— */
.ash-chart-card {
  margin-bottom: 10px;
  padding: 16px 18px 14px;
}

.ash-chart-card .md-card-head {
  margin-bottom: 10px;
}

.ash-chart-wrap {
  position: relative;
  width: 100%;
  min-height: 520px;
  height: calc(100vh - 340px);
  border-radius: 12px;
  overflow: hidden;
  background: #F2F2F7;
  border: 1px solid rgba(60, 60, 67, 0.1);
}

#ashChart {
  width: 100%;
  height: 100%;
}

.ash-loading {
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.72);
  z-index: 2;
  pointer-events: none;
}

.ash-loading[hidden],
.ash-loading.is-hidden {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.ash-loading:not([hidden]):not(.is-hidden) {
  display: flex;
  pointer-events: auto;
}

.ash-status {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--md-faint, #bfbfbf);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 900px) {
  .ash-tool--meta {
    margin-left: 0;
    width: 100%;
  }
  .ash-chart-wrap {
    height: calc(100vh - 460px);
    min-height: 400px;
  }
  .ash-filter-row > .ash-tool-label {
    flex-basis: 100%;
  }
}

body.md-page.is-fullscreen .sa-site-bar,
body.md-page.is-fullscreen .md-subnav,
body.md-page.is-fullscreen .md-title-area,
body.md-page.is-fullscreen .ash-toolbar-card,
body.md-page.is-fullscreen .ash-status,
body.md-page.is-fullscreen .ash-chart-card .md-card-head {
  display: none !important;
}

body.md-page.is-fullscreen .ash-chart-card {
  border: 0;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
  margin: 0;
}

body.md-page.is-fullscreen .ash-chart-wrap {
  height: 100vh;
  min-height: 100vh;
  border: 0;
  border-radius: 0;
}
