<!DOCTYPE html>
<!--
  Familiar - Self-hosted AI Agent
  Copyright (c) 2026 George Scott Foley
  
  Licensed under the MIT License
  For commercial licensing, contact: licensing@familiar.ai
-->
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="theme-color" content="#6B21A8">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    
    <title>Login - Familiar</title>
    
    <link rel="manifest" href="{{ url_for('pwa.manifest') }}">
    <script src="https://cdn.tailwindcss.com"></script>
    
    <style>
        body {
            padding-top: env(safe-area-inset-top);
            padding-bottom: env(safe-area-inset-bottom);
        }
    </style>
</head>
<body class="bg-purple-800 min-h-screen flex items-center justify-center p-4">
    <div class="bg-white rounded-2xl shadow-2xl p-8 w-full max-w-sm">
        <div class="text-center mb-8">
            <span class="text-6xl">🐍</span>
            <h1 class="text-2xl font-bold text-gray-800 mt-4">Familiar</h1>
            <p class="text-gray-500 mt-2">Your AI Assistant</p>
        </div>
        
        {% with messages = get_flashed_messages(with_categories=true) %}
        {% if messages %}
        <div class="mb-6">
            {% for category, message in messages %}
            <div class="p-3 rounded-lg mb-2 text-sm
                {% if category == 'error' %}bg-red-100 text-red-700
                {% elif category == 'success' %}bg-green-100 text-green-700
                {% else %}bg-blue-100 text-blue-700{% endif %}">
                {{ message }}
            </div>
            {% endfor %}
        </div>
        {% endif %}
        {% endwith %}
        
        <form method="POST" class="space-y-6">
            <div>
                <label for="email" class="block text-sm font-medium text-gray-700 mb-2">
                    Email Address
                </label>
                <input 
                    type="email" 
                    id="email" 
                    name="email" 
                    required
                    autofocus
                    autocomplete="email"
                    inputmode="email"
                    class="w-full px-4 py-3 border border-gray-300 rounded-xl focus:ring-2 focus:ring-purple-500 focus:border-transparent text-lg"
                    placeholder="you@example.org"
                >
            </div>
            
            <button 
                type="submit"
                class="w-full py-3 bg-purple-600 text-white rounded-xl font-semibold hover:bg-purple-700 active:bg-purple-800 transition-colors text-lg"
            >
                Continue
            </button>
        </form>
        
        <p class="text-center text-sm text-gray-500 mt-6">
            We'll send you a magic link to sign in.
        </p>
    </div>
</body>
</html>
