<template>
	<div class="system-page">
		<div class="system-card">
			<div class="status-code">401</div>
			<h1>{{ t('pages.system.unauthorized.title') }}</h1>
			<p>{{ t('pages.system.unauthorized.description') }}</p>
			<div class="actions">
				<el-button type="primary" @click="goHome">{{ t('pages.system.actions.backHome') }}</el-button>
				<el-button @click="goBack">{{ t('pages.system.actions.goBack') }}</el-button>
			</div>
		</div>
	</div>
</template>

<script setup lang="ts">
import { useRouter } from 'vue-router'
import { useI18n } from '@/composables/useI18n'

const router = useRouter()
const { t } = useI18n()

const goHome = () => {
	router.replace('/')
}

const goBack = () => {
	if (window.history.length > 1) {
		router.back()
		return
	}
	goHome()
}
</script>

<style scoped lang="less">
.system-page {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 100vh;
	padding: 24px;
	background: var(--bg-page);
	box-sizing: border-box;
}

.system-card {
	width: min(520px, 100%);
	text-align: center;
}

.status-code {
	font-size: 88px;
	font-weight: 700;
	line-height: 1;
	color: var(--el-color-warning);
}

h1 {
	margin: 18px 0 10px;
	font-size: 26px;
	color: var(--text-primary);
}

p {
	margin: 0;
	font-size: 15px;
	line-height: 1.7;
	color: var(--text-secondary);
}

.actions {
	display: flex;
	justify-content: center;
	gap: 12px;
	margin-top: 28px;
}
</style>
