<template>
  <div class="invite-members gradient-background-circles">
    <!-- 使用 GeneralHeader 替换 MobileHeader -->
    <GeneralHeader
      :showLanguageList="true"
      :title="t('invite_members')"
      color="black"
      style="box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); z-index: 999"
    />

    <div class="content">
      <div class="instructions">
        <div class="instruction-item">
          <span class="step-number">1.</span>
          <span>{{ t('invite_download_app') }}</span>
        </div>
        <div class="instruction-item">
          <span class="step-number">2.</span>
          <span>{{ t('invited_users_login') }}</span>
        </div>
        <div class="instruction-item">
          <span class="step-number">3.</span>
          <span>{{ t('join_team_steps') }}</span>
        </div>
        <div class="instruction-item">
          <span class="step-number">4.</span>
          <span>{{ t('enter_team_id') }}</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { useI18n } from 'vue-i18n'
import GeneralHeader from '@/components/GeneralHeader.vue'
import { setDocumentDirection } from '@/locales/i18n'

const { t, locale } = useI18n()

// 监听语言变化并设置文档方向
locale.value && setDocumentDirection(locale.value)
</script>

<style scoped>
.content {
  padding: 16px;
  position: relative;
  z-index: 2;
}

/* 说明步骤 */
.instructions {
  background-color: white;
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.instruction-item {
  display: flex;
  align-items: flex-start;
  margin-bottom: 16px;
  line-height: 1.5;
}

.instruction-item:last-child {
  margin-bottom: 0;
}

.step-number {
  color: #8b5cf6;
  font-weight: 600;
  margin-right: 8px;
  flex-shrink: 0;
}

.instruction-item span:last-child {
  color: #333;
  font-size: 14px;
}

/* 团队信息 */
.team-info {
  background-color: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.team-id-section {
  margin-bottom: 24px;
}

.team-id-section h3,
.share-section h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.team-id-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #f8f9fa;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.team-id {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  letter-spacing: 1px;
}

.copy-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.copy-btn:hover {
  background-color: #e9ecef;
}

.copy-btn:active {
  background-color: #dee2e6;
}

/* 分享按钮 */
.share-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.share-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 12px;
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  flex: 1;
  min-width: 80px;
}

.share-btn:hover {
  background-color: #e9ecef;
  border-color: #8b5cf6;
}

.share-btn:active {
  transform: scale(0.98);
}

.share-icon {
  font-size: 24px;
  margin-bottom: 4px;
}

.share-btn span:last-child {
  font-size: 12px;
  font-weight: 500;
  color: #666;
}

@media screen and (max-width: 360px) {
  * {
    font-size: 10px;
  }
}

@media screen and (min-width: 360px) {
  * {
    font-size: 12px;
  }
}

@media screen and (min-width: 768px) {
  * {
    font-size: 24px;
  }
}

/* RTL支持 */
[dir='rtl'] .step-number {
  margin-right: 0;
  margin-left: 8px;
}

[dir='rtl'] .instruction-item {
  text-align: right;
}
</style>
