<template>
  <!-- 滚动内容区域 -->
  <scroll-view scroll-y class="scroll-container">
    <view class="tab-page">
      <view class="tab-page__header">
        <text class="tab-page__title">训练</text>
        <text class="tab-page__subtitle">记录每一次进步</text>
      </view>

      <view class="train-cards">
        <view class="train-card" hover-class="train-card--hover" @tap="goTrainReport">
          <text class="train-card__title">训练报告</text>
          <text class="train-card__desc">查看本周/本月运动数据与趋势</text>
        </view>
        <view class="train-card" hover-class="train-card--hover" @tap="goBodyTest">
          <text class="train-card__title">智能体测</text>
          <text class="train-card__desc">连接设备，获取专业体测报告</text>
        </view>
        <view class="train-card" hover-class="train-card--hover" @tap="goBodyHistory">
          <text class="train-card__title">体测报告</text>
          <text class="train-card__desc">历史记录与对比分析</text>
        </view>
        <view class="train-card" hover-class="train-card--hover" @tap="goCheckIn">
          <text class="train-card__title">签到记录</text>
          <text class="train-card__desc">到店打卡与训练频次</text>
        </view>
      </view>

      <view class="bottom-placeholder"></view>
    </view>
  </scroll-view>
  
  <!-- 固定 TabBar -->
  <view class="tabbar-fixed">
    <TabBar :active="2" />
  </view>
</template>

<script setup>
import TabBar from '@/components/TabBar.vue'
import { PAGE, navigateToPage } from '@/common/constants/routes.js'

function goTrainReport() {
  navigateToPage(PAGE.TRAIN_REPORT)
}

function goBodyTest() {
  navigateToPage(PAGE.BODY_TEST_HOME)
}

function goBodyHistory() {
  navigateToPage(PAGE.BODY_TEST_HISTORY)
}

function goCheckIn() {
  navigateToPage(PAGE.CHECK_IN_HISTORY)
}
</script>

<style lang="scss" scoped>
.tab-page {
  min-height: 100vh;
  padding-bottom: 160rpx;
  position: relative;
  z-index: 2;
}

.tab-page__header {
  padding: 48rpx 32rpx 16rpx;
}

.tab-page__title {
  display: block;
  font-size: 40rpx;
  font-weight: $font-weight-bold;
  color: $text-dark;
}

.tab-page__subtitle {
  display: block;
  margin-top: 8rpx;
  font-size: 24rpx;
  color: $text-muted;
}

.train-cards {
  display: flex;
  flex-direction: column;
  gap: 20rpx;
  padding: 24rpx 32rpx;
}

.train-card {
  padding: 28rpx 32rpx;
  border-radius: $radius-md;
  background: $bg-white;
  box-shadow: $shadow-sm;
  border: 1px solid $border-light;
  transition: all 0.2s ease;
}

.train-card:active {
  transform: scale(0.98);
}

.train-card__title {
  display: block;
  font-size: 30rpx;
  font-weight: $font-weight-bold;
  color: $text-dark;
}

.train-card__desc {
  display: block;
  margin-top: 8rpx;
  font-size: 24rpx;
  color: $text-muted;
}

.bottom-placeholder {
  height: 40rpx;
}

/* 滚动容器 */
.scroll-container {
  position: relative;
  z-index: 1;
  height: 100vh;
  width: 100%;
}

/* 固定 TabBar */
.tabbar-fixed {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background-color: transparent;
}
</style>
