/* ═══════════════════════════════════════════════════════════════
   时间追踪页面样式 - 里程碑版
   基于里程碑概念的视觉设计
═══════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────
   页面容器
───────────────────────────────────────────────────────────────── */
.timeline-page {
  padding: 1.5rem;
  max-width: 1400px;
}

.timeline-content {
  min-height: 400px;
}

.timeline-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-text {
  font-size: 1rem;
  color: var(--muted);
}

/* ─────────────────────────────────────────────────────────────────
   主内容区域
───────────────────────────────────────────────────────────────── */
.timeline-main {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ─────────────────────────────────────────────────────────────────
   项目概览卡片
───────────────────────────────────────────────────────────────── */
.timeline-overview-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
}

.overview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.overview-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.overview-status {
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 500;
}

.overview-status.pending {
  background: rgba(156, 163, 175, 0.15);
  color: #9ca3af;
}

.overview-status.active {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.overview-status.paused {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
}

.overview-status.completed {
  background: rgba(96, 165, 250, 0.15);
  color: #60a5fa;
}

.overview-status.cancelled {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.overview-progress {
  margin-bottom: 1.25rem;
}

.progress-bar {
  position: relative;
  height: 8px;
  background: var(--surface2);
  border-radius: 4px;
  overflow: visible;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, rgba(var(--accent-rgb), 0.7) 100%);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-current {
  position: absolute;
  top: -4px;
  transform: translateX(-50%);
  transition: left 0.3s ease;
}

.progress-dot {
  width: 16px;
  height: 16px;
  background: var(--accent);
  border-radius: 50%;
  border: 3px solid var(--surface);
  box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.4);
}

.progress-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.6rem;
}

.progress-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.progress-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
}

.progress-detail {
  font-size: 0.78rem;
  color: var(--muted);
}

.overview-meta {
  display: flex;
  gap: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.meta-item.overdue .meta-value {
  color: #f87171;
}

.meta-icon {
  font-size: 0.9rem;
}

.meta-label {
  font-size: 0.75rem;
  color: var(--muted);
  min-width: 60px;
}

.meta-value {
  font-size: 0.82rem;
  color: var(--text);
}

/* ─────────────────────────────────────────────────────────────────
   里程碑时间线卡片
───────────────────────────────────────────────────────────────── */
.timeline-track-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
}

.track-header {
  margin-bottom: 1.25rem;
}

.track-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.track-container {
  position: relative;
}

.track-line {
  position: relative;
  height: 80px;
  border-bottom: 3px solid var(--border);
}

.track-progress {
  position: absolute;
  bottom: -3px;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent) 0%, rgba(var(--accent-rgb), 0.6) 100%);
  transition: width 0.5s ease;
}

.track-start,
.track-end {
  position: absolute;
  bottom: -18px;
  font-size: 1.4rem;
}

.track-start {
  left: 0;
}

.track-end {
  right: 0;
}

.track-milestones {
  position: absolute;
  width: 100%;
  height: 100%;
}

.milestone-track-item {
  position: absolute;
  bottom: -10px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.milestone-track-item:hover {
  transform: translateX(-50%) translateY(-3px);
}

.milestone-track-item.current .milestone-track-dot {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(var(--accent-rgb), 0);
  }
}

.milestone-track-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface2);
  border: 3px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.milestone-track-item.completed .milestone-track-dot {
  background: #4ade80;
  border-color: #4ade80;
  color: #fff;
}

.milestone-track-item.current .milestone-track-dot {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.milestone-track-label {
  font-size: 0.72rem;
  color: var(--text);
  margin-top: 0.5rem;
  white-space: nowrap;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.milestone-track-percent {
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

/* ─────────────────────────────────────────────────────────────────
   里程碑卡片网格
───────────────────────────────────────────────────────────────── */
.timeline-milestones-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.milestone-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  gap: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.milestone-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.milestone-card.selected {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.05);
}

.milestone-card.completed {
  border-color: rgba(34, 197, 94, 0.3);
}

.milestone-card.current {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 2px 8px rgba(var(--accent-rgb), 0.2);
}

.milestone-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.milestone-content {
  flex: 1;
  min-width: 0;
}

.milestone-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.milestone-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.milestone-status {
  font-size: 0.68rem;
  color: var(--muted);
}

.milestone-card.completed .milestone-status {
  color: #4ade80;
}

.milestone-card.current .milestone-status {
  color: var(--accent);
}

.milestone-progress-bar {
  height: 4px;
  background: var(--surface2);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.milestone-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.milestone-card.completed .milestone-progress-fill {
  background: #4ade80;
}

.milestone-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.milestone-tasks {
  font-size: 0.72rem;
  color: var(--muted);
}

.milestone-reward {
  font-size: 0.72rem;
  color: #fbbf24;
  font-weight: 500;
}

/* ─────────────────────────────────────────────────────────────────
   任务列表卡片
───────────────────────────────────────────────────────────────── */
.timeline-tasks-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.tasks-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}

.tasks-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.tasks-list {
  padding: 0.5rem 1.25rem;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  transition: opacity 0.2s ease;
}

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

.task-item.completed {
  opacity: 0.6;
}

.task-item.completed .task-title {
  text-decoration: line-through;
}

.task-checkbox {
  position: relative;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.task-checkbox input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.checkmark {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.task-checkbox input:checked ~ .checkmark {
  background: var(--accent);
  border-color: var(--accent);
}

.task-checkbox input:checked ~ .checkmark::after {
  content: '✓';
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
}

.task-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.task-title {
  font-size: 0.85rem;
  color: var(--text);
}

.task-assignee {
  font-size: 0.72rem;
  color: var(--muted);
}

.task-priority {
  font-size: 0.7rem;
}

.tasks-empty {
  text-align: center;
  padding: 2rem;
  color: var(--muted);
}

.tasks-more {
  text-align: center;
  padding: 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
}

/* ─────────────────────────────────────────────────────────────────
   响应式适配
───────────────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .timeline-milestones-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 900px) {
  .timeline-milestones-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .overview-meta {
    flex-wrap: wrap;
    gap: 1rem;
  }
}

@media (max-width: 600px) {
  .timeline-page {
    padding: 1rem;
  }

  .timeline-milestones-grid {
    grid-template-columns: 1fr;
  }

  .milestone-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .milestone-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .track-line {
    height: 100px;
  }

  .milestone-track-label {
    max-width: 60px;
    font-size: 0.65rem;
  }
}
