/**
 * SafeInvest AI v4.0 — W4 통합 CSS
 *
 * 진단 화면 미니 차트 (ls-mini-*) + 시나리오 수치 카드 (lc-summary-*).
 * 기존 lifecycle.css의 ls-* 패턴 활용 + chart.css의 lc-* 패턴 활용.
 */

/* ============================================================
   1. 진단 결과 화면 미니 차트 블록 (W4-A)
   ============================================================ */

.ls-mini-chart-wrapper {
  background: linear-gradient(135deg, #f0f9ff 0%, #fff 100%);
  border: 1px solid #bfdbfe;
  position: relative;
  overflow: hidden;
}

.ls-mini-chart-wrapper::before {
  content: "✨ v4.0";
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: #3b82f6;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  letter-spacing: 0.05em;
}

/* ============================================================
   2. 미니 통계 카드 그리드
   ============================================================ */

.ls-mini-stats {
  margin: 1rem 0;
}

.ls-mini-stats-grid {
  /* v4.0 #81: 4 카드 1줄 가로 배치 (개선 카드는 별도 줄) */
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

/* 개선 시나리오 카드는 전체 너비 차지 (4번째 카드) */
.ls-mini-stats-grid > .ls-stat-improvement {
  grid-column: 1 / -1;
}

@media (max-width: 720px) {
  .ls-mini-stats-grid {
    grid-template-columns: 1fr;
  }
  .ls-mini-stats-grid > .ls-stat-improvement {
    grid-column: auto;
  }
}

.ls-mini-stat-card {
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 0.5rem;
  border-top: 3px solid var(--stat-color, #94a3b8);
  position: relative;
  transition: transform 0.15s, box-shadow 0.15s;
}

.ls-mini-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.ls-stat-highlight {
  background: linear-gradient(135deg, #eff6ff 0%, #fff 100%);
  border-color: var(--stat-color, #3b82f6);
}

.ls-stat-improvement {
  background: linear-gradient(135deg, #fef3c7 0%, #fff 100%);
  border-color: var(--stat-color, #f59e0b);
}

.ls-stat-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary, #666);
  letter-spacing: 0.02em;
  margin-bottom: 0.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px dashed rgba(0,0,0,0.08);
}

.ls-stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary, #333);
  margin-bottom: 0.25rem;
  line-height: 1.2;
}

/* v4.0 #83: 시나리오 카드 라인 format ("라벨 : 값" 가로) */
.ls-stat-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 0;
  font-size: 0.78rem;
  line-height: 1.4;
  flex-wrap: wrap;
}
.ls-stat-line-label {
  color: var(--text-secondary, #666);
  font-weight: 500;
  min-width: fit-content;
}
.ls-stat-line-value {
  color: var(--text-primary, #333);
  font-weight: 600;
  flex: 1;
}
.ls-stat-line-value strong {
  color: var(--text-primary, #333);
  font-weight: 700;
}
.ls-stat-withdraw {
  border-top: 1px dashed rgba(0,0,0,0.05);
  margin-top: 2px;
  padding-top: 6px;
}

.ls-stat-sub, .ls-stat-sub-line {
  font-size: 0.72rem;
  color: var(--text-secondary, #666);
  line-height: 1.35;
}

.ls-stat-sub strong {
  color: var(--text-primary, #333);
  font-weight: 600;
}

/* ============================================================
   3. 미니 차트 캔버스
   ============================================================ */

.ls-mini-chart {
  background: #fff;
  border-radius: 0.5rem;
  padding: 0.5rem;
  margin: 1rem 0;
  min-height: 280px;
}

/* ============================================================
   4. CTA 영역
   ============================================================ */

.ls-mini-cta {
  margin-top: 1.25rem;
  text-align: center;
  padding: 1rem;
  background: rgba(59, 130, 246, 0.05);
  border-radius: 0.5rem;
}

.ls-mini-cta-hint {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: var(--text-secondary, #666);
}

/* ============================================================
   5. 시나리오 수치 카드 (W4-C, 타임라인 페이지)
   ============================================================ */

.lc-summary-cards {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
}

.lc-summary-cards h4 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 600;
}

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

.lc-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.875rem;
}

.lc-summary-card {
  padding: 1rem 1.125rem;
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 0.5rem;
  border-top: 3px solid var(--card-color, #94a3b8);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  --card-color: #94a3b8;
}

.lc-summary-highlight {
  background: linear-gradient(135deg, #eff6ff 0%, #fff 50%);
  border-color: var(--card-color);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.lc-summary-improvement {
  background: linear-gradient(135deg, #fef3c7 0%, #fff 50%);
  border-color: var(--card-color);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.1);
}

.lc-summary-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary, #333);
}

.lc-summary-dot {
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 50%;
  background: var(--card-color);
}

.lc-summary-label {
  font-weight: 600;
}

.lc-summary-main {
  padding: 0.5rem 0;
  border-bottom: 1px solid #f3f4f6;
}

.lc-summary-main-label {
  font-size: 0.75rem;
  color: var(--text-secondary, #666);
  margin-bottom: 0.125rem;
}

.lc-summary-main-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary, #333);
}

.lc-summary-rows {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.lc-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
}

.lc-summary-row-label {
  color: var(--text-secondary, #666);
}

.lc-summary-row-value {
  font-weight: 600;
  color: var(--text-primary, #333);
}

.lc-summary-secondary {
  color: var(--text-tertiary, #888) !important;
  font-weight: 500 !important;
}

/* ============================================================
   6. 자금 지속 배지
   ============================================================ */

.lc-badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.lc-badge-success {
  background: #d1fae5;
  color: #065f46;
}

.lc-badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.lc-badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

/* ============================================================
   7. 면책 (수치 카드 하단)
   ============================================================ */

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

/* ============================================================
   8. 반응형
   ============================================================ */

@media (max-width: 640px) {
  .ls-mini-stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .ls-mini-cta button {
    width: 100%;
  }

  .lc-summary-grid {
    grid-template-columns: 1fr;
  }

  .lc-summary-main-value {
    font-size: 1.25rem;
  }
}
