/**
 * 收益归因分析 — Tab 分页 + 紧凑布局
 * 6 个区块分为 3 个 Tab，一次只显示 1 个面板
 */

/* ── 弹窗容器 ── */
.attr-modal-content {
  max-width: 900px !important;
  max-height: 85vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

#returnAttributionContent {
  padding: 16px 24px 20px;
  flex: 1;
  overflow-y: auto;
}

/* ── 顶部总览：3 项紧凑统计 ── */
.attr-summary {
  display: flex;
  gap: 0;
  margin-bottom: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  overflow: hidden;
}

.attr-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 8px 8px;
  position: relative;
}

.attr-stat + .attr-stat::before {
  content: '';
  position: absolute;
  left: 0;
  top: 18%;
  height: 64%;
  width: 1px;
  background: rgba(255,255,255,0.08);
}

.attr-stat__label {
  font-size: 11px;
  color: #71717a;
  margin-bottom: 3px;
  letter-spacing: 0.02em;
}

.attr-stat__value {
  font-size: 20px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.1;
}

.attr-stat__sub {
  font-size: 10px;
  color: #a1a1aa;
  margin-top: 2px;
}

/* ── Tab 栏 ── */
.attr-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 3px;
}

.attr-tab {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 7px 0;
  font-size: 12px;
  font-weight: 500;
  color: #71717a;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.attr-tab:hover {
  color: #a1a1aa;
  background: rgba(255,255,255,0.04);
}

.attr-tab--active {
  color: #f59e0b;
  background: rgba(245,158,11,0.1);
  font-weight: 600;
}

/* ── Tab 面板 ── */
.attr-panel {
  min-height: 120px;
}

/* ── 通用区块容器 ── */
.attr-section {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
}

.attr-section:last-child {
  margin-bottom: 0;
}

.attr-section__title {
  font-size: 12px;
  font-weight: 600;
  color: #d4d4d8;
  margin-bottom: 10px;
}

.attr-empty {
  text-align: center;
  padding: 32px;
  color: #52525b;
  font-size: 13px;
}

/* ── 归因条形图 ── */
.attr-bars {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.attr-bar {
  flex: 1;
  min-width: 140px;
  background: rgba(0,0,0,0.2);
  border-radius: 10px;
  padding: 12px;
}

.attr-bar__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.attr-bar__label {
  font-size: 12px;
  font-weight: 500;
  color: #d4d4d8;
}

.attr-bar__value {
  font-size: 13px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}

.attr-bar__track {
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
}

.attr-bar__fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.attr-bar__desc {
  font-size: 10px;
  color: #52525b;
  margin-top: 4px;
  line-height: 1.4;
}

/* ── 类别归因：饼图 + 明细 并排 ── */
.attr-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.attr-card {
  flex: 1;
  min-width: 0;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 12px;
}

.attr-card--chart {
  min-width: 170px;
  max-width: 220px;
}

.attr-card__title {
  font-size: 12px;
  font-weight: 600;
  color: #d4d4d8;
  margin-bottom: 8px;
}

.attr-pie-wrap {
  position: relative;
  height: 200px;
}

.attr-cat-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.attr-cat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(0,0,0,0.15);
  border-radius: 8px;
  transition: background 0.2s;
}

.attr-cat-item:hover {
  background: rgba(0,0,0,0.25);
}

.attr-cat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.attr-cat-info {
  flex: 1;
  min-width: 0;
}

.attr-cat-name {
  font-size: 12px;
  color: #e4e4e7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attr-cat-count {
  font-size: 10px;
  color: #52525b;
}

.attr-cat-nums {
  text-align: right;
  flex-shrink: 0;
}

.attr-cat-profit {
  font-size: 13px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}

.attr-cat-pct {
  font-size: 10px;
  color: #52525b;
}

/* ── 盈亏榜 ── */
.attr-card--win {
  border-color: rgba(34,197,94,0.1);
  background: rgba(34,197,94,0.02);
}

.attr-card--lose {
  border-color: rgba(239,68,68,0.1);
  background: rgba(239,68,68,0.02);
}

.attr-card__title--win { color: #22c55e; }
.attr-card__title--lose { color: #f43f5e; }

.attr-rank-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

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

.attr-rank-num {
  width: 18px;
  font-size: 12px;
  color: #71717a;
  text-align: center;
  flex-shrink: 0;
}

.attr-rank-num--gold { color: #fbbf24; }

.attr-rank-name {
  flex: 1;
  font-size: 12px;
  color: #d4d4d8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attr-rank-val {
  font-size: 12px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}

.attr-rank-val--pos { color: #ef4444; }
.attr-rank-val--neg { color: #22c55e; }

/* ── 智能洞察 ── */
.attr-insight {
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-width: 1px;
  border-style: solid;
  transition: transform 0.2s;
}

.attr-insight:last-child { margin-bottom: 0; }

.attr-insight:hover {
  transform: translateX(3px);
}

.attr-insight__icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.attr-insight__body {
  flex: 1;
  min-width: 0;
}

.attr-insight__title {
  font-size: 12px;
  font-weight: 600;
  color: #e4e4e7;
  margin-bottom: 2px;
}

.attr-insight__desc {
  font-size: 11px;
  color: #a1a1aa;
  line-height: 1.5;
}

/* ── 基金明细表格 ── */
.attr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.attr-table th {
  padding: 6px 8px;
  text-align: left;
  font-weight: 500;
  color: #71717a;
  font-size: 11px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  white-space: nowrap;
}

.attr-table td {
  padding: 7px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  white-space: nowrap;
}

.attr-table tr {
  transition: background 0.15s;
}

.attr-table tbody tr:hover {
  background: rgba(255,255,255,0.03);
}

.attr-td-fund {
  font-size: 12px;
  color: #d4d4d8;
}

.attr-td-code {
  font-size: 10px;
  color: #52525b;
  font-family: monospace;
}

.attr-td-num {
  font-family: 'JetBrains Mono', monospace;
  color: #a1a1aa;
  font-size: 12px;
}

.attr-tag {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 500;
  white-space: nowrap;
}

/* ── 响应式：移动端 ── */
@media (max-width: 700px) {
  .attr-modal-content {
    max-width: 100% !important;
    border-radius: 0 0 20px 20px;
  }

  .attr-summary {
    gap: 0;
    border-radius: 12px;
  }

  .attr-stat__value {
    font-size: 18px;
  }

  .attr-row {
    flex-direction: column;
  }

  .attr-card--chart {
    max-width: none;
    min-width: 0;
  }

  .attr-bars {
    flex-direction: column;
  }

  .attr-bar {
    min-width: 0;
  }

  .attr-pie-wrap {
    height: 220px;
  }
}

/* ═══════════════════════════════════════
   增强版新增样式
   ═══════════════════════════════════════ */

/* 洞察详情 */
.attr-insight__detail {
  font-size: 11px;
  color: #71717a;
  margin-top: 3px;
  padding-top: 3px;
  border-top: 1px solid rgba(255,255,255,0.04);
}

/* 行业配置网格 */
.attr-sector-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-top: 6px;
}

.attr-sector-item {
  display: flex;
  flex-direction: column;
  background: rgba(0,0,0,0.2);
  border-radius: 8px;
  padding: 8px 10px;
  gap: 2px;
}

.attr-sector-cat {
  font-size: 11px;
  color: #d4d4d8;
  font-weight: 500;
}

.attr-sector-pct {
  font-size: 13px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}

.attr-sector-return {
  font-size: 10px;
  color: #52525b;
}

/* 4列统计适配 */
.attr-summary.attr-summary--4 {
  gap: 0;
}

.attr-summary.attr-summary--4 .attr-stat {
  padding: 10px 4px 8px;
}

/* 归因条形图增强（4项） */
.attr-bars--4 .attr-bar {
  flex: 1 1 calc(50% - 4px);
  min-width: 120px;
}

/* 基准信息标签 */
.attr-benchmark-tag {
  display: inline-block;
  font-size: 10px;
  padding: 2px 6px;
  background: rgba(34,197,94,0.1);
  color: #22c55e;
  border-radius: 4px;
  margin-left: 6px;
}

/* Beta指示器 */
.attr-beta-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
}

.attr-beta-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.attr-beta-dot--high { background: #f43f5e; }
.attr-beta-dot--mid { background: #22c55e; }
.attr-beta-dot--low { background: #3b82f6; }

/* 风险评估区块增强 */
.attr-section--risk {
  background: rgba(245,158,11,0.04);
  border-color: rgba(245,158,11,0.12);
}

/* 时机选择交易列表 */
.attr-timing-list {
  margin-top: 8px;
}

.attr-timing-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: rgba(0,0,0,0.15);
  border-radius: 6px;
  margin-bottom: 4px;
  font-size: 11px;
}

.attr-timing-good {
  color: #22c55e;
}

.attr-timing-bad {
  color: #f43f5e;
}
