<template>
  <div class="report-view">
    <!-- 页面头部 -->
    <div class="page-header">
      <div class="header-content">
        <div class="header-title">
          <div class="title-icon-wrapper">
            <BarChartOutlined class="title-icon" />
          </div>
          <div class="title-text">
            <h2>数据报告</h2>
            <p>查看学校教学数据和统计分析</p>
          </div>
        </div>
        <div class="header-actions">
          <a-range-picker
            v-model:value="dateRange"
            :placeholder="['开始日期', '结束日期']"
            style="width: 240px;"
          />
          <a-button class="export-btn">
            <DownloadOutlined class="btn-icon" />
            导出报告
          </a-button>
        </div>
      </div>
    </div>

    <!-- 概览卡片 -->
    <a-spin :spinning="loading">
      <div class="overview-cards">
        <div class="overview-card">
          <div class="card-icon" style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);">
            <BookOutlined />
          </div>
          <div class="card-content">
            <div class="card-value">{{ totalLessons }}</div>
            <div class="card-label">总授课次数</div>
          </div>
        </div>
        <div class="overview-card">
          <div class="card-icon" style="background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);">
            <SolutionOutlined />
          </div>
          <div class="card-content">
            <div class="card-value">{{ activeTeacherCount }}</div>
            <div class="card-label">活跃教师</div>
          </div>
        </div>
        <div class="overview-card">
          <div class="card-icon" style="background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);">
            <ReadOutlined />
          </div>
          <div class="card-content">
            <div class="card-value">{{ usedCourseCount }}</div>
            <div class="card-label">使用课程</div>
          </div>
        </div>
        <div class="overview-card">
          <div class="card-icon" style="background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);">
            <StarFilled />
          </div>
          <div class="card-content">
            <div class="card-value">{{ avgRating }}</div>
            <div class="card-label">平均评分</div>
          </div>
        </div>
      </div>
    </a-spin>

    <!-- 标签页 -->
    <div class="report-tabs">
      <div class="tab-header">
        <div
          v-for="tab in tabs"
          :key="tab.key"
          class="tab-item"
          :class="{ 'active': activeTab === tab.key }"
          @click="activeTab = tab.key"
        >
          <BarChartOutlined v-if="tab.icon === 'bar-chart'" class="tab-icon" />
          <SolutionOutlined v-else-if="tab.icon === 'solution'" class="tab-icon" />
          <ReadOutlined v-else-if="tab.icon === 'read'" class="tab-icon" />
          <TeamOutlined v-else-if="tab.icon === 'team'" class="tab-icon" />
          <span class="tab-label">{{ tab.label }}</span>
        </div>
      </div>

      <div class="tab-content">
        <!-- 整体概览 -->
        <div v-if="activeTab === 'overview'" class="overview-content">
          <div class="chart-grid">
            <div class="chart-card">
              <div class="chart-header">
                <LineChartOutlined class="chart-icon" />
                <h4>课程使用趋势</h4>
              </div>
              <div class="chart-placeholder">
                <div class="placeholder-bars">
                  <div class="bar" v-for="i in 7" :key="i" :style="{ height: Math.random() * 80 + 20 + '%' }"></div>
                </div>
                <div class="placeholder-labels">
                  <span v-for="day in ['一', '二', '三', '四', '五', '六', '日']" :key="day">周{{ day }}</span>
                </div>
              </div>
            </div>
            <div class="chart-card">
              <div class="chart-header">
                <AimOutlined class="chart-icon" />
                <h4>教师活跃度</h4>
              </div>
              <div class="chart-placeholder circle">
                <div class="circle-chart">
                  <svg viewBox="0 0 100 100">
                    <circle cx="50" cy="50" r="40" fill="none" stroke="#F0F0F0" stroke-width="12" />
                    <circle cx="50" cy="50" r="40" fill="none" stroke="url(#gradient1)" stroke-width="12"
                      stroke-dasharray="188 251" stroke-linecap="round" transform="rotate(-90 50 50)" />
                    <defs>
                      <linearGradient id="gradient1" x1="0%" y1="0%" x2="100%" y2="0%">
                        <stop offset="0%" style="stop-color:#667eea" />
                        <stop offset="100%" style="stop-color:#764ba2" />
                      </linearGradient>
                    </defs>
                  </svg>
                  <div class="circle-text">
                    <span class="percent">75%</span>
                    <span class="label">活跃率</span>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>

        <!-- 教师报告 -->
        <div v-if="activeTab === 'teacher'" class="table-content">
          <div class="teacher-cards" v-if="teacherData.length > 0">
            <div v-for="teacher in teacherData" :key="teacher.id" class="teacher-report-card">
              <div class="teacher-header">
                <div class="teacher-avatar">
                  <SolutionOutlined />
                </div>
                <div class="teacher-info">
                  <div class="teacher-name">{{ teacher.name }}</div>
                  <div class="teacher-rating">
                    <StarFilled v-for="i in 5" :key="i" class="star" :class="{ 'filled': i <= Math.round(teacher.avgRating) }" />
                    <span class="rating-value">{{ teacher.avgRating.toFixed(1) }}</span>
                  </div>
                </div>
              </div>
              <div class="teacher-stats">
                <div class="stat-item">
                  <BookOutlined class="stat-icon" />
                  <span class="stat-value">{{ teacher.lessonCount }}</span>
                  <span class="stat-label">授课次数</span>
                </div>
                <div class="stat-item">
                  <ReadOutlined class="stat-icon" />
                  <span class="stat-value">{{ teacher.courseCount }}</span>
                  <span class="stat-label">使用课程</span>
                </div>
                <div class="stat-item">
                  <MessageOutlined class="stat-icon" />
                  <span class="stat-value">{{ teacher.feedbackCount }}</span>
                  <span class="stat-label">反馈次数</span>
                </div>
              </div>
              <div class="teacher-action">
                <a-button type="link" @click="viewTeacherDetail(teacher)">
                  <FileTextOutlined style="margin-right: 4px;" />
                  查看详情
                </a-button>
              </div>
            </div>
          </div>
          <a-empty v-else description="暂无教师数据" />
        </div>

        <!-- 课程报告 -->
        <div v-if="activeTab === 'course'" class="table-content">
          <div class="course-report-list" v-if="courseData.length > 0">
            <div v-for="(course, index) in courseData" :key="course.id" class="course-report-item">
              <div class="course-rank" :class="'rank-' + (index + 1)">
                <TrophyOutlined v-if="index < 3" class="rank-icon" :class="'rank-' + (index + 1)" />
                <span v-else>{{ index + 1 }}</span>
              </div>
              <div class="course-info">
                <div class="course-name">{{ course.name }}</div>
                <div class="course-stats-inline">
                  <span><BookOutlined style="margin-right: 4px;" />授课{{ course.lessonCount }}次</span>
                  <span><SolutionOutlined style="margin-right: 4px;" />{{ course.teacherCount }}位教师</span>
                  <span><TeamOutlined style="margin-right: 4px;" />{{ course.studentCount }}名学生</span>
                </div>
              </div>
              <div class="course-rating">
                <StarFilled class="rating-stars" />
                <span class="rating-value">{{ course.avgRating.toFixed(1) }}</span>
              </div>
              <div class="course-action">
                <a-button type="link" size="small" @click="viewCourseDetail(course)">
                  详情
                </a-button>
              </div>
            </div>
          </div>
          <a-empty v-else description="暂无课程数据" />
        </div>

        <!-- 学生报告 -->
        <div v-if="activeTab === 'student'" class="table-content">
          <div class="student-report-grid" v-if="studentData.length > 0">
            <div v-for="student in studentData" :key="student.id" class="student-report-card">
              <div class="student-header">
                <div class="student-avatar">
                  <UserOutlined />
                </div>
                <div class="student-info">
                  <div class="student-name">{{ student.name }}</div>
                  <div class="student-class">{{ student.className }}</div>
                </div>
              </div>
              <div class="student-stats">
                <div class="stat-row">
                  <span class="stat-label"><BookOutlined style="margin-right: 4px;" />参与课程</span>
                  <span class="stat-value">{{ student.lessonCount }} 次</span>
                </div>
                <div class="stat-row">
                  <span class="stat-label"><AimOutlined style="margin-right: 4px;" />专注度</span>
                  <div class="progress-mini">
                    <div class="progress-fill" :style="{ width: student.avgFocus * 20 + '%' }"></div>
                  </div>
                  <span class="stat-value">{{ student.avgFocus }}/5</span>
                </div>
                <div class="stat-row">
                  <span class="stat-label"><FireOutlined style="margin-right: 4px;" />参与度</span>
                  <div class="progress-mini pink">
                    <div class="progress-fill" :style="{ width: student.avgParticipation * 20 + '%' }"></div>
                  </div>
                  <span class="stat-value">{{ student.avgParticipation }}/5</span>
                </div>
              </div>
            </div>
          </div>
          <a-empty v-else description="暂无学生数据" />
        </div>
      </div>
    </div>

    <!-- 教师详情弹窗 -->
    <a-modal
      v-model:open="teacherDetailVisible"
      :title="`${selectedTeacher?.name} - 教师报告详情`"
      width="600px"
      :footer="null"
    >
      <div v-if="selectedTeacher" class="detail-content">
        <div class="detail-header">
          <div class="detail-avatar">
            <SolutionOutlined />
          </div>
          <div class="detail-info">
            <h3>{{ selectedTeacher.name }}</h3>
            <div class="detail-rating">
              <StarFilled v-for="i in 5" :key="i" :class="{ 'filled': i <= Math.round(selectedTeacher.avgRating) }" />
              <span class="rating-text">{{ selectedTeacher.avgRating.toFixed(1) }} 分</span>
            </div>
          </div>
        </div>
        <a-divider />
        <div class="detail-stats">
          <div class="detail-stat-item">
            <div class="stat-number">{{ selectedTeacher.lessonCount }}</div>
            <div class="stat-label">授课次数</div>
          </div>
          <div class="detail-stat-item">
            <div class="stat-number">{{ selectedTeacher.courseCount }}</div>
            <div class="stat-label">使用课程数</div>
          </div>
          <div class="detail-stat-item">
            <div class="stat-number">{{ selectedTeacher.feedbackCount }}</div>
            <div class="stat-label">反馈次数</div>
          </div>
        </div>
        <a-divider />
        <div class="detail-section">
          <h4><BookOutlined style="margin-right: 8px;" />教学概况</h4>
          <p class="detail-desc">
            {{ selectedTeacher.name }} 老师共完成 {{ selectedTeacher.lessonCount }} 次授课，
            使用了 {{ selectedTeacher.courseCount }} 门不同的课程，
            累计获得 {{ selectedTeacher.feedbackCount }} 次教学反馈。
            <template v-if="selectedTeacher.avgRating > 0">
              平均评分为 {{ selectedTeacher.avgRating.toFixed(1) }} 分，
              {{ selectedTeacher.avgRating >= 4.5 ? '教学效果优秀！' : selectedTeacher.avgRating >= 3.5 ? '教学效果良好。' : '继续努力！' }}
            </template>
            <template v-else>
              暂无评分数据。
            </template>
          </p>
        </div>
      </div>
    </a-modal>

    <!-- 课程详情弹窗 -->
    <a-modal
      v-model:open="courseDetailVisible"
      :title="`${selectedCourse?.name} - 课程报告详情`"
      width="600px"
      :footer="null"
    >
      <div v-if="selectedCourse" class="detail-content">
        <div class="detail-header">
          <div class="detail-avatar course-avatar">
            <ReadOutlined />
          </div>
          <div class="detail-info">
            <h3>{{ selectedCourse.name }}</h3>
            <div class="detail-rating">
              <StarFilled v-for="i in 5" :key="i" :class="{ 'filled': i <= Math.round(selectedCourse.avgRating) }" />
              <span class="rating-text">{{ selectedCourse.avgRating.toFixed(1) }} 分</span>
            </div>
          </div>
        </div>
        <a-divider />
        <div class="detail-stats">
          <div class="detail-stat-item">
            <div class="stat-number">{{ selectedCourse.lessonCount }}</div>
            <div class="stat-label">授课次数</div>
          </div>
          <div class="detail-stat-item">
            <div class="stat-number">{{ selectedCourse.teacherCount }}</div>
            <div class="stat-label">授课教师</div>
          </div>
          <div class="detail-stat-item">
            <div class="stat-number">{{ selectedCourse.studentCount }}</div>
            <div class="stat-label">覆盖学生</div>
          </div>
        </div>
        <a-divider />
        <div class="detail-section">
          <h4><ReadOutlined style="margin-right: 8px;" />课程概况</h4>
          <p class="detail-desc">
            《{{ selectedCourse.name }}》共被授课 {{ selectedCourse.lessonCount }} 次，
            有 {{ selectedCourse.teacherCount }} 位教师使用该课程进行教学，
            累计覆盖 {{ selectedCourse.studentCount }} 名学生。
            <template v-if="selectedCourse.avgRating > 0">
              课程平均评分为 {{ selectedCourse.avgRating.toFixed(1) }} 分，
              {{ selectedCourse.avgRating >= 4.5 ? '深受师生好评！' : selectedCourse.avgRating >= 3.5 ? '反馈良好。' : '有待改进。' }}
            </template>
            <template v-else>
              暂无评分数据。
            </template>
          </p>
        </div>
      </div>
    </a-modal>
  </div>
</template>

<script setup lang="ts">
import { ref, computed, onMounted } from 'vue';
import { message } from 'ant-design-vue';
import dayjs, { Dayjs } from 'dayjs';
import {
  BarChartOutlined,
  DownloadOutlined,
  BookOutlined,
  SolutionOutlined,
  ReadOutlined,
  StarFilled,
  LineChartOutlined,
  AimOutlined,
  MessageOutlined,
  FileTextOutlined,
  TeamOutlined,
  UserOutlined,
  TrophyOutlined,
  FireOutlined,
} from '@ant-design/icons-vue';
import {
  getReportOverview,
  getTeacherReports,
  getCourseReports,
  getStudentReports,
  type TeacherReport,
  type CourseReport,
  type StudentReport,
} from '@/api/school';

const activeTab = ref('overview');
const dateRange = ref<[Dayjs, Dayjs] | undefined>(undefined);
const loading = ref(false);

const tabs = [
  { key: 'overview', label: '整体概览', icon: 'bar-chart' },
  { key: 'teacher', label: '教师报告', icon: 'solution' },
  { key: 'course', label: '课程报告', icon: 'read' },
  { key: 'student', label: '学生报告', icon: 'team' },
];

// 概览数据
const overviewData = ref({
  totalLessons: 0,
  activeTeacherCount: 0,
  usedCourseCount: 0,
  avgRating: 0,
});

const teacherData = ref<TeacherReport[]>([]);
const courseData = ref<CourseReport[]>([]);
const studentData = ref<StudentReport[]>([]);

const totalLessons = computed(() => overviewData.value.totalLessons);
const activeTeacherCount = computed(() => overviewData.value.activeTeacherCount);
const usedCourseCount = computed(() => overviewData.value.usedCourseCount);
const avgRating = computed(() => overviewData.value.avgRating.toFixed(1));

// 加载数据
const loadData = async () => {
  loading.value = true;
  try {
    const [overview, teachers, courses, students] = await Promise.all([
      getReportOverview(),
      getTeacherReports(),
      getCourseReports(),
      getStudentReports(),
    ]);
    overviewData.value = overview;
    teacherData.value = teachers;
    courseData.value = courses;
    studentData.value = students;
  } catch (error: any) {
    message.error(error.response?.data?.message || '加载数据失败');
  } finally {
    loading.value = false;
  }
};

// 教师详情弹窗
const teacherDetailVisible = ref(false);
const selectedTeacher = ref<TeacherReport | null>(null);

// 课程详情弹窗
const courseDetailVisible = ref(false);
const selectedCourse = ref<CourseReport | null>(null);

const viewTeacherDetail = (teacher: TeacherReport) => {
  selectedTeacher.value = teacher;
  teacherDetailVisible.value = true;
};

const viewCourseDetail = (course: CourseReport) => {
  selectedCourse.value = course;
  courseDetailVisible.value = true;
};

onMounted(() => {
  loadData();
});
</script>

<style scoped>
.report-view {
  min-height: 100vh;
  background: linear-gradient(180deg, #FFF8F0 0%, #FFFFFF 100%);
  padding: 0;
}

/* 页面头部 */
.page-header {
  background: linear-gradient(135deg, #FF8C42 0%, #FFB347 100%);
  border-radius: 20px;
  padding: 24px 32px;
  margin-bottom: 24px;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 16px;
}

.title-icon-wrapper {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.title-icon {
  font-size: 32px;
  color: white;
}

.title-text h2 {
  color: white;
  font-size: 24px;
  font-weight: 700;
  margin: 0;
}

.title-text p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  margin: 4px 0 0 0;
}

.header-actions {
  display: flex;
  gap: 12px;
}

.export-btn {
  background: white;
  border: none;
  border-radius: 12px;
  color: #FF8C42;
  font-weight: 600;
}

.export-btn:hover {
  background: #FFF8F0;
  color: #FF7A2A;
}

.btn-icon {
  margin-right: 8px;
  font-size: 16px;
}

/* 概览卡片 */
.overview-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.overview-card {
  background: white;
  border-radius: 16px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

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

.card-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: white;
}

.card-value {
  font-size: 28px;
  font-weight: 700;
  color: #2D3436;
}

.card-label {
  font-size: 13px;
  color: #636E72;
  margin-top: 4px;
}

/* 标签页 */
.report-tabs {
  background: white;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.tab-header {
  display: flex;
  border-bottom: 1px solid #F0F0F0;
  padding: 0 24px;
}

.tab-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 24px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
  color: #636E72;
}

.tab-item:hover {
  color: #FF8C42;
}

.tab-item.active {
  color: #FF8C42;
  border-bottom-color: #FF8C42;
}

.tab-icon {
  font-size: 18px;
}

.tab-label {
  font-weight: 500;
}

.tab-content {
  padding: 24px;
}

/* 图表区域 */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.chart-card {
  background: #F8F9FA;
  border-radius: 16px;
  padding: 20px;
}

.chart-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.chart-icon {
  font-size: 20px;
  color: #FF8C42;
}

.chart-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #2D3436;
}

.chart-placeholder {
  height: 250px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.placeholder-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  height: 200px;
  padding: 0 20px;
}

.placeholder-bars .bar {
  width: 30px;
  background: linear-gradient(180deg, #FF8C42 0%, #FFB347 100%);
  border-radius: 4px 4px 0 0;
}

.placeholder-labels {
  display: flex;
  justify-content: space-around;
  padding: 12px 20px 0;
  font-size: 12px;
  color: #636E72;
}

.chart-placeholder.circle {
  align-items: center;
  justify-content: center;
}

.circle-chart {
  position: relative;
  width: 180px;
  height: 180px;
}

.circle-chart svg {
  width: 100%;
  height: 100%;
}

.circle-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.circle-text .percent {
  display: block;
  font-size: 32px;
  font-weight: 700;
  color: #2D3436;
}

.circle-text .label {
  font-size: 12px;
  color: #636E72;
}

/* 教师报告卡片 */
.teacher-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.teacher-report-card {
  background: #F8F9FA;
  border-radius: 16px;
  padding: 20px;
}

.teacher-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.teacher-avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: white;
}

.teacher-name {
  font-size: 16px;
  font-weight: 600;
  color: #2D3436;
}

.teacher-rating {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 4px;
}

.star {
  font-size: 12px;
  color: #D0D0D0;
}

.star.filled {
  color: #FFB800;
}

.rating-value {
  margin-left: 4px;
  font-size: 12px;
  color: #FF8C42;
  font-weight: 600;
}

.teacher-stats {
  display: flex;
  justify-content: space-around;
  padding: 16px 0;
  border-top: 1px solid #E0E0E0;
  border-bottom: 1px solid #E0E0E0;
}

.stat-item {
  text-align: center;
}

.stat-item .stat-icon {
  display: block;
  font-size: 20px;
  margin-bottom: 4px;
  color: #FF8C42;
}

.stat-item .stat-value {
  font-size: 20px;
  font-weight: 700;
  color: #2D3436;
}

.stat-item .stat-label {
  font-size: 11px;
  color: #636E72;
}

.teacher-action {
  padding-top: 12px;
  text-align: right;
}

/* 课程报告列表 */
.course-report-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.course-report-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: #F8F9FA;
  border-radius: 12px;
  transition: all 0.2s ease;
}

.course-report-item:hover {
  background: #FFF8F0;
}

.course-rank {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #E0E0E0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: #636E72;
}

.course-rank .rank-icon.rank-1 {
  color: #FFD700;
}

.course-rank .rank-icon.rank-2 {
  color: #C0C0C0;
}

.course-rank .rank-icon.rank-3 {
  color: #CD7F32;
}

.course-info {
  flex: 1;
}

.course-name {
  font-size: 15px;
  font-weight: 600;
  color: #2D3436;
}

.course-stats-inline {
  font-size: 12px;
  color: #636E72;
  margin-top: 4px;
  display: flex;
  gap: 16px;
}

.course-rating {
  display: flex;
  align-items: center;
  gap: 4px;
}

.rating-stars {
  font-size: 18px;
  color: #FFB800;
}

.course-rating .rating-value {
  font-size: 16px;
  font-weight: 600;
  color: #FF8C42;
}

/* 学生报告网格 */
.student-report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.student-report-card {
  background: #F8F9FA;
  border-radius: 16px;
  padding: 16px;
}

.student-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.student-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: white;
}

.student-report-card .student-name {
  font-size: 15px;
  font-weight: 600;
  color: #2D3436;
}

.student-report-card .student-class {
  font-size: 12px;
  color: #636E72;
}

.student-stats {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-row .stat-label {
  font-size: 12px;
  color: #636E72;
  min-width: 70px;
}

.stat-row .stat-value {
  font-size: 12px;
  font-weight: 600;
  color: #2D3436;
  margin-left: auto;
}

.progress-mini {
  flex: 1;
  height: 6px;
  background: #E0E0E0;
  border-radius: 3px;
  overflow: hidden;
}

.progress-mini .progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #43e97b 0%, #38f9d7 100%);
  border-radius: 3px;
}

.progress-mini.pink .progress-fill {
  background: linear-gradient(90deg, #f093fb 0%, #f5576c 100%);
}

/* 详情弹窗样式 */
.detail-content {
  padding: 8px 0;
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.detail-avatar {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: white;
}

.detail-avatar.course-avatar {
  background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.detail-info h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #2D3436;
}

.detail-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
}

.detail-rating .anticon {
  font-size: 16px;
  color: #D0D0D0;
}

.detail-rating .anticon.filled {
  color: #FFB800;
}

.rating-text {
  margin-left: 8px;
  font-size: 14px;
  color: #FF8C42;
  font-weight: 600;
}

.detail-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  text-align: center;
}

.detail-stat-item {
  padding: 16px;
  background: #F8F9FA;
  border-radius: 12px;
}

.detail-stat-item .stat-number {
  font-size: 32px;
  font-weight: 700;
  color: #FF8C42;
}

.detail-stat-item .stat-label {
  font-size: 13px;
  color: #636E72;
  margin-top: 4px;
}

.detail-section h4 {
  margin: 0 0 12px 0;
  font-size: 15px;
  font-weight: 600;
  color: #2D3436;
  display: flex;
  align-items: center;
}

.detail-desc {
  margin: 0;
  font-size: 14px;
  color: #636E72;
  line-height: 1.8;
}

/* 响应式设计 */
@media (max-width: 1024px) {
  .overview-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .chart-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }

  .header-actions {
    width: 100%;
    flex-direction: column;
  }

  .overview-cards {
    grid-template-columns: 1fr;
  }

  .tab-header {
    overflow-x: auto;
    padding: 0;
  }

  .tab-item {
    padding: 12px 16px;
    white-space: nowrap;
  }
}
</style>
