<template>
  <div class="home">
    <!-- 主横幅区域 -->
    <section class="hero-banner">
      <img :src="bannerImage" :alt="bannerAlt" class="banner-image" />
      <div class="hero-content">
        <h2>中小学教师人工智能素养<span>提升</span>在线学习平台</h2>
        <p>为教师量身定制，帮助教师快速掌握AI技术、教学应用与伦理规范，赋能智慧课堂</p>
        <button>立即学习</button>
      </div>
    </section>

    <!-- 数据统计区域 -->
    <section class="stats-section">
      <div class="stats-grid">
        <div class="stat-item">
          <div class="stat-icon">
            <img src="/top/顶部icon1.png" alt="学习视频" />
          </div>
          <div class="stat-content">
            <div class="stat-number">1000 +</div>
            <div class="stat-label">{{ t('home.stats.learningVideos') }}</div>
          </div>
        </div>
        <div class="line"></div>
        <div class="stat-item">
          <div class="stat-icon">
            <img src="/top/顶部icon2.png" alt="名师专家" />
          </div>
          <div class="stat-content">
            <div class="stat-number">109 +</div>
            <div class="stat-label">{{ t('home.stats.expertTeachers') }}</div>
          </div>
        </div>
        <div class="line"></div>
        <div class="stat-item">
          <div class="stat-icon">
            <img src="/top/顶部icon3.png" alt="培训教材" />
          </div>
          <div class="stat-content">
            <div class="stat-number">3549 +</div>
            <div class="stat-label">{{ t('home.stats.trainingMaterials') }}</div>
          </div>
        </div>
        <div class="line"></div>
        <div class="stat-item">
          <div class="stat-icon">
            <img src="/top/顶部icon4.png" alt="资源素材" />
          </div>
          <div class="stat-content">
            <div class="stat-number">6532 +</div>
            <div class="stat-label">{{ t('home.stats.resourceMaterials') }}</div>
          </div>

        </div>
        <div class="line"></div>
        <div class="stat-item">
          <div class="stat-icon">
            <img src="/top/顶部icon5.png" alt="在线实验" />
          </div>
          <div class="stat-content">
            <div class="stat-number">2652 +</div>
            <div class="stat-label">{{ t('home.stats.onlineExperiments') }}</div>
          </div>

        </div>
      </div>
    </section>

    <!-- 热门课程 -->
    <section class="popular-courses">
      <div class="container">
        <div class="section-header">
          <div class="section-title-group">
            <span class="section-title-text">热门好课</span>
            <div class="section-subtitle">{{ t('home.popularCourses.subtitle') }}</div>
          </div>
          <n-button text type="primary" class="view-all-btn" @click="$router.push('/courses')">
            {{ t('home.popularCourses.viewAll') }} >
          </n-button>
        </div>
        <div class="courses-grid">
          <div class="course-card" v-for="course in popularCourses" :key="course.id"
            @click="goToCourseDetail(course.id)">
            <div class="course-image">
              <img :src="course.thumbnail" :alt="course.title" />
            </div>
            <div class="course-info">
              <h3 class="course-title">{{ course.title }}</h3>
              <div class="course-meta">
                <span class="course-students">{{ course.studentsCount }}{{ t('home.popularCourses.studentsEnrolled')
                  }}</span>
                <button class="enroll-btn" @click="handleEnrollCourse(course.id)">{{ t('home.popularCourses.enroll')
                  }}</button>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>

    <!-- 专题训练 -->
    <section class="special-training">
      <div class="container">
        <div class="section-header">
          <div class="section-title-group">
            <span class="section-title-text">专题训练</span>
            <div class="section-subtitle">{{ t('home.specialTraining.subtitle') }}</div>
          </div>
          <n-button text type="primary" class="view-all-btn" @click="$router.push('/special-training')">
            {{ t('home.specialTraining.viewAll') }} >
          </n-button>
        </div>
        <div class="training-grid">
          <div class="training-card" v-for="training in specialTrainings" :key="training.id">
            <div class="training-image">
              <img :src="training.thumbnail" :alt="training.title" />
            </div>
            <div class="training-info">
              <div class="training-title-row">
                <h3 class="training-title">{{ training.title }}</h3>
                <span class="training-tag">{{ training.tag }}</span>
              </div>
              <div class="training-meta">
                <span class="training-students">{{ training.studentsCount }}{{
                  t('home.specialTraining.studentsCheckedIn') }}</span>
                <button class="join-btn">{{ t('home.specialTraining.join') }}</button>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>

    <!-- 广告 -->
    <section class="advertisement-section" v-if="showAdvertisement">
      <div class="container">
        <div class="ad-container">
          <!-- <button class="close-btn" @click="closeAdvertisement">关闭</button> -->
          <img src="/images/advertising/advertising3.png" alt="广告图片" class="ad-image" />
          <div class="ad-container-text">
            2025AI算法挑战活动大赛
          </div>
        </div>
      </div>
    </section>

    <!-- 学习路径 -->
    <section class="learning-paths">
      <div class="container">
        <div class="section-header">
          <div class="section-title-group">
            <span class="section-title-text">学习路径</span>
            <div class="section-subtitle">{{ t('home.learningPaths.subtitle') }}</div>
          </div>
          <n-button text type="primary" class="view-all-btn" @click="$router.push('/learning-paths')">
            {{ t('home.learningPaths.viewAll') }} >
          </n-button>
        </div>
        <div class="paths-grid">
          <div class="path-card" v-for="path in learningPaths" :key="path.id" :class="`path-card-${path.id}`">
            <div class="path-content">
              <div class="path-image-container">
                <img :src="path.image" :alt="path.title" class="path-image" />
              </div>

              <div class="path-body">
                <div class="path-free-label">{{ t('home.learningPaths.freeLabel') }}</div>
                <div class="path-description">
                  {{ t('home.learningPaths.description') }}
                  <span class="detail-link">{{ t('home.learningPaths.viewDetails') }}</span>
                </div>

                <div class="path-details">
                  <div class="path-detail-item">
                    <span class="detail-label">{{ t('home.learningPaths.targetAudience') }}</span>
                    <span class="detail-value">{{ path.targetAudience }}</span>
                  </div>
                  <div class="path-detail-item">
                    <span class="detail-label">{{ t('home.learningPaths.learningGoal') }}</span>
                    <span class="detail-value">{{ path.learningGoal }}</span>
                  </div>
                  <div class="path-detail-item path-resources-item">
                    <span class="detail-label">{{ t('home.learningPaths.supportingResources') }}</span>
                    <div class="resources-tags">
                      <span class="resource-tag tag-1">{{ t('home.learningPaths.fullLearningMaterials') }}</span>
                      <span class="resource-tag tag-2">{{ t('home.learningPaths.oneOnOneTutoring') }}</span>
                    </div>
                  </div>
                </div>

                <div class="path-warning">
                  <img src="/images/icon/prompt.png" alt="">
                  {{ t('home.learningPaths.warmTip') }}
                </div>

                <button class="path-learn-btn">{{ t('home.learningPaths.startLearning') }}</button>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>

    <!-- 精选活动 -->
    <section class="featured-activities">
      <div class="container">
        <div class="section-header">
          <div class="section-title-group">
            <span class="section-title-text">精选活动</span>
            <div class="section-subtitle">SELECTED EVENTS</div>
          </div>
          <span class="view-all-btn">查看更多 > </span>
        </div>
        <div class="activities-grid">
          <div class="activity-left">
            <div class="activity-left-content">
              <div class="activity-title-name">
                <h3 class="activity-name">2025AI算法挑战活动大赛</h3>
                <span class="activity-detailed">查看详情></span>
              </div>
              <p class="activity-description">
                活动以“‘五禽戏’动作识别”为主题，引导学生通过改进数据处理、特征工
                程、模型训练等方法提高动作识别精度，探索开发能够指导“五禽戏”练习
                的虚拟现实应用、智能健身教练系统等作品。
              </p>
              <button class="activity-btn">立即报名</button>
            </div>
            <div class="activity-left-img">
              <img src="/images/activity/activity1.png" alt="">
            </div>
          </div>
          <!-- <div class="activity-right">
            <img src="/images/activity/activity2.png" alt="">
            <h3 class="activity-title-img">算法挑战</h3>
            <img src="/images/activity/right.png" class="activity-right-img" alt="">
          </div> -->
        </div>
      </div>
    </section>

    <!-- ai智能体验 -->
    <section class="ai-smart-experience">
      <div class="container">
        <div class="section-header">
          <div class="section-title-group">
            <span class="section-title-text">AI智能体验</span>
            <div class="section-subtitle">FEATURED REVIEWS</div>
          </div>
          <div class="view-all-btn">查看更多 > </div>
        </div>
        <div class="ai-cards-grid">
          <div class="ai-card" v-for="aiCard in aiCards" :key="aiCard.id">
            <div class="ai-card-icon">
              <div class="ai-icon-wrapper">
                <img :src="aiCard.icon" :alt="aiCard.title" class="ai-icon-image" />
              </div>
            </div>
            <div class="ai-card-content">
              <h3 class="ai-card-title">{{ aiCard.title }}</h3>
              <p class="ai-card-description">{{ aiCard.description }}</p>
            </div>
          </div>
        </div>
      </div>
    </section>

    <!-- 精选评论 -->
    <!-- <section class="featured-reviews">
      <div class="container">
        <div class="section-header">
          <div class="section-title-group">
            <span class="section-title-text">精选评论</span>
            <div class="section-subtitle">{{ t('home.featuredReviews.subtitle') }}</div>
          </div>
        </div>
        <div class="reviews-grid">
          <div class="featured-review">
            <img src="/opinion/opioion1.png" class="featured-img" alt="">
            <span class="featured-content">评论内容</span>
          </div>

        </div>
      </div>
    </section> -->


    <!-- 广告 -->
    <section class="advertisement-section" v-if="showAdvertisement">
      <div class="container">
        <div class="ad-container">
          <button class="close-btn" @click="closeAdvertisement">关闭</button>
          <img src="/images/advertising/advertising4.png" alt="广告图片" class="ad-image" />
          <div class="ad-container-title1">
            <h3>数据分析高阶集训营</h3>
            <div class="ad-box">
              <div class="ad-line"></div>
              <span>DATA ANALYSIS BOOT CAMP</span>
            </div>
          </div>
          <div class="ad-container-title2">
            以数据为剑 破解难题之锁
          </div>
        </div>
      </div>
    </section>

    <!-- 精选评论 -->
    <section class="featured-reviews">
      <div class="container">
        <div class="section-header">
          <div class="section-title-group">
            <span class="section-title-text">精选评论</span>
            <div class="section-subtitle">{{ t('home.featuredReviews.subtitle') }}</div>
          </div>
        </div>
        <div class="reviews-grid">
          <div class="content-comments" style="--t:50s">
            <div>
              <span>
                <img src="/images/activity/6.png" alt="" class="avatar-img">
                <span>通过机器学习、人工神经网络</span>
              </span>
              <span>
                <img src="/images/activity/7.png" alt="" class="avatar-img">
                <span>通过机器学习、人工神经网络的结构化学</span>
              </span>
              <span>
                <img src="/images/activity/8.png" alt="" class="avatar-img">
                <span>通过机器学习、人工神经网络的结构化学习，调整语言模</span>
              </span>
            </div>

            <div>
              <span>
                <img src="/images/activity/6.png" alt="" class="avatar-img">
                <span>通过机器学习、人工神经网络</span>
              </span>
              <span>
                <img src="/images/activity/7.png" alt="" class="avatar-img">
                <span>通过机器学习、人工神经网络的结构化学</span>
              </span>
              <span>
                <img src="/images/activity/8.png" alt="" class="avatar-img">
                <span>通过机器学习、人工神经网络的结构化学习，调整语言模</span>
              </span>
            </div>
          </div>
          <div class="content-comments" style="--t:25s">
            <div>
              <span>
                <img src="/images/activity/9.png" alt="" class="avatar-img">
                <span>通过机器学习、人工神经网络的结构化学</span>
              </span>
              <span>
                <img src="/images/activity/10.png" alt="" class="avatar-img">
                <span>通过机器学习</span>
              </span>
              <span>
                <img src="/images/activity/11.png" alt="" class="avatar-img">
                <span>通过机器学习、人工神经网络的结构化学习，调整语言模型和任务格式实</span>
              </span>
            </div>

            <div>
              <span>
                <img src="/images/activity/9.png" alt="" class="avatar-img">
                <span>通过机器学习、人工神经网络的结构化学</span>
              </span>
              <span>
                <img src="/images/activity/10.png" alt="" class="avatar-img">
                <span>通过机器学习</span>
              </span>
              <span>
                <img src="/images/activity/11.png" alt="" class="avatar-img">
                <span>通过机器学习、人工神经网络的结构化学习，调整语言模型和任务格式实</span>
              </span>
            </div>
          </div>
          <div class="content-comments" style="--t:35s">
            <div>
              <span>
                <img src="/images/activity/12.png" alt="" class="avatar-img">
                <span>通过机器学习、人工神经网络</span>
              </span>
              <span>
                <img src="/images/activity/7.png" alt="" class="avatar-img">
                <span>通过机器学习、人工神经网络的结构化学</span>
              </span>
              <span>
                <img src="/images/activity/8.png" alt="" class="avatar-img">
                <span>通过机器学习、人工神经网络的结构化学习，调整语言模</span>
              </span>
            </div>

            <div>
              <span>
                <img src="/images/activity/12.png" alt="" class="avatar-img">
                <span>通过机器学习、人工神经网络</span>
              </span>
              <span>
                <img src="/images/activity/7.png" alt="" class="avatar-img">
                <span>通过机器学习、人工神经网络的结构化学</span>
              </span>
              <span>
                <img src="/images/activity/8.png" alt="" class="avatar-img">
                <span>通过机器学习、人工神经网络的结构化学习，调整语言模</span>
              </span>
            </div>
          </div>
          <div class="content-comments" style="--t:20s">
            <div>
              <span>
                <img src="/images/activity/6.png" alt="" class="avatar-img">
                <span>通过机器学习、人工神经网络</span>
              </span>
              <span>
                <img src="/images/activity/7.png" alt="" class="avatar-img">
                <span>通过机器学习、人工神经网络的结构化学</span>
              </span>
              <span>
                <img src="/images/activity/8.png" alt="" class="avatar-img">
                <span>通过机器学习、人工神经网络的结构化学习，调整语言模</span>
              </span>
            </div>

            <div>
              <span>
                <img src="/images/activity/6.png" alt="" class="avatar-img">
                <span>通过机器学习、人工神经网络</span>
              </span>
              <span>
                <img src="/images/activity/7.png" alt="" class="avatar-img">
                <span>通过机器学习、人工神经网络的结构化学</span>
              </span>
              <span>
                <img src="/images/activity/8.png" alt="" class="avatar-img">
                <span>通过机器学习、人工神经网络的结构化学习，调整语言模</span>
              </span>
            </div>
          </div>
          <div class="content-comments" style="--t:42s">
            <div>
              <span>
                <img src="/images/activity/6.png" alt="" class="avatar-img">
                <span>通过机器学习、人工神经网络</span>
              </span>
              <span>
                <img src="/images/activity/7.png" alt="" class="avatar-img">
                <span>通过机器学习、人工神经网络的结构化学</span>
              </span>
              <span>
                <img src="/images/activity/8.png" alt="" class="avatar-img">
                <span>通过机器学习、人工神经网络的结构化学习，调整语言模</span>
              </span>
            </div>

            <div>
              <span>
                <img src="/images/activity/6.png" alt="" class="avatar-img">
                <span>通过机器学习、人工神经网络</span>
              </span>
              <span>
                <img src="/images/activity/7.png" alt="" class="avatar-img">
                <span>通过机器学习、人工神经网络的结构化学</span>
              </span>
              <span>
                <img src="/images/activity/8.png" alt="" class="avatar-img">
                <span>通过机器学习、人工神经网络的结构化学习，调整语言模</span>
              </span>
            </div>
          </div>
        </div>
      </div>
    </section>

    <!-- 合作伙伴 -->
    <!-- <section class="partners-section">
      <div class="container">
        <div class="section-header">
          <div class="section-title-group">
            <h2 class="section-title-text">合作伙伴</h2>
            <div class="section-subtitle">PARTNER</div>
          </div>
        </div>
        <div class="partners-grid">
          <div class="partner-item" v-for="partner in partners" :key="partner.id">
            <div class="logo-circle">
              <img :src="partner.logo" :alt="partner.name">
            </div>
            <div class="partner-name">{{ partner.name }}</div>
          </div>
        </div>
      </div>
    </section> -->

    <!-- 登录模态框 -->
    <LoginModal v-model:show="loginModalVisible" @success="handleAuthSuccess" />

    <!-- 注册模态框 -->
    <RegisterModal v-model:show="registerModalVisible" @success="handleAuthSuccess" />

    <!-- 固定按钮组 -->
    <div class="fixed-buttons-group">
      <div class="fixed-button customer-btn" title="客服">
        <img src="/images/icon/customer.jpg" alt="客服" />
      </div>
      <div class="fixed-button phone-btn" title="电话">
        <img src="/images/icon/phone.jpg" alt="电话" />
      </div>
      <div class="fixed-button issue-btn" title="问题" @click="showIssueModal">
        <img src="/images/icon/issue.jpg" alt="问题" />
      </div>
      <div class="fixed-button top-btn" title="返回顶部" @click="scrollToTop">
        <img src="/images/icon/top.jpg" alt="返回顶部" />
        <span class="top-btn-text">返回顶部</span>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { onMounted, computed, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import { useRouter } from 'vue-router'
import { useCourseStore } from '@/stores/course'
import { useUserStore } from '@/stores/user'
import { useAuth } from '@/composables/useAuth'
import { CourseApi } from '@/api'
import LoginModal from '@/components/auth/LoginModal.vue'
import RegisterModal from '@/components/auth/RegisterModal.vue'
// import { getPopularCourses } from '@/data/mockCourses'

const { t, locale } = useI18n()
const router = useRouter()
const courseStore = useCourseStore()
const userStore = useUserStore()
const { loginModalVisible, registerModalVisible, handleAuthSuccess } = useAuth()

// 控制广告显示状态
const showAdvertisement = ref(true)

// 关闭广告函数
const closeAdvertisement = () => {
  showAdvertisement.value = false
}

// 轮播图根据语言动态切换
const bannerImage = computed(() => {
  return locale.value === 'zh' ? '/banners/banner6.png' : '/banners/banner1-en.png'
})

const bannerAlt = computed(() => {
  return t('home.banner.alt')
})

// 热门课程数据
const popularCourses = computed(() => {
  const courses = courseStore.courses.slice(0, 4) // 取前4个课程作为热门课程
  return courses.map((course: any) => ({
    id: course.id,
    title: course.title,
    thumbnail: course.thumbnail,
    category: course.category.name,
    studentsCount: course.studentsCount,
    rating: course.rating,
    price: course.price,
    originalPrice: course.originalPrice
  }))
})

// 专题训练数据
const specialTrainings = computed(() => [
  {
    id: 1,
    title: t('home.trainings.chineseCulture'),
    thumbnail: '/images/traings/traing1.png',
    studentsCount: 324,
    tag: t('home.tags.weeklyPractice')
  },
  {
    id: 2,
    title: t('home.trainings.chinesePhonetics'),
    thumbnail: '/images/traings/traing2.png',
    studentsCount: 324,
    tag: t('home.tags.beginner')
  },
  {
    id: 3,
    title: t('home.trainings.dataStatistics'),
    thumbnail: '/images/traings/traing3.png',
    studentsCount: 324,
    tag: t('home.tags.practical')
  },
  {
    id: 4,
    title: t('home.trainings.foreignChinese'),
    thumbnail: '/images/traings/traing4.png',
    studentsCount: 324,
    tag: t('home.tags.competition')
  }
])

// 学习路径数据
const learningPaths = computed(() => [
  {
    id: 1,
    title: t('home.learningPathsData.beginnerToEntry.title'),
    targetAudience: t('home.learningPathsData.beginnerToEntry.targetAudience'),
    learningGoal: t('home.learningPathsData.beginnerToEntry.learningGoal'),
    image: '/images/studys/study1.png'
  },
  {
    id: 2,
    title: t('home.learningPathsData.entryToMastery.title'),
    targetAudience: t('home.learningPathsData.entryToMastery.targetAudience'),
    learningGoal: t('home.learningPathsData.entryToMastery.learningGoal'),
    image: '/images/studys/study2.png'
  },
  {
    id: 3,
    title: t('home.learningPathsData.expertAdvanced.title'),
    targetAudience: t('home.learningPathsData.expertAdvanced.targetAudience'),
    learningGoal: t('home.learningPathsData.expertAdvanced.learningGoal'),
    image: '/images/studys/study3.png'
  }
])

// AI智能体验数据
const aiCards = computed(() => [
  {
    id: 1,
    title: '手势分类',
    description: '在线训练手势分类的模型,查看内部工查看内部工查看内部工',
    icon: '/images/ai/ai1.png'
  },
  {
    id: 2,
    title: '玩玩神经网络',
    description: '在线训练神经网络,打开神经网络训练查看内部工查看内部工',
    icon: '/images/ai/ai2.png'
  },
  {
    id: 3,
    title: 'GPT内部探秘',
    description: '深入一个迷你GPT内部,打开LLM大语查看内部工查看内部工',
    icon: '/images/ai/ai3.png'
  },
  {
    id: 4,
    title: '生成对抗网络GANs',
    description: '查看伪造者和鉴赏家如何配合,打开生查看内部工查看内部工',
    icon: '/images/ai/ai4.png'
  }
])

// 合作伙伴数据
const partners = computed(() => [
  {
    id: 1,
    name: '云南师范大学',
    logo: '/logo/云师大.jpg'
  },
  {
    id: 2,
    name: '曲靖师范学院',
    logo: '/logo/曲靖师范.jpg'
  },
  {
    id: 3,
    name: '德宏师范学院',
    logo: '/logo/德宏师范.jpg'
  },
  {
    id: 4,
    name: '云南师范大学',
    logo: '/logo/云师大.jpg'
  },
  {
    id: 5,
    name: '曲靖师范学院',
    logo: '/logo/曲靖师范.jpg'
  },
  {
    id: 6,
    name: '德宏师范学院',
    logo: '/logo/德宏师范.jpg'
  }
])

// 精选评论数据
// const featuredReviews = computed(() => [
//   {
//     id: 1,
//     name: t('home.reviewsData.reviewer1.name'),
//     title: t('home.reviewsData.reviewer1.title'),
//     avatar: '/opinion/opioion1.png',
//     content: t('home.reviewsData.reviewer1.content')
//   },
//   {
//     id: 2,
//     name: t('home.reviewsData.reviewer2.name'),
//     title: t('home.reviewsData.reviewer2.title'),
//     avatar: '/opinion/opioion2.png',
//     content: t('home.reviewsData.reviewer2.content')
//   },
//   {
//     id: 3,
//     name: t('home.reviewsData.reviewer3.name'),
//     title: t('home.reviewsData.reviewer3.title'),
//     avatar: '/opinion/opioion3.png',
//     content: t('home.reviewsData.reviewer3.content')
//   },
//   {
//     id: 3,
//     name: t('home.reviewsData.reviewer3.name'),
//     title: t('home.reviewsData.reviewer3.title'),
//     avatar: '/opinion/opioion3.png',
//     content: t('home.reviewsData.reviewer3.content')
//   }
// ])

// 跳转到课程详情页面
const goToCourseDetail = async (courseId: string) => {
  try {
    // 检查用户是否已登录
    if (!userStore.isLoggedIn) {
      console.log('用户未登录，跳转到课程详情页')
      router.push(`/course/${courseId}`)
      return
    }

    console.log('检查课程报名状态，课程ID:', courseId)

    // 调用报名状态检查接口
    const response = await CourseApi.checkEnrollmentStatus(String(courseId))

    if ((response.code === 0 || response.code === 200) && response.data) {
      const isEnrolled = response.data.result

      if (isEnrolled) {
        // 已报名，跳转到已报名页面
        console.log('用户已报名，跳转到已报名页面')
        router.push(`/course/${courseId}/enrolled`)
      } else {
        // 未报名，跳转到课程详情页
        console.log('用户未报名，跳转到课程详情页')
        router.push(`/course/${courseId}`)
      }
    } else {
      // 查询失败，默认跳转到课程详情页
      console.warn('查询报名状态失败，跳转到课程详情页')
      router.push(`/course/${courseId}`)
    }
  } catch (error) {
    console.error('检查报名状态时发生错误:', error)
    // 发生错误时，默认跳转到课程详情页
    router.push(`/course/${courseId}`)
  }
}

// 处理课程报名 - 跳转到课程详情页面
const handleEnrollCourse = (courseId: string) => {
  // 跳转到课程详情页面，在那里进行登录状态判断和报名
  router.push(`/course/${courseId}`)
}

// 滚动到顶部
const scrollToTop = () => {
  window.scrollTo({
    top: 0,
    behavior: 'smooth'
  })
}

const showIssueModal = () => {
  // 跳转到帮助中心并刷新
  router.push('/help-center').then(() => {
    window.location.reload();
  })
}

onMounted(async () => {
  await courseStore.fetchCourses()
})
</script>

<style scoped>
/* 引入字体 */
@font-face {
  font-family: 'TheTitleIsBlack';
  src: url('@/assets/fonts/优设标题黑.ttf') format('truetype');
  font-display: swap;
}

@font-face {
  font-family: 'AlimamaShuHeiTiBold';
  src: url('@/assets/fonts/AlimamaShuHeiTi-Bold.ttf') format('truetype');
  font-display: swap;
}

@font-face {
  font-family: 'WendaoIsTide';
  src: url('@/assets/fonts/文道潮黑.ttf') format('truetype');
  font-display: swap;
}

@font-face {
  font-family: 'PangMenIsRight';
  src: url('@/assets/fonts/庞门正道标题体3.0.ttf') format('truetype');
  font-display: swap;
}

@font-face {
  font-family: 'DouyinSansBold';
  src: url('@/assets/fonts/DouyinSansBold.otf') format('truetype');
  font-display: swap;
}

@font-face {
  font-family: 'AlibabaPuHuiTiBold';
  src: url('@/assets/fonts/Alibaba_PuHuiTi_2.0_55_Regular_85_Bold.ttf') format('truetype');
  font-display: swap;
}



.home {
  width: 100%;
  background: #f8f9fa;
  position: relative;
}

/* 固定按钮组样式 */
.fixed-buttons-group {
  position: fixed;
  bottom: 30px;
  right: 30px;
  display: flex;
  flex-direction: column;
  gap: 15px;

  z-index: 1000;
}

.fixed-button {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  overflow: hidden;
  border: 2px solid #fff;
  box-shadow: inset 0 2px 5px rgba(133, 131, 131, 0.1);
}

.fixed-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.fixed-button img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.top-btn {
  padding: 10px;
  border-radius: 30px;
  height: 90px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.top-btn-text {
  font-size: 12px;
  color: #333;
  margin-top: 4px;
}

.top-btn img {
  width: 20px;
  height: 20px;
}

/* 合作伙伴部分 */
.partners-section {
  padding: 60px 0 60px 0;
  background-image: url('/images/partners/partners-bg.png');
  background-size: cover;
  background-position: center;
  width: 100%;
  height: auto;
}

.partners-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
  margin-top: 30px;
  justify-items: center;
}

.partner-item {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  /* width: 100%; */
  width: 454px;
  height: 154px;
  background-color: #fff;
  padding: 15px;
  border-radius: 5px;
  gap: 10px;
}

.logo-circle {
  width: 148px;
  height: 148px;
  border-radius: 50%;
  background: white;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 5px;
}

.logo-circle img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.partner-name {
  font-size: 30px;
  color: #292C2E;
  font-weight: 500;
  text-align: center;
  margin-right: 25px;
}

/* 响应式调整 */
@media (max-width: 992px) {
  .partners-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 576px) {
  .partners-grid {
    grid-template-columns: 1fr;
  }
}

/* 主横幅区域 */
.hero-banner {
  width: 100%;
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

.hero-content {
  width: 100%;
  position: absolute;
  left: 50%;
  top: 54%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 1;
}

.hero-content h2 {
  width: 100%;
  font-size: 58px;
  font-weight: 700;
  color: #000F3D;
}

.hero-content h2 span {
  color: #39A8E8;
  font-weight: 700;
}

.hero-content p {
  color: #031642;
  font-size: 22px;
  font-weight: 540;
  margin-bottom: 11px;
}

.hero-content button {
  margin-top: 56px;
  background: linear-gradient(to right, #6EC9FE, #0A8ED7);
  border: none;
  color: white;
  padding: 14px 40px;
  font-size: 20px;
  border-radius: 30px;
  cursor: pointer;
  transition: opacity 0.3s ease;
  font-weight: 600;
  letter-spacing: 4px;
  box-shadow: #0E92D9 0px 20px 30px -10px;
}


.banner-image {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.cta-button {
  padding: 12px 32px;
  font-size: 16px;
  border-radius: 25px;
  background: #ff6b35;
  border: none;
}

.banner-right {
  display: flex;
  justify-content: center;
  align-items: center;
}

.instructor-avatars {
  position: relative;
}

.avatar-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.instructor-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.instructor-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 占位符样式 */
.avatar-placeholder,
.image-placeholder,
.icon-placeholder {
  width: 100%;
  height: 100%;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
}

.course-image .image-placeholder {
  height: 120px;
}



.path-icon .icon-placeholder {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  background: #e6f7ff;
}

/* 数据统计区域 */
.stats-section {
  height: 187px;
  background: #F2FBFF;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

/* AI智能体验区域 */
.ai-smart-experience {
  padding: 60px 0;
  background: #ffffff;
}

.ai-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-top: 40px;
  width: 100%;
  max-width: 1420px;
  margin-left: auto;
  margin-right: auto;
}

.ai-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 0 0 15px 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  cursor: pointer;
  border: 1px solid #f0f0f0;
  width: 100%;
  box-sizing: border-box;
}

.ai-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.ai-card-icon {
  margin-bottom: 15px;
}

.ai-icon-wrapper {
  width: 100%;
  height: 100%;
  border-radius: 12px 12px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #e3f2fd 0%, #ffffff 100%);
}

.ai-icon-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ai-card-content {
  text-align: left;
  padding: 0 15px;
  width: 100%;
  box-sizing: border-box;
}

.ai-card-title {
  font-size: 16px;
  color: #000000;
  margin-bottom: 8px;
  line-height: 1.3;
}

.ai-card-description {
  font-size: 12px;
  color: #a2a2a2;
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  box-sizing: border-box;
}

/* 广告区域样式 */
.advertisement-section {
  margin: auto;
  padding: 40px 0;
  background: white;
}

.ad-container {
  width: 100%;
  max-width: 1420px;
  margin: 0 auto;
  text-align: center;
}

.ad-container-text {
  position: absolute;
  color: #3BA4EB;
  top: 48%;
  transform: translateY(-50%);
  left: 20%;
  font-size: 26px;
  font-family: 'AlibabaPuHuiTiBold';
}

.ad-container-title1 {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  left: 15%;
}

.ad-container-title1 span {
  font-size: 11px;
  font-weight: 700;
  color: #53789B;
}

.ad-container-title1 h3 {
  padding: 0;
  margin-bottom: -8px;
  font-family: 'DouyinSansBold';
  color: #021B50;
  font-size: 26px;
  font-weight: 600;
}

.ad-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ad-line {
  width: 32px;
  height: 3px;
  background: linear-gradient(to right, #5479F7, #60D9E9);
}

.ad-container-title2 {
  position: absolute;
  top: 65%;
  right: 29%;
  transform: translateY(-50%);
  width: 204px;
  height: 26px;
  color: #fff;
  background: linear-gradient(to right, #1D46F3, #60D9E9);
  font-size: 14px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.ad-image {
  width: 100%;
  height: auto;
  border-radius: 6px;
  transition: all 0.3s ease;
}

.ad-container {
  position: relative;
}

.close-btn {
  position: absolute;
  top: 0;
  right: 0;
  background: #CFD5D9;
  color: white;
  border: none;
  border-radius: 0 5px 0 0;
  width: 25px;
  height: 15px;
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 0.3s ease;
}

.close-btn:hover {
  background: rgba(0, 0, 0, 0.7);
}

/* 广告悬停效果 */
/* .ad-image:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
} */

.stats-grid {
  display: flex;
  align-items: center;
  width: 1420px;
  margin: 0 auto;
  padding: 0;
}

.stat-item {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 0;
}

/* 第一个 */
/* .stat-item:first-child {
  margin-left: 0;
}

.stat-item:last-child {
  border-right: none;
  padding-right: 0;
} */

.line {
  width: 1px;
  height: 50px;
  background: #D0E8F5;
  margin: 0 65px;
}

.stat-icon {
  flex-shrink: 0;
  width: 74px;
  height: 74px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon img {
  width: 74px;
  height: 74px;
  object-fit: contain;
  display: block;
}



.stat-content {
  text-align: left;
  /* flex: 1; */
}

.stat-number {
  font-size: 22px;
  /* font-weight: 700; */
  color: #292C2E;
  margin-bottom: 6px;
  line-height: 1.1;
  letter-spacing: -0.5px;
}

.stat-label {
  font-size: 14px;
  color: #5A5C5E;
  line-height: 1.3;
  font-weight: 400;
  word-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
  text-align: left;
}

.special-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.special-icon {
  margin-bottom: 6px;
}

.special-number {
  font-size: 20px;
  font-weight: bold;
  color: white;
  line-height: 1.2;
}

.special-text {
  font-size: 11px;
  color: white;
  opacity: 0.9;
  line-height: 1;
}

/* 通用样式 */
.container {
  width: 1420px !important;
  margin: 0 auto !important;
  padding: 0;
}

.section-header {
  max-width: 1420px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 32px;
  padding: 0;
}

.section-title-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.section-title {
  font-size: 28px;
  font-weight: 600;
  color: #333;
  margin: 0;
  margin-bottom: 4px;
  line-height: 1.2;
}

.section-title-image {
  height: 32px;
  width: auto;
  object-fit: contain;
  margin-bottom: 4px;
}

.section-title-text {
  /* 字体 */
  font-family: 'AlimamaShuHeiTiBold';
  height: 32px;
  line-height: 32px;
  font-size: 30px;
  color: #333;
  margin-bottom: 6px;
  display: inline-block;
}

.section-subtitle {
  font-size: 24px;
  color: #C0C0C0;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0;
  font-weight: 400;
  font-family: 'Source Han Sans', 'Source Han Sans Regular', sans-serif;
}

.view-all-btn {
  font-size: 18px;
  color: #999;
  padding: 0;
  height: auto;
  line-height: 34px;
  font-weight: 400;
}

.view-all-btn:hover {
  color: #1890ff;
}

/* 热门课程 */
.popular-courses {
  padding: 70px 0;
  background: #FFFFFF;
  width: 100%;
  min-height: 542px;
  height: auto;
}

.courses-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  width: 100%;
}

.course-card {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  height: auto;
  min-height: 240px;
  display: flex;
  flex-direction: column;
}

.course-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.course-image {
  position: relative;
  width: 340px;
  height: 209px;
  overflow: hidden;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  flex-shrink: 0;
}

.course-image img {
  width: 340px;
  height: 209px;
  object-fit: cover;
}



.course-info {
  padding: 12px 14px 16px 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.course-title {
  font-size: 16px;
  font-weight: 500;
  color: #333333;
  margin-bottom: 12px;
  line-height: 1.5;
  height: auto;
  min-height: 24px;
  overflow: visible;
  word-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

.course-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #666;
  margin-top: auto;
  padding-top: 8px;
}

.course-students {
  color: #999999;
  font-size: 14px;
  line-height: 17px;
  white-space: nowrap;
}

.enroll-btn {
  background: white;
  border: 1px solid #0088D1;
  color: #0088D1;
  min-width: 59px;
  height: 25px;
  padding: 0 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 400;
  line-height: 17px;
  font-family: 'PingFang SC', '苹方-简', 'PingFang SC Regular', sans-serif;
  cursor: pointer;
  transition: background-color 0.2s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.enroll-btn:hover {
  background: #40a9ff;
}

.join-btn {
  background: #FFFFFF;
  color: #0088D1;
  border: 1px solid #0088D1;
  width: 59px;
  height: 25px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 400;
  line-height: 17px;
  font-family: 'PingFang SC', '苹方-简', 'PingFang SC Regular', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
}

.join-btn:hover {
  background: #f0f8ff;
  border-color: #40a9ff;
  color: #40a9ff;
}

/* 专题训练 */
.special-training {
  padding: 80px 0;
  background: #F2FBFF;
  width: 100%;
  min-height: 578px;
  height: auto;
}

.training-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  max-width: 1420px;
  margin: 0 auto;
  padding: 0;
}

.training-card {
  background: white;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s;
  cursor: pointer;
}

.training-card:hover {
  transform: translateY(-2px);
}

.training-image {
  position: relative;
  width: 100%;
  /* height: 212px; */
  overflow: hidden;
}

.training-image img {
  width: 100%;
  height: 212px;
  object-fit: cover;
}

.training-info {
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  /* 改为flex-start，让内容从顶部开始排列 */
  height: 100px;
  /* 使用固定高度而不是最小高度，确保所有卡片高度一致 */
}

.training-title-row {
  display: flex;
  align-items: center;
  /* 让标题和标签顶部对齐 */
  gap: 8px;
  justify-content: flex-start;
  /* 改为flex-start，让标签紧跟在标题后面 */
  width: 100%;
  flex-wrap: nowrap;
  /* 防止换行，保持在同一行 */
  min-height: 28px;
  /* 增加最小高度以适应标签高度 */
}

.training-title {
  font-size: 20px;
  font-weight: 500;
  color: #333333;
  line-height: 24px;
  /* 固定行高为24px，确保所有标题高度一致 */
  margin: 0;
  flex: none;
  /* 让标题宽度根据内容自适应 */
  word-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
  display: inline-block;
  /* inline-block让宽度根据内容自适应 */
  padding-top: 2px;
  /* 添加2px的顶部padding，让标题与标签对齐 */
  max-width: calc(100% - 120px);
  /* 增加预留空间，适应英文标签可能更长的情况 */
  vertical-align: top;
  /* 确保与标签顶部对齐 */
}

.training-tag {
  background: #5BA0FF;
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  padding: 0 12px;
  /* 左右内边距，让文字有呼吸空间 */
  border-radius: 5px;
  white-space: nowrap;
  font-family: 'PingFang SC', '苹方-简', 'PingFang SC Regular', sans-serif;
  height: 20px;
  flex-shrink: 0;
  /* 防止标签被压缩 */
  display: inline-flex;
  /* 改为inline-flex，与标题的inline-block更好配合 */
  align-items: center;
  justify-content: center;
  width: auto;
  /* 自适应宽度 */
  margin-top: 2px;
  /* 与标题的padding-top保持一致 */
  vertical-align: top;
  /* 确保与标题顶部对齐 */
}

.training-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #666;
  margin-top: auto;
  /* 保持margin-top: auto，让meta区域始终在底部 */
  padding-top: 8px;
  height: 25px;
  /* 固定高度确保所有meta区域高度一致 */
}

.training-students {
  color: #999999;
  font-size: 14px;
  line-height: 17px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  /* 确保文本垂直居中对齐 */
  height: 25px;
  /* 与meta区域高度一致 */
}

/* 学习路径 */
.learning-paths {
  padding: 20px 0;
  background: white;
  width: 100%;
  min-height: 859px;
  height: auto;
}

.paths-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  max-width: 100%;
}

.path-card {
  background: white;
  border-radius: 12px;
  padding: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  height: auto;
  min-height: 100%;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.path-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.path-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.path-image-container {
  width: 100%;
  height: 195px;
  overflow: hidden;
  border-radius: 8px 8px 0 0;
  margin-bottom: 20px;
}

.path-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  padding: 0 24px 24px 24px;
}





.path-free-label {
  font-size: 22px;
  color: #333;
  font-weight: bold;
  margin-bottom: 12px;
  word-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

.path-description {
  font-size: 16px;
  color: #666;
  line-height: 1.6;
  margin-bottom: 16px;
  word-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

.detail-link {
  color: #0088D1;
  cursor: pointer;
  margin-left: 5px;
  font-size: 16px;
}

.detail-link:hover {
  text-decoration: underline;
}

.path-details {
  margin-bottom: 16px;
  background-color: #F7F8FA;
  padding: 16px;
  border-radius: 8px;
  flex: 1;
}

.path-detail-item {
  display: flex;
  margin-bottom: 12px;
  font-size: 16px;
  line-height: 1.5;
  align-items: flex-start;
}

.detail-label {
  color: #666;
  min-width: 80px;
  flex-shrink: 0;
  margin-right: 8px;
  word-wrap: break-word;
  word-break: break-word;
}

.detail-value {
  color: #333;
  flex: 1;
  word-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
  line-height: 1.4;
}

.resources-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.resource-tag {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: normal;
  word-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
  line-height: 1.3;
  text-align: center;
}

/* 第一个卡片的配套资源样式 */
.path-card-1 .resource-tag.tag-1 {
  color: #0C6ED9;
  background-color: #E6F3FF;
}

.path-card-1 .resource-tag.tag-2 {
  color: #0C6ED9;
  background-color: #E6F3FF;
}

/* 第二个卡片的配套资源样式 */
.path-card-2 .resource-tag.tag-1 {
  color: #3DA015;
  background-color: #F6FFEC;
}

.path-card-2 .resource-tag.tag-2 {
  color: #3DA015;
  background-color: #F6FFEC;
}

/* 第三个卡片的配套资源样式 */
.path-card-3 .resource-tag.tag-1 {
  color: #551DAB;
  background-color: #F9F0FF;
}

.path-card-3 .resource-tag.tag-2 {
  color: #551DAB;
  background-color: #F9F0FF;
}

.path-warning {
  background: #FFEBE5;
  border: 1px solid #FFEBE5;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  color: #FF682D;
  margin-bottom: 20px;
  line-height: 1.5;
  display: flex;
  align-items: center;
  word-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
  gap: 6px;
}

.warning-icon {
  color: #F39C12;
  font-style: normal;
  font-size: 14px;
}

.path-learn-btn {
  background: #0088D1;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
  align-self: flex-end;
  margin-top: auto;
  margin-bottom: 5px;
  white-space: nowrap;
}

.path-learn-btn:hover {
  background: #40a9ff;
}

.path-image {
  width: 100%;
  height: 195px;
  border-radius: 8px;
  object-fit: cover;
}

/* 精选评论 */
.featured-reviews {
  padding: 70px 0 76px 0;
  background-image: url('/images/comments/comments-bg.png');
  background-size: cover;
  background-position: center;
  width: 100%;
  height: 758px;
}

.reviews-grid {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  height: 500px;
}

.avatar-img {
  width: 43px;
  height: 43px;
  border-right: 50%;
}

.content-comments {
  position: relative;
  display: flex;
  width: 1420px;
  /* overflow: hidden; */
}

.content-comments div {
  white-space: nowrap;
  animation: animate var(--t) linear infinite;
}

.content-comments div:nth-child(2) {
  animation: animate2 var(--t) linear infinite;
  animation-delay: calc(var(--t) / -2);
}

@keyframes animate {
  from {
    transform: translate(100%);
  }

  to {
    transform: translate(-100%);
  }
}

@keyframes animate2 {
  from {
    transform: translate(0);
  }

  to {
    transform: translate(-200%);
  }
}

.content-comments div span {
  display: inline-flex;
  align-items: center;
  /* margin: 10px; */
  line-height: 1.5em;
  background-color: #fff;
  color: #999999;
  font-size: 18px;
  padding: 6px 8px;
  border-radius: 340px;
  border: 1.5px solid #D5E2E8;
  text-align: center;
  margin-right: 200px;
}

.content-comments div span span {
  border: none;
  padding: 5px 10px;
  margin-right: 5px;
}

.review-avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.review-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 上层：头像 + 姓名职位的横向布局 */
.review-header {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  width: auto;
}

/* 下层：评论内容 */
.review-content-wrapper {
  margin-top: 30px;
  width: 100%;
}

.reviewer-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.reviewer-name {
  font-size: 28px;
  font-weight: 500;
  color: #333333;
  line-height: 1.2;
  margin-bottom: 8px;
  word-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

.reviewer-title {
  font-size: 22px;
  color: #999999;
  line-height: 1.2;
  margin: 0 0 16px 0;
  word-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

.review-content {
  font-size: 20px;
  color: #999999;
  line-height: 1.6;
  margin: 0;
  word-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
  flex: 1;
}

/* 精选活动 */
.featured-activities {
  padding: 60px 0 40px 0;
  background-image: url('/images/activity/activity-bg.png');
  background-size: cover;
  background-position: center;
  width: 100%;
  height: auto;
}

.activities-grid {
  display: flex;
  justify-content: space-between;
  margin-top: 32px;
  gap: 20px;
}

.activity-left {
  padding-left: 30px;
  width: 100%;
  height: 404px;
  background: white;
  border-radius: 5px;
  display: flex;
  justify-content: space-between;
  gap: 50px;
}

.activity-left-content {
  max-width: 740px;
  position: relative;
}

.activity-title-name {
  padding: 25px 0 25px 0;
  display: flex;
  justify-content: space-between;
  align-items: end;
}

.activity-name {
  /* font-weight: 600; */
  font-size: 26px;
}

.activity-detailed {
  color: #0088D1;
  font-size: 14px;
}

.activity-description {
  font-size: 20px;
  color: #52565D;
}

.activity-left-img {
  width: 442px;
  height: 100%;
  border-radius: 5px;
}

.activity-right {
  width: 223px;
  height: 404px;
  border-radius: 5px;
  position: relative;
}

.activity-right .activity-title-img {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 54px;
  color: #1380BF;
  width: 119px;
  height: 150px;
}

.activity-right .activity-right-img {
  position: absolute;
  left: 56px;
  bottom: 16%;
}

.activity-btn {
  position: absolute;
  left: 0;
  bottom: 7%;
  color: white;
  background-color: #0088D1;
  border: none;
  font-size: 12px;
  padding: 7px 32px;
  border-radius: 6px;
  margin-top: auto;
}


@media (max-width: 900px) {
  .activities-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .activity-image {
    height: 110px;
  }
}

/* 通用文本自适应样式 */
.home-container * {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* 确保所有标题和文本都能正确换行 */
h1,
h2,
h3,
h4,
h5,
h6,
p,
span,
div {
  word-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

/* 防止长单词破坏布局 */
.section-title,
.section-subtitle,
.course-title,
.training-title,
.reviewer-name,
.reviewer-title,
.review-content,
.detail-value,
.stat-label {
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

/* 确保专题训练标题在不同语言下的一致性 */
.training-title {
  /* 字体渲染优化 */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;

  /* 确保中英文字体一致性 */
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;

  /* 字符间距优化 */
  letter-spacing: -0.01em;
}

/* 确保标签在不同语言下的一致性 */
.training-tag {
  /* 字体渲染优化 */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* 专题训练标题响应式优化 */
@media (max-width: 768px) {
  .training-title-row {
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
    min-height: auto;
    /* 移动端不需要固定最小高度 */
  }

  .training-title {
    font-size: 18px;
    line-height: 1.3;
    /* 移动端稍微增加行高提高可读性 */
    flex: none;
    /* 移动端重置flex */
  }

  .training-tag {
    align-self: flex-start;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .training-title {
    font-size: 18px;
    max-width: calc(100% - 70px);
    line-height: 1.2;
    /* 保持一致的行高 */
    padding-top: 2px;
    /* 保持垂直对齐 */
  }

  .training-tag {
    margin-top: 2px;
    /* 保持垂直对齐 */
  }
}

/* 响应式设计 */

/* 大屏幕 (1200px-1399px) */
@media (max-width: 1399px) and (min-width: 1200px) {
  .container {
    padding: 0 24px;
    max-width: 1200px;
    margin: 0 auto;
  }

  .courses-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
  }

  .training-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
  }

  .paths-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
  }

  .reviews-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
  }

  .ai-cards-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
  }
}

/* 中等屏幕 (992px-1199px) */
@media (max-width: 1199px) and (min-width: 992px) {
  .banner-content {
    padding: 0 20px;
    gap: 40px;
  }

  .container {
    padding: 0 20px;
    max-width: 992px;
    margin: 0 auto;
  }

  .courses-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
  }

  .training-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }

  .paths-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .reviews-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
  }

  .ai-cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .section-title {
    font-size: 26px;
  }

  .banner-title {
    font-size: 3rem;
  }
}

/* 小屏幕 (768px-991px) */
@media (max-width: 991px) and (min-width: 768px) {
  .banner-content {
    padding: 0 16px;
    gap: 32px;
  }

  .container {
    padding: 0 16px;
    max-width: 768px;
    margin: 0 auto;
  }

  .banner-title {
    font-size: 2.5rem;
    line-height: 1.2;
  }

  .section-title {
    font-size: 24px;
  }

  .popular-courses,
  .special-training,
  .learning-paths,
  .featured-reviews {
    padding: 50px 0;
  }

  .courses-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .training-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
  }

  .paths-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .reviews-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .ai-cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .ai-card {
    padding: 20px;
  }

  .ai-card-title {
    font-size: 16px;
  }

  .ai-card-description {
    font-size: 13px;
    color: #a2a2a2;
    line-height: 1.5;
    margin: 0;
    /* 添加以下样式确保文本溢出显示省略号 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* 确保有宽度限制 */
    max-width: 100%;
    display: block;
    /* 确保是块级元素 */
  }

  .stats-section {
    width: 100%;
  }

  .stats-grid {
    flex-direction: column;
    gap: 16px;
    padding: 16px;
  }

  .stat-item {
    border-right: none;
    border-bottom: 1px solid #e8e8e8;
    padding: 16px 0;
    justify-content: center;
    text-align: center;
  }

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

  .course-image {
    width: 100%;
    height: 140px;
  }

  .course-image img {
    width: 100%;
    height: 140px;
  }

  .training-image {
    width: 100%;
    height: 180px;
  }

  .training-image img {
    width: 100%;
    height: 180px;
  }
}

/* 移动设备 (576px-767px) */
@media (max-width: 767px) and (min-width: 576px) {
  .banner-content {
    grid-template-columns: 1fr;
    gap: 24px;
    text-align: center;
    padding: 0 16px;
  }

  .container {
    padding: 0 16px;
    max-width: 576px;
    margin: 0 auto;
  }

  .banner-title {
    font-size: 2rem;
    line-height: 1.3;
  }

  .banner-subtitle {
    font-size: 1.1rem;
  }

  .section-title {
    font-size: 20px;
  }

  .popular-courses,
  .special-training,
  .learning-paths,
  .featured-reviews {
    padding: 40px 0;
  }

  .courses-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .training-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .paths-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .reviews-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .ai-cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .ai-card {
    padding: 16px;
  }

  .ai-card-title {
    font-size: 15px;
  }

  .ai-card-description {
    font-size: 12px;
  }

  .ai-icon-wrapper {
    width: 60px;
    height: 60px;
  }

  .ai-icon-image {
    padding: 7px;
  }

  .stats-section {
    width: 100%;
  }

  .stats-grid {
    flex-direction: column;
    gap: 12px;
    padding: 12px;
  }

  .stat-item {
    border-right: none;
    border-bottom: 1px solid #e8e8e8;
    padding: 12px 0;
    justify-content: center;
    text-align: center;
  }

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

  .course-image {
    width: 100%;
    height: 200px;
  }

  .course-image img {
    width: 100%;
    height: 200px;
  }

  .training-image {
    width: 100%;
    height: 160px;
  }

  .training-image img {
    width: 100%;
    height: 160px;
  }

  .review-card {
    width: 100%;
    min-height: auto;
  }

  .footer-title {
    font-size: 18px;
  }
}

/* 小移动设备 (≤575px) */
@media (max-width: 575px) {
  .banner-content {
    grid-template-columns: 1fr;
    gap: 20px;
    text-align: center;
    padding: 0 12px;
  }

  .container {
    padding: 0 12px;
    max-width: 100%;
    margin: 0 auto;
  }

  .banner-title {
    font-size: 1.6rem;
    line-height: 1.4;
  }

  .banner-subtitle {
    font-size: 1rem;
    line-height: 1.5;
  }

  .section-title {
    font-size: 18px;
  }

  .section-subtitle {
    font-size: 12px;
  }

  .popular-courses,
  .special-training,
  .learning-paths,
  .featured-reviews {
    padding: 32px 0;
  }

  .section-header {
    margin-bottom: 20px;
  }

  .courses-grid,
  .training-grid,
  .paths-grid,
  .reviews-grid,
  .ai-cards-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .ai-card {
    padding: 12px;
  }

  .ai-card-title {
    font-size: 14px;
  }

  .ai-card-description {
    font-size: 11px;
  }

  .ai-icon-wrapper {
    width: 50px;
    height: 50px;
  }

  .ai-icon-image {
    padding: 6px;
  }

  .stats-section {
    width: 100%;
    height: auto;
    padding: 20px 0;
  }

  .stats-grid {
    flex-direction: column;
    gap: 8px;
    padding: 8px;
  }

  .stat-item {
    border-right: none;
    border-bottom: 1px solid #f0f0f0;
    padding: 12px 8px;
    justify-content: center;
    text-align: center;
    flex-direction: column;
    gap: 8px;
  }

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

  .stat-icon {
    width: 48px;
    height: 48px;
  }

  .stat-icon img {
    width: 48px;
    height: 48px;
  }

  .stat-number {
    font-size: 18px;
  }

  .stat-label {
    font-size: 12px;
  }

  .course-image {
    width: 100%;
    height: 180px;
  }

  .course-image img {
    width: 100%;
    height: 180px;
  }

  .training-image {
    width: 100%;
    height: 140px;
  }

  .training-image img {
    width: 100%;
    height: 140px;
  }

  .review-card {
    width: 100%;
    min-height: auto;
    padding: 16px;
  }

  .reviewer-name {
    font-size: 20px;
  }

  .reviewer-title {
    font-size: 16px;
  }

  .review-content {
    font-size: 14px;
  }

  .path-free-label {
    font-size: 18px;
  }

  .path-description {
    font-size: 14px;
  }

  .detail-label,
  .detail-value {
    font-size: 14px;
  }

  .footer-title {
    font-size: 16px;
  }

  .avatar-group {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .instructor-avatar {
    width: 50px;
    height: 50px;
  }
}

/* 超小屏幕 (≤360px) */
@media (max-width: 360px) {
  .container {
    padding: 0 8px;
  }

  .banner-title {
    font-size: 1.4rem;
  }

  .banner-subtitle {
    font-size: 0.9rem;
  }

  .section-title {
    font-size: 16px;
  }

  .popular-courses,
  .special-training,
  .learning-paths,
  .featured-reviews {
    padding: 24px 0;
  }

  .stat-item {
    padding: 8px 4px;
  }

  .course-image,
  .training-image {
    height: 120px;
  }

  .course-image img,
  .training-image img {
    height: 120px;
  }

  .review-card {
    padding: 12px;
  }
}

/* 横屏模式优化 */
@media (max-height: 500px) and (orientation: landscape) {

  .popular-courses,
  .special-training,
  .learning-paths,
  .featured-reviews {
    padding: 20px 0;
  }

  .banner-content {
    gap: 16px;
  }

  .section-header {
    margin-bottom: 16px;
  }

  .stats-section {
    min-height: auto;
    padding: 20px 0;
  }
}

/* 高分辨率屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {

  .section-title-image,
  .footer-logo-img,
  .cert-logo-img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* 打印样式 */
@media print {

  .banner-content,
  .stats-section,
  .footer-container {
    display: none;
  }

  .popular-courses,
  .special-training,
  .learning-paths,
  .featured-reviews {
    padding: 20px 0;
    page-break-inside: avoid;
  }

  .course-card,
  .training-card,
  .path-card,
  .review-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* 全屏模式样式现在在App.vue中统一管理 */
</style>
