<template>
  <div class="contact-container">
    <div class="social-icons">
      <a
        v-for="icon in socialIcons"
        :key="icon.name"
        :href="icon.link"
        target="_blank"
        rel="noopener noreferrer"
      >
        <img :src="icon.icon" :alt="icon.name" class="icon" />
      </a>
    </div>

    <div class="info-card">
      <div class="image-section">
        <img src="../static/images/location.png" alt="Company Image" class="company-image" />
      </div>
      <div class="info-section">
        <h2 class="company-name">{{ companyName }}</h2>
        <p class="company-address">{{ companyAddress }}</p>
        <p class="company-contact">{{ companyContact }}</p>
      </div>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { defineComponent } from "vue";
import about from "../pages/aboutUs.vue";

// 可配置的社交图标数据
const socialIcons = [
  {
    name: "Telegram",
    icon: "https://cdn-icons-png.flaticon.com/512/2111/2111646.png",
    link: "https://t.me/buddyscloud",
  },
  {
    name: "Phone",
    icon: "https://cdn-icons-png.flaticon.com/512/126/126341.png",
    link: "tel:+8615656988217",
  },
  {
    name: "WhatsApp",
    icon: "https://cdn-icons-png.flaticon.com/512/733/733585.png",
    link: "https://whatsapp.com",
  },
  {
    name: "Facebook",
    icon: "https://cdn-icons-png.flaticon.com/512/733/733547.png",
    link: "https://facebook.com",
  },
];

const companyName = "南京知云信息科技有限公司";
const companyAddress = "江苏省南京市高淳区砖墙镇竹园里138号砖墙经济园B区1幢101-76号南京，jiangsu 211305";
const companyContact = "Phone: (+86) 15656988217 | Email: support@buddyscloud.com";
</script>

<style scoped>
.contact-container {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  padding: 0 20px;
}

.social-icons {
  position: absolute;
  top: -50px;
  right: 20px;
  display: flex;
  gap: 15px;
  background: transparent;
  padding: 10px 15px;
  border-radius: 25px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.icon {
  width: 30px;
  height: 30px;
  transition: transform 0.3s ease;
}

.icon:hover {
  transform: scale(1.2);
}

.info-card {
  display: flex;
  background-color: #ff6700;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  margin-top: 20px;
  justify-content: flex-end;
}

.image-section {
  flex: 1;
  max-width: 40%;
}

.company-image {
  width: 100%;
  height: 160px;
  object-fit: contain;  /*contain 保持图片比例，fill 拉伸图片*/
}

.info-section {
  flex: 2;
  padding: 20px;
  text-align: right;
}

.company-name {
  margin-top: 0;
  color: #ffffff;
  font-size: 1.5rem;
}

.company-address,
.company-contact {
  color: #ffffff;
  margin: 10px 0;
  line-height: 1.5;
}

/* 移动端响应式样式 */
@media (max-width: 768px) {
  .contact-container {
    padding: 0 15px;
  }

  .social-icons {
    position: static;
    justify-content: center;
    margin-bottom: 20px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.9);
  }

  .icon {
    width: 25px;
    height: 25px;
  }

  .info-card {
    flex-direction: column;
  }

  .image-section {
    width: 100%;
  }

  .company-image {
    height: 200px;
    object-fit: cover;
  }

  .info-section {
    padding: 15px;
  }

  .company-name {
    font-size: 1.2rem;
  }

  .company-address,
  .company-contact {
    font-size: 0.9rem;
    margin: 8px 0;
  }
}

/* 小屏幕手机适配 */
@media (max-width: 480px) {
  .contact-container {
    padding: 0 10px;
  }

  .social-icons {
    gap: 10px;
  }

  .icon {
    width: 20px;
    height: 20px;
  }

  .company-image {
    height: 150px;
  }

  .info-section {
    padding: 10px;
  }

  .company-name {
    font-size: 1.1rem;
  }

  .company-address,
  .company-contact {
    font-size: 0.8rem;
  }
}
</style>
