<template>
  <view class="container">
    <image class="logo" src="/static/logo.png" mode="widthFix"></image>
    <view class="title">注册新账号</view>
    
    <view class="form">
      <view class="input-row">
        <text class="label">账号</text>
        <input type="text" v-model="account" class="input-field" placeholder="请输入账号" />
      </view>
      
      <view class="input-row">
        <text class="label">密码</text>
        <input type="password" v-model="password" class="input-field" placeholder="请输入密码" />
      </view>
      
      <view class="input-row">
        <text class="label">确认密码</text>
        <input type="password" v-model="confirmPassword" class="input-field" placeholder="请再次输入密码" />
      </view>
      
      <button class="btn submit-btn" :disabled="loading" @click="onRegister">注册</button>
    </view>
    
    <view class="login-link">
      <text @tap="goLogin">已有账号？去登录</text>
    </view>
    
    <view v-if="error" class="error">{{ error }}</view>
  </view>
</template>

<script setup>
import { ref } from 'vue'

const account = ref('')
const password = ref('')
const confirmPassword = ref('')
const loading = ref(false)
const error = ref('')

function goLogin() {
  uni.navigateBack()
}

function onRegister() {
  if (!account.value || !password.value) {
    uni.showToast({ title: '请填写完整', icon: 'none' })
    return
  }
  if (password.value !== confirmPassword.value) {
    uni.showToast({ title: '两次密码不一致', icon: 'none' })
    return
  }
  // TODO: 调用注册 API
  uni.showToast({ title: '注册功能开发中', icon: 'none' })
}
</script>

<style scoped>
/* ============================================
   奇盒潮玩 - 注册页面
   ============================================ */

.container {
  min-height: 100vh;
  padding: 60rpx 40rpx;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(180deg, #FFF8F3 0%, #FFE8D1 50%, #FFDAB9 100%);
}

.logo {
  width: 160rpx;
  height: 160rpx;
  margin-top: 80rpx;
  margin-bottom: 32rpx;
  border-radius: 32rpx;
  box-shadow: 0 12rpx 36rpx rgba(255, 107, 53, 0.2);
}

.title {
  font-size: 40rpx;
  font-weight: 700;
  color: #1F2937;
  margin-bottom: 48rpx;
}

.form {
  width: 100%;
  max-width: 600rpx;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  border-radius: 32rpx;
  padding: 40rpx;
  box-shadow: 0 16rpx 48rpx rgba(0, 0, 0, 0.08);
}

.input-row {
  display: flex;
  align-items: center;
  margin-bottom: 24rpx;
  background: #F9FAFB;
  border-radius: 16rpx;
  padding: 8rpx 24rpx;
  border: 2rpx solid #E5E7EB;
}

.label {
  width: 140rpx;
  font-size: 28rpx;
  font-weight: 500;
  color: #6B7280;
}

.input-field {
  flex: 1;
  height: 80rpx;
  border: none;
  background: transparent;
  font-size: 28rpx;
  color: #1F2937;
}

.submit-btn {
  width: 100%;
  height: 88rpx;
  line-height: 88rpx;
  margin-top: 32rpx;
  background: linear-gradient(135deg, #FF9F43, #FF6B35) !important;
  color: #FFFFFF !important;
  border: none;
  border-radius: 44rpx;
  font-size: 32rpx;
  font-weight: 600;
  box-shadow: 0 8rpx 24rpx rgba(255, 107, 53, 0.35);
}
.submit-btn:active {
  transform: scale(0.97);
}

.login-link {
  margin-top: 32rpx;
  font-size: 26rpx;
  color: #FF9F43;
  font-weight: 500;
}

.error {
  margin-top: 24rpx;
  color: #EF4444;
  font-size: 26rpx;
  text-align: center;
}
</style>
