<template>
  <div class="login-page">
    <div class="welcome-section">
      <h2>食话食说 Talk of Food</h2>
      <p>守护您和家人的每一餐</p>
    </div>

    <div class="form-section">
      <div class="input-group">
        <span class="icon">📱</span>
        <input type="tel" placeholder="请输入手机号" />
      </div>
      <div class="input-group">
        <span class="icon">✉️</span>
        <input type="text" placeholder="请输入验证码" />
        <button class="get-code-btn">获取验证码</button>
      </div>
      <button class="login-btn">登录 / 注册</button>
    </div>

    <div class="social-login-section">
      <div class="divider">或</div>
      <button class="wechat-login-btn" @click="wechatLogin">
        <span class="wechat-icon">🟢</span>
        微信一键登录
      </button>
    </div>

    <div class="policy-section">
      <input type="checkbox" id="policy-check" checked />
      <label for="policy-check">
        我已阅读并同意
        <router-link to="/policy">用户协议</router-link> 和
        <router-link to="/policy">隐私政策</router-link>
      </label>
    </div>
  </div>
</template>

<script setup lang="ts">
import { useRouter } from 'vue-router';

const router = useRouter();

const wechatLogin = () => {
  router.push('/onboarding');
};
</script>

<style scoped>
.login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 100px 40px 20px;
  box-sizing: border-box;
  height: 100%;
  overflow-y: auto;
}

.welcome-section {
  text-align: center;
  margin-bottom: 40px;
  flex-shrink: 0;
}

.welcome-section h2 {
  font-size: 24px;
  margin-bottom: 10px;
}

.welcome-section p {
  color: #6b7280;
}

.form-section {
  width: 100%;
  max-width: 400px;
  flex-shrink: 0;
}

.input-group {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 12px 10px;
}

.input-group .icon {
  margin-right: 10px;
}

.input-group input {
  border: none;
  outline: none;
  flex-grow: 1;
  background: transparent;
  min-width: 0;
}

.get-code-btn {
  background: none;
  border: none;
  color: #22c55e;
  cursor: pointer;
  font-size: 14px;
  white-space: nowrap;
}

.login-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background-color: #22c55e;
  color: white;
  font-size: 16px;
  cursor: pointer;
}

.social-login-section {
  width: 100%;
  max-width: 400px;
  text-align: center;
  margin-top: 10px;
  flex-shrink: 0;
}

.divider {
  color: #9ca3af;
  margin-bottom: 10px;
  font-size: 12px;
}

.wechat-login-btn {
  width: 100%;
  padding: 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background-color: white;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
}

.wechat-icon {
  margin-right: 8px;
}

.policy-section {
  margin-top: 20px;
  font-size: 12px;
  color: #6b7280;
  text-align: center;
  flex-shrink: 0;
}

.policy-section a {
  color: #22c55e;
  text-decoration: none;
}
</style>