/* ========================================
   运动日志仪表盘样式
   ======================================== */

.sport-dashboard {
  --green: #2bbc8a;
  --pink: rgba(212, 128, 170, 1);
  --orange: #e67e22;
  --blue: #3498db;
  --red: #e74c3c;
  --heatmap-empty: #ebedf0;
  --heatmap-fill: #2bbc8a;
  --card-bg: #ffffff;
  --card-border: #e8e8e8;
  --text-primary: #383838;
  --text-secondary: #8c8c8c;
  --radius: 8px;
}

/* ========================================
   顶部文本
   ======================================== */

.page-motto {
  text-align: center;
  margin: 0.25rem 0 2rem 0; 
  color: #383838;
  font-size: 1.2rem;
  font-weight: 300;
  letter-spacing: 0.25em;
}

/* ========================================
   总览卡片
   ======================================== */

.summary-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  margin-top: 0.5rem;
  padding: 1rem 1.2rem 0.5rem 1.2rem;
  overflow: hidden;
}

.summary-card canvas {
  display: block;
  width: 100%;
  height: 320px;
}

/* ========================================
   运动目标区域
   ======================================== */

.target-section {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--card-border);
}

.target-section-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.6rem;
}

.target-card {
  background: #fafafa;
  border: 1px solid var(--card-border);
  border-left: 4px solid var(--target-color, var(--green));
  border-radius: 6px;
  padding: 0.65rem 1rem;
  margin-bottom: 0.5rem;
}

.target-card:last-child {
  margin-bottom: 0;
}

.target-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

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

.target-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
}

.target-status {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  background: #e8f5e9;
  color: #2e7d32;
  white-space: nowrap;
  flex-shrink: 0;
}

.target-card-dates {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
  padding-left: 16px;
}

.target-card-total {
  font-size: 0.8rem;
  color: var(--text-primary);
  font-weight: 500;
  padding-left: 16px;
}

/* ========================================
   热力图
   ======================================== */

.heatmap-section {
  margin-bottom: 2rem;
}

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

.heatmap-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.heatmap-year-select {
  font-size: 0.8rem;
  padding: 2px 8px;
  border: 1px solid var(--card-border);
  border-radius: 4px;
  background: var(--card-bg);
  color: var(--text-primary);
  cursor: pointer;
  font-family: inherit;
  outline: none;
}

.heatmap-year-select:focus {
  border-color: var(--green);
}

.heatmap-wrapper {
  overflow: visible;
  padding: 0 2px 24px 2px;
}

.heatmap-wrapper::-webkit-scrollbar {
  display: none;
}

.heatmap-months {
  display: flex;
  margin-bottom: 3px;
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.heatmap-body {
  display: flex;
}

.heatmap-grid {
  display: grid;
  grid-template-rows: repeat(7, auto);
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  width: 100%;
}

.heatmap-cell {
  aspect-ratio: 1;
  width: 100%;
  border-radius: 2px;
  background: var(--heatmap-empty);
  cursor: default;
  position: relative;
}

.heatmap-cell.active {
  background: var(--heatmap-fill);
}

.heatmap-cell.future {
  background: #f9f9f9;
}

/* 今日标记：内部圆点 */
.heatmap-cell.today::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--red);
  pointer-events: none;
}

/* Tooltip */
/* 仅当有 data-tooltip 属性时才显示悬浮框 */
.heatmap-cell[data-tooltip]:hover::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  font-size: 0.65rem;
  padding: 3px 7px;
  border-radius: 3px;
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
  font-family: "Menlo", "Meslo LG", monospace;
}

/* ========================================
   运动记录列表
   ======================================== */

.record-section {
  margin-top: 1.5rem;
}

.record-section h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.record-list {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.record-item {
  display: flex;
  align-items: center;
  padding: 0.6rem 1.2rem;
  border-bottom: 1px solid #f5f5f5;
  transition: background 0.15s ease;
  font-size: 0.9rem;
}

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

.record-item:hover {
  background: #fafafa;
}

/* 目标标记记录 */
.record-item.target-active {
  border-left: 3px solid var(--record-target-color, var(--green));
  border-right: 3px solid var(--record-target-color, var(--green));
  padding-left: calc(1.2rem - 3px);
  padding-right: calc(1.2rem - 3px);
}

.record-item.target-first {
  border-top: 3px solid var(--record-target-color, var(--green));
}

.record-item.target-last {
  border-bottom: 3px solid var(--record-target-color, var(--green));
}

/* 表头 */
.record-header {
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 2px solid #d0d0d0;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.record-header:hover {
  background: transparent;
}

.record-header .record-date,
.record-header .record-metrics span,
.record-header .record-note {
  color: var(--text-secondary);
}

.record-date {
  color: var(--text-secondary);
  flex: 0 0 130px;
}

.record-metrics {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
}

.record-metrics .metric-distance {
  flex: 0 0 78px;
  color: var(--text-primary);
}

.record-metrics .metric-duration {
  flex: 0 0 82px;
  color: var(--text-primary);
}

.record-metrics .sport-icon-inline {
  font-size: 0.85rem;
}

.record-metrics .metric-extra {
  flex: 0 0 70px;
  color: var(--text-secondary);
}

.record-metrics .metric-hr {
  flex: 0 0 95px;
  color: var(--red);
  font-size: 0.85rem;
}

.record-note {
  flex: 1;
  min-width: 0;
  font-size: 0.75rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-left: 0.5rem;
}

/* ========================================
   响应式
   ======================================== */

@media (max-width: 768px) {
  .summary-card canvas {
    height: 260px;
  }

  .heatmap-grid {
    gap: 1px;
  }

  .heatmap-cell.today::after {
    width: 3px;
    height: 3px;
  }

  .record-item {
    flex-wrap: wrap;
    padding: 0.6rem 1rem;
    gap: 0.3rem;
  }

  .record-item.target-active {
    padding-left: calc(1rem - 3px);
    padding-right: calc(1rem - 3px);
  }

  .record-date {
    flex: 0 0 auto;
  }

  .record-metrics {
    flex-basis: 100%;
    font-size: 0.8rem;
    gap: 0.5rem;
  }

  .record-metrics .metric-distance {
    flex: 0 0 65px;
  }

  .record-metrics .metric-duration {
    flex: 0 0 70px;
  }

  .record-metrics .metric-extra {
    flex: 0 0 60px;
  }

  .record-metrics .metric-hr {
    flex: 0 0 80px;
  }
}

@media (max-width: 480px) {
  .summary-card canvas {
    height: 220px;
  }

  .heatmap-grid {
    gap: 1px;
  }

  .heatmap-cell {
    border-radius: 1px;
  }

  .heatmap-cell.today::after {
    width: 2px;
    height: 2px;
  }

  .target-card {
    padding: 0.55rem 0.75rem;
  }

  .target-name {
    font-size: 0.8rem;
  }

  .record-metrics {
    gap: 0.3rem;
    font-size: 0.72rem;
  }

  .record-metrics .metric-distance {
    flex: 0 0 52px;
  }

  .record-metrics .metric-duration {
    flex: 0 0 58px;
  }

  .record-metrics .metric-extra {
    flex: 0 0 50px;
  }

  .record-metrics .metric-hr {
    flex: 0 0 68px;
  }
}
