/* ==========================================================================
   추억 다이어리 3-in-1 완전체 및 가족별 다중 필터 전용 독립 스타일시트
   - 300줄 상한제 준수 (약 240줄)
   - 발신자별 5대 고유 컬러 테마 (#2D6A4F, #E76F51, #2A9D8F, #9C8EB9, #E9C46A)
   ========================================================================== */

/* 1. 최상위 래퍼 */
.memory-diary-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 16px 80px;
  background: var(--bg-surface-alt, #fafbfc);
  min-height: calc(100vh - 120px);
}

/* 1-1. 최상단 헤더 타이틀 바 */
.diary-header-bar {
  display: flex;
  flex-direction: column;
  padding: 2px 2px 4px 2px;
}

.diary-header-title {
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.3px;
}

/* 2. 상단 3대 서브탭 세그먼트 컨트롤러 */
.diary-subtab-bar {
  display: flex;
  background: #e2e8f0;
  padding: 4px;
  border-radius: 14px;
  gap: 4px;
}

.diary-subtab-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px 4px;
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.diary-subtab-btn.active {
  background: #ffffff;
  color: #2d6a4f;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* 3. 가족별 다중 선택(중복 필터링) 칩 바 */
.family-multi-filter {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 2px 0 6px;
}

.family-filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  padding: 0 2px;
}

.family-chip-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 6px;
  scrollbar-width: none;
}
.family-chip-scroll::-webkit-scrollbar { display: none; }

.family-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  border: none;
  background: #f1f5f9;
  color: #475569;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.18s ease;
}

.family-chip .color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.family-chip.active {
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* 5대 가족 테마별 활성 색상 */
.family-chip.chip-all.active { color: #0f172a; border: none; background: #e2e8f0; }
.family-chip.chip-dad.active { color: #2d6a4f; border: none; background: #e8f5e9; }
.family-chip.chip-daughter1.active { color: #e76f51; border: none; background: #ffe8d6; }
.family-chip.chip-son.active { color: #2a9d8f; border: none; background: #e0f2f1; }
.family-chip.chip-daughter2.active { color: #8b5cf6; border: none; background: #f3e8ff; }
.family-chip.chip-grandson.active { color: #b07d1a; border: none; background: #fefae0; }

/* 4. 모드 1: 달력 그리드 */
.diary-calendar-card {
  background: #ffffff;
  border-radius: 18px;
  padding: 14px 12px 10px;
  border: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.diary-cal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding: 0 4px;
}

.diary-cal-month {
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
}

.diary-cal-nav {
  background: #f1f5f9;
  border: none;
  border-radius: 8px;
  width: 28px;
  height: 28px;
  font-size: 12px;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.diary-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  text-align: center;
}

.diary-cal-dayhead {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  padding-bottom: 6px;
}

.diary-cal-cell {
  height: 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 4px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  position: relative;
  transition: background 0.15s ease;
}

.diary-cal-cell.other-month { color: #cbd5e1; }
.diary-cal-cell.today { font-weight: 800; color: #2d6a4f; }
.diary-cal-cell.selected {
  background: #f0fdf4;
  border: 1.5px solid #2d6a4f;
  color: #2d6a4f;
  font-weight: 800;
}

/* 날짜 셀 멀티 점(Dot) */
.diary-dot-row {
  display: flex;
  gap: 3px;
  margin-top: 4px;
  align-items: center;
  justify-content: center;
  height: 6px;
}

.diary-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}
.diary-dot.dad { background: #2d6a4f; }
.diary-dot.daughter1 { background: #e76f51; }
.diary-dot.son { background: #2a9d8f; }
.diary-dot.daughter2 { background: #8b5cf6; }
.diary-dot.grandson { background: #e9c46a; }

/* 5. 선택된 날짜의 온기 교차 타임라인 카드 */
.diary-timeline-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.timeline-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 14px 16px;
  border: none;
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.04);
}

.timeline-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 7px;
}

.sender-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--font-size-xs, 11px);
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 8px;
}
.sender-badge.badge-dad { background: #e8f5e9; color: #2d6a4f; }
.sender-badge.badge-daughter1 { background: #ffe8d6; color: #e76f51; }
.sender-badge.badge-son, .sender-badge.badge-son1 { background: #e0f2f1; color: #2a9d8f; }
.sender-badge.badge-daughter2 { background: #f3e8ff; color: #8b5cf6; }
.sender-badge.badge-grandson { background: #fefae0; color: #b07d1a; }

.card-time {
  font-size: var(--font-size-xs, 11px);
  color: #94a3b8;
  font-weight: 600;
}

.card-text {
  font-size: var(--font-size-sm, 13.5px);
  line-height: 1.55;
  color: #334155;
  margin-bottom: 8px;
}

/* 오디오 플레이어 바 */
.audio-player-pill {
  background: #f1f5f9;
  border: none;
  border-radius: 20px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
}

.play-btn-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: #2d6a4f;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  cursor: pointer;
  flex-shrink: 0;
}

/* 6. 모드 2: 마구잡이 퀵 메모 피드 & FAB */
.quick-memo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.quick-memo-card {
  background: #ffffff;
  border-radius: 14px;
  padding: 12px;
  border: 1px solid #edf2f7;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100px;
}

.quick-memo-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  width: fit-content;
  margin-bottom: 6px;
}
.quick-memo-badge.text { background: #f1f5f9; color: #475569; }
.quick-memo-badge.voice { background: #e8f5e9; color: #2d6a4f; }
.quick-memo-badge.video { background: #fefae0; color: #b07d1a; }

.btn-quick-memo-write {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #2d6a4f;
  color: #ffffff;
  border: none;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
  margin-bottom: 12px;
  box-shadow: 0 3px 10px rgba(45, 106, 79, 0.25);
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.btn-quick-memo-write:active {
  transform: scale(0.98);
  background: #245740;
}

/* 7. 모드 3: 인생 인터뷰 질문 카드 */
.interview-card {
  background: #ffffff;
  border-radius: 18px;
  padding: 18px 16px;
  border: none;
  box-shadow: 0 4px 16px rgba(45, 106, 79, 0.08);
}

.interview-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  background: #e8f5e9;
  color: #2d6a4f;
  padding: 4px 10px;
  border-radius: 10px;
  margin-bottom: 10px;
}

.interview-question {
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.5;
  margin-bottom: 14px;
}

.interview-action-row {
  display: flex;
  gap: 8px;
}

.interview-btn {
  flex: 1;
  padding: 11px 0;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.interview-btn.primary { background: #2d6a4f; color: #ffffff; border: none; }
.interview-btn.secondary { background: #f1f5f9; color: #475569; border: none; }

/* 8. 환우 모드 접근성 강화 (64dp, 140% 폰트) */
body.patient-mode .family-chip {
  padding: 10px 16px;
  font-size: 15px;
}
body.patient-mode .diary-cal-cell {
  height: 56px;
  font-size: 15px;
}
body.patient-mode .card-text {
  font-size: 15px;
}
body.patient-mode .audio-player-pill {
  padding: 10px 16px;
  font-size: 14px;
}

/* 9. 캘린더 달력 ↔ 대화형 타임라인 뷰 전환 바 */
.diary-view-toggle-bar {
  display: flex;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 14px;
  margin: 4px 0 10px;
}

.diary-view-toggle-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px 0;
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
  border-radius: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.diary-view-toggle-btn.active {
  background: #ffffff;
  color: #2d6a4f;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* 10. 대화형 타임라인 연속 피드 */
.timeline-chat-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 24px;
}

.timeline-date-divider {
  text-align: center;
  margin: 18px 0 10px;
  position: relative;
}

.timeline-date-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: #e2e8f0;
  z-index: 1;
}

.timeline-date-tag {
  position: relative;
  z-index: 2;
  display: inline-block;
  background: #e2e8f0;
  color: #475569;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 14px;
  border-radius: 14px;
}

.chat-bubble-row {
  display: flex;
  margin-bottom: 6px;
  gap: 8px;
}

.chat-bubble-row.dad-row {
  justify-content: flex-start;
}

.chat-bubble-row.family-row {
  justify-content: flex-end;
}

.chat-bubble-row .bubble-content {
  max-width: 90%;
  padding: 13px 15px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.chat-bubble-row.dad-row .bubble-content {
  border: 1.5px solid #2d6a4f;
  border-radius: 18px 18px 18px 4px;
}

.chat-bubble-row.family-row .bubble-content {
  border-radius: 18px 18px 4px 18px;
}

.chat-bubble-row.family-row.bubble-daughter1 .bubble-content {
  background: #fff8f5;
  border: 1.5px solid #e76f51;
}

.chat-bubble-row.family-row.bubble-son .bubble-content {
  background: #f4fbf9;
  border: 1.5px solid #2a9d8f;
}

.chat-bubble-row.family-row.bubble-daughter2 .bubble-content {
  background: #fbf8ff;
  border: 1.5px solid #8b5cf6;
}

.chat-bubble-row.family-row.bubble-grandson .bubble-content {
  background: #fefdf6;
  border: 1.5px solid #e9c46a;
}
