<template>
  <div class="footer">
    <div class="gototop" v-show="showGototop" @click="goToTop">
      <i class="fa-solid fa-arrow-up"></i>
    </div>
    <div class="footer-content">
      <div class="footer-main">
        <div class="left">
          <div class="footer-column">
            <div class="title">关于美天</div>
            <ul>
              <li>企业概况</li>
              <li>公司证件</li>
              <li>新闻中心</li>
              <li>加入我们</li>
              <li>联系我们</li>
            </ul>
          </div>
          <div class="footer-column">
            <div class="title">产品中心</div>
            <ul>
              <li>金蝶·云星空</li>
              <li>金蝶·KIS Cloud</li>
              <li>金蝶·EAS Cloud</li>
              <li>警务保障系统</li>
              <li>义警联盟平台</li>
              <li>商超进销存系统</li>
            </ul>
          </div>
          <div class="footer-column">
            <div class="title">解决方案</div>
            <ul>
              <li>财务云</li>
              <li>供应链云</li>
              <li>全渠道云</li>
              <li>制造云</li>
            </ul>
          </div>
          <div class="footer-column">
            <div class="title">服务支持</div>
            <ul>
              <li>常见问题</li>
              <li>软件下载</li>
              <li>投诉与建议</li>
            </ul>
          </div>
          <div class="footer-column">
            <div class="title">商务合作</div>
            <ul>
              <li>商务合作</li>
            </ul>
          </div>
        </div>
        <div class="right">
          <div class="footer-column">
            <div class="title">订阅我们</div>
            <div>第一时间了解我们的最新信息</div>
          </div>
        </div>
      </div>
      <div class="footer-bottom">
        <div class="left">
          <span>美天，为您用心多一点</span>
          <span>江苏美天智能科技有限公司·所有版权©2019-2026</span>
          <span>备案号:苏ICP备2020053493号</span>
        </div>
        <div class="right">
          <span>法律声明 | 隐私条款</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref, onMounted, onUnmounted } from 'vue'

const showGototop = ref(false)

const handleScroll = () => {
  showGototop.value = window.scrollY > 300
}

const goToTop = () => {
  window.scrollTo({
    top: 0,
    behavior: 'smooth'
  })
}

onMounted(() => {
  window.addEventListener('scroll', handleScroll)
  handleScroll()
})

onUnmounted(() => {
  window.removeEventListener('scroll', handleScroll)
})
</script>

<style lang="scss" scoped>
.footer {
  width: 100%;
  background-color: var(--tw-bg-opacity);
  color: var(--footer-color);
  font-size: var(--footer-size);
  padding: 20px 0;
  margin-top: auto;
  position: relative;
  z-index: 99;

  .footer-content {
    width:1200px;
    margin: 0 auto;
  }

  .title {
    font-size: var(--footer-title);
    font-weight: var(--footer-title-weight);
    margin-bottom: 16px;
    color: #fff;
  }

  ul {
    list-style: none;
    padding: 0;
    margin: 0;
  }

  li {
    margin-bottom: 12px;
    cursor: pointer;
    transition: color 0.3s;
  }

  li:hover {
    color: #fff;
  }

  .footer-main {
    display: flex;
    padding: 40px 0;

    .left {
      width: 80%;
      display: flex;

      .footer-column {
        flex: 1;
        padding: 0 15px;
      }
    }

    .right {
      width: 20%;
    }
  }

  .footer-bottom {
    border-top: 1px solid #fff;
    padding: 20px 0;
    display: flex;
    justify-content: space-between;

    .left {
      display: flex;

      p {
        margin-right: 12px;
      }
    }
  }

  .gototop {
        position: fixed;
        right: 40px;
        bottom: 40px;
        width: 50px;
        height: 50px;
        border-radius: 50%;
        background-color: #3973ff;
        color: #fff;
        display: flex;
        justify-content: center;
        align-items: center;
        cursor: pointer;
        box-shadow: 0 4px 15px rgba(64, 158, 255, 0.3);
        transition: all 0.3s ease;
        z-index: 9999;

        i {
            font-size: 20px;
        }

        &:hover {
            background-color: #ff6b6b;
            transform: translateY(-5px);
            box-shadow: 0 8px 20px rgba(64, 158, 255, 0.4);
        }

        &:active {
            transform: scale(0.95);
        }
    }
}
</style>
