<template>
  <div class="ai-practice-center">
    <div class="page-header">
      <h1 class="page-title">AI陪练中心</h1>
      <div class="header-info">
        <el-tag type="success" size="large">
          <el-icon><Microphone /></el-icon>
          语音陪练
        </el-tag>
      </div>
    </div>

    <!-- 场景筛选 -->
    <div class="filter-section">
      <el-card class="filter-card">
        <template #header>
          <div class="card-header">
            <h3>选择陪练场景</h3>
            <el-text type="info">选择合适的场景开始AI陪练</el-text>
          </div>
        </template>
        
        <el-form :inline="true" :model="filterForm" class="filter-form">
          <el-form-item label="场景类型">
            <el-select 
              v-model="filterForm.type" 
              placeholder="全部类型" 
              clearable 
              @change="filterScenes"
              style="width: 120px"
            >
              <el-option label="电话销售" value="phone" />
              <el-option label="面对面销售" value="face" />
              <el-option label="客户投诉" value="complaint" />
              <el-option label="售后服务" value="after-sales" />
              <el-option label="产品介绍" value="product-intro" />
            </el-select>
          </el-form-item>
          <el-form-item label="难度等级">
            <el-select 
              v-model="filterForm.difficulty" 
              placeholder="全部难度" 
              clearable 
              @change="filterScenes"
              style="width: 120px"
            >
              <el-option label="入门" value="beginner" />
              <el-option label="初级" value="junior" />
              <el-option label="中级" value="intermediate" />
              <el-option label="高级" value="senior" />
              <el-option label="专家" value="expert" />
            </el-select>
          </el-form-item>
          <el-form-item label="关键词">
            <el-input 
              v-model="filterForm.search" 
              placeholder="搜索场景名称或描述" 
              clearable 
              @input="filterScenes"
              style="width: 200px"
            >
              <template #prefix>
                <el-icon><Search /></el-icon>
              </template>
            </el-input>
          </el-form-item>
          <el-form-item>
            <el-button @click="resetFilters">
              <el-icon class="el-icon--left"><Refresh /></el-icon>
              重置
            </el-button>
          </el-form-item>
        </el-form>

        <!-- 当前筛选条件显示 -->
        <div v-if="hasActiveFilters" class="filter-tags">
          <span class="filter-label">当前筛选：</span>
          <el-tag 
            v-if="filterForm.search" 
            closable 
            @close="clearSearch"
            type="primary"
          >
            关键词：{{ filterForm.search }}
          </el-tag>
          <el-tag 
            v-if="filterForm.type" 
            closable 
            @close="clearType"
            type="success"
          >
            类型：{{ getTypeText(filterForm.type) }}
          </el-tag>
          <el-tag 
            v-if="filterForm.difficulty" 
            closable 
            @close="clearDifficulty"
            type="warning"
          >
            难度：{{ getDifficultyText(filterForm.difficulty) }}
          </el-tag>
          <el-button 
            link 
            type="danger" 
            size="small" 
            @click="resetFilters"
            class="clear-all-btn"
          >
            清空全部
          </el-button>
        </div>

        <!-- 搜索结果统计 -->
        <div class="search-result-info">
          <span class="result-count">
            共找到 <strong>{{ filteredScenes.length }}</strong> 个陪练场景
            <span v-if="hasActiveFilters" class="filter-hint">（已筛选）</span>
          </span>
        </div>
      </el-card>
    </div>

    <!-- 陪练模式选择 -->
    <div class="practice-modes">
      <el-card class="mode-selection-card">
        <template #header>
          <div class="card-header">
            <h3>选择陪练模式</h3>
            <el-text type="info">根据您的需求选择合适的陪练方式</el-text>
          </div>
        </template>
        
        <el-row :gutter="20">
          <el-col :xs="24" :sm="12" :md="8">
            <div class="mode-card" @click="startFreeChat">
              <div class="mode-icon">
                <el-icon :size="48" color="#667eea">
                  <ChatDotRound />
                </el-icon>
              </div>
              <h4 class="mode-title">AI对话陪练</h4>
              <p class="mode-description">
                通过自然对话方式进行陪练，支持文本和语音交互，灵活自由的练习体验
              </p>
              <div class="mode-features">
                <el-tag size="small" type="success">自由对话</el-tag>
                <el-tag size="small" type="primary">语音支持</el-tag>
                <el-tag size="small" type="warning">实时反馈</el-tag>
              </div>
              <el-button type="primary" size="small" class="mode-button">
                立即体验
                <el-icon class="el-icon--right"><ArrowRight /></el-icon>
              </el-button>
            </div>
          </el-col>
          
          <el-col :xs="24" :sm="12" :md="8">
            <div class="mode-card" @click="scrollToScenes">
              <div class="mode-icon">
                <el-icon :size="48" color="#764ba2">
                  <Collection />
                </el-icon>
              </div>
              <h4 class="mode-title">场景化陪练</h4>
              <p class="mode-description">
                预设各种销售场景，通过角色扮演方式进行针对性练习
              </p>
              <div class="mode-features">
                <el-tag size="small" type="info">场景预设</el-tag>
                <el-tag size="small" type="danger">角色扮演</el-tag>
                <el-tag size="small" type="warning">专项训练</el-tag>
              </div>
              <el-button type="primary" size="small" class="mode-button">
                选择场景
                <el-icon class="el-icon--right"><ArrowDown /></el-icon>
              </el-button>
            </div>
          </el-col>
          
          <el-col :xs="24" :sm="12" :md="8">
            <div class="mode-card coming-soon">
              <div class="mode-icon">
                <el-icon :size="48" color="#cccccc">
                  <VideoPlay />
                </el-icon>
              </div>
              <h4 class="mode-title">视频陪练</h4>
              <p class="mode-description">
                通过视频方式进行陪练，模拟真实面对面交流场景
              </p>
              <div class="mode-features">
                <el-tag size="small" type="info">即将推出</el-tag>
              </div>
              <el-button type="info" size="small" class="mode-button" disabled>
                敬请期待
              </el-button>
            </div>
          </el-col>
        </el-row>
      </el-card>
    </div>

    <!-- 场景列表 -->
    <div v-if="filteredScenes.length > 0" class="scene-grid">
      <div 
        v-for="scene in filteredScenes" 
        :key="scene.id" 
        class="scene-card"
        @click="selectScene(scene)"
      >
        <div class="scene-cover">
          <div class="scene-type-icon">
            <el-icon :size="32" :color="getTypeIconColor(scene.type)">
              <component :is="getTypeIcon(scene.type)" />
            </el-icon>
          </div>
          <div class="scene-status" :class="scene.status">
            {{ scene.status === 'active' ? '可用' : '维护中' }}
          </div>
        </div>
        
        <div class="scene-info">
          <h4 class="scene-title">{{ scene.name }}</h4>
          <p class="scene-description">{{ scene.description }}</p>
          
          <div class="scene-meta">
            <div class="meta-item">
              <el-tag :type="getTypeTagType(scene.type)" size="small">
                {{ getTypeText(scene.type) }}
              </el-tag>
            </div>
            <div class="meta-item">
              <el-tag :type="getDifficultyTagType(scene.difficulty)" size="small">
                {{ getDifficultyText(scene.difficulty) }}
              </el-tag>
            </div>
          </div>
          
          <div class="scene-stats">
            <div class="stat-item">
              <el-icon><Timer /></el-icon>
              <span>{{ scene.duration }}分钟</span>
            </div>
            <div class="stat-item">
              <el-icon><User /></el-icon>
              <span>{{ scene.usage_count }}次练习</span>
            </div>
            <div class="stat-item">
              <el-icon><Star /></el-icon>
              <span>{{ scene.rating }}分</span>
            </div>
          </div>
          
          <div class="scene-actions">
            <el-button 
              type="primary" 
              :disabled="scene.status !== 'active'"
              @click.stop="startPractice(scene)"
            >
              <el-icon><Microphone /></el-icon>
              开始陪练
            </el-button>
            <el-button 
              link 
              type="info" 
              @click.stop="viewSceneDetail(scene)"
            >
              <el-icon><View /></el-icon>
              查看详情
            </el-button>
          </div>
        </div>
      </div>
    </div>

    <!-- 空状态显示 -->
    <div v-else class="empty-state">
      <el-empty 
        :description="hasActiveFilters ? '没有符合条件的陪练场景' : '暂无陪练场景'"
        :image-size="120"
      >
        <el-button v-if="hasActiveFilters" type="primary" @click="resetFilters">
          清空筛选条件
        </el-button>
        <el-button v-else type="primary" disabled>
          敬请期待更多场景
        </el-button>
      </el-empty>
    </div>

    <!-- 场景详情弹窗 -->
    <el-dialog
      v-model="sceneDetailVisible"
      :title="currentScene?.name"
      width="800px"
      class="scene-detail-dialog"
    >
      <div v-if="currentScene" class="scene-detail">
        <div class="detail-header">
          <div class="scene-icon-large">
            <el-icon :size="48" :color="getTypeIconColor(currentScene.type)">
              <component :is="getTypeIcon(currentScene.type)" />
            </el-icon>
          </div>
          <div class="header-info">
            <h2>{{ currentScene.name }}</h2>
            <div class="scene-tags">
              <el-tag :type="getTypeTagType(currentScene.type)" size="large">
                {{ getTypeText(currentScene.type) }}
              </el-tag>
              <el-tag :type="getDifficultyTagType(currentScene.difficulty)" size="large">
                {{ getDifficultyText(currentScene.difficulty) }}
              </el-tag>
              <el-tag :type="currentScene.status === 'active' ? 'success' : 'info'" size="large">
                {{ currentScene.status === 'active' ? '可用' : '维护中' }}
              </el-tag>
            </div>
          </div>
        </div>
        
        <div class="detail-content">
          <div class="description-section">
            <h4>场景描述</h4>
            <p>{{ currentScene.description }}</p>
          </div>
          
          <div class="background-section">
            <h4>背景设定</h4>
            <div class="background-text">{{ currentScene.background }}</div>
          </div>
          
          <div class="ai-role-section">
            <h4>AI角色设定</h4>
            <div class="ai-role-text">{{ currentScene.ai_role }}</div>
          </div>
          
          <div class="objectives-section">
            <h4>练习目标</h4>
            <ul class="objectives-list">
              <li v-for="objective in currentScene.objectives" :key="objective">
                <el-icon><Check /></el-icon>
                <span>{{ objective }}</span>
              </li>
            </ul>
          </div>
          
          <div class="keywords-section">
            <h4>关键词</h4>
            <div class="keywords-tags">
              <el-tag 
                v-for="keyword in currentScene.keywords" 
                :key="keyword"
                type="primary"
                effect="plain"
              >
                {{ keyword }}
              </el-tag>
            </div>
          </div>
          
          <div class="stats-section">
            <el-descriptions :column="3" border>
              <el-descriptions-item label="预计时长">{{ currentScene.duration }}分钟</el-descriptions-item>
              <el-descriptions-item label="使用次数">{{ currentScene.usage_count }}次</el-descriptions-item>
              <el-descriptions-item label="评分">{{ currentScene.rating }}分</el-descriptions-item>
            </el-descriptions>
          </div>
        </div>
      </div>
      
      <template #footer>
        <div class="dialog-footer">
          <el-button @click="sceneDetailVisible = false">关闭</el-button>
          <el-button 
            type="primary" 
            :disabled="currentScene?.status !== 'active'"
            @click="startPracticeFromDetail"
          >
            <el-icon><Microphone /></el-icon>
            开始陪练
          </el-button>
        </div>
      </template>
    </el-dialog>

  </div>
</template>

<script setup lang="ts">
import { ref, reactive, computed, onMounted } from 'vue'
import { useRouter } from 'vue-router'
import { ElMessage } from 'element-plus'
import { 
  Refresh, 
  Microphone, 
  Search, 
  Timer, 
  User, 
  Star, 
  View, 
  Check,
  ChatDotRound,
  Collection,
  VideoPlay,
  ArrowRight,
  ArrowDown
  // Back, Phone, Warning, Service, Goods - Unused
} from '@element-plus/icons-vue'
import { practiceApi } from '@/api/practice'
import type { PracticeScene } from '@/types/practice'

const router = useRouter()

// 响应式数据
const sceneDetailVisible = ref(false)
const currentScene = ref<PracticeScene | null>(null)
const selectedScene = ref<PracticeScene | null>(null)
const loading = ref(false)

// 筛选表单
const filterForm = reactive({
  type: '',
  difficulty: '',
  search: ''
})

// 分页参数
const currentPage = ref(1)
const pageSize = ref(20)
const total = ref(0)

// 场景列表数据（从API获取）
const sceneList = ref<PracticeScene[]>([])

// 直接显示场景列表（后端已筛选）
const filteredScenes = computed(() => sceneList.value)

// 是否有活跃的筛选条件
const hasActiveFilters = computed(() => {
  return !!(filterForm.search || filterForm.type || filterForm.difficulty)
})

/**
 * 初始化页面
 */
onMounted(() => {
  fetchScenes()
})

/**
 * 获取场景列表
 */
const fetchScenes = async () => {
  try {
    loading.value = true
    const response: any = await practiceApi.getScenes({
      page: currentPage.value,
      size: pageSize.value,
      type: filterForm.type as any,
      difficulty: filterForm.difficulty as any,
      search: filterForm.search || undefined
    })
    
    // http.ts响应拦截器已经返回了response.data，所以response直接是业务数据
    if (response.code === 200 && response.data) {
      sceneList.value = response.data.items || []
      total.value = response.data.total || 0
      console.log(`✅ 获取场景列表成功: ${sceneList.value.length}条`)
    } else {
      console.error('❌ 获取场景列表失败:', response)
      ElMessage.error(response.message || '获取场景列表失败')
    }
  } catch (error: any) {
    console.error('❌ 获取场景列表异常:', error)
    ElMessage.error(error.message || '获取场景列表失败，请稍后重试')
  } finally {
    loading.value = false
  }
}

/**
 * 筛选场景（触发API请求）
 */
const filterScenes = () => {
  currentPage.value = 1  // 重置到第一页
  fetchScenes()
}

/**
 * 重置筛选条件
 */
const resetFilters = () => {
  filterForm.search = ''
  filterForm.type = ''
  filterForm.difficulty = ''
  currentPage.value = 1
  fetchScenes()
  ElMessage.success('已重置所有筛选条件')
}

/**
 * 清除搜索关键词
 */
const clearSearch = () => {
  filterForm.search = ''
  fetchScenes()
}

/**
 * 清除类型筛选
 */
const clearType = () => {
  filterForm.type = ''
  fetchScenes()
}

/**
 * 清除难度筛选
 */
const clearDifficulty = () => {
  filterForm.difficulty = ''
  fetchScenes()
}

/**
 * 获取类型文本
 */
const getTypeText = (type: string) => {
  const map: Record<string, string> = {
    phone: '电话销售',
    face: '面对面销售',
    complaint: '客户投诉',
    'after-sales': '售后服务',
    'product-intro': '产品介绍'
  }
  return map[type] || '未知'
}

/**
 * 获取难度文本
 */
const getDifficultyText = (difficulty: string) => {
  const map: Record<string, string> = {
    beginner: '入门',
    junior: '初级',
    intermediate: '中级',
    senior: '高级',
    expert: '专家'
  }
  return map[difficulty] || '未知'
}

/**
 * 选择场景
 */
const selectScene = (scene: any) => {
  if (scene.status !== 'active') {
    ElMessage.warning('该场景暂时不可用')
    return
  }
  
  selectedScene.value = scene
  if (scene) {
    startPractice(scene)
  }
}

/**
 * 查看场景详情
 */
const viewSceneDetail = (scene: any) => {
  currentScene.value = scene
  sceneDetailVisible.value = true
}

/**
 * 从详情页开始陪练
 */
const startPracticeFromDetail = () => {
  if (!currentScene.value) return
  sceneDetailVisible.value = false
  selectedScene.value = currentScene.value
  startPractice(currentScene.value)
}

/**
 * 开始陪练
 */
const startPractice = (scene: PracticeScene) => {
  // 跳转到陪练对话页面，传递场景ID
  router.push({
    name: 'AIPractice',
    query: {
      sceneId: scene.id
    }
  })
}

/**
 * 开始自由对话陪练
 */
const startFreeChat = () => {
  // 直接跳转到陪练页面，使用自由对话模式
  router.push({
    name: 'AIPractice',
    query: {
      mode: 'free'
    }
  })
}

/**
 * 滚动到场景列表
 */
const scrollToScenes = () => {
  const sceneGrid = document.querySelector('.scene-grid')
  if (sceneGrid) {
    sceneGrid.scrollIntoView({ behavior: 'smooth', block: 'start' })
  }
}

/**
 * 获取场景类型图标
 */
const getTypeIcon = (type: string) => {
  const iconMap: Record<string, string> = {
    phone: 'Phone',
    face: 'User',
    complaint: 'Warning',
    'after-sales': 'Service',
    'product-intro': 'Goods'
  }
  return iconMap[type] || 'Microphone'
}

/**
 * 获取场景类型图标颜色
 */
const getTypeIconColor = (type: string) => {
  const colorMap: Record<string, string> = {
    phone: '#409eff',
    face: '#67c23a',
    complaint: '#f56c6c',
    'after-sales': '#e6a23c',
    'product-intro': '#909399'
  }
  return colorMap[type] || '#409eff'
}

/**
 * 获取场景类型标签类型
 */
const getTypeTagType = (type: string) => {
  const tagMap: Record<string, string> = {
    phone: 'primary',
    face: 'success',
    complaint: 'danger',
    'after-sales': 'warning',
    'product-intro': 'info'
  }
  return tagMap[type] || 'primary'
}


/**
 * 获取难度等级标签类型
 */
const getDifficultyTagType = (difficulty: string) => {
  const tagMap: Record<string, string> = {
    beginner: 'success',
    junior: 'primary',
    intermediate: 'warning',
    senior: 'danger',
    expert: 'danger'
  }
  return tagMap[difficulty] || 'primary'
}

</script>

<style lang="scss" scoped>
.ai-practice-center {
  padding: 20px;
  // 完全参考report.vue，不设置height，让它自适应
  overflow-y: auto;
  
  .page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 24px 30px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);

    .page-title {
      font-size: 28px;
      font-weight: 700;
      margin: 0;
    }
    
    .header-info {
      .el-tag {
        background: rgba(255, 255, 255, 0.2);
        border: 1px solid rgba(255, 255, 255, 0.3);
        color: white;
      }
    }
  }

  .filter-section {
    margin-bottom: 24px;
    
    .filter-card {
      border-radius: 12px;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
      
      :deep(.el-card__header) {
        background: #f8f9fa;
        border-bottom: 1px solid #ebeef5;
        
        .card-header {
          display: flex;
          justify-content: space-between;
          align-items: center;
          
          h3 {
            margin: 0;
            font-size: 18px;
            font-weight: 600;
            color: #333;
          }
        }
      }
      
      .filter-form {
        .el-form-item {
          margin-bottom: 0;
        }
      }

      .filter-tags {
        margin-top: 16px;
        padding-top: 16px;
        border-top: 1px solid #f0f0f0;
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 8px;

        .filter-label {
          color: #666;
          font-size: 14px;
          margin-right: 8px;
        }

        .clear-all-btn {
          margin-left: 8px;
        }
      }

      .search-result-info {
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid #f0f0f0;

        .result-count {
          color: #666;
          font-size: 14px;

          strong {
            color: #409eff;
            font-weight: 600;
          }
        }

        .filter-hint {
          color: #e6a23c;
          font-size: 12px;
        }
      }
    }
  }

  .practice-modes {
    margin-bottom: 24px;
    
    .mode-selection-card {
      border-radius: 16px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
      
      .card-header {
        h3 {
          margin: 0 0 8px 0;
          color: #333;
          font-size: 18px;
          font-weight: 600;
        }
      }
      
      .mode-card {
        background: white;
        border: 2px solid #f0f2f5;
        border-radius: 12px;
        padding: 24px;
        text-align: center;
        cursor: pointer;
        transition: all 0.3s ease;
        height: 100%;
        display: flex;
        flex-direction: column;
        
        &:hover:not(.coming-soon) {
          border-color: #667eea;
          transform: translateY(-4px);
          box-shadow: 0 8px 24px rgba(102, 126, 234, 0.15);
        }
        
        &.coming-soon {
          opacity: 0.6;
          cursor: not-allowed;
        }
        
        .mode-icon {
          margin-bottom: 16px;
        }
        
        .mode-title {
          font-size: 18px;
          font-weight: 600;
          color: #333;
          margin: 0 0 12px 0;
        }
        
        .mode-description {
          font-size: 14px;
          color: #666;
          line-height: 1.6;
          margin-bottom: 16px;
          flex: 1;
        }
        
        .mode-features {
          display: flex;
          gap: 8px;
          justify-content: center;
          flex-wrap: wrap;
          margin-bottom: 20px;
        }
        
        .mode-button {
          width: 100%;
        }
      }
    }
  }

  .empty-state {
    padding: 40px 20px;
    text-align: center;
  }

  .scene-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    
    .scene-card {
      background: white;
      border-radius: 16px;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
      overflow: hidden;
      cursor: pointer;
      transition: all 0.3s ease;
      
      &:hover {
        transform: translateY(-8px);
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
      }
      
      .scene-cover {
        position: relative;
        background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
        padding: 24px;
        text-align: center;
        
        .scene-type-icon {
          margin-bottom: 12px;
        }
        
        .scene-status {
          position: absolute;
          top: 12px;
          right: 12px;
          padding: 4px 12px;
          border-radius: 12px;
          font-size: 12px;
          font-weight: 500;
          
          &.active {
            background: rgba(103, 194, 58, 0.9);
            color: white;
          }
          
          &.inactive {
            background: rgba(144, 147, 153, 0.9);
            color: white;
          }
        }
      }
      
      .scene-info {
        padding: 20px;
        
        .scene-title {
          font-size: 18px;
          font-weight: 600;
          color: #333;
          margin: 0 0 12px 0;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }
        
        .scene-description {
          font-size: 14px;
          color: #666;
          line-height: 1.6;
          margin: 0 0 16px 0;
          height: 44px;
          overflow: hidden;
          text-overflow: ellipsis;
          display: -webkit-box;
          -webkit-line-clamp: 2;
          -webkit-box-orient: vertical;
        }
        
        .scene-meta {
          display: flex;
          gap: 8px;
          margin-bottom: 16px;
          flex-wrap: wrap;
        }
        
        .scene-stats {
          display: flex;
          justify-content: space-between;
          margin-bottom: 16px;
          
          .stat-item {
            display: flex;
            align-items: center;
            gap: 4px;
            font-size: 12px;
            color: #666;
            
            .el-icon {
              color: #409eff;
            }
          }
        }
        
        .scene-actions {
          display: flex;
          gap: 12px;
          
          .el-button {
            flex: 1;
          }
        }
      }
    }
  }
}

// 场景详情弹窗样式
:deep(.scene-detail-dialog) {
  .el-dialog__header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0;
    padding: 24px 30px;
    
    .el-dialog__title {
      color: white;
      font-size: 20px;
      font-weight: 600;
    }
    
    .el-dialog__close {
      color: white;
      font-size: 20px;
      
      &:hover {
        color: rgba(255, 255, 255, 0.8);
      }
    }
  }
  
  .el-dialog__body {
    padding: 30px;
    max-height: 70vh;
    overflow-y: auto;
  }
  
  .el-dialog__footer {
    padding: 20px 30px;
    background: #f8f9fa;
    border-radius: 0 0 12px 12px;
    border-top: 1px solid #ebeef5;
  }
}

.scene-detail {
  .detail-header {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 30px;
    padding-bottom: 24px;
    border-bottom: 2px solid #f0f2f5;
    
    .scene-icon-large {
      width: 80px;
      height: 80px;
      border-radius: 16px;
      background: rgba(102, 126, 234, 0.1);
      display: flex;
      align-items: center;
      justify-content: center;
    }
    
    .header-info {
      flex: 1;
      
      h2 {
        margin: 0 0 16px 0;
        font-size: 24px;
        font-weight: 700;
        color: #333;
      }
      
      .scene-tags {
        display: flex;
        gap: 12px;
        flex-wrap: wrap;
      }
    }
  }
  
  .detail-content {
    .description-section,
    .background-section,
    .ai-role-section,
    .objectives-section,
    .keywords-section,
    .stats-section {
      margin-bottom: 24px;
      
      h4 {
        margin: 0 0 12px 0;
        font-size: 16px;
        font-weight: 600;
        color: #333;
        display: flex;
        align-items: center;
        
        &::before {
          content: '';
          width: 4px;
          height: 16px;
          background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
          border-radius: 2px;
          margin-right: 12px;
        }
      }
      
      p, .background-text, .ai-role-text {
        font-size: 14px;
        line-height: 1.6;
        color: #666;
        margin: 0;
      }
      
      .background-text, .ai-role-text {
        background: #f8f9fa;
        padding: 16px;
        border-radius: 8px;
        border-left: 4px solid #409eff;
      }
    }
    
    .objectives-list {
      list-style: none;
      padding: 0;
      margin: 0;
      
      li {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 8px 0;
        font-size: 14px;
        color: #666;
        
        .el-icon {
          color: #67c23a;
        }
      }
    }
    
    .keywords-tags {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
    }
  }
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}


// 响应式设计
@media (max-width: 768px) {
  .ai-practice-center {
    padding: 12px;
    
    .scene-grid {
      grid-template-columns: 1fr;
    }
    
    .practice-interface {
      .practice-content {
        padding: 16px 20px;
        
        .conversation-area {
          .conversation-messages {
            height: 250px;
          }
        }
      }
    }
  }
}
</style>
