<template>
  <div class="course-description">
    <!-- <div class="section-header">
      <div class="header-line"></div>
      <h3 class="section-title">{{$t('common.kechengjieshao')}}</h3>
    </div> -->
    
    <div class="description-content">
      <div class="rich-text" v-html="info.courseIntro"></div>
      
      <div v-if="info.coverImageUrl" class="cover-image-wrapper">
        <img :src="info.coverImageUrl" alt="" class="cover-image">
        <div class="image-glow"></div>
      </div>
    </div>
  </div>
</template>
<script setup>
import { getCourseList } from '@/api/course.js'
import { ref, onMounted } from 'vue'
defineProps({
  info: {
    type: Object,
    default: () => ({})
  }
})

const list = ref([]);

</script>
<style scoped lang="scss">
.course-description {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 
    0 8px 32px rgba(79, 70, 229, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  
  .section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    
    .header-line {
      width: 4px;
      height: 24px;
      background: linear-gradient(135deg, #4f46e5, #7c3aed);
      border-radius: 2px;
      box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
    }
    
    .section-title {
      font-size: 18px;
      font-weight: 700;
      color: #1f2937;
      margin: 0;
      letter-spacing: -0.02em;
    }
  }
  
  .description-content {
    .rich-text {
      font-size: 15px;
      line-height: 1.8;
      color: #374151;
      
      :deep(h1), :deep(h2), :deep(h3), :deep(h4) {
        color: #1f2937;
        font-weight: 700;
        margin: 24px 0 12px 0;
        line-height: 1.3;
        
        &:first-child {
          margin-top: 0;
        }
      }
      
      :deep(h1) { font-size: 24px; }
      :deep(h2) { font-size: 20px; }
      :deep(h3) { font-size: 18px; }
      :deep(h4) { font-size: 16px; }
      
      :deep(p) {
        margin: 12px 0;
        text-align: justify;
      }
      
      :deep(ul), :deep(ol) {
        margin: 16px 0;
        padding-left: 24px;
        
        li {
          margin: 8px 0;
          position: relative;
          
          &::marker {
            color: #4f46e5;
            font-weight: 600;
          }
        }
      }
      
      :deep(blockquote) {
        margin: 20px 0;
        padding: 16px 20px;
        background: linear-gradient(135deg, rgba(79, 70, 229, 0.05), rgba(124, 58, 237, 0.05));
        border-left: 4px solid #4f46e5;
        border-radius: 8px;
        font-style: italic;
        color: #4b5563;
      }
      
      :deep(img) {
        max-width: 100%;
        height: auto;
        border-radius: 12px;
        margin: 16px 0;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
      }
      
      :deep(a) {
        color: #4f46e5;
        text-decoration: none;
        font-weight: 500;
        transition: all 0.3s ease;
        border-bottom: 1px solid transparent;
        
        &:hover {
          color: #7c3aed;
          border-bottom-color: #7c3aed;
        }
      }
      
      :deep(code) {
        background: rgba(79, 70, 229, 0.08);
        padding: 2px 6px;
        border-radius: 4px;
        font-family: 'Monaco', 'Menlo', monospace;
        font-size: 13px;
        color: #4f46e5;
      }
      
      :deep(pre) {
        background: #1f2937;
        color: #f9fafb;
        padding: 20px;
        border-radius: 12px;
        overflow-x: auto;
        margin: 20px 0;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
        
        code {
          background: none;
          color: inherit;
          padding: 0;
        }
      }
      
      :deep(table) {
        width: 100%;
        border-collapse: collapse;
        margin: 20px 0;
        font-size: 14px;
        
        th, td {
          padding: 12px 16px;
          text-align: left;
          border-bottom: 1px solid #e5e7eb;
        }
        
        th {
          background: linear-gradient(135deg, rgba(79, 70, 229, 0.05), rgba(124, 58, 237, 0.05));
          font-weight: 600;
          color: #1f2937;
        }
        
        tr:hover {
          background: rgba(79, 70, 229, 0.02);
        }
      }
      
      :deep(hr) {
        border: none;
        height: 1px;
        background: linear-gradient(to right, transparent, #e5e7eb, transparent);
        margin: 32px 0;
      }
      
      :deep(strong), :deep(b) {
        font-weight: 600;
        color: #1f2937;
      }
      
      :deep(em), :deep(i) {
        font-style: italic;
        color: #4b5563;
      }
    }
    
    .cover-image-wrapper {
      position: relative;
      margin-top: 24px;
      border-radius: 16px;
      overflow: hidden;
      box-shadow: 
        0 8px 32px rgba(79, 70, 229, 0.12),
        0 2px 8px rgba(0, 0, 0, 0.06);
      
      .cover-image {
        width: 100%;
        height: auto;
        display: block;
        transition: transform 0.3s ease;
      }
      
      .image-glow {
        position: absolute;
        top: -50%;
        left: -50%;
        right: -50%;
        bottom: -50%;
        background: radial-gradient(circle at center, rgba(79, 70, 229, 0.15), transparent 70%);
        opacity: 0;
        transition: opacity 0.3s ease;
        pointer-events: none;
      }
      
      &:hover {
        .cover-image {
          transform: scale(1.02);
        }
        
        .image-glow {
          opacity: 1;
        }
      }
    }
  }
}

@media (max-width: 768px) {
  .course-description {
    padding: 20px;
    border-radius: 16px;
    
    .section-header {
      margin-bottom: 16px;
      
      .header-line {
        height: 20px;
      }
      
      .section-title {
        font-size: 16px;
      }
    }
    
    .description-content {
      .rich-text {
        font-size: 14px;
        line-height: 1.7;
        
        :deep(h1) { font-size: 20px; }
        :deep(h2) { font-size: 18px; }
        :deep(h3) { font-size: 16px; }
        :deep(h4) { font-size: 15px; }
      }
      
      .cover-image-wrapper {
        margin-top: 20px;
        border-radius: 14px;
      }
    }
  }
}

@media (max-width: 480px) {
  .course-description {
    padding: 16px;
    border-radius: 14px;
    
    .description-content {
      .rich-text {
        font-size: 13px;
        line-height: 1.6;
        
        :deep(ul), :deep(ol) {
          padding-left: 20px;
        }
        
        :deep(blockquote) {
          padding: 12px 16px;
          margin: 16px 0;
        }
        
        :deep(pre) {
          padding: 16px;
          font-size: 12px;
        }
        
        :deep(table) {
          font-size: 13px;
          
          th, td {
            padding: 10px 12px;
          }
        }
      }
    }
  }
}
</style>
