<template>
    <div class="page">
        <div class="user-card">
            <div class="avatar"></div>
            <div class="user-info">
                <div class="hello">{{ userInfo?.name }}</div>
                <div class="phone">{{ userInfo?.email }}</div>
            </div>
        </div>
        <div class="group">
            <div class="group-item" @click="$router.push('/language')">
                <i class="i-mdi-web"></i>
                <span>{{ t('language.i1') }}</span>
            </div>
            <div class="group-item">
                <i class="i-mdi-history"></i>
                <span>{{ t('language.i4') }}</span>
            </div>
        </div>
        <div class="group">
            <div class="group-item" @click="$router.push('/pay/password')">
                <i class="i-mdi-lock-reset"></i>
                <span>{{ t('language.i2') }}</span>
            </div>
            <div class="group-item">
                <i class="i-mdi-shield-lock-outline"></i>
                <span>{{ t('language.i3') }}</span>
            </div>
        </div>
        <div class="group">
            <div class="group-item">
                <i class="i-mdi-information-outline"></i>
                <span>{{ t('language.i5') }}</span>
                <span class="version">v2.0.21</span>
            </div>
        </div>
        <div class="group">
            <div class="group-item" @click="handleLogout">
                <i class="i-mdi-logout"></i>
                <span>{{ t('language.i6') }}</span>
            </div>
        </div>
    </div>
</template>

<script setup lang="ts">
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
import { useRouter } from 'vue-router'
const router = useRouter()
import useUserStore from '@/stores/use-user-store'
const userStore = useUserStore()
const userInfo = userStore.userInfo
const handleLogout = () => {
    userStore.clearUserInfo()
    router.push('/login')
}
</script>

<style scoped>
.user-card {
    background: var(--main-yellow);
    margin-top: 24px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    padding: 24px 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}
.avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #d8d8d8 url('https://img.icons8.com/color/96/000000/user-male-circle--v2.png') center/cover no-repeat;
    margin-right: 18px;
    border: 2px solid #fff;
}
.user-info .hello {
    color: #333;
    font-size: var(--font-size-16);
    margin-bottom: 6px;
}
.user-info .phone {
    color: #333;
    font-size: var(--font-size-18);
    font-weight: bold;
}
.group {
    background: var(--action-bg);
    border-radius: 16px;
    margin-top: 12px;
    overflow: hidden;
    border: 1px solid rgba(214, 255, 0, 0.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.group-item {
    display: flex;
    align-items: center;
    padding: 18px 18px;
    color: var(--white);
    font-size: var(--font-size-15);
    border-bottom: 1px solid var(--action-bg);
    position: relative;
}
.group-item:last-child {
    border-bottom: none;
}
i{
    color: var(--main-yellow);
    font-size: var(--font-size-18);
    margin-right: 12px;
}
.group-item .version {
    margin-left: auto;
    color: var(--main-yellow);
    font-size: 15px;
}
</style>
