<template>
  <footer class="mobile-footer">
    <div class="mobile-footer-container">
      <div class="footer-brand">
        <h2 class="brand-title">DDAC</h2>
      </div>
      <nav class="footer-nav">
        <div v-for="(section, index) in sections" :key="section.title" class="nav-column">
          <div class="nav-title-row" @click="toggleSection(index)">
            <h3 class="nav-title">{{ section.title }}</h3>
            <Icon name="line-md:chevron-down" class="nav-item-icon" :class="{ 'icon-rotated': openSections[index] }" />
          </div>
          <Transition name="nav-expand">
            <div v-show="openSections[index]" class="nav-list">
              <div v-for="item in section.items" :key="item" class="nav-link">{{ item }}</div>
            </div>
          </Transition>
        </div>
      </nav>
      <div class="footer-section">
        <span class="section-link">行业解决方案</span>
      </div>
      <div class="footer-contact">
        <span class="contact-label">联系我们</span>
        <p class="contact-email">企业邮箱：support@yundun.com</p>
      </div>
      <div class="footer-bottom">
        <span class="report-link">举报中心</span>
        <p class="copyright">Copyright@2025 SUYUN,All Rights Reserved</p>
      </div>
    </div>
  </footer>
</template>

<script setup>
const sections = [
  {
    title: '安全产品',
    items: [
      'SDK安全加速（游戏DDoS、CC、WAF防护）',
      'Web安全加速（网站DDoS、CC、WAF防护）',
      'TCP安全加速（DDoS防护）',
      'DNS安全加速（域名解析）'
    ]
  },
  {
    title: '安全服务',
    items: [
      '互联网暴露面检测服务',
      '渗透测试服务',
      '安全巡检和加固服务',
      '重保服务',
      '其他安全专家服务'
    ]
  },
  {
    title: '热搜榜单',
    items: [
      '零信任安全访问',
      '出海云主机',
      'Web网站安全加速',
      'APP安全加速'
    ]
  },
  {
    title: '文档中心',
    items: [
      '入门指导',
      '问答专区',
      '主题',
      '资讯列表',
      '关键词'
    ]
  },
  {
    title: '关于我们',
    items: [
      '企业简介',
      '资质认证',
      '法律条款',
      '大事记'
    ]
  }
]

const openSections = ref(sections.map(() => false))

const toggleSection = (index) => {
  openSections.value[index] = !openSections.value[index]
}
</script>

<style scoped lang="scss">
.mobile-footer {
  width: 100%;
  background-color: #030014;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 16px;
  margin-top: auto;
  box-sizing: border-box;
}

.mobile-footer-container {
  margin: 0 auto;
}

.footer-brand {
  padding-bottom: 16px;
  position: relative;

  .brand-title {
    color: #FFF;
    font-size: 24px;
    font-weight: 900;
  }

  &::before {
    position: absolute;
    bottom: 0;
    left: 0;
    content: '';
    width: 100%;
    height: 1PX;
    background-color: rgba(255, 255, 255, 0.06);
  }
}

.footer-nav {
  display: flex;
  flex-direction: column;
}

.nav-column {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  cursor: pointer;
}

.nav-title {
  color: #DDD;
  font-size: 18px;
  font-weight: 400;
}

.nav-item-icon {
  width: 18px;
  height: 18px;
  color: #fff;
  transition: transform 0.3s ease;
}

.icon-rotated {
  transform: rotate(180deg);
}

.nav-list {
  padding-bottom: 12px;
}

.nav-link {
  font-size: 14px;
  color: #bdbdbd;
  margin-bottom: 12px;
  cursor: pointer;

  &:last-child {
    margin-bottom: 0;
  }

  &:hover {
    color: #ffffff;
  }
}

.nav-expand-enter-active,
.nav-expand-leave-active {
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.nav-expand-enter-from,
.nav-expand-leave-to {
  max-height: 0 !important;
}

.nav-expand-enter-to,
.nav-expand-leave-from {
  max-height: 500px !important;
}

.footer-section {
  .section-link {
    color: #DDD;
    font-size: 14px;
    font-weight: 400;
  }
}

.footer-contact {
  display: flex;
  gap: 44px;
  color: #DDD;
  font-size: 14px;
  font-style: normal;
  font-weight: 400;

}

.footer-bottom {
  padding: 36px 0 50px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: #DDD;
  font-size: 14px;
  font-weight: 400;

  .copyright {
    color: #fff;
  }
}
</style>
