<template>
  <div>
    <section class="container">
      <section class="leftNav">
        <div class="leftNav-item " :class="{active:DetailsParams.id == item.id}"  v-for="item in problems" :key="item.id" @click="handleClick(item.id)">
          {{ item.title }}
        </div>
      </section>
      <section class="rightContent">
        <div v-if="problemLoading" class="loading-container">
          <span class="loading-text">{{ $t('home.loadingContent') || '正在加载内容...' }}</span>
        </div>
        <div v-else-if="info && info.trim()" class="dynamic-content" v-html="info"></div>
        <div v-else class="no-content">
          <p>{{ $t('home.noContent') || '暂无内容' }}</p>
        </div>
      </section>
    </section>
  </div>
</template>

<script>
import IndexJs from "./index.js";
export default {
  mixins: [IndexJs],
}
</script>

<style lang="scss" scoped>
.container{
  display: flex;
  justify-content: center;
  width: 80vw;
  height: 80vh;
  margin: 0 auto;
  // background: #fff;
  border-radius: 10px;
  // box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
  padding: 20px;
  margin-top: 60px;
  padding-top: 50px;
  .leftNav{
    width: 200px;
    height: 100%;
    overflow-y: auto;
  }
  .rightContent{
    flex: 1;
    height: 100%;
    margin-left: 50px;
    overflow-y: auto;
    padding-right: 20px;
    .dynamic-content {
      width: 100%;
      margin: 0 auto;
     
      // 富文本样式
      :deep(table) {
        border-collapse: collapse;
        width: 100%;
        margin: 16px 0;
      }
      :deep(th), :deep(td) {
        border: 1px solid #d1d5db;
        padding: 8px 12px;
        text-align: left;
      }
      :deep(th) {
        background: #f3f4f6;
        font-weight: bold;
      }
      :deep(strong), :deep(b) {
        font-weight: bold !important;
        color: inherit !important;
        font-style: normal !important;
      }
      :deep(em), :deep(i) {
        font-style: italic !important;
        color: inherit !important;
      }
      :deep(a) {
        color: #007bff !important;
        text-decoration: none !important;
        &:hover {
          text-decoration: underline !important;
        }
      }

      :deep(p) {
        text-align: justify !important;
        text-justify: inter-ideograph !important;
        line-height: 2 !important;
        margin: 0.8em 0 !important;
        /* 英文按单词换行，避免拆词；超长连续单词在必要时断行 */
        white-space: normal !important;
        word-break: normal !important;
        overflow-wrap: break-word !important; /* 现代浏览器 */
        word-wrap: break-word !important;      /* 旧版兼容 */
        hyphens: none;
      }

      :deep(div) {
        text-align: justify !important;
        text-justify: inter-ideograph !important;
        line-height: 2 !important;
        margin: 0.8em 0 !important;
        /* 英文按单词换行，避免拆词；超长连续单词在必要时断行 */
        white-space: normal !important;
        word-break: normal !important;
        overflow-wrap: break-word !important; /* 现代浏览器 */
        word-wrap: break-word !important;      /* 旧版兼容 */
        hyphens: none;
      }

     
    }
    .loading-container {
      text-align: center;
      padding: 40px 0;
      .loading-text {
        font-size: 16px;
        color: #666;
        vertical-align: middle;
      }
    }
    .no-content {
      text-align: center;
      padding: 40px 0;
      p {
        font-size: 16px;
        color: #999;
        margin: 0;
      }
    }
  }
}

.leftNav-item{
  cursor: pointer;
  padding: 10px;
  margin-bottom: 10px;
  text-decoration: underline;
  text-align: right;
  &:hover{
    background:rgba(0,0,0,0.02);
    color: #651FFF;
  }
}

.active{
  color: #651FFF;
}
</style>