<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>

      <TodayRecommend />

      <view class="discover-links">
        <view class="discover-link" hover-class="discover-link--hover" @tap="goReferral">
          <text class="discover-link__title">邀请好友</text>
          <text class="discover-link__desc">邀请注册/购课，双方得积分</text>
        </view>
        <view class="discover-link" hover-class="discover-link--hover" @tap="goCouponCenter">
          <text class="discover-link__title">领券中心</text>
          <text class="discover-link__desc">限时优惠券，先到先得</text>
        </view>
        <view class="discover-link" hover-class="discover-link--hover" @tap="goPointsMall">
          <text class="discover-link__title">积分商城</text>
          <text class="discover-link__desc">积分兑换好礼</text>
        </view>
      </view>

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

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

function goReferral() {
  navigateToPage(PAGE.REFERRAL)
}

function goCouponCenter() {
  navigateToPage(PAGE.COUPON_CENTER)
}

function goPointsMall() {
  navigateToPage(PAGE.POINTS_MALL)
}
</script>

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

.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;
}

.discover-links {
  display: flex;
  flex-direction: column;
  gap: 16rpx;
  padding: 24rpx 32rpx;
}

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

.discover-link:active {
  transform: scale(0.98);
}

.discover-link__title {
  display: block;
  font-size: 28rpx;
  font-weight: $font-weight-bold;
  color: $text-dark;
}

.discover-link__desc {
  display: block;
  margin-top: 6rpx;
  font-size: 22rpx;
  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>
