/* ============================================================
   观看记录页样式
   ============================================================ */

.history-head {
  padding: 36px 0 12px;
}

.history-head .container {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.history-title-block h1 {
  font-family: var(--font-display);
  font-size: 44px;
  letter-spacing: 1.5px;
  line-height: 1;
}

.history-title-block h1 .accent {
  background: var(--grad-energy);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.history-title-block p {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 14px;
}

/* 统计卡 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 24px 0 36px;
}

.stat-card {
  position: relative;
  padding: 22px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--grad-energy);
}

.stat-card.highlight::before {
  background: var(--accent);
}

.stat-label {
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 42px;
  line-height: 1;
  letter-spacing: 1px;
}

.stat-value.primary { color: var(--primary); }
.stat-value.accent { color: var(--accent); }
.stat-value.success { color: var(--success); }

.stat-unit {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-muted);
  margin-left: 4px;
}

/* 月份切换 */
.month-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.month-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.month-current {
  font-family: var(--font-display);
  font-size: 26px;
  letter-spacing: 1px;
  min-width: 140px;
  text-align: center;
}

.month-arrow {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all 0.2s;
}

.month-arrow:hover:not(:disabled) {
  color: var(--primary);
  border-color: var(--primary);
}

.month-arrow:disabled {
  opacity: 0.3;
  cursor: default;
}

/* 月历 */
.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 40px;
}

.cal-weekday {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  padding: 6px 0;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.cal-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
  position: relative;
  cursor: default;
  transition: all 0.2s;
}

.cal-cell.empty {
  background: transparent;
  border-color: transparent;
}

.cal-cell.today {
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 700;
}

.cal-cell.has-training {
  background: var(--primary-soft);
  border-color: rgba(255, 107, 53, 0.35);
  color: var(--text);
  cursor: pointer;
}

.cal-cell.has-training:hover {
  background: rgba(255, 107, 53, 0.25);
  transform: scale(1.05);
}

.cal-cell.all-done {
  background: rgba(6, 214, 160, 0.12);
  border-color: rgba(6, 214, 160, 0.35);
}

.cal-count {
  position: absolute;
  top: 3px;
  right: 5px;
  font-size: 9px;
  font-weight: 700;
  color: var(--primary);
}

.cal-cell.all-done .cal-count {
  color: var(--success);
}

.cal-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--primary);
  margin-top: 2px;
}

.cal-cell.all-done .cal-dot {
  background: var(--success);
}

/* 时间线 */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.timeline-day {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 24px;
}

.timeline-day-label {
  text-align: right;
  padding-top: 4px;
}

.timeline-day-date {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: 1px;
  line-height: 1;
}

.timeline-day-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}

.timeline-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-left: 2px solid var(--border);
  padding-left: 20px;
  position: relative;
}

.timeline-items::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
}

.timeline-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.2s;
}

.timeline-item:hover {
  border-color: var(--border-strong);
}

.timeline-thumb {
  width: 100px;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-alt);
  flex-shrink: 0;
}

.timeline-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.timeline-item-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-item-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-dim);
  flex-wrap: wrap;
}

.timeline-item-meta .dot-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-dim);
}

.timeline-replay {
  flex-shrink: 0;
  padding: 8px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-muted);
  transition: all 0.2s;
}

.timeline-replay:hover {
  color: var(--primary);
  border-color: var(--primary);
}

/* 当日详情弹层 */
.day-detail-mask {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.day-detail {
  width: 100%;
  max-width: 460px;
  max-height: 80vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: fadeUp 0.3s ease;
}

.day-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.day-detail-title {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 1px;
}

.day-detail-body {
  padding: 16px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.day-detail-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
}

.day-detail-item:hover {
  border-color: var(--primary);
}

.day-detail-item-thumb {
  width: 64px;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}

.day-detail-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.day-detail-item-title {
  font-size: 13px;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .timeline-day {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .timeline-day-label {
    text-align: left;
  }
  .timeline-day-date {
    font-size: 22px;
  }
  .timeline-items {
    padding-left: 16px;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    gap: 10px;
  }
  .stat-card {
    padding: 16px 14px;
  }
  .stat-value {
    font-size: 32px;
  }
  .calendar {
    gap: 3px;
  }
  .cal-cell {
    font-size: 11px;
  }
  .timeline-thumb {
    width: 80px;
  }
  .timeline-replay span {
    display: none;
  }
}
