/**
 * SafeInvest AI v4.0 — Life Cycle 타임라인 CSS
 *
 * 기존 lifecycle.js의 ls-* 패턴과 통일감 유지하되 lc-* 접두사 사용.
 * 색상 변수는 기존 SafeInvest 디자인 시스템 활용.
 */

/* ============================================================
   1. 헤더
   ============================================================ */

.lc-timeline-header {
  margin-bottom: 1.5rem;
}

.lc-timeline-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.lc-timeline-title-row h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.lc-timeline-actions {
  display: flex;
  gap: 0.5rem;
}

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

/* ============================================================
   2. 가로 스크롤 타임라인
   ============================================================ */

.lc-timeline-scroll-container {
  overflow-x: auto;
  overflow-y: visible;
  padding: 4rem 1rem 2rem;
  background: var(--bg-secondary, #f8f9fa);
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
  scroll-behavior: smooth;
}

.lc-timeline-scroll-container::-webkit-scrollbar {
  height: 8px;
}

.lc-timeline-scroll-container::-webkit-scrollbar-thumb {
  background: var(--border-color, #ddd);
  border-radius: 4px;
}

.lc-timeline-axis {
  position: relative;
  height: 120px;
  min-width: 100%;
}

.lc-axis-line {
  position: absolute;
  top: 60px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border-color, #ccc);
}

/* 눈금 */
.lc-tick {
  position: absolute;
  top: 56px;
  width: 1px;
  height: 10px;
  background: var(--border-color, #ccc);
}

.lc-tick-major {
  height: 16px;
  top: 50px;
  width: 2px;
  background: var(--text-secondary, #666);
}

.lc-tick-label {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  color: var(--text-secondary, #666);
  font-weight: 500;
  white-space: nowrap;
}

/* 이벤트 마커 */
.lc-event-marker {
  position: absolute;
  top: 0;
  cursor: pointer;
  z-index: 2;
  transition: transform 0.15s;
}

.lc-event-marker:hover {
  transform: translateY(-2px);
}

.lc-event-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-primary, #fff);
  border: 2px solid var(--primary, #3b82f6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  position: absolute;
  top: 40px;
  left: -18px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.lc-event-line {
  position: absolute;
  top: 78px;
  left: -1px;
  width: 2px;
  height: 30px;
  background: var(--primary, #3b82f6);
}

/* ============================================================
   3. 이벤트 카드 리스트
   ============================================================ */

.lc-event-list {
  margin-top: 1.5rem;
}

.lc-event-list h4 {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary, #333);
}

.lc-event-cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.lc-event-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-primary, #fff);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 0.5rem;
  transition: box-shadow 0.15s;
}

.lc-event-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.lc-event-card-icon {
  font-size: 1.75rem;
  flex-shrink: 0;
}

.lc-event-card-body {
  flex: 1;
  min-width: 0;
}

.lc-event-card-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.lc-event-card-age {
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--text-secondary, #666);
}

.lc-event-card-summary {
  font-size: 0.85rem;
  color: var(--text-secondary, #666);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lc-event-card-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  font-size: 1rem;
  border-radius: 0.25rem;
  transition: background 0.15s;
}

.btn-icon:hover {
  background: var(--bg-secondary, #f3f4f6);
}

/* ============================================================
   4. 빈 상태
   ============================================================ */

.lc-empty-state,
.lc-event-list-empty {
  text-align: center;
  padding: 3rem 1rem;
  background: var(--bg-secondary, #f8f9fa);
  border-radius: 0.5rem;
}

.lc-empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.lc-empty-state h3 {
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
}

.lc-empty-state p {
  margin: 0 0 1rem;
  color: var(--text-secondary, #666);
}

.lc-event-list-empty p {
  margin: 0.25rem 0;
  color: var(--text-secondary, #666);
}

.lc-block-note {
  font-size: 0.85rem;
  color: var(--text-tertiary, #888);
}

/* ============================================================
   5. 모달
   ============================================================ */

.lc-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.lc-modal-content {
  background: var(--bg-primary, #fff);
  border-radius: 0.75rem;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.lc-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.lc-modal-header h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.lc-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  color: var(--text-secondary, #666);
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
}

.lc-modal-close:hover {
  background: var(--bg-secondary, #f3f4f6);
}

.lc-modal-body {
  padding: 1.5rem;
}

.lc-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color, #e5e7eb);
  background: var(--bg-secondary, #f9fafb);
}

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

/* ============================================================
   6. 타입 선택 그리드
   ============================================================ */

.lc-type-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.lc-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 0.5rem;
  background: var(--bg-primary, #fff);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.15s;
}

.lc-type-btn:hover {
  border-color: var(--primary, #3b82f6);
  background: var(--bg-secondary, #f3f4f6);
  transform: translateY(-2px);
}

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

.lc-type-label {
  font-size: 0.85rem;
  font-weight: 500;
}

/* ============================================================
   7. 폼
   ============================================================ */

.lc-form-row {
  margin-bottom: 1.25rem;
}

/* v4.0 #87: 이벤트 모달 → KB 카드 학습 링크 */
.lc-form-kb-link {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(99, 102, 241, 0.06);
  border-left: 3px solid var(--c-brand, #5b6ee1);
  border-radius: 4px;
  font-size: 13px;
  color: var(--c-ink-2, #374151);
  line-height: 1.5;
}
.lc-form-kb-link a {
  color: var(--c-brand, #5b6ee1);
  text-decoration: none;
  font-weight: 600;
  margin-left: 4px;
}
.lc-form-kb-link a:hover {
  text-decoration: underline;
}

.lc-form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-primary, #333);
}

.lc-form-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.95rem;
  border: 1px solid var(--border-color, #d1d5db);
  border-radius: 0.375rem;
  background: var(--bg-primary, #fff);
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.lc-form-input:focus {
  outline: none;
  border-color: var(--primary, #3b82f6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.lc-form-hint {
  display: block;
  margin-top: 0.375rem;
  font-size: 0.8rem;
  color: var(--text-secondary, #666);
}

.lc-form-info {
  background: var(--info-bg, #eff6ff);
  border-left: 3px solid var(--info, #3b82f6);
  padding: 0.75rem 1rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  color: var(--text-primary, #333);
  margin: 1rem 0;
}

.lc-form-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.lc-form-checkbox input[type="checkbox"] {
  width: 1.125rem;
  height: 1.125rem;
  cursor: pointer;
}

/* ============================================================
   8. 검증 박스
   ============================================================ */

.lc-validation-box {
  margin-top: 1rem;
  padding: 0.875rem 1rem;
  background: var(--bg-secondary, #f9fafb);
  border-radius: 0.375rem;
  font-size: 0.875rem;
}

.lc-validation-row {
  display: flex;
  justify-content: space-between;
  padding: 0.25rem 0;
}

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

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

.lc-validation-warnings {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color, #e5e7eb);
}

.lc-validation-warning {
  color: var(--warning, #d97706);
  padding: 0.25rem 0;
  font-weight: 500;
}

.lc-validation-ok {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color, #e5e7eb);
  color: var(--success, #059669);
  font-weight: 500;
}

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

@media (max-width: 640px) {
  .lc-timeline-title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .lc-type-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .lc-event-card {
    flex-wrap: wrap;
  }

  .lc-event-card-summary {
    white-space: normal;
  }

  .lc-modal-content {
    margin: 0.5rem;
    max-height: 95vh;
  }

  .lc-modal-body {
    padding: 1rem;
  }
}
