{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Admin Login | Matrichaya Properties</title>
    
    <!-- Tailwind CSS -->
    <script src="https://cdn.tailwindcss.com"></script>
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        'matrichaya-green': '#22c55e',
                        'matrichaya-dark-green': '#16a34a',
                    }
                }
            }
        }
    </script>
    
    <!-- Font Awesome -->
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
</head>
<body class="bg-gradient-to-br from-matrichaya-green to-matrichaya-dark-green min-h-screen flex items-center justify-center">
    <div class="max-w-md w-full mx-4">
        <!-- Login Card -->
        <div class="bg-white rounded-lg shadow-xl p-8">
            <!-- Header -->
            <div class="text-center mb-8">
                <div class="w-16 h-16 bg-matrichaya-green rounded-lg flex items-center justify-center mx-auto mb-4">
                    <i class="fas fa-cogs text-white text-2xl"></i>
                </div>
                <h1 class="text-2xl font-bold text-gray-800">Admin Panel</h1>
                <p class="text-gray-600 mt-2">Matrichaya Properties Ltd.</p>
            </div>
            
            <!-- Messages -->
            {% if messages %}
                {% for message in messages %}
                    <div class="mb-4 p-4 rounded-lg {% if message.tags == 'error' %}bg-red-100 text-red-700 border border-red-200{% elif message.tags == 'success' %}bg-green-100 text-green-700 border border-green-200{% elif message.tags == 'info' %}bg-blue-100 text-blue-700 border border-blue-200{% else %}bg-gray-100 text-gray-700 border border-gray-200{% endif %}">
                        <div class="flex items-center">
                            {% if message.tags == 'error' %}
                                <i class="fas fa-exclamation-circle mr-2"></i>
                            {% elif message.tags == 'success' %}
                                <i class="fas fa-check-circle mr-2"></i>
                            {% elif message.tags == 'info' %}
                                <i class="fas fa-info-circle mr-2"></i>
                            {% else %}
                                <i class="fas fa-bell mr-2"></i>
                            {% endif %}
                            {{ message }}
                        </div>
                    </div>
                {% endfor %}
            {% endif %}
            
            <!-- Login Form -->
            <form method="post" class="space-y-6">
                {% csrf_token %}
                
                <div>
                    <label for="username" class="block text-sm font-medium text-gray-700 mb-2">
                        <i class="fas fa-user mr-2"></i>Username
                    </label>
                    <input type="text" 
                           id="username" 
                           name="username" 
                           required
                           class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-matrichaya-green focus:border-transparent transition duration-200"
                           placeholder="Enter your username">
                </div>
                
                <div>
                    <label for="password" class="block text-sm font-medium text-gray-700 mb-2">
                        <i class="fas fa-lock mr-2"></i>Password
                    </label>
                    <input type="password" 
                           id="password" 
                           name="password" 
                           required
                           class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-matrichaya-green focus:border-transparent transition duration-200"
                           placeholder="Enter your password">
                </div>
                
                <button type="submit" 
                        class="w-full bg-matrichaya-green hover:bg-matrichaya-dark-green text-white font-semibold py-3 px-4 rounded-lg transition duration-200 flex items-center justify-center">
                    <i class="fas fa-sign-in-alt mr-2"></i>
                    Sign In
                </button>
            </form>
            
            <!-- Footer -->
            <div class="mt-8 text-center">
                <p class="text-sm text-gray-600">
                    <i class="fas fa-shield-alt mr-1"></i>
                    Secure Admin Access
                </p>
                <a href="{% url 'home' %}" class="text-sm text-matrichaya-green hover:text-matrichaya-dark-green mt-2 inline-block">
                    <i class="fas fa-home mr-1"></i>
                    Back to Website
                </a>
            </div>
        </div>
        
    </div>
    
    <script>
        // Auto-hide messages after 5 seconds
        setTimeout(function() {
            const alerts = document.querySelectorAll('.bg-red-100, .bg-green-100, .bg-blue-100');
            alerts.forEach(function(alert) {
                alert.style.transition = 'opacity 0.5s';
                alert.style.opacity = '0';
                setTimeout(function() {
                    alert.remove();
                }, 500);
            });
        }, 5000);
    </script>
</body>
</html>
