<template>
  <div class="main-background main-background-type0 index">
    <div class="nav-placeholder"></div>
    <div class="hero-section">
      <!-- 大标题区域 -->
      <div class="hero-header">
        <img src="@/assets/images/LogoIconDark.png" class="hero-logo" />
        <h1 class="main-title">{{TITLE}}</h1>
        <p class="welcome-text">欢迎您 {{authStore.userInfo?.nickname}}!</p>
      </div>
      <div class="action-buttons">
        <RouterLink v-if="authStore.isLogged && authStore.loginType === 1" to="/admin" class="button-link">
          <a-button size="large" type="primary" class="action-button">进入管理员页面</a-button>
        </RouterLink>
        <RouterLink v-else-if="authStore.isLogged" to="/inheritor" class="button-link">
          <a-button size="large" type="primary" class="action-button">进入非遗数字化资源信息校对</a-button>
        </RouterLink>
        <RouterLink v-else to="/login" class="button-link">
          <a-button size="large" type="primary" class="action-button">去登录</a-button>
        </RouterLink>
      </div>
    </div>

    <!--介绍内容区域-->
    <section class="main-section large small-h">
      <div class="content">
        <div class="title">
          <h2>平台优势</h2>
        </div>
        <div class="features-grid">
          <div class="feature-card">
            <div class="feature-icon">📸</div>
            <h3>数字化采集</h3>
            <p>高效便捷地采集闽南文化资源，支持图片、音频、视频等多种格式</p>
          </div>
          <div class="feature-card">
            <div class="feature-icon">📋</div>
            <h3>智能管理</h3>
            <p>系统化管理非遗项目信息，实现快速检索和数据统计分析</p>
          </div>
          <div class="feature-card">
            <div class="feature-icon">🔍</div>
            <h3>精准校对</h3>
            <p>专业的信息校对流程，确保数据准确性和文化传承质量</p>
          </div>
        </div>
      </div>
    </section>

    <!--常见问题-->
    <section class="main-section large small-h">
      <div class="content">
        <div class="title">
          <h2>常见问题</h2>
        </div>

        <a-collapse class="faq-collapse" v-model:activeKey="activeKey" accordion>
          <a-collapse-panel key="1" header="如何使用">
            <p>用户可通过注册账号登录系统，提交非遗项目，传承人，传习所信息。</p>
          </a-collapse-panel>
          <a-collapse-panel key="2" header="是免费使用的吗？">
            <p>是的，传承人可登录系统进行资源信息提交和修改。</p>
          </a-collapse-panel>
          <a-collapse-panel key="3" header="如果我需要帮助，可以获得支持吗？">
            <p>欢迎致电：18649931391 获取电话支持服务。</p>
          </a-collapse-panel>
        </a-collapse>
        
      </div>
    </section>
  </div>
</template>

<script setup lang="ts">
import { TITLE } from '@/common/ConstStrings';
import { useAuthStore } from '@/stores/auth';
import { ref } from 'vue';
import { RouterLink } from 'vue-router';

const authStore = useAuthStore();
const activeKey = ref('1');
</script>

<style lang="scss">
@use '@/assets/scss/colors.scss' as *;

.index {
  min-height: calc(100vh - 50px);
}

.hero-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  min-height: 80vh;
}
.hero-header {
  margin-bottom: 40px;
}
.hero-logo {
  width: 60px;
  height: 60px;
  margin-top: 64px;
  margin-bottom: 24px;
  transition: transform 0.3s ease;

  &:hover {
    transform: scale(1.05);
  }
}

.main-title {
  font-size: 2.8rem;
  font-weight: 700;
  color: #333;
  margin-bottom: 16px;
  letter-spacing: 1px;
  font-family: 'SourceHanSerifCNBold', sans-serif;
}

.welcome-text {
  font-size: 1.4rem;
  color: #666;
  margin-bottom: 32px;
}
.action-buttons {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 60px;
}
.button-link {
  text-decoration: none;
}
.action-button {
  padding: 12px 24px;
  font-size: 1.1rem;
  border-radius: 8px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  min-width: 200px;

  &:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  }
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
}
.feature-card {
  background: white;
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;

  h3 {
    text-align: center;
  }

  &:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  }

  .feature-icon {
    font-size: 2.5rem;
    margin-bottom: 20px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  h3 {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 16px;
    font-weight: 600;
  }

  p {
    color: #666;
    line-height: 1.6;
  }
}

.faq-collapse {
  border-radius: 0!important;
  border: none!important;
  background-color: transparent;

  .ant-collapse-item {
    background-color: #fff!important;
    border-radius: 0.75rem!important;
    border: 1px solid #e5e7eb!important;
    margin-top: 1.5rem;
    overflow: hidden;
  }
  .ant-collapse-item-active {
    border-radius: 0.75rem!important;
  }
  .ant-collapse-header {
    display: flex;
    flex-direction: row;
    align-items: center !important;
    font-size: 1.125rem!important;
    line-height: 1.75rem!important;
    font-weight: 600;
    padding: 1.5rem !important;

  }
  .ant-collapse-content {
    border: none!important;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    font-size: 1rem!important;
  }
  .ant-collapse-content-box {
    padding: 0!important;
  }
}

@media (max-width: 768px) {
  .main-title {
    font-size: 2.2rem;
  }
  .welcome-text {
    font-size: 1.2rem;
  }
  .action-buttons {
    flex-direction: column;
    align-items: center;
    gap: 16px;
  } 
  .hero-logo {
    width: 150px;
    height: 150px;
  }
  .features-grid {
    grid-template-columns: 1fr;
  }
}
</style>