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

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

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

  .mb-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);
  }
}

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

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

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

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

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

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

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

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

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

  &:hover {
    color: #ffffff;
  }
}

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

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

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

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

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

}

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

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