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

    <div class="content">
      <!-- 身份 -->
      <div style="display: flex; justify-content: space-between">
        <div
          style="
            margin: 0 1%;
            margin-bottom: 12px;
            font-weight: 600;
            display: flex;
            align-items: center;
            font-size: 1.3em;
          "
        >
          {{ t('my_account') }}
          <img
            src="../../assets/icon/identity/agency.png"
            alt=""
            height="20px"
            style="margin-left: 10px"
          />
        </div>
        <img
          @click="goToNotification"
          src="../../assets/icon/Aslan/bell.png"
          height="20px"
          alt=""
        />
      </div>

      <!-- 用户信息卡片 -->
      <div
        style="
          background-color: white;
          padding: 16px;
          border-radius: 12px;
          box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.25);
          margin-bottom: 12px;
          display: flex;
          flex-direction: column;
          justify-content: space-between;
        "
      >
        <!-- 头像信息 -->
        <div style="display: flex; align-items: center; margin-bottom: 12px">
          <div class="avatar">
            <img
              :src="userInfo.userAvatar || ''"
              :alt="userInfo.name"
              style="
                display: block;
                object-fit: cover;
                width: 100%;
                aspect-ratio: 1/1;
                border-radius: 50%;
              "
              @error="handleAvatarImageError"
            />
          </div>
          <div style="min-width: 0; flex: 1">
            <div
              style="
                margin-bottom: 4px;
                font-weight: 600;
                color: #333;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
              "
            >
              {{ userInfo.userNickname || userInfo.name }}
            </div>
            <div style="margin: 0; font-size: 14px; color: #666">
              <span style="display: flex; align-items: center">
                <span>ID</span>
                <span style="margin: 0 2px">:</span>
                <span>{{ userInfo.id }}</span>
              </span>
            </div>
          </div>
          <button
            style="
              width: 1.5em;
              border: none;
              background: none;
              display: flex;
              justify-content: center;
              align-items: center;
            "
            @click="gotoEdit"
          >
            <img
              v-smart-img
              src="../../assets/icon/Aslan/edit.png"
              alt=""
              style="display: block; width: 70%; object-fit: contain"
            />
          </button>
        </div>

        <!-- 我的薪资 -->
        <div>
          <div style="display: flex; justify-content: space-between; margin-bottom: 5px">
            <div style="font-weight: 600">{{ t('my_salary') }}</div>
            <button
              style="
                font-weight: 500;
                color: rgba(0, 0, 0, 0.4);
                border: 0;
                background-color: transparent;
              "
              @click="goToPersonalSalary"
            >
              {{ t('personal_salary') }} >
            </button>
          </div>
        </div>

        <!-- 历史薪资 -->
        <div style="display: grid; grid-template-columns: repeat(2, 1fr)">
          <div>
            <div style="font-weight: 500; color: rgba(0, 0, 0, 0.4); margin-bottom: 5px">
              {{ t('history_salary') }}
            </div>
            <div style="font-weight: 600">${{ totalSalary }}</div>
          </div>
          <div>
            <div style="font-weight: 500; color: rgba(0, 0, 0, 0.4); margin-bottom: 5px">
              {{ t('current_salary') }}
            </div>
            <div style="font-weight: 600">${{ salaryInfo.currentSalary }}</div>
          </div>
        </div>
      </div>

      <!-- 标签选项 -->
      <div style="display: flex; justify-content: space-between; align-items: center">
        <div style="display: flex; margin: 5px 0; padding: 5px 0; position: relative">
          <div
            style="padding: 0 5px"
            :class="[taskTab === 'host' ? 'TabActive' : 'TabNoActive']"
            @click="taskTab = 'host'"
            ref="tabHost"
          >
            {{ t('host') }}
          </div>
          <div
            style="padding: 0 5px"
            :class="[taskTab === 'agency' ? 'TabActive' : 'TabNoActive']"
            @click="taskTab = 'agency'"
            ref="tabAgency"
          >
            {{ t('agency') }}
          </div>
        </div>

        <!-- help -->
        <img
          src="../../assets/icon/Aslan/helpPurple.png"
          alt=""
          class="help-btn"
          @click.stop="goToInviteMembers"
        />
      </div>

      <!-- 标签内容 -->
      <div>
        <!-- 主播栏 -->
        <div v-if="taskTab === 'host'">
          <div
            style="
              display: flex;
              flex-direction: column;
              justify-content: space-between;
              gap: 5px;
              background-color: white;
              padding: 3%;
              border-radius: 12px;
              margin: 0 1%;
              margin-bottom: 12px;
              box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.25);
            "
          >
            <div style="display: flex; justify-content: space-between">
              <div style="font-weight: 600">{{ t('todays_task') }}</div>
              <button
                style="
                  font-weight: 500;
                  color: rgba(0, 0, 0, 0.4);
                  border: 0;
                  background-color: transparent;
                "
                @click="goToPlatformPolicy"
              >
                {{ t('platform_policy') }} >
              </button>
            </div>
            <div style="display: flex">
              <div style="flex: 1">
                <div
                  style="
                    width: max-content;
                    display: flex;
                    flex-direction: column;
                    align-items: center;
                    gap: 5px;
                  "
                >
                  <div style="font-weight: 600">{{ t('host_type') }}</div>
                  <div style="font-weight: 600">{{ taskInfo.anchorType }}</div>
                </div>
              </div>
              <div
                style="
                  flex: 1;
                  display: flex;
                  flex-direction: column;
                  align-items: center;
                  gap: 5px;
                "
              >
                <div style="font-weight: 600">{{ t('minutes') }}</div>
                <div style="font-weight: 600">
                  {{ taskInfo.minutesProgress }}/{{ taskInfo.minutesTotal }}
                </div>
              </div>
              <div style="flex: 1; display: flex; justify-content: flex-end">
                <div
                  style="
                    width: max-content;
                    display: flex;
                    flex-direction: column;
                    align-items: center;
                    gap: 5px;
                  "
                >
                  <div style="font-weight: 600">{{ t('gift_task') }}</div>
                  <div style="font-weight: 600">{{ taskInfo.giftTask }}</div>
                </div>
              </div>
            </div>
          </div>

          <!-- 进度信息 -->
          <workReportBox
            style="margin-bottom: 10px"
            :type="progressInfo.status"
            :date="progressInfo.date"
            :target="String(progressInfo.target)"
            :salary="progressInfo.salary"
            :income="progressInfo.income"
            :days="String(progressInfo.timeDays)"
          ></workReportBox>
        </div>

        <!-- 代理栏 -->
        <div v-else>
          <div
            style="
              display: flex;
              flex-direction: column;
              justify-content: space-between;
              gap: 5px;
              background-color: white;
              padding: 3%;
              border-radius: 12px;
              margin-bottom: 12px;
              box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.25);
            "
          >
            <div style="display: flex; justify-content: space-between">
              <div style="font-weight: 600">
                {{ teamBillInfo.date }}
              </div>
              <button
                style="
                  font-weight: 500;
                  color: rgba(0, 0, 0, 0.4);
                  border: 0;
                  background-color: transparent;
                "
                @click="goToTeamBill"
              >
                {{ t('team_bill') }} >
              </button>
            </div>
            <div style="display: grid; grid-template-columns: repeat(2, 1fr); gap: 5px">
              <div class="contentText">
                {{ t('host_salary') }}: {{ teamBillInfo.hostSalary || '–' }}
              </div>
              <div class="contentText">
                {{ t('agent_salary') }}: {{ teamBillInfo.agentSalary || '–' }}
              </div>
              <div class="contentText">{{ t('total') }}: {{ teamBillInfo.total || '–' }}</div>
              <div style="display: flex; justify-content: flex-end">
                <div
                  style="
                    margin: 4px;
                    padding: 0 8px;
                    border-radius: 4px;
                    display: flex;
                    align-items: center;
                  "
                  :style="{ boxShadow }"
                >
                  <div style="font-weight: 500" :style="{ color }">
                    {{ teamBillInfo.status || '–' }}
                  </div>
                </div>
              </div>
            </div>
          </div>

          <div v-if="taskTab === 'agency'" class="team-member-section">
            <div class="team-member-card" @click="goToTeamMember">
              <div class="card-content">
                <div class="member-title">
                  {{ t('team_member') }}
                  <span v-if="loadingMemberCount">({{ t('loading') }}...)</span>
                  <span v-else class="member-title">({{ teamMemberCount }})</span>
                </div>
                <span class="arrow">></span>
              </div>
            </div>
          </div>
        </div>
      </div>

      <!-- 操作按钮 -->
      <div style="display: flex; align-items: center; gap: 2vw; margin: 0 1%">
        <!-- 兑换按钮 -->
        <button
          class="action-btn"
          style="
            background: linear-gradient(135deg, #f1eca6 2.82%, #ffd22f 99.15%), #fff;
            box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.25);
            color: white;
          "
          @click="exchangeGoldCoins"
        >
          {{ t('exchange') }}
        </button>

        <!-- 转账按钮 -->
        <button
          class="action-btn"
          style="
            background: linear-gradient(135deg, #a6aaf1 2.82%, #592fff 99.15%), #fff;
            box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.25);
            color: white;
          "
          @click="transfer"
        >
          {{ t('transfer') }}
        </button>

        <!-- 提现按钮 -->
        <button
          v-if="withdrawEnabled"
          class="action-btn"
          style="
            background: linear-gradient(135deg, #a6f1b2 2.82%, #2fff3d 99.15%), #fff;
            box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.25);
            color: white;
          "
          @click="goToWithdraw"
        >
          {{ t('withdraw') }}
        </button>
      </div>
    </div>

    <!-- 弹窗遮罩层 -->
    <maskLayer :maskLayerShow="maskLayerShow" @click="maskLayerShow = false">
      <!-- 资料不足提示弹窗 -->
      <div
        style="
          width: 100vw;
          height: 100vh;
          display: flex;
          justify-content: center;
          align-items: center;
        "
        @click="maskLayerShow = false"
      >
        <div
          style="
            width: 80%;
            border-radius: 12px;
            background: #fff;
            padding: 12px;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 2vw;
          "
          @click.stop
        >
          <div style="color: rgba(0, 0, 0, 0.8); font-weight: 700; font-size: 1.2em">
            {{ t('prompt') }}
          </div>
          <div style="color: rgba(0, 0, 0, 0.8); font-weight: 600">
            {{ t('fill_info_tips') }}
          </div>
          <div style="color: rgba(0, 0, 0, 0.4); font-weight: 600; font-size: 0.8em">
            {{ t('card_issue_tips') }}
          </div>
          <div
            style="
              display: flex;
              justify-content: center;
              align-items: center;
              border-radius: 999999px;
              background:
                linear-gradient(180deg, #d3acff 0%, rgba(222, 172, 255, 0) 58.38%),
                linear-gradient(152deg, #c670ff 7.01%, #7726ff 92.99%), #ff4768;
              box-shadow:
                -1px 0 5px 0 rgba(255, 255, 255, 0.7) inset,
                -3.5px 0 7.5px 0 rgba(255, 255, 255, 0.2) inset,
                1px 0 5px 0 rgba(255, 255, 255, 0.7) inset,
                3.5px 0 7.5px 0 rgba(255, 255, 255, 0.2) inset;

              color: #fff;
              font-weight: 800;
              padding: 8px 12px;
              width: 50%;
            "
            @click="goToImprove"
          >
            {{ t('to_improve') }}
          </div>
        </div>
      </div>
    </maskLayer>
  </div>
</template>

<script setup>
import { ref, reactive, onMounted, computed, watch } from 'vue'
import { useRouter } from 'vue-router'
import { useI18n } from 'vue-i18n'
import { setDocumentDirection } from '@/locales/i18n'
import { usePageInitializationWithConfig } from '@/utils/pageConfig.js'
import { getTeamId, getUserId } from '@/utils/userStore.js'
import { clearSelectedPayee } from '@/utils/payeeStore.js'
import { handleAvatarImageError } from '@/utils/image/imageHandler.js'
import { useIdentityStore } from '@/stores/identity.js'

import { getTeamMemberCount, getTeamBill, getTeamMemberWork } from '@/api/teamBill.js'
import {
  getUserIdentity,
  getBankCardList, // 获取正在使用的银行卡
  getWithdrawInfoList, // 获取申请提现信息
  apiGetWithdrawEnabled, // 获取提现权限
} from '@/api/wallet.js'

import GeneralHeader from '@/components/GeneralHeader.vue'
import workReportBox from '@/components/workReportBox.vue'
import maskLayer from '@/components/MaskLayer.vue'

const { t, locale } = useI18n()
const router = useRouter()
const identityStore = useIdentityStore()

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

const withdrawEnabled = ref(false) // 提现权限
const maskLayerShow = ref(false) // 弹窗遮罩层显示状态

const totalSalary = ref('0') //历史收入

// 任务标签
const taskTab = ref('host')
const tabHost = ref(null)
const tabAgency = ref(null)

// 进度信息
const progressInfo = reactive({
  date: '–',
  status: '–',
  target: '–',
  salary: '–',
  timeDays: '–',
  hostSalary: '–',
  agentSalary: '–',
  total: '–',
})

// 样式
const color = ref('')
const boxShadow = ref('')

// 团队成员数量
const teamMemberCount = ref(0)
const loadingMemberCount = ref(false)

// Team Bill 信息
const teamBillInfo = reactive({
  date: '–',
  hostSalary: '–',
  agentSalary: '–',
  total: '–',
  status: '–',
})
const loadingTeamBill = ref(false)

const underlineStyle = computed(() => {
  console.log('计算属性')

  let activeTab = taskTab.value == 'host' ? tabHost.value : tabAgency.value
  console.log('选中元素的左边距', activeTab?.offsetLeft)
  return {
    left: `${activeTab?.offsetLeft + activeTab?.offsetWidth / 2 - 15 / 2}px`,
  }
})

const bankCardList = ref([]) // 银行卡列表
const usedBankCard = ref(null) //正在使用的银行卡

const bankCardInfo = ref(null)
const checkStatus = computed(() => {
  return bankCardInfo.value == null || usedBankCard.value == null
  // return true
})

// 获取最新成员工作数据和账单数据
const fetchMemberWorkData = async () => {
  try {
    const userId = getUserId()

    if (!userId) {
      console.warn('No user ID available')
      return
    }

    const response = await getTeamMemberWork(userId)
    if (response.status && response.body) {
      const data = response.body

      // 取第一条target数据（最新的工作数据）
      if (data.targets && data.targets.length > 0) {
        const latestTarget = data.targets[0]

        // 格式化状态
        const formatStatus = (status) => {
          const statusMap = {
            SETTLED: 'Completed',
            UNPAID: 'In Progress',
            HANG_UP: 'Out of account',
            PAY_OUT: 'Completed',
          }
          return statusMap[status] || status
        }

        // 获取level值
        const level =
          latestTarget.target?.settlementResult?.level || latestTarget.target?.level || '–'

        // 更新数据
        Object.assign(progressInfo, {
          date: latestTarget.billTitle,
          status: formatStatus(latestTarget.status),
          target: level,
          salary: latestTarget.target?.settlementResult?.memberSalary?.toFixed(2) || '–',
          income: latestTarget.target?.settlementResult?.acceptGiftValue,
          timeDays: latestTarget.target?.effectiveDay || '–',
        })
      } else {
        console.warn('No targets data available')
      }

      const targets = response.body.targets || []
      const userIdentity = await getUserIdentity()

      // 计算总薪资 - 根据用户身份选择对应的薪资字段
      const totalAmount = targets.reduce((sum, target, index) => {
        let salary = 0

        // 跳过第一项（当月还在计算中），从第二项开始计算
        if (index > 0) {
          // 根据用户身份决定使用哪个薪资字段
          if (userIdentity.body?.agent) {
            // agent 为 true 时，使用 ownSalary
            salary = parseFloat(
              (target.target?.settlementResult?.ownSalary || 0) +
                (target.target?.settlementResult?.memberSalary || 0),
            )
          } else if (userIdentity.body?.anchor) {
            // anchor 为 true 时，使用 memberSalary
            salary = parseFloat(target.target?.settlementResult?.memberSalary || 0)
          }

          return sum + salary
        } else {
          // 对于第一项，只返回当前的sum，不添加任何值
          return sum
        }
      }, 0)

      totalSalary.value = totalAmount.toFixed(2)
    } else {
      console.warn('No member work data available')
    }
  } catch (error) {
    console.error('Failed to fetch member work data:', error)
  }
}

watch(
  () => teamBillInfo?.status,
  (newStatus) => {
    if (newStatus == t('in_progress')) {
      boxShadow.value = '0 0 1px 0 #6085FF'
      color.value = 'rgba(61, 115, 255, 1)'
    }
    if (newStatus == t('pending')) {
      boxShadow.value = '0 0 1px 0 #FF6062'
      color.value = 'rgba(255, 61, 64, 1)'
    }
    if (newStatus == t('completed')) {
      boxShadow.value = '0 0 1px 0 #60FF65'
      color.value = 'rgba(61, 255, 84, 1)'
    }
    if (newStatus == t('out_of_account')) {
      boxShadow.value = '0 0 1px 0 #6A6161'
      color.value = 'rgba(174, 174, 174, 1)'
    }
    return
  },
)

// 页面跳转方法
const goToNotification = () => {
  router.push('/message')
}

const gotoEdit = () => {
  router.push('/agency-setting')
}

const goToInviteMembers = () => {
  router.push('/invite-members')
}

const goToTeamBill = () => {
  router.push('/team-bill')
}

const goToTeamMember = () => {
  router.push({
    path: '/team-member',
    query: { source: 'agency-center', members: teamMemberCount.value },
  })
}

const exchangeGoldCoins = () => {
  router.push('/exchange-gold-coins')
}

const transfer = () => {
  router.push('/transfer')
}

// 前往提现
const goToWithdraw = () => {
  if (checkStatus.value) {
    maskLayerShow.value = true
    return
  }
  router.push('/cash-withdraw')
}

// 前往完善信息
const goToImprove = () => {
  router.push('/agency-setting')
}

const goToPersonalSalary = () => {
  router.push('/history-salary')
}

const goToPlatformPolicy = () => {
  router.push('/platform-policy?from=agencycenter')
}

// 获取团队成员数量
const fetchTeamMemberCount = async () => {
  try {
    loadingMemberCount.value = true
    const teamId = getTeamId()

    if (teamId) {
      const response = await getTeamMemberCount(teamId)
      if (response.status && response.body) {
        teamMemberCount.value = response.body.memberQuantity
      } else {
        teamMemberCount.value = 0
      }
    }
  } catch (error) {
    console.error('Failed to fetch team member count:', error)
    teamMemberCount.value = 87 // 出错时使用默认值
  } finally {
    loadingMemberCount.value = false
  }
}

// 获取团队账单数据
const fetchTeamBillData = async () => {
  try {
    loadingTeamBill.value = true
    const teamId = getTeamId()

    if (!teamId) {
      console.warn('No team ID available')
      return
    }

    const response = await getTeamBill(teamId)
    if (response.status && response.body && Array.isArray(response.body)) {
      // 取第一条数据（最新的账单）
      const latestBill = response.body[0]
      if (latestBill) {
        // 格式化日期：202508 -> 08/2025
        const billBelong = latestBill.billBelong.toString()
        const year = billBelong.substring(0, 4)
        const month = billBelong.substring(4, 6)

        // 格式化状态
        const formatStatus = (status) => {
          const statusMap = {
            SETTLED: t('completed'),
            UNPAID: t('in_progress'),
            HANG_UP: t('out_of_account'),
            PAY_OUT: t('completed'),
          }
          return statusMap[status] || status
        }

        // 更新数据
        Object.assign(teamBillInfo, {
          date: `${year}.${month}`,
          hostSalary: latestBill.settleResult?.memberSalary?.toFixed(2) || '–',
          agentSalary: latestBill.settleResult?.ownSalary?.toFixed(2) || '–',
          total: latestBill.settleResult?.totalSalary?.toFixed(2) || '–',
          status: formatStatus(latestBill.status),
        })
      }
    } else {
      console.warn('No team bill data available')
    }
  } catch (error) {
    console.error('Failed to fetch team bill data:', error)
  } finally {
    loadingTeamBill.value = false
  }
}

// 获取银行卡列表
const getBankCards = async () => {
  try {
    const resBankCards = await getBankCardList()
    console.log('银行卡列表:', resBankCards)
    if (resBankCards.status && resBankCards.body) {
      // 处理银行卡列表数据
      bankCardList.value = resBankCards.body

      const usedCard = bankCardList.value.find((card) => card.use)
      if (usedCard) {
        usedBankCard.value = usedCard
      } else {
        // 没有使用中的银行卡
        usedBankCard.value = null
      }
    }
  } catch (error) {
    console.error('获取银行卡列表失败:', error)
  }
}

// 获取提现信息列表
const getWithdrawInfoListData = async () => {
  try {
    const resWithdrawInfoList = await getWithdrawInfoList()
    console.log('提现信息列表:', resWithdrawInfoList)
    if (resWithdrawInfoList.status && resWithdrawInfoList.body?.length > 0) {
      let imgList = JSON.parse(resWithdrawInfoList.body[0].passportFrontUrl)
      let previewUrls = imgList.map((item) => item)
      bankCardInfo.value = { previewUrls, ...resWithdrawInfoList.body[0] }
    }
  } catch (error) {
    console.error('获取提现信息列表失败:', error)
    showError(error.response?.errorMsg)
  }
}

// 获取提现权限
const getWithdrawEnabled = async () => {
  try {
    const resWithdrawEnabled = await apiGetWithdrawEnabled()
    if (resWithdrawEnabled.body && resWithdrawEnabled.status) {
      withdrawEnabled.value = resWithdrawEnabled.body
    }
  } catch (error) {
    console.error('获取提现信息列表失败:', error)
    showError(error.response?.errorMsg)
  }
}

const { userInfo, salaryInfo, taskInfo } = usePageInitializationWithConfig('AGENCY_CENTER', {
  needsTeamInfo: true,
  forceRefresh: true, // 强制刷新
  onDataLoaded: () => {
    fetchTeamMemberCount()
    fetchTeamBillData() // 获取团队账单数据
    fetchMemberWorkData() // 获取最新成员工作数据
  },
})

onMounted(() => {
  identityStore.setIdentity('AGENCY')
  getBankCards() // 获取正在使用的银行卡
  getWithdrawInfoListData() // 获取提现信息列表
  getWithdrawEnabled() // 获取提现权限

  underlineStyle.value // 触发计算属性更新

  clearSelectedPayee() //清除选中的收款人
})
</script>

<style scoped>
* {
  color: rgba(0, 0, 0, 0.8);
}

.contentText {
  font-weight: 700;
  font-size: 1em;
}

.TabActive {
  font-weight: 600;
}

.TabNoActive {
  font-weight: 500;
  color: rgba(0, 0, 0, 0.4);
}

.content {
  padding: 16px;
  position: relative;
  z-index: 2;
}

.avatar {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 25px;
}

/* Team Member 独立区域 */
.team-member-section {
  margin-bottom: 12px;
}

.team-member-card {
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid #e5e7eb;
}

.team-member-card:active {
  transform: scale(0.98);
}

/* 通用卡片内容样式 */
.card-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
}

.card-date {
  font-size: 18px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 8px;
}

.card-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.status-badge {
  background-color: #dbeafe;
  color: #1d4ed8;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  text-align: center;
}

.member-title {
  font-weight: 600;
  color: #1f2937;
}

/* 操作按钮 */

.action-btn {
  flex: 1;
  min-width: 0;

  padding: 14px 12px;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
  transition: all 0.2s;
  width: 100%;
}

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

/* 通用箭头样式 */
.arrow {
  font-weight: bold;
  color: #8b5cf6;
}

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

  .help-btn {
    width: 14px;
  }
}

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

  .help-btn {
    width: 16px;
  }
}

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

  .help-btn {
    width: 28px;
  }
}

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

[dir='rtl'] .help-btn {
  /* transform: scaleX(-1); */
}
</style>
