<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户注册 - 图书管理系统</title>
    <link rel="stylesheet" href="{{ url_for('static', filename='css/register.css') }}">
</head>
<body>
    <div class="overlay"></div>

    <div class="theme-toggle" id="theme-toggle">☀️</div>

    <div class="main-container">
        <div class="login-container register-container">
            <div class="logo">
                <img src="{{ url_for('static', filename='images/logo.png') }}" alt="Logo">
            </div>
            <h1>图书管理系统</h1>
            <p class="subtitle">创建您的新账户</p>

            <div id="register-form-container">
                <form id="register-form" action="{{ url_for('user.register') }}" method="post">
                    <div class="form-group">
                        <label for="username">用户名</label>
                        <div class="input-with-icon">
                            <span class="input-icon">👤</span>
                            <input type="text" id="username" name="username" class="form-control" placeholder="请输入用户名" required>
                        </div>
                        <div class="validation-message" id="username-error"></div>
                    </div>

                    <div class="form-group">
                        <label for="email">邮箱</label>
                        <div class="input-with-icon">
                            <span class="input-icon">📧</span>
                            <input type="email" id="email" name="email" class="form-control" placeholder="请输入邮箱" required>
                        </div>
                        <div class="validation-message" id="email-error"></div>
                    </div>

                    <div class="form-group">
                        <label for="verification_code">邮箱验证码</label>
                        <div class="verification-code-container">
                            <input type="text" id="verification_code" name="verification_code" class="verification-input" placeholder="请输入验证码" required>
                            <button type="button" id="send-code-btn" class="send-code-btn">发送验证码</button>
                        </div>
                        <div class="validation-message" id="verification-code-error"></div>
                    </div>

                    <div class="form-group">
                        <label for="password">密码</label>
                        <div class="input-with-icon">
                            <span class="input-icon">🔒</span>
                            <input type="password" id="password" name="password" class="form-control" placeholder="请设置密码" required>
                            <span class="password-toggle" id="password-toggle">👁️</span>
                        </div>
                        <div class="validation-message" id="password-error"></div>
                    </div>

                    <div class="form-group">
                        <label for="confirm_password">确认密码</label>
                        <div class="input-with-icon">
                            <span class="input-icon">🔒</span>
                            <input type="password" id="confirm_password" name="confirm_password" class="form-control" placeholder="请再次输入密码" required>
                        </div>
                        <div class="validation-message" id="confirm-password-error"></div>
                    </div>

                    {% if error %}
                    <div class="alert alert-danger">{{ error }}</div>
                    {% endif %}

                    <button type="submit" class="btn-login" id="register-button">
                        <span>注册</span>
                        <span class="loading">⟳</span>
                    </button>
                </form>

                <div class="signup">
                    已有账号？ <a href="{{ url_for('user.login') }}">返回登录</a>
                </div>
            </div>
        </div>
    </div>

    <footer>
        <p>© 施琦图书管理系统 - 版权所有</p>
    </footer>

    <script src="{{ url_for('static', filename='js/main.js') }}"></script>
</body>
</html>