/**
 * S0 PEST 分析 - 样式系统
 * 20+ 维度精细化规划展示
 */

:root {
  --color-political: #388bfd;
  --color-economic: #f7853e;
  --color-social: #3fb950;
  --color-tech: #e3b341;
}

.pest-container {
  max-width: 100%;
  padding: 0;
}

/* ═══════════════════════════════════════════════════════════ */
/* 1. 总体评分卡片组 */
/* ═══════════════════════════════════════════════════════════ */

.pest-header-section {
  display: flex;
  gap: 24px;
  margin-bottom: 32px;
  padding: 0 24px;
}

.pest-score-card {
  flex: 1;
  background: linear-gradient(135deg, rgba(0,212,255,0.05) 0%, rgba(255,107,107,0.05) 100%);
  border: 1px solid rgba(0,212,255,0.2);
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.pest-score-card.main {
  flex: 0 0 280px;
  background: linear-gradient(135deg, rgba(57,211,195,0.08) 0%, rgba(56,139,253,0.08) 100%);
  border: 2px solid rgba(57,211,195,0.3);
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.score-value {
  font-size: 64px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 12px;
  font-variant-numeric: tabular-nums;
}

.score-label {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.score-status {
  display: inline-block;
  padding: 8px 16px;
  background: rgba(63, 185, 80, 0.1);
  border: 1px solid rgba(63, 185, 80, 0.3);
  border-radius: 6px;
  color: #3fb950;
  font-size: 12px;
  font-weight: 600;
}

.score-status.positive { border-color: rgba(63, 185, 80, 0.4); }
.score-status.warning { border-color: rgba(247, 133, 62, 0.4); }
.score-status.negative { border-color: rgba(255, 107, 107, 0.4); }

/* 维度评分卡片 */
.pest-dimension-scores {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.dim-score {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.dim-score::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--dim-color);
}

.dim-score:hover {
  border-color: var(--dim-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.dim-icon {
  font-size: 24px;
  margin-bottom: 8px;
  display: block;
}

.dim-name {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: block;
}

.dim-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--dim-color);
  font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════════════════════════ */
/* 2. 标签页组件 */
/* ═══════════════════════════════════════════════════════════ */

.pest-detail-tabs {
  margin: 0 24px 32px;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 12px;
}

.tab-buttons {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-default);
  padding-bottom: 12px;
}

.tab-btn {
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  background: rgba(0, 212, 255, 0.05);
  color: var(--text-primary);
}

.tab-btn.active {
  background: rgba(57, 211, 195, 0.1);
  color: var(--text-primary);
  border-bottom: 2px solid var(--color-tech);
}

/* ═══════════════════════════════════════════════════════════ */
/* 3. 维度详细内容 */
/* ═══════════════════════════════════════════════════════════ */

.dimension-detail {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.dim-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-default);
}

.dim-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 12px;
}

.dim-icon {
  font-size: 20px;
}

.dim-score-large {
  font-size: 36px;
  font-weight: 700;
  color: var(--color-tech);
  font-variant-numeric: tabular-nums;
}

/* 指标列表 */
.metrics-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.metric-detail-item {
  background: rgba(0, 212, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 16px;
  transition: all 0.3s ease;
}

.metric-detail-item:hover {
  border-color: var(--border-default);
  background: rgba(57, 211, 195, 0.04);
}

.metric-row-1 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.metric-icon {
  font-size: 20px;
  min-width: 24px;
}

.metric-name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.metric-value-box {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.metric-value-box .value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.metric-value-box .unit {
  font-size: 12px;
  color: var(--text-muted);
}

.metric-value-box .trend {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.metric-value-box .trend.positive {
  color: #3fb950;
  background: rgba(63, 185, 80, 0.1);
}

.metric-value-box .trend.negative {
  color: #ff6b9d;
  background: rgba(255, 107, 157, 0.1);
}

.metric-value-box .trend.stable {
  color: var(--text-muted);
  background: rgba(0, 212, 255, 0.05);
}

/* 进度条 */
.metric-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: var(--border-subtle);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-tech), var(--color-social));
  transition: width 0.5s ease;
}

.threshold-label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* 描述和含义 */
.metric-row-2 {
  margin-bottom: 12px;
}

.description {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.metric-implications {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}

.risk-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 600;
  white-space: nowrap;
}

.risk-label.low {
  background: rgba(63, 185, 80, 0.1);
  color: #3fb950;
}

.risk-label.medium {
  background: rgba(247, 133, 62, 0.1);
  color: #f7853e;
}

.implication {
  flex: 1;
  color: var(--text-muted);
  padding: 0 8px;
  border-left: 2px solid var(--border-default);
}

/* 子部分 */
.dimension-opportunities,
.dimension-risks {
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.sub-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.opp-list-mini,
.risk-list-mini {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.opp-item-mini,
.risk-item-mini {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(0, 212, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  font-size: 12px;
}

.opp-text {
  color: var(--text-primary);
}

.confidence-badge,
.severity-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 6px;
  background: rgba(57, 211, 195, 0.1);
  border-radius: 3px;
  color: var(--color-tech);
}

.risk-item-mini.risk-high {
  border-color: rgba(255, 107, 107, 0.2);
  background: rgba(255, 107, 107, 0.03);
}

/* ═══════════════════════════════════════════════════════════ */
/* 4. 机会评估卡片 */
/* ═══════════════════════════════════════════════════════════ */

.pest-opportunities-section {
  margin: 32px 24px;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 12px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.opportunities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.opportunity-card {
  background: linear-gradient(135deg, rgba(57, 211, 195, 0.04) 0%, rgba(56, 139, 253, 0.04) 100%);
  border: 1px solid rgba(57, 211, 195, 0.2);
  border-radius: 10px;
  padding: 16px;
  transition: all 0.3s ease;
}

.opportunity-card:hover {
  border-color: var(--color-tech);
  box-shadow: 0 4px 16px rgba(57, 211, 195, 0.15);
  transform: translateY(-2px);
}

.opp-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.opp-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--color-tech);
  color: var(--bg-default);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
}

.opp-score {
  display: flex;
  align-items: center;
  gap: 8px;
}

.confidence {
  font-size: 13px;
  font-weight: 600;
  color: #3fb950;
}

.impact-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}

.impact-badge.high {
  background: rgba(255, 107, 107, 0.1);
  color: #ff6b9d;
}

.impact-badge.medium {
  background: rgba(247, 133, 62, 0.1);
  color: #f7853e;
}

.opp-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.4;
}

.opp-timeframe {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.opp-actions {
  padding-top: 12px;
  border-top: 1px solid rgba(57, 211, 195, 0.1);
}

.action-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  display: block;
}

.action-tag {
  display: inline-block;
  padding: 4px 8px;
  background: rgba(57, 211, 195, 0.1);
  border-radius: 4px;
  font-size: 12px;
  color: var(--color-tech);
  margin: 2px 4px 2px 0;
}

/* ═══════════════════════════════════════════════════════════ */
/* 5. 风险评估 */
/* ═══════════════════════════════════════════════════════════ */

.pest-risks-section {
  margin: 32px 24px;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 12px;
}

.risks-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.risk-item {
  display: flex;
  gap: 16px;
  padding: 16px;
  background: rgba(0, 212, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  transition: all 0.3s ease;
}

.risk-item.risk-high {
  border-left: 3px solid #ff6b9d;
  background: rgba(255, 107, 157, 0.04);
}

.risk-item.risk-medium {
  border-left: 3px solid #f7853e;
  background: rgba(247, 133, 62, 0.04);
}

.risk-item.risk-low {
  border-left: 3px solid #3fb950;
  background: rgba(63, 185, 80, 0.04);
}

.risk-icon {
  font-size: 24px;
  min-width: 32px;
  text-align: center;
}

.risk-content {
  flex: 1;
}

.risk-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.risk-severity {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.risk-mitigations {
  font-size: 12px;
  color: var(--text-muted);
}

.mitigation-tag {
  display: inline-block;
  padding: 4px 8px;
  background: rgba(247, 133, 62, 0.1);
  border-radius: 4px;
  color: #f7853e;
  margin: 2px 4px 2px 0;
}

/* ═══════════════════════════════════════════════════════════ */
/* 6. 市场洞察 */
/* ═══════════════════════════════════════════════════════════ */

.pest-insights-section {
  margin: 32px 24px;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 12px;
}

.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.insight-card {
  padding: 20px;
  border-radius: 10px;
  display: flex;
  gap: 16px;
}

.insight-card.positive {
  background: linear-gradient(135deg, rgba(63, 185, 80, 0.08) 0%, rgba(57, 211, 195, 0.08) 100%);
  border: 1px solid rgba(63, 185, 80, 0.2);
}

.insight-card.caution {
  background: linear-gradient(135deg, rgba(247, 133, 62, 0.08) 0%, rgba(255, 107, 157, 0.08) 100%);
  border: 1px solid rgba(247, 133, 62, 0.2);
}

.insight-card.strategy {
  background: linear-gradient(135deg, rgba(56, 139, 253, 0.08) 0%, rgba(227, 179, 65, 0.08) 100%);
  border: 1px solid rgba(56, 139, 253, 0.2);
}

.insight-icon {
  font-size: 24px;
  min-width: 32px;
  text-align: center;
}

.insight-text {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary);
}

.insight-text strong {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
}

/* ═══════════════════════════════════════════════════════════ */
/* 7. PEST矩阵视图 */
/* ═══════════════════════════════════════════════════════════ */

.pest-matrix-view {
  padding: 24px;
}

.matrix-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 24px;
  text-align: center;
}

.matrix-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.matrix-cell {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
}

.cell-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.cell-icon {
  font-size: 28px;
}

.cell-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.cell-score {
  font-size: 32px;
  font-weight: 700;
  color: var(--color-tech);
  margin-bottom: 12px;
  font-variant-numeric: tabular-nums;
}

.cell-metrics {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.mini-metric {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: rgba(0, 212, 255, 0.05);
  border-radius: 6px;
  font-size: 12px;
  border: 1px solid var(--border-subtle);
}

.mini-metric .score {
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════════════════════════ */
/* 响应式设计 */
/* ═══════════════════════════════════════════════════════════ */

@media (max-width: 1200px) {
  .pest-dimension-scores {
    grid-template-columns: repeat(2, 1fr);
  }

  .opportunities-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .pest-header-section {
    flex-direction: column;
    gap: 16px;
  }

  .pest-score-card.main {
    flex: 1;
  }

  .pest-dimension-scores {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .tab-buttons {
    flex-wrap: wrap;
  }

  .insights-grid {
    grid-template-columns: 1fr;
  }
}

.hidden {
  display: none !important;
}
