/* DuPont Analysis - 전용 스타일 (depreciation.css와 함께 사용) */

/* ----- 1단계: 공식 트리, 왜 분해, 유래, 요약 카드 ----- */
.dupont-formula-tree {
  background: linear-gradient(135deg, #f8fbff 0%, #eef6ff 100%);
  border: 1px solid #cce5ff;
  border-radius: 12px;
  padding: 1.5rem;
  margin: 1.5rem 0;
}
.formula-tree-title {
  font-weight: 600;
  color: #003366;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.formula-tree-root {
  font-size: 1.5rem;
  font-weight: 700;
  color: #007bff;
  text-align: center;
  margin-bottom: 0.5rem;
}
.formula-tree-eq {
  text-align: center;
  font-size: 1.2rem;
  color: #6c757d;
  margin-bottom: 0.75rem;
}
.formula-tree-branches {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 0.75rem;
}
.formula-tree-branch {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  background: #fff;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  min-width: 140px;
}
.branch-name { font-weight: 600; color: #2c3e50; font-size: 0.9rem; }
.branch-formula { font-family: 'Courier New', monospace; font-size: 0.8rem; color: #495057; margin-top: 0.25rem; }
.branch-times { font-size: 1.1rem; color: #007bff; font-weight: 700; }

.dupont-why-split, .dupont-origin {
  background: #fff;
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin: 1.25rem 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border-left: 4px solid #17a2b8;
}
.dupont-origin { border-left-color: #6f42c1; }
.dupont-why-split h4, .dupont-origin h4 {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  color: #2c3e50;
}
.dupont-why-split p, .dupont-origin p {
  margin: 0;
  color: #495057;
  line-height: 1.7;
  font-size: 0.95rem;
}

.dupont-summary-card .summary-preview {
  font-size: 0.9rem;
  color: #6c757d;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e9ecef;
}

/* ----- 2단계: ROE 정의, 벤치마크, 해석 ----- */
.roe-definition {
  background: #fff;
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin: 1.25rem 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border-left: 4px solid #007bff;
}
.roe-definition h4 { margin: 0 0 0.75rem 0; font-size: 1rem; color: #2c3e50; }
.roe-formula-block {
  font-family: 'Courier New', monospace;
  font-size: 1rem;
  color: #495057;
  margin: 0.5rem 0;
  word-break: break-all;
}
.roe-eq { color: #6c757d; }
.roe-result { font-weight: 700; color: #007bff; }
.roe-per-dollar {
  font-size: 0.9rem;
  color: #495057;
  margin: 0.75rem 0 0 0;
  padding: 0.5rem 0;
  border-top: 1px dashed #dee2e6;
}
.roe-benchmark {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
}
.roe-benchmark h4 { margin: 0 0 0.5rem 0; font-size: 0.95rem; color: #2c3e50; }
.roe-benchmark ul { margin: 0; padding-left: 1.25rem; line-height: 1.8; color: #495057; font-size: 0.9rem; }
.roe-same-diff {
  font-size: 0.9rem;
  color: #495057;
  line-height: 1.6;
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  background: #f0f7ff;
  border-radius: 8px;
}

/* ----- 3단계: 3요소 카드 + 수준 뱃지 + 이 기업 코멘트 ----- */
.dupont-formula-big {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  color: #003366;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, #e7f3ff 0%, #f0f7ff 100%);
  border-radius: 12px;
  margin: 1.5rem 0;
  border-left: 4px solid #007bff;
}

.components-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}
.component-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  transition: all 0.3s ease;
  cursor: pointer;
  border: 2px solid transparent;
}
.component-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(0,123,255,0.15);
  border-color: #007bff;
}
.component-card.active { border-color: #007bff; background: #f8fbff; }

.component-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.component-header > *:first-child { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; color: #2c3e50; }
.component-header i { color: #007bff; font-size: 1.1rem; }

.level-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.level-badge.level-high { background: #d4edda; color: #155724; }
.level-badge.level-mid { background: #fff3cd; color: #856404; }
.level-badge.level-low { background: #f8d7da; color: #721c24; }

.component-formula {
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  color: #495057;
  background: #f8f9fa;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  margin: 0.4rem 0;
}
.component-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: #007bff;
  margin: 0.5rem 0;
}
.component-easy {
  font-size: 0.85rem;
  color: #6c757d;
  margin: 0.4rem 0 0 0;
  line-height: 1.5;
}
.component-comment {
  font-size: 0.85rem;
  color: #495057;
  line-height: 1.5;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #eee;
}

/* ----- 4단계: 출처 안내, 데이터 카드 메타 ----- */
.dupont-data-source {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
}
.dupont-data-source h4 { margin: 0 0 0.5rem 0; font-size: 0.95rem; color: #2c3e50; }
.dupont-data-source ul { margin: 0; padding-left: 1.25rem; line-height: 1.8; color: #495057; font-size: 0.9rem; }

.dupont-data-grid { gap: 1rem; }
.dupont-data-card .data-meta {
  font-size: 0.8rem;
  color: #6c757d;
  margin-top: 0.5rem;
}
.dupont-data-card .data-source { color: #007bff; }

/* ----- 5단계: 계산 카드 3열, ROE 검증·주된 요인 한 블록 ----- */
.dupont-step5-calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0;
}
.dupont-step5-calc-card {
  background: #fff;
  border-radius: 12px;
  padding: 1rem 1.1rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.07);
  border: 1px solid #e9ecef;
  border-left: 4px solid #007bff;
}
.dupont-step5-calc-card .calc-card-header {
  font-weight: 600;
  color: #2c3e50;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.dupont-step5-calc-card .calc-card-header i { color: #007bff; font-size: 0.9rem; }
.dupont-step5-calc-card .calc-card-formula {
  font-size: 0.8rem;
  color: #6c757d;
  margin-bottom: 0.5rem;
}
.dupont-step5-calc-card .calc-card-eq {
  font-family: 'SF Mono', 'Consolas', 'Courier New', monospace;
  font-size: 0.85rem;
  color: #495057;
  line-height: 1.45;
  word-break: break-all;
}
.dupont-step5-calc-card .calc-card-eq strong { color: #007bff; font-size: 1.05em; }

.dupont-step5-verify {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, #f0fff4 0%, #e8f5e9 100%);
  border: 1px solid #c8e6c9;
  border-radius: 10px;
  margin: 1.25rem 0;
}
.step5-verify-roe {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
}
.step5-verify-roe .step5-verify-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #2e7d32;
  flex-shrink: 0;
}
.step5-verify-roe .step5-verify-formula {
  font-family: 'SF Mono', 'Consolas', 'Courier New', monospace;
  font-size: 0.9rem;
  color: #1b5e20;
}
.step5-verify-roe .step5-verify-formula .text-success { color: #2e7d32; margin-left: 0.2rem; }
.step5-verify-driver {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: #2c3e50;
  padding-left: 0.5rem;
  border-left: 2px solid #a5d6a7;
}
.step5-verify-driver i { color: #007bff; }
.step5-verify-driver strong { color: #007bff; }
.dupont-step5-note {
  font-size: 0.82rem;
  color: #6c757d;
  margin: 0.5rem 0 1rem 0;
  padding: 0;
}

/* ----- 6단계: 추이 인사이트, 차트 노트 ----- */
.trend-insight-box {
  background: #f0f7ff;
  border: 1px solid #cce5ff;
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin: 1.25rem 0;
}
.trend-insight-box h4 { margin: 0 0 0.5rem 0; font-size: 1rem; color: #003366; }
.trend-insight-box p { margin: 0; color: #495057; line-height: 1.7; font-size: 0.95rem; }

.chart-note {
  font-size: 0.85rem;
  color: #6c757d;
  line-height: 1.5;
  margin: 1rem 0 0 0;
  padding: 0.75rem 1rem;
  background: #f8f9fa;
  border-radius: 8px;
}

/* 6단계: 차트 카드·인터랙티브 스타일 */
.dupont-chart-card {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  border-top: 3px solid #6366f1;
  overflow: hidden;
  padding: 1.25rem 1.25rem 0.75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.dupont-chart-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  border-color: #cbd5e1;
  border-top-color: #4f46e5;
}
.dupont-chart-title {
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 1rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.dupont-chart-title i { color: #6366f1; }
.dupont-chart-inner {
  height: 360px;
  width: 100%;
  min-height: 280px;
  border-radius: 10px;
  overflow: hidden;
}
#dupont-components-chart .js-plotly-plot,
#dupont-trend-chart .js-plotly-plot {
  border-radius: 10px;
}
.dupont-chart-card .modebar {
  background: transparent !important;
  border-radius: 8px;
}
.dupont-chart-card .modebar-btn path {
  fill: #64748b;
}
.dupont-chart-card .modebar-btn:hover path {
  fill: #334155;
}
.dupont-chart-card .modebar-btn.active path {
  fill: #6366f1;
}

/* ----- 7단계: 이 기업 수치 강조 ----- */
.dupont-reasons-grid .reason-this {
  font-size: 0.8rem;
  font-weight: 600;
  color: #007bff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 0.75rem;
}
.dupont-reasons-grid .reason-this-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: #2c3e50;
  margin: 0.25rem 0 0 0;
}

/* ----- 8단계: 추가 지표, 다음 단계 링크 ----- */
.interpretation-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}
.interpretation-section .impact-card ul {
  margin: 0.5rem 0 0 0;
  padding-left: 1.25rem;
  line-height: 1.7;
  color: #495057;
}
.interp-more p { margin: 0.5rem 0 0 0; color: #495057; line-height: 1.6; font-size: 0.95rem; }
.interp-more a { color: #007bff; }

.next-steps-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  background: #f8f9fa;
  border-radius: 10px;
}
.next-steps-links a {
  color: #007bff;
  font-weight: 500;
  text-decoration: none;
}
.next-steps-links a:hover { text-decoration: underline; }

/* ----- 공통: ROE 카드, formula-box ----- */
.dupont-roe-card {
  max-width: 360px;
  margin: 1.5rem auto;
}

/* 2단계: 카드 4개 그리드 (ROE, 순이익, 자기자본, 참고수준) */
.dupont-step2-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}
.dupont-step2-cards .dupont-roe-card {
  max-width: none;
  margin: 0;
}
.dupont-step2-cards .data-card {
  min-height: 0;
}
.dupont-step2-cards .roe-level-value {
  font-size: 1.25rem;
}
.roe-explain { background: #f8f9fa; padding: 1rem 1.25rem; border-radius: 8px; margin: 1rem 0; border-left: 4px solid #17a2b8; }
.roe-explain p { margin: 0.5rem 0; color: #495057; line-height: 1.6; }

@media (max-width: 768px) {
  .components-overview { grid-template-columns: 1fr; }
  .interpretation-section { grid-template-columns: 1fr; }
  .dupont-step2-cards { grid-template-columns: 1fr; }
  .dupont-step5-calc-grid { grid-template-columns: 1fr; } /* 모바일: 1열 */
  .dupont-step5-verify { flex-direction: column; align-items: flex-start; }
  .step5-verify-driver { border-left: none; padding-left: 0; border-top: 2px solid #a5d6a7; padding-top: 0.5rem; margin-top: 0.25rem; }
  .dupont-formula-big { font-size: 1.05rem; }
  .formula-tree-branches { flex-direction: column; }
  .branch-times { transform: rotate(90deg); }
  .dupont-chart-card { padding: 1rem 1rem 0.5rem; }
  .dupont-chart-inner { height: 320px; min-height: 260px; }
}
