/**
 * Dashboard Timeline View CSS
 * 구글 캘린더 스타일의 타임라인 뷰 스타일
 * 
 * @version 1.0.0
 */

/* ==========================================================================
   CSS Variables
   ========================================================================== */

:root {
  --timeline-bg: var(--dm-surface, #ffffff);
  --timeline-border: var(--gray-200, #e5e7eb);
  --timeline-hour-text: var(--gray-400, #9ca3af);
  --timeline-hour-line: var(--gray-200, #e5e7eb);
  --timeline-grid-line: var(--gray-100, #f3f4f6);
  --timeline-current-line: #ef4444;
  --timeline-event-bg: #0ea5e9;
  --timeline-event-text: #ffffff;
  --timeline-unscheduled-bg: var(--gray-50, #f8fafc);
  --timeline-unscheduled-border: var(--gray-200, #e2e8f0);
  --timeline-kpi-success: var(--dm-primary, #6366F1);
  --timeline-kpi-time: var(--gray-500, #64748b);
  --primary-color: #0ea5e9;
  --primary-hover: #0284c7;
  --text-primary: var(--dm-text-primary, #1f2937);
  --text-secondary: var(--dm-text-secondary, #6b7280);
  --session-btn-hover: #f1f5f9;
  --session-btn-disabled-bg: #f8fafc;
  --session-btn-disabled-text: #94a3b8;
}

[data-theme="dark"] {
  --timeline-bg: #1f2937;
  --timeline-border: #374151;
  --timeline-hour-text: #aab2ff; /* 아이스 블루 */
  --timeline-hour-line: linear-gradient(to right, rgba(170, 178, 255, 0.15), rgba(255, 255, 255, 0.02));
  --timeline-grid-line: #374151;
  --timeline-current-line: #f43f5e;
  --timeline-event-bg: #38bdf8;
  --timeline-event-text: #ffffff;
  --timeline-unscheduled-bg: #111827;
  --timeline-unscheduled-border: #374151;
  --timeline-kpi-success: #818cf8;
  --timeline-kpi-time: #9ca3af;
  --text-primary: #f9fafb;
  --text-secondary: #d1d5db;
  --session-btn-hover: #374151;
  --session-btn-disabled-bg: #111827;
  --session-btn-disabled-text: #4b5563;
  --sidebar-glass-bg: rgba(26, 28, 44, 0.6);
  --neon-blue: #0ea5e9;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --timeline-bg: #1f2937;
    --timeline-border: #374151;
    --timeline-hour-text: #aab2ff; /* 아이스 블루 */
    --timeline-hour-glow: rgba(170, 178, 255, 0.4);
    --timeline-hour-line: linear-gradient(to right, rgba(170, 178, 255, 0.2), rgba(255, 255, 255, 0.02));
    --timeline-grid-line: #374151;
    --timeline-current-line: #f43f5e;
    --timeline-event-bg: #38bdf8;
    --timeline-event-text: #ffffff;
    --timeline-unscheduled-bg: #111827;
    --timeline-unscheduled-border: #374151;
    --timeline-kpi-success: #818cf8;
    --timeline-kpi-time: #9ca3af;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --session-btn-hover: #374151;
    --session-btn-disabled-bg: #111827;
    --session-btn-disabled-text: #4b5563;
    --sidebar-glass-bg: rgba(26, 28, 44, 0.6);
    --neon-blue: #0ea5e9;
  }

  .session-action-btn:hover {
    background-color: #374151 !important;
    color: #ffffff !important;
  }

  .session-timer-btn:disabled {
    background-color: #111827 !important;
    color: #4b5563 !important;
    border-color: #374151 !important;
  }
}

/* ==========================================================================
   Timeline Header
   ========================================================================== */

.timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--timeline-bg) !important;
  border-bottom: 1px solid var(--timeline-border);
  gap: 12px;
  flex-wrap: wrap;
}

.timeline-header-meta {
  display: flex;
  align-items: center;
  gap: 20px;
}

.timeline-date-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.timeline-nav-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--timeline-border);
  background: var(--timeline-bg);
  color: var(--text-primary, #1f2937);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s;
}

.timeline-nav-btn:hover {
  background: var(--primary-color, #0ea5e9);
  color: white;
  border-color: var(--primary-color, #0ea5e9);
}

.timeline-date-display {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary, #1f2937);
  min-width: 180px;
  text-align: center;
}

.timeline-today-btn {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--timeline-border);
  background: var(--timeline-bg);
  color: var(--text-primary, #1f2937);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.timeline-today-btn:hover {
  background: var(--primary-color, #0ea5e9);
  color: white;
  border-color: var(--primary-color, #0ea5e9);
}

/* ==========================================================================
   KPI Summary
   ========================================================================== */

.timeline-kpi {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
}

.timeline-kpi-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.timeline-kpi-icon {
  font-size: 16px;
}

.timeline-kpi-value {
  font-weight: 600;
  color: var(--timeline-kpi-success);
}

.timeline-kpi-percent {
  color: var(--timeline-kpi-success);
  font-size: 13px;
}

.timeline-kpi-time {
  color: var(--timeline-kpi-time);
}

.timeline-kpi-divider {
  width: 1px;
  height: 20px;
  background: var(--timeline-border);
}

/* ==========================================================================
   View Toggle
   ========================================================================== */

.timeline-view-toggle {
  display: flex;
  background: var(--timeline-unscheduled-bg);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--timeline-border);
}

.timeline-view-btn {
  padding: 6px 16px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary, #64748b);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.timeline-view-btn.active {
  background: var(--primary-color, #0ea5e9) !important;
  color: white !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Redefine global theme behavior for navigation components */
[data-theme="dark"] .timeline-nav-btn,
[data-theme="dark"] .timeline-today-btn {
  background: #1e293b;
  color: #f8fafc;
  border-color: #334155;
}

[data-theme="dark"] .timeline-nav-btn:hover,
[data-theme="dark"] .timeline-today-btn:hover {
  background: var(--primary-color);
  border-color: var(--primary-color);
}

.timeline-view-btn:first-child {
  border-right: 1px solid var(--timeline-border);
}

.timeline-view-btn.active {
  background: var(--primary-color, #0ea5e9);
  color: white;
}

.timeline-view-btn:hover:not(.active) {
  background: rgba(14, 165, 233, 0.1);
}

/* ==========================================================================
   Unscheduled Sessions Area
   ========================================================================== */

.timeline-unscheduled {
  padding: 12px 20px;
  background: var(--timeline-unscheduled-bg);
  border-bottom: 1px solid var(--timeline-unscheduled-border);
}

.unscheduled-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.unscheduled-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--timeline-kpi-success);
}

.unscheduled-title .icon {
  font-size: 14px;
}

.unscheduled-count {
  background: var(--primary-color, #0ea5e9);
  color: white;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.unscheduled-sessions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.unscheduled-session-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(245, 158, 11, 0.08); /* 앰버/오렌지 틴트로 시간 미정 강조 */
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-left: 4px solid #f59e0b; /* 좌측 강조 바 */
  border-radius: 8px;
  cursor: grab;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

.unscheduled-session-chip.completed {
  background: rgba(16, 185, 129, 0.12); /* 초록색 틴트 약간 강화 */
  border-color: rgba(16, 185, 129, 0.4);
  border-left-color: #10b981; /* 초록색 바 */
}

/* 시간 미정 칩 집중도 평가 반영 */
.unscheduled-session-chip.rating-focus {
  background: rgba(16, 185, 129, 0.25) !important;
  border-color: rgba(16, 185, 129, 0.5) !important;
  border-left-color: #34d399 !important;
}

.unscheduled-session-chip.rating-normal {
  background: rgba(16, 185, 129, 0.15) !important;
  border-color: rgba(16, 185, 129, 0.4) !important;
  border-left-color: #10b981 !important;
}

.unscheduled-session-chip.rating-distracted {
  background: rgba(16, 185, 129, 0.08) !important;
  border-color: rgba(16, 185, 129, 0.2) !important;
  border-left-color: #6ee7b7 !important;
  opacity: 0.8;
}

.unscheduled-session-chip.completed .unscheduled-chip-parent,
.unscheduled-session-chip.completed .unscheduled-chip-title {
  text-decoration: line-through;
  opacity: 0.7;
}

.unscheduled-chip-icon {
  color: #10b981;
  font-weight: bold;
  font-size: 14px;
}

.unscheduled-session-chip:hover {
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.unscheduled-session-chip:active {
  cursor: grabbing;
}

.unscheduled-session-chip.dragging {
  opacity: 0.5;
  transform: scale(0.95);
}

.unscheduled-chip-content {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
}

.unscheduled-chip-parent {
  color: var(--timeline-hour-text);
  font-size: 11px;
  font-weight: 500;
  padding: 1px 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.unscheduled-chip-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.unscheduled-chip-duration {
  margin-left: auto;
  color: var(--timeline-hour-text);
  font-size: 11px;
  font-family: monospace;
}

/* ==========================================================================
   Day View - Timeline Grid
   ========================================================================== */

.timeline-day-view {
  position: relative;
  background: var(--timeline-bg);
  min-height: 400px;
  max-height: calc(100vh - 280px); /* 헤더+미정영역 고려 */
  overflow-y: auto;
}

.timeline-hours {
  position: relative;
  padding: 0 16px;
}

/* 좌측 시간축 글래스모피즘 사이드바 영역 - grid 컨테이너에 직접 적용 */
[data-theme="dark"] #timeline-hours-grid::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 60px; /* label width와 동일 */
  /* height: 100% -> 1440px: 스크롤 영역 전체를 커버하도록 수정 (9AM 컷오프 방지) */
  height: 1440px; 
  background: var(--sidebar-glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-right: 1px solid rgba(170, 178, 255, 0.1);
  z-index: 1;
  pointer-events: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #timeline-hours-grid::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 60px;
    height: 1440px; /* 고정 높이 적용 */
    background: rgba(26, 28, 44, 0.8); /* 명확성을 위해 투명도 조절 */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-right: 1px solid rgba(170, 178, 255, 0.15);
    z-index: 1;
    pointer-events: none;
  }
}

/* 세로 네온 라인 추가 */
[data-theme="dark"] #timeline-hours-grid::after {
  content: '';
  position: absolute;
  left: 60px;
  top: 0;
  width: 1px;
  height: 1440px; /* 고정 높이 적용 */
  background: linear-gradient(to bottom, 
    transparent, 
    var(--neon-blue), 
    transparent
  );
  opacity: 0.4;
  z-index: 5;
  pointer-events: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #timeline-hours-grid::after {
    content: '';
    position: absolute;
    left: 60px;
    top: 0;
    width: 2px; /* 1px -> 2px로 강화 */
    height: 1440px; /* 고정 높이 적용 */
    background: linear-gradient(to bottom, 
      transparent, 
      var(--neon-blue), 
      var(--neon-blue),
      transparent
    );
    opacity: 0.6; /* 0.4 -> 0.6으로 강화 */
    z-index: 5;
    pointer-events: none;
  }
}

.timeline-hour-row {
  position: absolute;
  left: 0;
  right: 0;
  height: 60px;
  box-sizing: border-box;
}

.timeline-hour-row::after {
  content: '';
  position: absolute;
  top: 0;
  left: 60px;
  right: 0;
  height: 1px;
  background: var(--timeline-hour-line);
  transition: all 0.3s ease;
}

[data-theme="dark"] .timeline-hour-row.active::after {
  background: linear-gradient(to right, rgba(14, 165, 233, 0.6), rgba(170, 178, 255, 0.3), rgba(255, 255, 255, 0.05));
  height: 2px;
  opacity: 1;
  box-shadow: 0 0 15px rgba(14, 165, 233, 0.3);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .timeline-hour-row.active::after {
    background: linear-gradient(to right, rgba(14, 165, 233, 0.6), rgba(170, 178, 255, 0.3), rgba(255, 255, 255, 0.05));
    height: 2px;
    opacity: 1;
    box-shadow: 0 0 15px rgba(14, 165, 233, 0.3);
  }
}

.timeline-hour-row.drag-over {
  /* 배경 강조 제거 요청 반영 */
  background-color: transparent !important;
}

.timeline-hour-label {
  position: absolute;
  left: 0;
  width: 60px;
  text-align: right;
  padding-right: 12px;
  font-size: 11px;
  color: var(--timeline-hour-text);
  user-select: none;
  pointer-events: none;
  line-height: 1;
  z-index: 2; /* 사이드바 위로 */
  transition: all 0.3s ease;
}

[data-theme="dark"] .timeline-hour-label.active {
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
  text-shadow: 0 0 12px var(--timeline-hour-glow, rgba(170, 178, 255, 0.6)), 0 0 20px rgba(14, 165, 233, 0.5);
  /* 굳이 색깔을 달리할 필요가 없다는 요청에 따라 배경 강조 제거 */
  background: transparent; 
  border-radius: 4px;
  padding-left: 4px;
  margin-right: -4px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .timeline-hour-label.active {
    color: #ffffff;
    font-weight: 700;
    font-size: 13px;
    text-shadow: 0 0 12px var(--timeline-hour-glow, rgba(170, 178, 255, 0.6)), 0 0 20px rgba(14, 165, 233, 0.5);
    background: transparent;
    border-radius: 4px;
    padding-left: 4px;
    margin-right: -4px;
  }
}

/* 다크모드 일반 라벨 글로우 강화 */
[data-theme="dark"] .timeline-hour-label {
  text-shadow: 0 0 8px rgba(170, 178, 255, 0.3);
  font-weight: 500;
  color: var(--timeline-hour-text);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .timeline-hour-label {
    text-shadow: 0 0 8px rgba(170, 178, 255, 0.3);
    font-weight: 500;
    color: var(--timeline-hour-text);
  }
}

.timeline-hour-content {
  flex: 1;
  position: relative;
  min-height: 60px;
}

/* Current time indicator */
.timeline-now-indicator {
  position: absolute;
  left: 60px;
  right: 16px;
  height: 2px;
  background: var(--timeline-current-line);
  z-index: 20;
  pointer-events: none;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

/* Drop preview - 고도로 명확하게 개선 */
.timeline-drop-preview {
  position: absolute;
  left: 60px;
  right: 16px;
  background: rgba(14, 165, 233, 0.1); 
  border: 2px dashed var(--primary-color); 
  border-radius: 4px;
  z-index: 2000; /* 드래그 중인 요소(1000)보다 위에 표시 */
  pointer-events: none;
  display: none;
  font-size: 13px;
  color: var(--primary-color);
  padding: 8px 12px;
  font-weight: 700;
  box-sizing: border-box;
  box-shadow: 0 0 15px rgba(14, 165, 233, 0.2);
  transition: top 0.1s cubic-bezier(0.18, 0.89, 0.32, 1.28); /* 특특특 걸리는 애니메이션 */
}

.timeline-drop-preview::before {
  content: '⏰ ' attr(data-time);
  position: absolute;
  top: -24px;
  left: 0;
  background: var(--primary-color);
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}

.timeline-now-indicator::before {
  content: '';
  position: absolute;
  left: -5px;
  top: -4px;
  width: 10px;
  height: 10px;
  background: var(--timeline-current-line);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2);
}

.timeline-now-indicator-dot {
  display: none; /* Replaced by ::before */
}

/* Timeline Event */
.timeline-event {
  position: absolute;
  background: rgba(14, 165, 233, 0.2); /* 기본 Glass 배경 (Light) */
  border-radius: 10px;
  padding: 0 12px;
  color: var(--text-primary); /* Light mode text color */
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  overflow: hidden;
  z-index: 10;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), inset 0 1px 1px rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  display: flex !important;
  align-items: center;
}

[data-theme="dark"] .timeline-event {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.25), rgba(56, 189, 248, 0.1));
  color: #ffffff; /* Dark mode text color */
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top: 1px solid rgba(255, 255, 255, 0.25); /* 상단 내부 광원 효과 */
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .timeline-event {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.25), rgba(56, 189, 248, 0.1));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-top: 1px solid rgba(255, 255, 255, 0.25); /* 상단 내부 광원 효과 */
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  }
}

/* 리사이징 시각적 피드백 제거 */
.timeline-event::after {
  display: none !important;
}

.timeline-event:hover::after {
  display: none !important;
}

.timeline-event:hover {
  transform: scale(1.02) translateY(-1px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  z-index: 50;
  cursor: grab; /* 리사이즈 대신 잡기 포인터 표시 */
}

/* 기본 완료 상태 (평가 없음) */
.timeline-event.completed {
  background: rgba(16, 185, 129, 0.2) !important;
  border-top-color: rgba(167, 243, 208, 0.3) !important;
  opacity: 0.9;
}

/* 최고였어요 (Focus): 더 밝고 선명한 그린 + 강화된 내부 광원 */
.timeline-event.rating-focus {
  background: rgba(16, 185, 129, 0.45) !important;
  border-top-color: rgba(52, 211, 153, 0.6) !important;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.2);
  opacity: 1;
}

/* 해냈어요 (Normal): 표준 에메랄드 그린 */
.timeline-event.rating-normal {
  background: rgba(16, 185, 129, 0.3) !important;
  border-top-color: rgba(167, 243, 208, 0.4) !important;
  opacity: 1;
}

/* 좀 아쉬워요 (Distracted): 채도가 낮고 투명도가 높은 차분한 그린 */
.timeline-event.rating-distracted {
  background: rgba(16, 185, 129, 0.15) !important;
  border-top-color: rgba(167, 243, 208, 0.2) !important;
  opacity: 0.8;
}

/* 진행 중 상태: 좌측 네온 블루 라인 강조 */
.timeline-event.in-progress {
  background: rgba(14, 165, 233, 0.35) !important;
  border-left: 3px solid var(--neon-blue, #0ea5e9) !important;
}

.timeline-event.in-progress .event-goal-name {
  color: #0369a1; /* Light mode: Dark Blue */
  font-weight: 700;
}

[data-theme="dark"] .timeline-event.in-progress .event-goal-name {
  color: #e3f2fd; /* Dark mode: Ice Blue */
}

/* 드래그 및 상호작용 중인 상태 (Premium Drag Proxy)
   - 프리뷰 시간 정보를 가리지 않도록 너비를 줄이고 오른쪽으로 살짝 밀어냅니다. */
.timeline-event.dragging {
  opacity: 0.6 !important; /* 투명도를 더 낮춰 아래 프리뷰 확인 용이 */
  width: 150px !important; /* 너비를 작게 고정하여 시야 확보 */
  left: 100px !important; /* 왼쪽 시간 라벨 영역 노출 */
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 20px rgba(14, 165, 233, 0.4) !important;
  z-index: 3000 !important;
  cursor: grabbing !important;
  transform: scale(1.04) rotate(1deg) !important;
  background: var(--primary-color) !important;
  color: white !important;
  border: 1px solid rgba(255, 255, 255, 0.4) !important;
  backdrop-filter: blur(12px) brightness(1.1);
  -webkit-backdrop-filter: blur(12px) brightness(1.1);
  pointer-events: none;
}

/* 드래그 중에는 핵심 정보(태스크명)만 남기고 나머지는 숨겨서 가독성 및 시야 확보 */
.timeline-event.dragging .event-goal-name,
.timeline-event.dragging .event-time-info,
.timeline-event.dragging .event-icon {
  display: none !important;
}

.timeline-event.dragging .event-task-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
}

.unscheduled-session-chip.dragging {
  opacity: 0.3; /* 시간 미정 칩도 드래그 시 투명하게 */
}

.timeline-event-single-line {
  display: flex;
  align-items: center;
  gap: 12px; /* 간격 넓힘 */
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  font-size: 13px;
}

.event-icon {
  color: #22c55e;
  font-weight: bold;
  margin-right: -4px;
}

.event-task-name {
  color: rgba(255, 255, 255, 0.95);
  font-size: 10px;
  font-weight: 700;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 2px 10px;
  background: rgba(0, 0, 0, 0.35); /* 대비를 위해 더 어둡게 */
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.event-goal-name {
  color: var(--text-primary); /* Light mode override */
  font-weight: 700;
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
  letter-spacing: -0.01em;
}

.event-time-info {
  margin-left: auto;
  padding-left: 12px;
  border-left: 1px solid rgba(0, 0, 0, 0.1); /* Light mode border */
  color: var(--text-secondary); /* Light mode text */
  font-size: 11.5px;
  font-weight: 600;
  font-family: 'Pretendard', sans-serif;
  flex-shrink: 0;
  opacity: 1; /* 투명도 제거로 선명도 확보 */
}

[data-theme="dark"] .event-goal-name {
  color: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .event-goal-name {
    color: #ffffff;
  }
}

[data-theme="dark"] .event-time-info {
  border-left: 1px solid rgba(255, 255, 255, 0.25);
  color: #e0f2fe;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .event-time-info {
    border-left: 1px solid rgba(255, 255, 255, 0.25);
    color: #e0f2fe;
  }
}

.event-time-info small {
  font-size: 10.5px;
  margin-left: 4px;
  color: inherit; /* 부모 색상 상속 -> 라이트모드에선 회색 */
  opacity: 0.8;
  font-weight: 500;
}

[data-theme="dark"] .event-time-info small {
  color: #bae6fd; /* 다크모드: 연한 하늘색 */
  opacity: 1;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .event-time-info small {
    color: #bae6fd;
    opacity: 1;
  }
}

/* 기존 스타일 제거/무시 */
.timeline-event-header,
.timeline-event-title,
.timeline-event-meta {
  display: none;
}

/* ==========================================================================
   Month View - Session List
   ========================================================================== */

.timeline-month-view {
  background: var(--timeline-bg);
  min-height: 400px;
  /* overflow-y 제거하여 전체 페이지 스크롤 활용 */
}

.timeline-date-group {
  border-bottom: 1px solid var(--timeline-border);
}

.timeline-date-header {
  padding: 16px 20px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary, #1f2937);
  background: var(--timeline-bg);
  position: sticky;
  top: 0;
  z-index: 5;
}

.timeline-session-item {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  border-top: 1px solid var(--timeline-border);
  gap: 16px;
  cursor: pointer;
  transition: background 0.2s;
}

.timeline-session-item:hover {
  background: rgba(14, 165, 233, 0.05);
}

.session-time {
  width: 80px;
  font-size: 13px;
  color: var(--timeline-hour-text);
  flex-shrink: 0;
}

.session-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary-color, #0ea5e9);
  flex-shrink: 0;
}

.session-dot.completed {
  background: #22c55e;
}

.session-info {
  flex: 1;
  min-width: 0;
}

.session-title {
  font-size: 14px;
  color: var(--text-primary, #1f2937);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.session-progress-text {
  color: var(--primary-color, #0ea5e9);
  font-weight: 500;
}

.session-duration {
  color: var(--timeline-hour-text);
}

/* ==========================================================================
   Empty State
   ========================================================================== */

.timeline-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--timeline-hour-text);
  text-align: center;
}

.timeline-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.timeline-empty-title {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-primary, #1f2937);
}

.timeline-empty-desc {
  font-size: 14px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

/* Add Session Modal Styles */
.add-session-modal {
  width: 100%;
  max-width: 480px;
  background: var(--timeline-bg);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
  position: relative;
  z-index: 1010;
  border: 1px solid var(--timeline-border);
  animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* 🆕 잠긴 항목 흔들림 애니메이션 (도리도리) */
@keyframes shake-locked {
  0% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-8px); }
  80% { transform: translateX(8px); }
  100% { transform: translateX(0); }
}

.shake-locked {
  animation: shake-locked 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  perspective: 1000px;
}

.add-session-modal .modal-header {
  padding: 24px;
  border-bottom: 1px solid var(--timeline-border);
}

.add-session-modal .modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.add-session-modal .form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.add-session-modal label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, #e2e8f0);
  white-space: nowrap;
}

.add-session-modal .form-control {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--timeline-border);
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  font-size: 15px;
  transition: all 0.2s;
  box-sizing: border-box;
}

.add-session-modal .form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

/* For light mode support if needed */
[data-theme="light"] .add-session-modal label {
  color: #374151;
}
[data-theme="light"] .add-session-modal .form-control {
  background: #f9fafb;
  color: #111827;
}

.add-session-modal .form-row {
  display: flex;
  gap: 12px;
}

.add-session-modal .flex-1 {
  flex: 1;
}

.add-session-modal .modal-footer {
  padding: 16px 24px 24px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

@media (max-width: 768px) {
  .timeline-header {
    flex-direction: column;
    align-items: center; /* Center on mobile for balance */
    padding: 12px 16px;
    gap: 8px;
  }
  
  .timeline-date-nav {
    width: 100%;
    justify-content: center;
    gap: 4px;
  }

  .timeline-date-display {
    min-width: auto;
    font-size: 15px; /* Slightly smaller to fit better */
    flex: 1; /* Allow to take available space */
  }

  .timeline-header-meta {
    width: 100%;
    justify-content: space-between; /* Put KPI on left and Toggle on right */
    gap: 8px;
  }
  
  .timeline-kpi {
    gap: 8px;
    font-size: 13px;
  }
  
  .timeline-kpi-divider {
    height: 14px;
  }

  .timeline-view-btn {
    padding: 4px 12px;
    font-size: 12px;
  }
  
  .session-title {
    max-width: 200px;
  }

  .add-session-modal {
    margin: 16px;
    max-width: calc(100% - 32px);
  }
}

/* ==========================================================================
   Session Menu Modal
   ========================================================================== */
.session-menu-modal {
  width: 100%;
  max-width: 320px;
  background: var(--timeline-bg);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  border: 1px solid var(--timeline-border);
  position: relative;
  animation: modalPop 0.2s ease-out;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.session-menu-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--timeline-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--timeline-unscheduled-bg);
}

.session-menu-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-menu-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.session-menu-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.session-timer-btn {
  width: 100%;
  padding: 14px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 6px rgba(14, 165, 233, 0.2);
}

.session-timer-btn:not(:disabled):hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(14, 165, 233, 0.3);
}

.session-timer-btn:disabled {
  background-color: var(--session-btn-disabled-bg, #f1f5f9) !important;
  color: var(--session-btn-disabled-text, #94a3b8) !important;
  cursor: not-allowed;
  box-shadow: none !important;
  border: 1px solid var(--timeline-border) !important;
  opacity: 0.6;
}

[data-theme="dark"] .session-timer-btn:disabled {
  background-color: #111827 !important;
  color: #4b5563 !important;
  border-color: #374151 !important;
}

.session-action-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.session-action-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  text-align: left;
}

.session-action-btn:hover {
  background-color: var(--session-btn-hover, #f3f4f6) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] .session-action-btn:hover {
  background-color: #374151 !important;
  color: #ffffff !important;
}

.session-action-btn:active {
  background-color: var(--session-btn-hover, #e2e8f0) !important;
  transform: translateY(1px);
}

[data-theme="dark"] .session-action-btn:active {
  background-color: #4b5563 !important;
}

.session-action-btn.danger {
  color: #ef4444;
}

.session-action-btn.danger:hover {
  background: rgba(239, 68, 68, 0.1); /* 다크 모드 가독성을 위해 불투명도 약간 상향 */
}

.session-menu-divider {
  height: 1px;
  background: var(--timeline-border);
  margin: 4px 0;
}

/* Completed Event Styling */
.timeline-event.completed {
  opacity: 0.8;
  background: var(--timeline-event-completed-bg, #059669) !important; /* Greenish/Darker */
  border-left: 4px solid #22c55e;
}

.timeline-event.completed .event-goal-name {
  text-decoration: line-through;
  color: rgba(255, 255, 255, 0.8);
}

/* ==========================================================================
   Goal Edit Modal Customization
   ========================================================================== */
.goal-edit-time-selection-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.goal-edit-time-selection-row .profile-form-group,
.goal-edit-time-selection-row .form-group {
  flex: 1;
  margin-bottom: 0;
}

/* Mobile: Force 3-column layout regardless of other global rules */
@media (max-width: 767px) {
  .goal-edit-time-selection-row {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
  }
  
  .goal-edit-time-selection-row .profile-form-group,
  .goal-edit-time-selection-row .form-group {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
  }
  
  .goal-edit-time-selection-row label {
    font-size: 11px !important;
    white-space: nowrap !important;
    margin-bottom: 4px !important;
  }
  
  .goal-edit-time-selection-row select,
  .goal-edit-time-selection-row .profile-form-select,
  .goal-edit-time-selection-row .form-control {
    width: 100% !important;
    height: 38px !important;
    font-size: 12px !important; /* 글자 크기 약간 축소 */
    padding: 0 4px !important;
    padding-right: 20px !important; /* 화살표 공간 축소하여 텍스트 영역 확보 */
    box-sizing: border-box !important;
    letter-spacing: -0.5px !important; /* 자간 축소 */
  }
}

.goal-edit-modal-content {
  /* 기존 모달 스타일 오버라이드 또는 보강 */
  max-width: 480px;
}

/* ==========================================================================
   Month View - Schedule List Enhancements
   ========================================================================== */

/* Schedule View Container */
.schedule-view {
  padding: 0;
}

.schedule-group {
  border-bottom: 1px solid var(--timeline-border);
}

.schedule-group[data-date] {
  scroll-margin-top: 60px;
}

.schedule-date-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--timeline-unscheduled-bg);
  position: sticky;
  top: 0;
  z-index: 5;
}

/* Today Highlight */
.schedule-group.today-highlight .schedule-date-header {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.15), rgba(99, 102, 241, 0.1));
  color: var(--primary-color);
}

.today-badge {
  background: var(--primary-color, #0ea5e9);
  color: white;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  margin-left: auto;
}

/* Schedule Item Row */
.schedule-item {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  gap: 12px;
  cursor: pointer;
  transition: background 0.2s;
  border-bottom: 1px solid var(--timeline-grid-line);
}

.schedule-item:last-child {
  border-bottom: none;
}

.schedule-item:hover {
  background: rgba(14, 165, 233, 0.05);
}

/* Completed Item Styling */
.schedule-item.completed .schedule-title {
  text-decoration: line-through;
  opacity: 0.7;
}

.schedule-item.completed .schedule-time {
  opacity: 0.7;
}

/* 🆕 In-Progress Item Styling (세션 있지만 미완료) */
.schedule-item.in-progress .schedule-title {
  text-decoration: none; /* 취소선 없음 */
  opacity: 1;
}

.schedule-item.in-progress .schedule-time {
  color: var(--amber-500, #f59e0b);
}

.schedule-dot.in-progress {
  background-color: #f59e0b !important; /* 노란색 점 */
  border: none;
}

/* Scheduled (Pending) Item Styling */
.schedule-item.scheduled {
  background: rgba(245, 158, 11, 0.05);
}

.schedule-item.scheduled .schedule-time {
  color: var(--amber-500, #f59e0b);
}

.schedule-item.scheduled .schedule-dot {
  background: transparent;
  border: 2px dashed var(--amber-500, #f59e0b);
}

.schedule-time-prefix {
  font-size: 10px;
  color: var(--amber-600, #d97706);
  margin-right: 2px;
}

/* Rating Icon */
.schedule-rating-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

/* Schedule Dot */
.schedule-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary-color, #0ea5e9);
  flex-shrink: 0;
}

.schedule-dot.completed {
  background: #22c55e;
}

/* Schedule Content */
.schedule-content {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.schedule-title {
  font-size: 14px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.schedule-duration {
  font-size: 12px;
  color: var(--timeline-hour-text);
  flex-shrink: 0;
}

.schedule-time {
  width: 70px;
  font-size: 13px;
  color: var(--timeline-hour-text);
  flex-shrink: 0;
}

/* Empty State for Schedule View */
.schedule-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--timeline-hour-text);
}

.schedule-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.schedule-empty-text {
  font-size: 14px;
}

/* Dark Mode Adjustments */
[data-theme="dark"] .schedule-item.scheduled {
  background: rgba(245, 158, 11, 0.08);
}

[data-theme="dark"] .schedule-group.today-highlight .schedule-date-header {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(129, 140, 248, 0.15));
}

/* 🆕 과거 미완료 목표 (기간 만료) 스타일 */
.schedule-item.missed-expired {
  background: rgba(107, 114, 128, 0.05); /* 연한 회색 */
  border-left: 3px solid #6b7280;
  opacity: 0.6;
}

.schedule-item.missed-expired .schedule-time {
  color: #9ca3af;
}

.schedule-item.missed-expired .schedule-title {
  color: #9ca3af;
  text-decoration: line-through;
  text-decoration-color: rgba(156, 163, 175, 0.4);
}

.schedule-dot.missed {
  background: #9ca3af;
}

/* 🆕 날짜 포커스 하이라이트 효과 */
.highlight-date-focus {
  animation: highlight-pulse 2s ease-out;
  border-radius: 8px;
}

@keyframes highlight-pulse {
  0% { background-color: rgba(14, 165, 233, 0.1); box-shadow: 0 0 0 0 rgba(14, 165, 233, 0.4); }
  30% { background-color: rgba(14, 165, 233, 0.2); box-shadow: 0 0 0 10px rgba(14, 165, 233, 0); }
  100% { background-color: transparent; box-shadow: 0 0 0 0 rgba(14, 165, 233, 0); }
}

/* 🆕 세션 횟수 배지 */
.schedule-session-count {
  font-size: 11px;
  color: var(--timeline-hour-text, #9ca3af);
  font-weight: 500;
  margin-left: 4px;
}

.schedule-item.completed .schedule-session-count {
  color: #22c55e;
}

/* ==========================================================================
   State-based Text Color Overrides (상태별 텍스트 색상 오버라이드) -- 2025-12-31 Hotfix
   ========================================================================== */

/* 완료되거나 평가된 상태에서는 배경이 진하므로 텍스트를 흰색으로 강제 */
.timeline-event.completed .event-goal-name,
.timeline-event.completed .event-time-info,
.timeline-event.rating-focus .event-goal-name,
.timeline-event.rating-focus .event-time-info,
.timeline-event.rating-normal .event-goal-name,
.timeline-event.rating-normal .event-time-info {
  color: #ffffff !important;
}

/* 시간 정보 구분선도 밝은 색으로 변경 */
.timeline-event.completed .event-time-info,
.timeline-event.rating-focus .event-time-info,
.timeline-event.rating-normal .event-time-info {
  border-left-color: rgba(255, 255, 255, 0.4) !important;
}

/* small 태그(상태 텍스트)도 흰색으로 */
.timeline-event.completed .event-time-info small,
.timeline-event.rating-focus .event-time-info small,
.timeline-event.rating-normal .event-time-info small {
  color: rgba(255, 255, 255, 0.9) !important;
  opacity: 1 !important;
}

