<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Login - ChatBot</title>
    <style>
        /* Use your existing beautiful login CSS here */
        @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;600&display=swap');

        /* Your existing login styles... */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Poppins', sans-serif;
        }

        body {
            height: 100vh;
            background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }

        .login-container {
            background: white;
            max-width: 400px;
            width: 100%;
            padding: 40px 30px 50px;
            border-radius: 20px;
            box-shadow: 0 20px 40px rgba(0,0,0,0.2);
            text-align: center;
            transition: transform 0.3s ease;
        }

        .login-container:hover {
            transform: translateY(-8px);
            box-shadow: 0 30px 60px rgba(0,0,0,0.3);
        }

        h2 {
            font-weight: 600;
            color: #333;
            margin-bottom: 30px;
            font-size: 28px;
            letter-spacing: 1.2px;
        }

        .input-group {
            margin-bottom: 25px;
            text-align: left;
        }

        label {
            display: block;
            margin-bottom: 8px;
            color: #555;
            font-weight: 600;
            font-size: 14px;
        }

        input[type="email"],
        input[type="password"] {
            width: 100%;
            padding: 14px 18px;
            font-size: 16px;
            border-radius: 12px;
            border: 2px solid #ddd;
            transition: 0.3s border-color ease;
            box-shadow: 0 2px 5px rgba(0,0,0,0.05);
        }

        input[type="email"]:focus,
        input[type="password"]:focus {
            border-color: #2575fc;
            outline: none;
            box-shadow: 0 0 12px rgba(37, 117, 252, 0.5);
        }

        .checkbox-group {
            display: flex;
            align-items: center;
            margin: 15px 0;
            text-align: left;
        }

        .checkbox-group input[type="checkbox"] {
            margin-right: 8px;
        }

        .checkbox-group label {
            margin: 0;
            font-size: 14px;
            color: #666;
        }

        button {
            width: 100%;
            padding: 16px 0;
            margin-top: 10px;
            background-color: #2575fc;
            border: none;
            border-radius: 14px;
            color: white;
            font-size: 18px;
            font-weight: 700;
            letter-spacing: 1px;
            cursor: pointer;
            box-shadow: 0 10px 20px rgba(37, 117, 252, 0.4);
            transition: background-color 0.3s ease, box-shadow 0.3s ease;
        }

        button:hover {
            background-color: #1859d6;
            box-shadow: 0 15px 25px rgba(24, 89, 214, 0.6);
        }

        .register-link {
            margin-top: 20px;
            font-size: 14px;
            color: #666;
        }

        .register-link a {
            color: #2575fc;
            text-decoration: none;
            font-weight: 600;
        }

        .register-link a:hover {
            text-decoration: underline;
        }

        .error-message {
            margin-top: 20px;
            color: #ff4d4f;
            font-weight: 600;
            font-size: 15px;
            text-align: center;
            background: #ffe6e6;
            padding: 10px 15px;
            border-radius: 10px;
            box-shadow: 0 2px 6px rgba(255,77,79,0.3);
            display: none;
        }
    </style>
</head>
<body>
    <div class="login-container">
        <h2>Login to Your Account</h2>

        <!-- Flash Messages -->
        {% with messages = get_flashed_messages(with_categories=true) %}
            {% if messages %}
                <div class="error-message" style="display: block;">
                    {% for category, message in messages %}
                        {{ message }}
                    {% endfor %}
                </div>
            {% endif %}
        {% endwith %}

        <form method="POST" action="{{ url_for('login') }}">
            <div class="input-group">
                <label for="email">Email Address</label>
                <input type="email" id="email" name="email"
                       placeholder="you@example.com"
                       value="{{ request.form.email if request.form.email }}"
                       required />
            </div>
            <div class="input-group">
                <label for="password">Password</label>
                <input type="password" id="password" name="password"
                       placeholder="Your password" required />
            </div>
            <div class="checkbox-group">
                <input type="checkbox" id="remember_me" name="remember_me" />
                <label for="remember_me">Remember me</label>
            </div>
            <button type="submit">Log In</button>
            <div class="register-link">
                Don't have an account? <a href="{{ url_for('register') }}">Sign up here</a>
            </div>
        </form>
    </div>
</body>
</html>