<script setup lang="ts">
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import { ElMessage } from 'element-plus'
import { User, Lock, Phone } from '@element-plus/icons-vue'

const router = useRouter()

const form = ref({ username: '', password: '', confirmPassword: '', phone: '' })

function goLogin() {
  router.push('/login')
}

function onContact() {
  ElMessage.info('请联系客服开通账号（演示环境可用 user001 / 123456 直接登录）')
}
</script>

<template>
  <div class="auth-page">
    <div class="auth-bg">
      <div class="shape shape-1"></div>
      <div class="shape shape-2"></div>
      <div class="shape shape-3"></div>
    </div>

    <div class="auth-container">
      <div class="auth-left">
        <div class="brand">
          <div class="brand-icon">
            <el-icon :size="40"><Shop /></el-icon>
          </div>
          <h1>零食商城</h1>
          <p>精选全球美味，让每一口都充满幸福感</p>
        </div>
        <div class="features">
          <div class="feature-item">
            <div class="feature-dot"></div>
            <span>正品保障 · 品质甄选</span>
          </div>
          <div class="feature-item">
            <div class="feature-dot"></div>
            <span>极速发货 · 新鲜直达</span>
          </div>
          <div class="feature-item">
            <div class="feature-dot"></div>
            <span>售后无忧 · 7天退换</span>
          </div>
        </div>
      </div>

      <div class="auth-box">
        <div class="auth-header">
          <h2>加入我们</h2>
          <p>暂未开放自助注册，请联系客服或前往登录</p>
        </div>

        <el-alert
          type="info"
          :closable="false"
          title="当前后端未提供公开注册接口"
          description="演示账号：user001 / 123456（普通用户）；admin / 123456（管理端）"
          show-icon
          class="info-alert"
        />

        <div class="actions">
          <el-button type="primary" size="large" class="action-btn-primary" @click="goLogin">
            前往登录
          </el-button>
          <el-button size="large" class="action-btn-secondary" @click="onContact">
            联系客服
          </el-button>
        </div>

        <div class="auth-divider">
          <span>已有账号？</span>
        </div>

        <div class="auth-footer">
          <a @click="goLogin">立即登录</a>
        </div>
      </div>
    </div>
  </div>
</template>

<style scoped>
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #FEF2F2 0%, #FFF7ED 50%, #F0F9FF 100%);
}

/* Animated background shapes */
.auth-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
}
.shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.5;
  animation: float 8s ease-in-out infinite;
}
.shape-1 {
  width: 400px;
  height: 400px;
  background: linear-gradient(135deg, #FF6B35, #FF8F5D);
  top: -100px;
  left: -100px;
  animation-delay: 0s;
}
.shape-2 {
  width: 300px;
  height: 300px;
  background: linear-gradient(135deg, #06D6A0, #34D399);
  bottom: -80px;
  right: -80px;
  animation-delay: -3s;
}
.shape-3 {
  width: 250px;
  height: 250px;
  background: linear-gradient(135deg, #F59E0B, #FBBF24);
  top: 40%;
  left: 60%;
  animation-delay: -5s;
}
@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-20px) scale(1.05); }
}

.auth-container {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 440px;
  gap: 60px;
  max-width: 960px;
  width: 100%;
  padding: 0 24px;
  align-items: center;
}

/* Left side */
.auth-left {
  color: var(--color-text);
}
.brand {
  margin-bottom: 40px;
}
.brand-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  background: var(--color-primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  margin-bottom: 20px;
  box-shadow: var(--shadow-lg);
}
.brand h1 {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 10px;
  background: var(--color-primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.brand p {
  font-size: 16px;
  color: var(--color-text-secondary);
  line-height: 1.6;
}
.features {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.feature-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  color: var(--color-text-secondary);
}
.feature-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
  flex-shrink: 0;
}

/* Auth Box */
.auth-box {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  padding: 44px 36px;
  box-shadow: var(--shadow-xl);
  border: 1px solid rgba(255, 255, 255, 0.6);
}
.auth-header {
  margin-bottom: 28px;
}
.auth-header h2 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 8px;
}
.auth-header p {
  color: var(--color-text-secondary);
  font-size: 14px;
}

.info-alert {
  margin-bottom: 24px;
  border-radius: var(--radius-md);
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.action-btn-primary {
  width: 100%;
  height: 48px;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 600;
}
.action-btn-secondary {
  width: 100%;
  height: 48px;
  border-radius: var(--radius-md);
  font-size: 16px;
}

/* Divider */
.auth-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 24px 0;
  color: var(--color-text-muted);
  font-size: 14px;
}

/* Footer */
.auth-footer {
  text-align: center;
  font-size: 14px;
}
.auth-footer a {
  color: var(--color-primary);
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
}
.auth-footer a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
  .auth-container {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .auth-left {
    display: none;
  }
  .auth-box {
    padding: 32px 24px;
  }
}
</style>
