<!DOCTYPE html>
<html lang="tr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Kullanıcı Girişi - Üretim Takip Sistemi</title>
    <!-- Stil dosyası dışarıdan çağırılıyor -->
    <link rel="stylesheet" href="{{ url_for('static', filename='css/login.css') }}">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
</head>
<body class="text-slate-800">

    <div class="min-h-screen flex items-center justify-center p-4">
        <div class="w-full max-w-sm">
            <div class="bg-white p-8 rounded-2xl shadow-lg text-center">
                <div class="mx-auto bg-slate-100 rounded-full h-20 w-20 flex items-center justify-center mb-4">
                    <svg xmlns="http://www.w3.org/2000/svg" class="h-12 w-12 text-slate-500" viewBox="0 0 20 20" fill="currentColor">
                      <path fill-rule="evenodd" d="M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z" clip-rule="evenodd" />
                    </svg>
                </div>
                <h1 class="text-2xl font-bold text-slate-900">Kullanıcı Girişi</h1>
                <p class="text-slate-600 mt-2 mb-6">Devam etmek için bilgilerinizi giriniz.</p>

                <!-- Sunucudan gelen flash mesajları göstermek için -->
                {% with messages = get_flashed_messages(with_categories=true) %}
                    {% if messages %}
                        {% for category, message in messages %}
                            <div class="alert alert-{{ category }}">{{ message }}</div>
                        {% endfor %}
                    {% endif %}
                {% endwith %}

                <!-- Form doğrudan sunucuya POST isteği gönderecek şekilde güncellendi -->
                <form method="POST" action="{{ url_for('auth.login') }}">
                    <div class="space-y-4">
                        <div>
                            <label for="kullanici_adi" class="sr-only">Kullanıcı Adı</label>
                            <!-- name attribute'leri app.py'nin bekledeği şekilde ayarlandı -->
                            <input type="text" id="kullanici_adi" name="kullanici_adi" placeholder="Kullanıcı Adı" required class="w-full p-3 border border-gray-300 rounded-lg bg-gray-50 text-base focus:ring-2 focus:ring-indigo-500 focus:outline-none">
                        </div>
                        <div>
                            <label for="sifre" class="sr-only">Şifre</label>
                            <input type="password" id="sifre" name="sifre" placeholder="Şifre" required class="w-full p-3 border border-gray-300 rounded-lg bg-gray-50 text-base focus:ring-2 focus:ring-indigo-500 focus:outline-none">
                        </div>
                        <button type="submit" class="w-full bg-indigo-600 text-white font-bold py-3 px-4 rounded-lg hover:bg-indigo-700 transition-colors">
                            Giriş Yap
                        </button>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <!-- JavaScript mantığı artık sunucu tarafından yönetildiği için script kaldırıldı -->
</body>
</html>
