<template>
  <div class="LearningSystem container-height">
    <div v-if="!isChildRoute">

      <!-- ===== HERO ===== -->
      <section class="ls-hero">
        <div class="ls-hero-bg" aria-hidden="true">
          <div class="ls-orb ls-orb-1"></div>
          <div class="ls-orb ls-orb-2"></div>
          <div class="ls-orb ls-orb-3"></div>
          <div class="ls-grid-overlay"></div>
          <div class="ls-hero-topbar"></div>
          <div class="ls-hero-sweep"></div>
          <div class="ls-particle ls-p1"></div>
          <div class="ls-particle ls-p2"></div>
          <div class="ls-particle ls-p3"></div>
          <div class="ls-particle ls-p4"></div>
          <div class="ls-particle ls-p5"></div>
          <div class="ls-particle ls-p6"></div>
          <div class="ls-particle ls-p7"></div>
          <div class="ls-particle ls-p8"></div>
        </div>

        <div class="container ls-hero-inner">
          <div class="ls-hero-left">
            <div class="ls-hero-badge">
              <span class="ls-badge-dot"></span>
              <span>{{ $t('learningSystem.heroBadge') }}</span>
              <span class="ls-badge-sep">|</span>
              <span class="ls-badge-sub">{{ $t('learningSystem.heroBadgeSub') }}</span>
            </div>

            <h1 class="ls-hero-title">
              {{ $t('learningSystem.heroTitle1') }}<br/>
              <em class="ls-title-em">{{ $t('learningSystem.heroTitle2') }}</em><br/>
              {{ $t('learningSystem.heroTitle3') }}
            </h1>

            <p class="ls-hero-desc">
              {{ $t('learningSystem.heroDesc1') }}<br/>
              {{ $t('learningSystem.heroDesc2') }}
            </p>

            <div class="ls-hero-cta">
              <button class="ls-btn-primary" @click="scrollToCourses">
                <svg width="16" height="16" viewBox="0 0 24 24" fill="white"><path d="M8 5v14l11-7z"/></svg>
                {{ $t('learningSystem.heroBtn1') }}
              </button>
              <button class="ls-btn-ghost">
                <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="M12 8v4l3 3"/></svg>
                {{ $t('learningSystem.heroBtn2') }}
              </button>
            </div>

            <div class="ls-hero-stats">
              <div class="ls-stat-card">
                <span class="ls-stat-n">50,000+</span>
                <span class="ls-stat-l">{{ $t('learningSystem.heroStat1') }}</span>
              </div>
              <div class="ls-stat-card">
                <span class="ls-stat-n">200+</span>
                <span class="ls-stat-l">{{ $t('learningSystem.heroStat2') }}</span>
              </div>
              <div class="ls-stat-card">
                <span class="ls-stat-n">98.6%</span>
                <span class="ls-stat-l">{{ $t('learningSystem.heroStat3') }}</span>
              </div>
            </div>
          </div>

          <div class="ls-hero-right">
            <div class="ls-preview-card">
              <div class="ls-pc-header">
                <div class="ls-pc-dots">
                  <span class="d-r"></span><span class="d-y"></span><span class="d-g"></span>
                </div>
                <span class="ls-pc-title">{{ $t('learningSystem.previewTitle') }}</span>
                <span class="ls-pc-live">
                  <span class="ls-pc-live-dot"></span>
                  {{ $t('learningSystem.previewLive') }}
                </span>
              </div>
              <div class="ls-pc-items">
                <div class="ls-pc-item" v-for="(c, i) in previewCourses" :key="i">
                  <div class="ls-pc-icon-wrapper" :style="{ background: c.bgColor }">
                    <span class="ls-pc-emoji">{{ c.emoji }}</span>
                  </div>
                  <div class="ls-pc-content">
                    <div class="ls-pc-name">{{ c.name }}</div>
                    <div class="ls-pc-bar-row">
                      <div class="ls-pc-bar">
                        <div class="ls-pc-bar-fill" :style="{ width: c.progress + '%', background: c.barColor }"></div>
                      </div>
                      <span class="ls-pc-pct">{{ c.progress }}%</span>
                    </div>
                  </div>
                  <span class="ls-pc-badge" :class="c.cls">{{ c.label }}</span>
                </div>
              </div>
              <div class="ls-pc-footer">
                <span class="ls-pc-ind active"></span>
                <span class="ls-pc-ind"></span>
                <span class="ls-pc-ind"></span>
              </div>
            </div>
          </div>
        </div>

        <div class="ls-hero-wave" aria-hidden="true">
          <svg viewBox="0 0 1440 80" preserveAspectRatio="none">
            <path d="M0,40 C360,80 1080,0 1440,40 L1440,80 L0,80 Z" fill="#f8faff"/>
          </svg>
        </div>
      </section>

      <!-- ===== BREADCRUMB ===== -->
      <div class="container ls-breadcrumb-wrapper">
        <Breadcrumb />
      </div>

      <!-- ===== FILTER & COURSES ===== -->
      <div class="container ls-content-wrapper" id="courses-section">
        <!-- 左侧筛选面板 -->
        <aside class="ls-filter-panel">
          <div class="ls-filter-panel-header">
            <div class="ls-filter-icon-wrap">
              <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2.5"><polygon points="22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"/></svg>
            </div>
            <h2 class="ls-filter-title">{{ $t('learningSystem.filterTitle') }}</h2>
            <span class="ls-filter-count" v-if="listTotal > 0">{{ listTotal }}</span>
          </div>

          <!-- 学习阶段 -->
          <div class="ls-filter-group">
            <div class="ls-filter-label">
              <span class="ls-label-dot" style="background: linear-gradient(135deg,#0055FE,#60a5fa)"></span>
              <span class="ls-label-icon">📚</span>
              {{$t('common.studyStage')}}
            </div>
            <div class="ls-filter-tags" :class="{ 'is-expanded': expandedFilters.studyStage }">
              <span class="ls-tag" :class="{ 'is-active': searchFom.studyStage === '' }"
                @click="selectFilter('studyStage', '')">{{$t('common.all')}}</span>
              <span v-for="item in bus_study_stage" :key="item.dictValue"
                class="ls-tag" :class="{ 'is-active': searchFom.studyStage === item.dictValue }"
                @click="selectFilter('studyStage', item.dictValue)">{{ item.dictLabel }}</span>
            </div>
            <button class="ls-filter-expand" @click="expandedFilters.studyStage = !expandedFilters.studyStage">
              {{ expandedFilters.studyStage ? $t('common.collapse') : $t('common.expand') }}
              <svg :class="{ 'is-expanded': expandedFilters.studyStage }" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="6 9 12 15 18 9"/></svg>
            </button>
          </div>

          <div class="ls-filter-divider"></div>

          <!-- 课程分类 -->
          <div class="ls-filter-group">
            <div class="ls-filter-label">
              <span class="ls-label-dot" style="background: linear-gradient(135deg,#7c3aed,#c084fc)"></span>
              <span class="ls-label-icon">🗂️</span>
              {{$t('common.courseCategory')}}
            </div>
            <div class="ls-filter-tags" :class="{ 'is-expanded': expandedFilters.courseCategory }">
              <span class="ls-tag" :class="{ 'is-active': searchFom.courseCategory === '' }"
                @click="selectFilter('courseCategory', '')">{{$t('common.all')}}</span>
              <span v-for="item in bus_course_category" :key="item.dictValue"
                class="ls-tag" :class="{ 'is-active': searchFom.courseCategory === item.dictValue }"
                @click="selectFilter('courseCategory', item.dictValue)">{{ item.dictLabel }}</span>
            </div>
            <button class="ls-filter-expand" @click="expandedFilters.courseCategory = !expandedFilters.courseCategory">
              {{ expandedFilters.courseCategory ? $t('common.collapse') : $t('common.expand') }}
              <svg :class="{ 'is-expanded': expandedFilters.courseCategory }" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="6 9 12 15 18 9"/></svg>
            </button>
          </div>

          <div class="ls-filter-divider"></div>

          <!-- 技能标签 -->
          <div class="ls-filter-group">
            <div class="ls-filter-label">
              <span class="ls-label-dot" style="background: linear-gradient(135deg,#C832FA,#f472b6)"></span>
              <span class="ls-label-icon">🏷️</span>
              {{$t('common.skillTag')}}
            </div>
            <div class="ls-filter-tags" :class="{ 'is-expanded': expandedFilters.skillTag }">
              <span class="ls-tag" :class="{ 'is-active': searchFom.skillTag === '' }"
                @click="selectFilter('skillTag', '')">{{$t('common.all')}}</span>
              <span v-for="item in bus_skill_tag" :key="item.dictValue"
                class="ls-tag" :class="{ 'is-active': searchFom.skillTag === item.dictValue }"
                @click="selectFilter('skillTag', item.dictValue)">{{ item.dictLabel }}</span>
            </div>
            <button class="ls-filter-expand" @click="expandedFilters.skillTag = !expandedFilters.skillTag">
              {{ expandedFilters.skillTag ? $t('common.collapse') : $t('common.expand') }}
              <svg :class="{ 'is-expanded': expandedFilters.skillTag }" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="6 9 12 15 18 9"/></svg>
            </button>
          </div>
        </aside>

        <!-- 右侧课程列表 -->
        <div class="ls-course-list" v-loading="loading">

          <!-- 列表顶部统计横幅 -->
          <div v-if="list.length > 0" class="ls-list-banner">
            <div class="ls-list-banner-item">
              <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"/><path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"/></svg>
              <span><strong>{{ listTotal }}</strong> {{ $t('learningSystem.courseCount') }}</span>
            </div>
            <div class="ls-list-banner-divider"></div>
            <div class="ls-list-banner-item">
              <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M23 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/></svg>
              <span><strong>50,000+</strong> {{ $t('learningSystem.heroStat1') }}</span>
            </div>
            <div class="ls-list-banner-divider"></div>
            <div class="ls-list-banner-item">
              <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/></svg>
              <span>{{ $t('learningSystem.heroStat3') }} <strong>98.6%</strong></span>
            </div>
          </div>

          <div v-if="list.length > 0" class="ls-course-grid">
            <article class="ls-course-card" v-for="item in list" :key="item.courseId"
              @click.stop.prevent="goDetail(item)">

              <!-- 顶部渐变条 -->
              <div class="ls-card-top-border"></div>

              <!-- 封面图区域 -->
              <div class="ls-card-image-wrapper">
                <img :src="item.coverImageUrl" :alt="item.courseTitle" class="ls-card-image" loading="lazy" />

                <!-- 热度徽章（左上角） -->
                <div class="ls-card-hot-badge" v-if="getHotLevel(item.viewCount)">
                  <svg width="10" height="10" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2c0 0-4.5 4.5-4.5 9 0 2.5 2 4.5 4.5 4.5s4.5-2 4.5-4.5C16.5 6.5 12 2 12 2zm0 12c-1.7 0-3-1.3-3-3 0-2 1.5-4.2 3-6 1.5 1.8 3 4 3 6 0 1.7-1.3 3-3 3z"/></svg>
                  {{ getHotLevel(item.viewCount) }}
                </div>

                <!-- 收藏按钮（右上角） -->
                <button class="ls-card-fav-btn" :class="{ 'is-faved': isFavorited(item.courseId) }"
                  @click.stop.prevent="toggleFavorite(item.courseId)">
                  <svg width="14" height="14" viewBox="0 0 24 24" :fill="isFavorited(item.courseId) ? 'currentColor' : 'none'" stroke="currentColor" stroke-width="2"><path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/></svg>
                </button>

                <!-- 图片遮罩层 -->
                <div class="ls-card-image-overlay">
                  <div class="ls-card-play-circle">
                    <svg width="22" height="22" viewBox="0 0 24 24" fill="white"><path d="M8 5v14l11-7z"/></svg>
                  </div>
                  <span class="ls-card-overlay-text">{{ $t('learningSystem.previewNow') }}</span>
                </div>
              </div>

              <!-- 内容区域 -->
              <div class="ls-card-content">

                <!-- 卡片内容浮起层 -->
                <div class="ls-card-content-inner">

                  <!-- 标签行 -->
                  <div class="ls-card-tags">
                    <span v-if="item.skillTagName" class="ls-card-tag ls-tag-skill">{{ item.skillTagName }}</span>
                    <span class="ls-card-tag ls-tag-stage" :class="getStageClass(item.studyStage)">{{ getStageName(item.studyStage) }}</span>
                  </div>

                  <!-- 课程标题 -->
                  <h3 class="ls-card-title">{{ item.courseTitle }}</h3>

                  <!-- 星级评分行 -->
                  <div class="ls-card-rating">
                    <div class="ls-card-stars">
                      <span v-for="i in 5" :key="i" class="ls-star"
                        :class="i <= Math.round(getCourseRating(item.viewCount)) ? 'is-full' : 'is-empty'">
                        <svg width="11" height="11" viewBox="0 0 24 24" fill="currentColor"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/></svg>
                      </span>
                    </div>
                    <span class="ls-card-rating-score">{{ getCourseRating(item.viewCount).toFixed(1) }}</span>
                    <span class="ls-card-review-count">({{ getReviewCount(item.viewCount) }} {{ $t('learningSystem.reviewCount') }})</span>
                  </div>

                  <!-- 课程简介 -->
                  <p class="ls-card-description">{{ item.courseIntro }}</p>

                  <!-- 课程信息行：时长 + 章节数 -->
                  <div class="ls-card-info-row">
                    <span class="ls-card-info-item">
                      <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>
                      {{ getCourseDuration(item.studyStage) }}
                    </span>
                    <span class="ls-card-info-sep">·</span>
                    <span class="ls-card-info-item">
                      <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 6h16M4 10h16M4 14h16M4 18h16"/></svg>
                      {{ getChapterCount(item.courseId, item.studyStage) }} {{ $t('learningSystem.chapterCount') }}
                    </span>
                    <span class="ls-card-info-sep">·</span>
                    <span class="ls-card-info-item">
                      <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/></svg>
                      {{ formatViewCount(item.viewCount) }}{{ $t('learningSystem.learnedCount') }}
                    </span>
                  </div>

                  <!-- 难度指示器 -->
                  <div class="ls-card-difficulty">
                    <span class="ls-card-difficulty-label">{{ $t('learningSystem.difficulty') }}</span>
                    <div class="ls-card-difficulty-dots">
                      <span v-for="i in 3" :key="i" class="ls-diff-dot"
                        :class="i <= getDifficultyLevel(item.studyStage) ? 'is-active' : ''">
                      </span>
                    </div>
                    <span class="ls-card-difficulty-text">{{ getStageName(item.studyStage) }}</span>
                  </div>

                </div><!-- end ls-card-content-inner -->

                <!-- 底部操作区 - 独立在 inner 外，带渐变背景 -->
                <div class="ls-card-meta">
                  <!-- 微粒子装饰 -->
                  <span class="ls-card-particle" style="left:15%;animation-delay:0s"></span>
                  <span class="ls-card-particle" style="left:40%;animation-delay:1.5s"></span>
                  <span class="ls-card-particle" style="left:65%;animation-delay:0.8s"></span>
                  <span class="ls-card-particle" style="left:85%;animation-delay:2.2s"></span>
                  <div class="ls-card-meta-left">
                    <span class="ls-card-hot-text" :class="getHotClass(item.viewCount)">
                      {{ getHotLabel(item.viewCount) }}
                    </span>
                  </div>
                  <button class="ls-card-action-btn" @click.stop.prevent="goDetail(item)">
                    <svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7z"/></svg>
                    {{ $t('learningSystem.startLearning') }}
                  </button>
                </div>
              </div>
            </article>
          </div>
          <EmptyState v-else-if="!loading" />

          <Pagination
            v-if="list.length > 0"
            :total="listTotal"
            :page-size="searchFom.pageSize"
            :current-page="searchFom.pageNum"
            @page-change="handlePageChange"
          />
        </div>
      </div>
    </div>
    <router-view v-else />
  </div>
</template>

<script setup>
import { ref, reactive, computed, onMounted, inject } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { getCourseList } from '@/api/course.js'
import { getDictType } from '@/api/common.js'
import { isLogin } from '@/utils/util.js'
import { useI18n } from 'vue-i18n'
import Pagination from '@/components/Pagination.vue'
import EmptyState from '@/components/EmptyState.vue'
import Breadcrumb from '@/components/Breadcrumb.vue'

const { t } = useI18n()
const route = useRoute()
const router = useRouter()
const openLoginDialog = inject('openLoginDialog')

// 子路由判断
const isChildRoute = computed(() => route.matched.length > 1)

// Hero 预览卡片数据（静态展示）
const previewCourses = [
  { emoji: '🔧', name: t('learningSystem.previewCourse1'), progress: 100, bgColor: 'linear-gradient(135deg,#0055FE,#60a5fa)', barColor: 'linear-gradient(90deg,#0055FE,#60a5fa)', cls: 'b-green', label: t('learningSystem.previewCompleted') },
  { emoji: '🤖', name: t('learningSystem.previewCourse2'), progress: 78, bgColor: 'linear-gradient(135deg,#7c3aed,#c084fc)', barColor: 'linear-gradient(90deg,#7c3aed,#c084fc)', cls: 'b-purple', label: t('learningSystem.previewInProgress') },
  { emoji: '🧠', name: t('learningSystem.previewCourse3'), progress: 45, bgColor: 'linear-gradient(135deg,#C832FA,#f472b6)', barColor: 'linear-gradient(90deg,#C832FA,#f472b6)', cls: 'b-pink', label: t('learningSystem.previewInProgress') },
]

// 筛选展开状态
const expandedFilters = reactive({
  studyStage: false,
  courseCategory: false,
  skillTag: false,
})

// 字典数据
const bus_study_stage = ref([])
const bus_course_category = ref([])
const bus_skill_tag = ref([])

// 列表数据
const loading = ref(false)
const list = ref([])
const listTotal = ref(0)

// 搜索表单
const searchFom = reactive({
  studyStage: '',
  courseCategory: '',
  skillTag: '',
  pageNum: 1,
  pageSize: 10,
  orderByColumn: 'courseId',
  isAsc: 'desc',
})

onMounted(() => {
  getList()
  getDictTypeFn('bus_study_stage')
  getDictTypeFn('bus_course_category')
  getDictTypeFn('bus_skill_tag')
})

const getList = async (type) => {
  if (type === 'init') searchFom.pageNum = 1
  loading.value = true
  try {
    const res = await getCourseList(searchFom)
    if (res.code === 200) {
      list.value = res.rows || []
      listTotal.value = res.total || 0
    }
  } finally {
    loading.value = false
  }
}

const getDictTypeFn = (dictType) => {
  getDictType({ dictType }).then(res => {
    if (dictType === 'bus_study_stage') bus_study_stage.value = res.rows || []
    else if (dictType === 'bus_course_category') bus_course_category.value = res.rows || []
    else if (dictType === 'bus_skill_tag') bus_skill_tag.value = res.rows || []
  })
}

const selectFilter = (type, value) => {
  searchFom[type] = value
  getList('init')
}

const handlePageChange = (page, pageSize) => {
  searchFom.pageNum = page
  if (pageSize) searchFom.pageSize = pageSize
  getList()
}

const goDetail = (item) => {
  if (!isLogin({ callback: openLoginDialog, t })) return
  router.push({
    path: `/learning-system/detail/${item.courseId}`,
    query: { courseId: item.courseId, metaTitle: item.courseTitle || t('learningSystem.courseDetail') }
  })
}

const scrollToCourses = () => {
  const el = document.getElementById('courses-section')
  if (el) el.scrollIntoView({ behavior: 'smooth', block: 'start' })
}

// ===== 卡片辅助函数 =====

// 获取热度徽章文字（图片上方）
const getHotLevel = (viewCount) => {
  const v = viewCount || 0
  if (v >= 100) return t('learningSystem.hotLevel1')
  if (v >= 30) return t('learningSystem.hotLevel2')
  return ''
}

// 获取热度标签文字（底部）
const getHotLabel = (viewCount) => {
  const v = viewCount || 0
  if (v >= 100) return t('learningSystem.hotLabel1')
  if (v >= 30) return t('learningSystem.hotLabel2')
  return t('learningSystem.hotLabel3')
}

// 获取热度样式类
const getHotClass = (viewCount) => {
  const v = viewCount || 0
  if (v >= 100) return 'hot-fire'
  if (v >= 30) return 'hot-rising'
  return 'hot-new'
}

// 格式化浏览量
const formatViewCount = (viewCount) => {
  const v = viewCount || 0
  if (v >= 10000) return (v / 10000).toFixed(1) + t('learningSystem.tenThousand')
  if (v >= 1000) return (v / 1000).toFixed(1) + 'k'
  return v.toString()
}

// 获取学习阶段名称
const getStageName = (studyStage) => {
  const stageMap = {
    'basic': t('learningSystem.stageBasic'),
    'intermediate': t('learningSystem.stageIntermediate'),
    'advanced': t('learningSystem.stageAdvanced'),
  }
  return stageMap[studyStage] || t('learningSystem.stageAll')
}

// 获取学习阶段样式类
const getStageClass = (studyStage) => {
  const classMap = {
    'basic': 'stage-basic',
    'intermediate': 'stage-inter',
    'advanced': 'stage-adv',
  }
  return classMap[studyStage] || 'stage-all'
}

// 获取难度等级（1-3）
const getDifficultyLevel = (studyStage) => {
  const map = { 'basic': 1, 'intermediate': 2, 'advanced': 3 }
  return map[studyStage] || 1
}

// 派生星级评分（基于 viewCount）
const getCourseRating = (viewCount) => {
  const v = viewCount || 0
  if (v >= 100) return 4.9
  if (v >= 50)  return 4.7
  if (v >= 20)  return 4.5
  if (v >= 5)   return 4.3
  return 4.1
}

// 派生评价数量（基于 viewCount）
const getReviewCount = (viewCount) => {
  const v = viewCount || 0
  return Math.max(1, Math.floor(v * 0.3))
}

// 派生课程时长（基于 studyStage）
const getCourseDuration = (studyStage) => {
  const map = { 'basic': '2.5h', 'intermediate': '4.5h', 'advanced': '8h' }
  return map[studyStage] || '3h'
}

// 派生章节数（基于 studyStage + courseId 哈希）
const getChapterCount = (courseId, studyStage) => {
  const base = { 'basic': 8, 'intermediate': 14, 'advanced': 20 }
  const b = base[studyStage] || 10
  return b + ((courseId || 0) % 5)
}

// 收藏状态（纯前端状态）
const favoritedSet = ref(new Set())
const isFavorited = (courseId) => favoritedSet.value.has(courseId)
const toggleFavorite = (courseId, e) => {
  if (e) e.stopPropagation()
  const s = new Set(favoritedSet.value)
  if (s.has(courseId)) s.delete(courseId)
  else s.add(courseId)
  favoritedSet.value = s
}
</script>

<style scoped lang="scss">
// ===== 动画 =====
@keyframes orb-anim {
  0%   { transform: translate(0,0) scale(1); opacity: 0.35; }
  25%  { transform: translate(60px,-40px) scale(1.12); opacity: 0.45; }
  50%  { transform: translate(0,60px) scale(0.9); opacity: 0.38; }
  75%  { transform: translate(-50px,-25px) scale(1.06); opacity: 0.48; }
  100% { transform: translate(0,0) scale(1); opacity: 0.35; }
}
@keyframes particle-float {
  0%   { transform: translateY(0) translateX(0) scale(1); opacity: 0.25; }
  33%  { transform: translateY(-22px) translateX(12px) scale(1.15); opacity: 0.38; }
  66%  { transform: translateY(12px) translateX(-6px) scale(0.88); opacity: 0.28; }
  100% { transform: translateY(0) translateX(0) scale(1); opacity: 0.25; }
}
@keyframes pulse-dot {
  0%,100% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 0 rgba(74,222,128,0.5); }
  50%      { transform: scale(1.3); opacity: 0.8; box-shadow: 0 0 0 6px rgba(74,222,128,0); }
}
@keyframes shine {
  0%   { transform: translateX(-100%) skewX(-20deg); }
  100% { transform: translateX(200%) skewX(-20deg); }
}
@keyframes progress-fill {
  from { width: 0; }
}
@keyframes border-glow {
  0%,100% { box-shadow: 0 0 0 rgba(0,85,254,0.3); }
  50%     { box-shadow: 0 0 16px rgba(0,85,254,0.6), 0 0 32px rgba(200,50,250,0.3); }
}
@keyframes hero-sweep {
  0%   { transform: translateX(-100%) skewX(-15deg); opacity: 0; }
  10%  { opacity: 1; }
  50%  { transform: translateX(200%) skewX(-15deg); opacity: 1; }
  51%  { opacity: 0; }
  100% { transform: translateX(200%) skewX(-15deg); opacity: 0; }
}

// ===== 全局 =====
.LearningSystem {
  background: #f8faff;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  position: relative;

  &::before {
    content: '';
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background-image:
      linear-gradient(rgba(0,85,254,0.025) 1px, transparent 1px),
      linear-gradient(90deg, rgba(0,85,254,0.025) 1px, transparent 1px);
    background-size: 40px 40px;
  }
}

.container {
  // max-width: 1200px;
  width: 100%;
  min-width: auto;
  margin: 0 auto;
  padding: 0 24px;
  position: relative; z-index: 1;
}

// ===== HERO =====
.ls-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(150deg, #030618 0%, #0b0330 35%, #180645 65%, #050e28 100%);
  color: #f0f2f5;
  margin-top: -4px;

  .ls-hero-bg {
    position: absolute; inset: 0; z-index: 0; overflow: hidden;

    .ls-orb {
      position: absolute; border-radius: 50%;
      filter: blur(90px); opacity: 0.35;
      animation: orb-anim 20s infinite ease-in-out;
    }
    .ls-orb-1 { width: 350px; height: 350px; top: -80px; left: -60px; background: radial-gradient(circle,#0055FE,#4f46e5); animation-delay: 0s; }
    .ls-orb-2 { width: 450px; height: 450px; bottom: -100px; right: -80px; background: radial-gradient(circle,#C832FA,#7c3aed); animation-delay: 7s; }
    .ls-orb-3 { width: 280px; height: 280px; top: 30%; right: 30%; background: radial-gradient(circle,#60a5fa,#818cf8); animation-delay: 14s; }

    .ls-grid-overlay {
      position: absolute; inset: 0;
      background-image:
        linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
      background-size: 48px 48px;
      mask-image: radial-gradient(ellipse at center, rgba(0,0,0,1) 0%, transparent 72%);
    }

    .ls-hero-topbar {
      position: absolute; top: 0; left: 0; right: 0; height: 3px;
      background: linear-gradient(90deg, #0055FE, #C832FA);
    }

    // 扫光效果
    .ls-hero-sweep {
      position: absolute; inset: 0; z-index: 1; pointer-events: none;
      background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.015) 50%, transparent 60%);
      animation: hero-sweep 8s ease-in-out infinite;
    }

    .ls-particle {
      position: absolute; border-radius: 50%;
      animation: particle-float 15s infinite ease-in-out;
    }
    .ls-p1 { width: 5px; height: 5px; background: rgba(0,85,254,0.9); top: 20%; left: 30%; animation-delay: 0s; }
    .ls-p2 { width: 8px; height: 8px; background: rgba(200,50,250,0.8); bottom: 15%; left: 45%; animation-delay: 3s; }
    .ls-p3 { width: 6px; height: 6px; background: rgba(96,165,250,0.8); top: 55%; right: 22%; animation-delay: 6s; }
    .ls-p4 { width: 4px; height: 4px; background: rgba(192,132,252,0.9); top: 18%; right: 40%; animation-delay: 9s; }
    .ls-p5 { width: 3px; height: 3px; background: rgba(248,250,252,0.7); top: 40%; left: 15%; animation-delay: 4.5s; }
    .ls-p6 { width: 6px; height: 6px; background: rgba(0,85,254,0.7); bottom: 30%; right: 15%; animation-delay: 7.5s; }
    .ls-p7 { width: 4px; height: 4px; background: rgba(200,50,250,0.6); top: 70%; left: 60%; animation-delay: 11s; }
    .ls-p8 { width: 7px; height: 7px; background: rgba(96,165,250,0.6); top: 10%; right: 25%; animation-delay: 2s; }
  }

  .ls-hero-inner {
    position: relative; z-index: 2;
    display: flex; justify-content: space-between; align-items: center;
    gap: 48px;
    padding: 100px 24px 120px;
  }

  .ls-hero-left { flex: 1; max-width: 580px; }

  .ls-hero-badge {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 100px;
    padding: 8px 20px;
    font-size: 13px; font-weight: 500;
    color: rgba(255,255,255,0.88);
    margin-bottom: 28px;

    .ls-badge-dot {
      width: 8px; height: 8px; border-radius: 50%;
      background: #4ade80;
      animation: pulse-dot 2s ease-in-out infinite;
    }
    .ls-badge-sep { color: rgba(255,255,255,0.3); }
    .ls-badge-sub { color: rgba(255,255,255,0.55); font-size: 12px; }
  }

  .ls-hero-title {
    font-size: 68px; font-weight: 900; line-height: 1.12;
    margin-bottom: 28px; letter-spacing: -3px;
    color: #ffffff;
    text-shadow: 0 2px 12px rgba(0,0,0,0.4);

    .ls-title-em {
      font-style: normal;
      background: linear-gradient(90deg, #93c5fd 0%, #d8b4fe 50%, #f9a8d4 100%);
      background-size: 200% auto;
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
      filter: drop-shadow(0 0 24px rgba(147,197,253,0.5));
      animation: gradient-shift 4s linear infinite;
    }
  }

  @keyframes gradient-shift {
    0%   { background-position: 0% center; }
    100% { background-position: 200% center; }
  }

  .ls-hero-desc {
    font-size: 17px; color: rgba(255,255,255,0.78);
    line-height: 1.9; margin-bottom: 40px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
    max-width: 520px;
  }

  .ls-hero-cta {
    display: flex; gap: 16px; margin-bottom: 40px;

    .ls-btn-primary {
      display: inline-flex; align-items: center; gap: 8px;
      padding: 14px 30px; border-radius: 100px;
      background: linear-gradient(90deg, #0055FE, #C832FA); color: white;
      font-size: 15px; font-weight: 700; border: none; cursor: pointer;
      box-shadow: 0 6px 24px rgba(0,85,254,0.4);
      transition: all 0.22s ease; position: relative; overflow: hidden;

      &::after {
        content: ''; position: absolute; inset: 0;
        background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
        transform: translateX(-100%);
      }
      &:hover {
        transform: translateY(-3px); box-shadow: 0 12px 36px rgba(0,85,254,0.55);
        &::after { animation: shine 0.6s ease forwards; }
      }
      &:active { transform: translateY(-1px); }
    }

    .ls-btn-ghost {
      display: inline-flex; align-items: center; gap: 8px;
      padding: 13px 26px; border-radius: 100px;
      background: rgba(255,255,255,0.07);
      backdrop-filter: blur(8px);
      border: 1px solid rgba(255,255,255,0.22);
      color: rgba(255,255,255,0.9);
      font-size: 15px; font-weight: 600; cursor: pointer;
      transition: all 0.22s ease;
      &:hover { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.4); transform: translateY(-3px); }
    }
  }

  // 统计数据 - 独立卡片式
  .ls-hero-stats {
    display: flex; gap: 14px;

    .ls-stat-card {
      display: flex; flex-direction: column; gap: 5px;
      background: rgba(255,255,255,0.07);
      backdrop-filter: blur(20px);
      border: 1px solid rgba(255,255,255,0.14);
      border-radius: 16px; padding: 18px 24px;
      transition: all 0.28s cubic-bezier(0.4,0,0.2,1);
      position: relative; overflow: hidden;

      &::before {
        content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
        background: linear-gradient(90deg, #0055FE, #C832FA);
        opacity: 0; transition: opacity 0.28s;
      }
      &:hover {
        background: rgba(255,255,255,0.13); border-color: rgba(255,255,255,0.25);
        transform: translateY(-5px);
        box-shadow: 0 16px 40px rgba(0,85,254,0.25);
        &::before { opacity: 1; }
      }
    }
    .ls-stat-n {
      font-size: 30px; font-weight: 900; color: #ffffff;
      background: linear-gradient(90deg, #93c5fd, #d8b4fe);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
    }
    .ls-stat-l { font-size: 12px; color: rgba(255,255,255,0.5); letter-spacing: 0.5px; }
  }

  .ls-hero-right { flex: 0 0 460px; }

  // 预览卡片
  .ls-preview-card {
    width: 100%;
    background: rgba(8,4,32,0.82);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 24px; padding: 28px;
    box-shadow:
      0 40px 100px rgba(0,0,0,0.6),
      0 0 0 1px rgba(255,255,255,0.06),
      inset 0 1px 0 rgba(255,255,255,0.12),
      0 0 60px rgba(0,85,254,0.15);
    transform: perspective(1200px) rotateY(-10deg) rotateX(5deg);
    transform-origin: center right;
    transition: transform 0.4s cubic-bezier(0.4,0,0.2,1);
    &:hover { transform: perspective(1200px) rotateY(-6deg) rotateX(2deg) scale(1.02); }

    .ls-pc-header {
      display: flex; align-items: center; gap: 10px;
      margin-bottom: 20px; padding-bottom: 14px;
      border-bottom: 1px solid rgba(255,255,255,0.08);

      .ls-pc-dots {
        display: flex; gap: 6px;
        span { width: 11px; height: 11px; border-radius: 50%; }
        .d-r { background: #FF5F56; box-shadow: 0 0 6px rgba(255,95,86,0.6); }
        .d-y { background: #FFBD2E; box-shadow: 0 0 6px rgba(255,189,46,0.6); }
        .d-g { background: #27C93F; box-shadow: 0 0 6px rgba(39,201,63,0.6); }
      }
      .ls-pc-title { flex: 1; margin-left: 8px; font-size: 15px; color: rgba(255,255,255,0.6); font-weight: 600; }
      .ls-pc-live {
        display: flex; align-items: center; gap: 5px;
        font-size: 11px; color: #4ade80; font-weight: 600;
        .ls-pc-live-dot {
          width: 6px; height: 6px; border-radius: 50%; background: #4ade80;
          box-shadow: 0 0 8px rgba(74,222,128,0.8);
          animation: pulse-dot 2s infinite;
        }
      }
    }

    .ls-pc-items { display: flex; flex-direction: column; gap: 14px; }

    .ls-pc-item {
      display: flex; align-items: center; gap: 14px;
      background: rgba(255,255,255,0.05);
      border: 1px solid rgba(255,255,255,0.09);
      border-radius: 16px; padding: 16px 18px;
      transition: all 0.22s ease;
      position: relative; overflow: hidden;

      &::before {
        content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
        background: linear-gradient(180deg, #0055FE, #C832FA);
        opacity: 0; transition: opacity 0.22s;
      }
      &:hover {
        background: rgba(255,255,255,0.09); transform: translateX(4px);
        &::before { opacity: 1; }
      }

      .ls-pc-icon-wrapper {
        width: 52px; height: 52px; border-radius: 14px;
        display: flex; align-items: center; justify-content: center;
        flex-shrink: 0; box-shadow: 0 6px 20px rgba(0,0,0,0.4);
      }
      .ls-pc-emoji { font-size: 24px; }
      .ls-pc-content { flex: 1; min-width: 0; }
      .ls-pc-name {
        font-size: 15px; font-weight: 700; color: rgba(255,255,255,0.95);
        margin-bottom: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
      }
      .ls-pc-bar-row { display: flex; align-items: center; gap: 10px; }
      .ls-pc-bar {
        flex: 1; height: 7px; background: rgba(255,255,255,0.1); border-radius: 4px; overflow: hidden;
      }
      .ls-pc-bar-fill {
        height: 100%; border-radius: 3px;
        animation: progress-fill 1.2s cubic-bezier(0.4,0,0.2,1) both;
        box-shadow: 0 0 8px rgba(0,85,254,0.5);
      }
      .ls-pc-pct { font-size: 13px; color: rgba(255,255,255,0.55); min-width: 36px; text-align: right; font-weight: 600; }
      .ls-pc-badge {
        font-size: 12px; font-weight: 700; padding: 4px 12px; border-radius: 100px; flex-shrink: 0;
        &.b-green { background: rgba(74,222,128,0.15); color: #4ade80; border: 1px solid rgba(74,222,128,0.3); }
        &.b-purple { background: rgba(192,132,252,0.15); color: #c084fc; border: 1px solid rgba(192,132,252,0.3); }
        &.b-pink { background: rgba(244,114,182,0.15); color: #f472b6; border: 1px solid rgba(244,114,182,0.3); }
      }
    }

    .ls-pc-footer {
      display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 16px;
      .ls-pc-ind {
        width: 6px; height: 6px; border-radius: 3px;
        background: rgba(255,255,255,0.2); transition: all 0.3s;
        &.active { width: 20px; background: linear-gradient(90deg, #0055FE, #C832FA); }
      }
    }
  }

  .ls-hero-wave {
    position: absolute; bottom: 0; left: 0; right: 0; height: 80px;
    svg { display: block; width: 100%; height: 100%; }
  }
}

// ===== BREADCRUMB =====
.ls-breadcrumb-wrapper {
  padding: 20px 24px 0;
}

// ===== 布局 =====
.ls-content-wrapper {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 28px;
  padding-top: 20px;
  padding-bottom: 60px;
  align-items: start;
}

// ===== 筛选面板 =====
.ls-filter-panel {
  background: #ffffff;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(0,85,254,0.12);
  box-shadow:
    0 8px 40px rgba(0,85,254,0.1),
    0 2px 8px rgba(0,0,0,0.04),
    inset 0 1px 0 rgba(255,255,255,0.8);
  position: sticky; top: 80px;

  // 微纹理背景点阵
  &::before {
    content: '';
    position: absolute; inset: 0; z-index: 0; pointer-events: none;
    background-image: radial-gradient(circle, rgba(0,85,254,0.04) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.6;
  }

  .ls-filter-panel-header {
    display: flex; align-items: center; gap: 10px;
    padding: 20px 20px 16px;
    background: linear-gradient(135deg, rgba(0,85,254,0.07) 0%, rgba(200,50,250,0.07) 100%);
    border-bottom: 1px solid rgba(0,85,254,0.08);
    position: relative; z-index: 1;

    &::after {
      content: ''; position: absolute; bottom: 0; left: 20px; right: 20px; height: 1px;
      background: linear-gradient(90deg, transparent, rgba(0,85,254,0.25) 30%, rgba(200,50,250,0.25) 70%, transparent);
    }

    .ls-filter-icon-wrap {
      width: 34px; height: 34px; border-radius: 10px;
      background: linear-gradient(135deg, #0055FE, #C832FA);
      display: flex; align-items: center; justify-content: center;
      box-shadow: 0 4px 16px rgba(0,85,254,0.45);
      flex-shrink: 0;
    }
    .ls-filter-count {
      margin-left: auto;
      background: linear-gradient(90deg, #0055FE, #C832FA);
      color: white; font-size: 11px; font-weight: 700;
      padding: 3px 10px; border-radius: 100px;
      box-shadow: 0 2px 8px rgba(0,85,254,0.3);
      flex-shrink: 0;
    }
  }

  .ls-filter-title {
    font-size: 15px; font-weight: 700; color: #1a1a2e; margin: 0;
  }

  .ls-filter-group {
    padding: 18px 20px 14px;
    position: relative; z-index: 1;
  }

  .ls-filter-divider {
    height: 1px; margin: 0 20px;
    background: linear-gradient(90deg, transparent, rgba(0,85,254,0.12) 30%, rgba(200,50,250,0.12) 70%, transparent);
  }

  .ls-filter-label {
    display: flex; align-items: center; gap: 8px;
    font-size: 13.5px; font-weight: 700; color: #1a1a2e;
    margin-bottom: 14px;

    .ls-label-dot {
      width: 3px; height: 18px; border-radius: 3px; flex-shrink: 0;
      background: linear-gradient(180deg, #0055FE, #C832FA);
      box-shadow: 0 2px 8px rgba(0,85,254,0.35);
    }
    .ls-label-icon {
      font-size: 14px;
      width: 26px; height: 26px; border-radius: 8px;
      background: linear-gradient(135deg, rgba(0,85,254,0.1), rgba(200,50,250,0.1));
      display: flex; align-items: center; justify-content: center;
      flex-shrink: 0;
    }
  }

  .ls-filter-tags {
    display: flex; flex-wrap: wrap; gap: 7px;
    max-height: 38px; overflow: hidden;
    padding: 4px;
    transition: max-height 0.38s cubic-bezier(0.4,0,0.2,1);
    &.is-expanded { max-height: 200px; }
  }

  // 筛选标签
  .ls-tag {
    display: inline-flex; align-items: center;
    padding: 6px 14px; border-radius: 100px;
    font-size: 12.5px; font-weight: 500;
    color: #6b7280;
    background: #f5f6fa;
    border: 1.5px solid #e5e7f0;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.4,0,0.2,1); user-select: none;

    &:hover {
      background: linear-gradient(135deg, rgba(0,85,254,0.07), rgba(200,50,250,0.07));
      color: #4f46e5;
      border-color: rgba(0,85,254,0.3);
      transform: translateY(-2px);
      box-shadow: 0 4px 14px rgba(0,85,254,0.15);
    }
    &.is-active {
      background: linear-gradient(135deg, #0055FE, #C832FA);
      color: white; border-color: transparent; font-weight: 700;
      box-shadow: 0 4px 14px rgba(0,85,254,0.15);
      transform: translateY(-1px);
    }
  }

  .ls-filter-expand {
    display: inline-flex; align-items: center; gap: 5px;
    margin-top: 12px; padding: 6px 14px;
    border-radius: 100px;
    background: rgba(0,85,254,0.05);
    color: #0055FE; font-size: 12px; font-weight: 700;
    border: 1.5px solid rgba(0,85,254,0.16); cursor: pointer;
    transition: all 0.22s ease;
    letter-spacing: 0.3px;
    &:hover {
      background: rgba(0,85,254,0.1); border-color: rgba(0,85,254,0.3);
      transform: translateY(-1px); box-shadow: 0 3px 10px rgba(0,85,254,0.15);
    }

    svg {
      transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
      &.is-expanded { transform: rotate(180deg); }
    }
  }
}

// ===== 课程列表 =====
.ls-course-list {
  display: flex; flex-direction: column; gap: 24px;
  min-height: 300px;
}

.ls-course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 24px;
}

// ===== 课程卡片 =====
.ls-course-card {
  position: relative;
  background: #ffffff;
  border-radius: 22px;
  overflow: hidden;
  cursor: pointer;
  border: 1.5px solid rgba(0,0,0,0.06);
  box-shadow: 0 4px 24px rgba(0,0,0,0.07), 0 1px 4px rgba(0,0,0,0.04);
  transition: all 0.42s cubic-bezier(0.4,0,0.2,1);
  display: flex; flex-direction: column;

  // 流光底部背景
  &::after {
    content: '';
    position: absolute; bottom: 0; left: 0; width: 100%; height: 80px;
    background: linear-gradient(90deg,
      rgba(0,85,254,0.07) 0%,
      rgba(200,50,250,0.07) 50%,
      rgba(0,85,254,0.07) 100%);
    background-size: 200% 100%;
    animation: card-flow-light 8s linear infinite;
    filter: blur(10px);
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
  }

  &:hover {
    transform: translateY(-12px) scale(1.015);
    box-shadow:
      0 28px 70px rgba(0,85,254,0.2),
      0 8px 24px rgba(200,50,250,0.12),
      0 0 0 1.5px rgba(0,85,254,0.18);
    border-color: rgba(0,85,254,0.2);

    &::after { opacity: 1; }

    .ls-card-top-border { height: 4px; box-shadow: 0 0 22px rgba(0,85,254,0.6); }
    .ls-card-image-overlay { opacity: 1; }
    .ls-card-image { transform: scale(1.08); }
    .ls-card-title { color: #0055FE; }
    .ls-card-content-inner { transform: translateY(-4px); }
    .ls-card-action-btn {
      transform: translateY(-2px);
      box-shadow: 0 8px 28px rgba(0,85,254,0.55), 0 0 0 3px rgba(0,85,254,0.15);
      &::after { animation: shine 0.6s ease forwards; }
    }
    .ls-card-particle { animation-play-state: running; }
  }

  // 顶部渐变条
  .ls-card-top-border {
    position: absolute; top: 0; left: 0; width: 100%; height: 3px;
    background: linear-gradient(90deg, #0055FE, #C832FA); z-index: 3;
    transition: height 0.22s ease, box-shadow 0.22s ease;
  }

  // 图片区域
  .ls-card-image-wrapper {
    position: relative; width: 100%;
    padding-bottom: 56.25%; overflow: hidden; flex-shrink: 0;

    .ls-card-image {
      position: absolute; inset: 0; width: 100%; height: 100%;
      object-fit: cover;
      transition: transform 0.55s cubic-bezier(0.4,0,0.2,1);
    }

    // 热度徽章 - 右上角
    .ls-card-hot-badge {
      position: absolute; top: 10px; right: 10px; z-index: 2;
      display: inline-flex; align-items: center; gap: 4px;
      padding: 4px 9px; border-radius: 100px;
      background: linear-gradient(135deg, #ff6b35, #f7c59f);
      color: white; font-size: 11px; font-weight: 700;
      box-shadow: 0 2px 10px rgba(255,107,53,0.45);
      backdrop-filter: blur(4px);
      animation: pulse-hot 2.5s ease-in-out infinite;
    }

    // 图片遮罩层
    .ls-card-image-overlay {
      position: absolute; inset: 0;
      background: linear-gradient(160deg, rgba(0,85,254,0.82) 0%, rgba(200,50,250,0.82) 100%);
      display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
      opacity: 0;
      transition: opacity 0.32s ease;
      z-index: 1;

      .ls-card-play-circle {
        width: 54px; height: 54px; border-radius: 50%;
        background: rgba(255,255,255,0.22);
        border: 2px solid rgba(255,255,255,0.7);
        display: flex; align-items: center; justify-content: center;
        backdrop-filter: blur(4px);
        transition: transform 0.22s ease;
        &:hover { transform: scale(1.1); }
      }

      .ls-card-overlay-text {
        color: rgba(255,255,255,0.9); font-size: 13px; font-weight: 600;
        letter-spacing: 1px;
      }
    }
  }

  // 内容区域
  .ls-card-content {
    padding: 0;
    display: flex; flex-direction: column; flex: 1;
    position: relative; z-index: 1;
  }

  .ls-card-content-inner {
    padding: 16px 18px 0;
    display: flex; flex-direction: column; flex: 1;
    transition: transform 0.38s cubic-bezier(0.4,0,0.2,1);
  }

  // 标签行
  .ls-card-tags {
    display: flex; align-items: center; gap: 6px;
    margin-bottom: 12px; flex-wrap: wrap;
  }

  .ls-card-tag {
    display: inline-flex; align-items: center;
    padding: 3px 10px; border-radius: 100px;
    font-size: 11px; font-weight: 600; letter-spacing: 0.3px;
  }

  // 技能标签 - 蓝紫渐变，主标签（稍大）
  .ls-tag-skill {
    background: linear-gradient(135deg, rgba(0,85,254,0.1), rgba(200,50,250,0.1));
    color: #4f46e5;
    border: 1.5px solid rgba(0,85,254,0.22);
    font-size: 11.5px;
    box-shadow: 0 1px 6px rgba(0,85,254,0.1);
  }

  // 阶段标签（辅助标签，稍小）
  .ls-tag-stage {
    font-size: 10.5px;
    &.stage-basic  { background: rgba(16,185,129,0.08); color: #10b981; border: 1px solid rgba(16,185,129,0.2); }
    &.stage-inter  { background: rgba(245,158,11,0.08); color: #f59e0b; border: 1px solid rgba(245,158,11,0.2); }
    &.stage-adv    { background: rgba(239,68,68,0.08);  color: #ef4444; border: 1px solid rgba(239,68,68,0.2); }
    &.stage-all    { background: rgba(107,114,128,0.06); color: #9ca3af; border: 1px solid rgba(107,114,128,0.15); }
  }

  // 标题
  .ls-card-title {
    font-size: 16px; font-weight: 700; color: #1a1a2e;
    margin-bottom: 8px; line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    transition: color 0.22s ease;
    min-height: 48px;
  }

  // 简介
  .ls-card-description {
    font-size: 13px; color: #9ca3af; line-height: 1.7;
    margin-bottom: 14px; flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    min-height: 44px;
  }

  // 底部 meta 区域
  .ls-card-meta {
    display: flex; justify-content: space-between; align-items: center;
    margin: 0;
    padding: 14px 18px 18px;
    border-top: 1px solid rgba(0,85,254,0.08);
    background: linear-gradient(135deg,
      rgba(0,85,254,0.04) 0%,
      rgba(200,50,250,0.04) 50%,
      rgba(0,85,254,0.04) 100%);
    background-size: 200% 100%;
    animation: card-flow-light 8s linear infinite;
    border-radius: 0 0 22px 22px;
    gap: 8px;
    position: relative;
    overflow: hidden;
  }

  .ls-card-meta-left {
    display: flex; align-items: center; gap: 8px;
    min-width: 0;
  }

  .ls-card-views {
    display: flex; align-items: center; gap: 4px;
    font-size: 12px; color: #b8bcc8; white-space: nowrap;
    svg { flex-shrink: 0; }
  }

  .ls-card-divider {
    color: #dde1ea; font-size: 14px; line-height: 1; flex-shrink: 0;
  }

  // 热度文字标签
  .ls-card-hot-text {
    font-size: 10.5px; font-weight: 700; border-radius: 100px;
    padding: 2px 8px; white-space: nowrap; flex-shrink: 0;
    &.hot-fire   { background: rgba(234,88,12,0.1); color: #ea580c; }
    &.hot-rising { background: rgba(245,158,11,0.1); color: #d97706; }
    &.hot-new    { background: rgba(16,185,129,0.1); color: #10b981; }
  }

  // 操作按钮
  .ls-card-action-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 8px 16px; border-radius: 100px;
    background: linear-gradient(135deg, #0055FE, #C832FA);
    color: white; font-size: 12px; font-weight: 700; border: none; cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,85,254,0.28);
    transition: all 0.22s ease;
    position: relative; overflow: hidden; flex-shrink: 0;
    white-space: nowrap;

    &::after {
      content: ''; position: absolute; inset: 0;
      background: linear-gradient(90deg, transparent, rgba(255,255,255,0.22), transparent);
      transform: translateX(-100%);
    }
    &:hover {
      transform: translateY(-2px);
      box-shadow: 0 8px 24px rgba(0,85,254,0.45);
    }
  }
}

@keyframes pulse-hot {
  0%,100% { box-shadow: 0 2px 10px rgba(255,107,53,0.45); }
  50%     { box-shadow: 0 2px 18px rgba(255,107,53,0.7); }
}

@keyframes card-flow-light {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

@keyframes particle-float {
  0%   { transform: translateY(0) scale(0.6); opacity: 0; }
  20%  { opacity: 0.9; }
  80%  { opacity: 0.3; }
  100% { transform: translateY(-40px) scale(1.3); opacity: 0; }
}

// ===== 卡片微粒子 =====
.ls-card-particle {
  position: absolute;
  bottom: 8px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,85,254,0.9) 0%, rgba(200,50,250,0.9) 100%);
  box-shadow: 0 0 6px rgba(0,85,254,0.6);
  animation: particle-float 4s ease-out infinite;
  animation-play-state: paused;
  pointer-events: none;
  z-index: 1;
}

// ===== 列表顶部统计横幅 =====
.ls-list-banner {
  display: flex; align-items: center; gap: 0;
  background: linear-gradient(135deg, rgba(0,85,254,0.04) 0%, rgba(200,50,250,0.04) 100%);
  border: 1px solid rgba(0,85,254,0.1);
  border-radius: 14px; padding: 12px 20px;
  margin-bottom: 4px;

  .ls-list-banner-item {
    display: flex; align-items: center; gap: 8px;
    flex: 1; justify-content: center;
    font-size: 13px; color: #6b7280;
    svg { color: #0055FE; flex-shrink: 0; }
    strong { color: #1a1a2e; font-weight: 700; }
  }

  .ls-list-banner-divider {
    width: 1px; height: 24px; flex-shrink: 0;
    background: linear-gradient(180deg, transparent, rgba(0,85,254,0.2), transparent);
  }
}

// ===== 收藏按钮 =====
.ls-card-fav-btn {
  position: absolute; top: 10px; left: 10px; z-index: 3;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(8px);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #d1d5db;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  transition: all 0.22s cubic-bezier(0.4,0,0.2,1);

  &:hover {
    transform: scale(1.15);
    background: rgba(255,255,255,1);
    color: #ef4444;
    box-shadow: 0 4px 16px rgba(239,68,68,0.25);
  }
  &.is-faved {
    color: #ef4444;
    background: rgba(255,255,255,1);
    animation: fav-pop 0.35s cubic-bezier(0.4,0,0.2,1);
  }
}

@keyframes fav-pop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.35); }
  100% { transform: scale(1); }
}

// ===== 星级评分 =====
.ls-card-rating {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 10px;

  .ls-card-stars {
    display: flex; align-items: center; gap: 2px;
  }
  .ls-star {
    display: inline-flex;
    &.is-full  svg { fill: #f59e0b; color: #f59e0b; }
    &.is-empty svg { fill: #e5e7eb; color: #e5e7eb; }
  }
  .ls-card-rating-score {
    font-size: 13px; font-weight: 700; color: #f59e0b;
  }
  .ls-card-review-count {
    font-size: 11px; color: #9ca3af;
  }
}

// ===== 课程信息行：时长 + 章节数 + 学习人数 =====
.ls-card-info-row {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 12px; flex-wrap: wrap;

  .ls-card-info-item {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 11.5px; color: #9ca3af;
    svg { flex-shrink: 0; color: #c4b5fd; }
  }
  .ls-card-info-sep {
    color: #e5e7eb; font-size: 12px;
  }
}

// ===== 难度指示器 =====
.ls-card-difficulty {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px;

  .ls-card-difficulty-label {
    font-size: 11px; color: #9ca3af; font-weight: 500;
  }
  .ls-card-difficulty-dots {
    display: flex; align-items: center; gap: 4px;
  }
  .ls-diff-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #e5e7eb;
    transition: all 0.22s ease;
    &.is-active {
      background: linear-gradient(135deg, #0055FE, #C832FA);
      box-shadow: 0 0 6px rgba(0,85,254,0.4);
    }
  }
  .ls-card-difficulty-text {
    font-size: 11px; font-weight: 600; color: #6b7280;
  }
}

// ===== 分页覆盖 =====
:deep(.el-pagination.is-background .el-pager li.is-active) {
  background: linear-gradient(90deg, #0055FE, #C832FA) !important;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0,85,254,0.35);
}
// :deep(.el-pagination.is-background .el-pager li:hover) {
//   color: #0055FE;
// }
:deep(.el-pagination) {
  justify-content: center;
  padding: 8px 0;
}

// ===== 响应式 =====
@media (max-width: 1024px) {
  .ls-content-wrapper { grid-template-columns: 240px 1fr; }
}
@media (max-width: 900px) {
  .ls-hero-inner { flex-direction: column; text-align: center; padding: 80px 24px 100px; }
  .ls-hero-left { max-width: 100%; align-items: center; display: flex; flex-direction: column; }
  .ls-hero-title { font-size: 46px; }
  .ls-hero-right { flex: 0 0 auto; width: 100%; max-width: 420px; }
  .ls-preview-card { transform: none; &:hover { transform: none; } }
  .ls-content-wrapper { grid-template-columns: 1fr; }
  .ls-filter-panel { position: static; }
  .ls-hero-stats { justify-content: center; }
}
@media (max-width: 640px) {
  .ls-hero-title { font-size: 36px; }
  .ls-hero-cta { flex-direction: column; width: 100%; max-width: 280px; }
  .ls-course-grid { grid-template-columns: 1fr; }
}
</style>
