/**
 * SafeInvest AI v4.0 — Life Cycle 차트 + 자동 추천 카드 CSS
 *
 * timeline.css와 패턴 일관성 유지 (lc-* 접두사).
 * ApexCharts 기본 스타일은 라이브러리가 처리.
 */

/* ============================================================
   1. 차트 섹션 컨테이너
   ============================================================ */

.lc-chart-section {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--bg-primary, #fff);
  border-radius: 0.75rem;
  border: 1px solid var(--border-color, #e5e7eb);
}

.lc-chart-header {
  margin-bottom: 1rem;
}

.lc-chart-header h3 {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
  font-weight: 600;
}

.lc-chart-subtitle {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-secondary, #666);
}

.lc-chart-wrapper {
  position: relative;
  margin: 1rem 0;
  min-height: 420px;
}

.lc-chart-error {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--warning, #d97706);
  background: var(--bg-secondary, #fef3c7);
  border-radius: 0.5rem;
}

.lc-chart-legend {
  margin-top: 1rem;
  padding: 0.75rem;
  background: var(--bg-secondary, #f9fafb);
  border-radius: 0.375rem;
}

.lc-chart-note {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-secondary, #666);
}

/* ============================================================
   2. 시나리오 토글 버튼
   ============================================================ */

.lc-chart-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.lc-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  background: var(--bg-secondary, #f9fafb);
  border: 1.5px solid var(--border-color, #e5e7eb);
  border-radius: 9999px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s;
  --toggle-color: #3b82f6;
}

.lc-toggle:hover {
  background: var(--bg-primary, #fff);
  border-color: var(--toggle-color);
}

.lc-toggle-active {
  background: var(--bg-primary, #fff);
  border-color: var(--toggle-color);
  color: var(--text-primary, #333);
}

.lc-toggle:not(.lc-toggle-active) {
  opacity: 0.5;
}

.lc-toggle:not(.lc-toggle-active) .lc-toggle-dot {
  opacity: 0.4;
}

.lc-toggle-dot {
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 50%;
  background: var(--toggle-color);
  flex-shrink: 0;
}

.lc-toggle-label {
  white-space: nowrap;
  font-weight: 500;
}

/* ============================================================
   3. 차트 툴팁 (호버 시 자산 구성)
   ============================================================ */

.lc-tooltip {
  background: var(--bg-primary, #fff);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 0.5rem;
  padding: 0.875rem 1rem;
  font-size: 0.8125rem;
  min-width: 240px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.lc-tooltip-header {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.375rem;
  padding-bottom: 0.375rem;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.lc-tooltip-badge {
  font-size: 0.7rem;
  background: var(--primary, #3b82f6);
  color: #fff;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-weight: 500;
}

.lc-tooltip-net-worth {
  font-size: 0.95rem;
  margin: 0.375rem 0;
  color: var(--text-primary, #333);
}

.lc-tooltip-net-worth strong {
  color: var(--primary, #3b82f6);
}

.lc-tooltip-breakdown {
  padding: 0.375rem 0;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
  margin-bottom: 0.5rem;
}

.lc-tooltip-row {
  display: flex;
  justify-content: space-between;
  padding: 0.125rem 0;
  color: var(--text-secondary, #666);
}

.lc-tooltip-row strong {
  color: var(--text-primary, #333);
}

.lc-tooltip-bars {
  margin-top: 0.375rem;
}

.lc-tooltip-bar-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.25rem 0;
}

.lc-tooltip-bar-label {
  width: 50px;
  font-size: 0.75rem;
  color: var(--text-secondary, #666);
  flex-shrink: 0;
}

.lc-tooltip-bar-track {
  flex: 1;
  height: 0.5rem;
  background: var(--bg-secondary, #f3f4f6);
  border-radius: 9999px;
  overflow: hidden;
}

.lc-tooltip-bar-fill {
  height: 100%;
  transition: width 0.3s;
}

.lc-tooltip-bar-pct {
  width: 32px;
  text-align: right;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary, #333);
}

.lc-tooltip-warning {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color, #e5e7eb);
  color: var(--warning, #d97706);
  font-size: 0.75rem;
  font-weight: 500;
}

/* ============================================================
   4. 자동 개선 추천 카드
   ============================================================ */

.lc-improvement-card {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: linear-gradient(135deg, #fef3c7 0%, #fff 50%);
  border: 1px solid #fbbf24;
  border-radius: 0.75rem;
  position: relative;
  overflow: hidden;
}

.lc-improvement-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 50%, #fde68a 100%);
}

.lc-improvement-header {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.lc-improvement-icon {
  font-size: 2.5rem;
  flex-shrink: 0;
}

.lc-improvement-title-area {
  flex: 1;
}

.lc-improvement-eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  color: #d97706;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.lc-improvement-title {
  margin: 0 0 0.375rem;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary, #333);
}

.lc-improvement-reason {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-secondary, #666);
  line-height: 1.5;
}

/* ============================================================
   5. 효과 요약
   ============================================================ */

.lc-improvement-effect {
  background: var(--bg-primary, #fff);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.lc-effect-summary {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.25rem;
}

.lc-effect-label {
  font-size: 0.875rem;
  color: var(--text-secondary, #666);
  font-weight: 500;
}

.lc-effect-value {
  font-size: 1.75rem;
  font-weight: 700;
}

.lc-effect-positive {
  color: #059669;
}

.lc-effect-neutral {
  color: var(--text-secondary, #666);
}

.lc-effect-amount {
  font-size: 0.8125rem;
  color: var(--text-secondary, #666);
}

.lc-effect-amount strong {
  color: #059669;
}

/* ============================================================
   6. 핵심 시점 비교 테이블
   ============================================================ */

.lc-milestones {
  margin-bottom: 1.25rem;
}

.lc-milestones-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  background: var(--bg-primary, #fff);
  border-radius: 0.5rem;
  overflow: hidden;
  border: 1px solid var(--border-color, #e5e7eb);
}

.lc-milestones-table th {
  background: var(--bg-secondary, #f9fafb);
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-weight: 600;
  color: var(--text-secondary, #666);
  border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.lc-milestones-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-color, #f3f4f6);
}

.lc-milestones-table tbody tr:last-child td {
  border-bottom: none;
}

.lc-milestone-label {
  font-weight: 600;
  color: var(--text-primary, #333);
}

.lc-milestone-base {
  color: var(--text-secondary, #666);
}

.lc-milestone-improved {
  color: var(--text-primary, #333);
  font-weight: 500;
}

.lc-milestone-diff {
  font-weight: 600;
  text-align: right;
}

.lc-diff-positive {
  color: #059669;
}

.lc-diff-negative {
  color: #dc2626;
}

/* ============================================================
   7. 액션 가이드
   ============================================================ */

.lc-improvement-actions {
  background: var(--bg-primary, #fff);
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.lc-actions-header {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary, #333);
  margin-bottom: 0.625rem;
}

.lc-actions-list {
  margin: 0;
  padding-left: 1.25rem;
}

.lc-actions-list li {
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-primary, #333);
  margin-bottom: 0.375rem;
}

.lc-actions-list li:last-child {
  margin-bottom: 0;
}

/* ============================================================
   8. 면책
   ============================================================ */

.lc-improvement-disclaimer {
  margin: 0;
  padding: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-tertiary, #888);
  text-align: center;
  background: rgba(0,0,0,0.02);
  border-radius: 0.375rem;
  line-height: 1.5;
}

/* ============================================================
   9. 반응형
   ============================================================ */

@media (max-width: 640px) {
  .lc-chart-section {
    padding: 1rem;
  }

  .lc-chart-toggles {
    gap: 0.375rem;
  }

  .lc-toggle {
    padding: 0.375rem 0.625rem;
    font-size: 0.75rem;
  }

  .lc-improvement-header {
    flex-direction: column;
    gap: 0.5rem;
  }

  .lc-improvement-icon {
    font-size: 2rem;
  }

  .lc-milestones-table {
    font-size: 0.75rem;
  }

  .lc-milestones-table th,
  .lc-milestones-table td {
    padding: 0.375rem 0.5rem;
  }

  .lc-effect-value {
    font-size: 1.5rem;
  }
}
