<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block title %}NAIMS - Namibia Agricultural Information Management System{% endblock %}</title>
    <meta name="description" content="Centralized agricultural data platform for the Government of Namibia.">
    <!-- Google Fonts -->
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Montserrat:wght@700&display=swap" rel="stylesheet">
    <!-- Bootstrap 5 CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Custom Theme Colors -->
    <style>
        :root {
            --naims-blue: #003580;
            --naims-green: #009543;
            --naims-yellow: #FFD100;
            --naims-white: #FFFFFF;
            --naims-bg: #f8f9fa;
        }
        body {
            font-family: 'Inter', sans-serif;
            background-color: var(--naims-bg);
            color: #333;
        }
        h1, h2, h3, h4, h5, h6 {
            font-family: 'Montserrat', sans-serif;
            color: var(--naims-blue);
        }
        .navbar {
            background-color: var(--naims-blue);
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
        .navbar-brand, .nav-link {
            color: var(--naims-white) !important;
        }
        .btn-primary {
            background-color: var(--naims-blue);
            border-color: var(--naims-blue);
        }
        .btn-primary:hover {
            background-color: #00265c;
            border-color: #00265c;
        }
        .btn-success {
            background-color: var(--naims-green);
            border-color: var(--naims-green);
        }
        .card {
            border: none;
            border-radius: 12px;
            box-shadow: 0 4px 6px rgba(0,0,0,0.05);
            transition: transform 0.2s;
        }
        .card:hover {
            transform: translateY(-5px);
        }
        .hero-section {
            background: linear-gradient(135deg, var(--naims-blue) 0%, #0056b3 100%);
            color: var(--naims-white);
            padding: 80px 0;
            border-bottom: 5px solid var(--naims-yellow);
        }
    </style>
    {% block extra_css %}{% endblock %}
</head>
<body>
    <nav class="navbar navbar-expand-lg sticky-top">
        <div class="container">
            <a class="navbar-brand fw-bold" href="{% url 'home' %}">
                <span style="color: var(--naims-yellow)">NAIMS</span> Namibia
            </a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav ms-auto">
                    <li class="nav-item"><a class="nav-link" href="{% url 'home' %}">Dashboard</a></li>
                    {% if user.is_authenticated %}
                        <li class="nav-item"><a class="nav-link" href="{% url 'farmer_list' %}">Farmer Registry</a></li>
                        <li class="nav-item"><a class="nav-link" href="{% url 'farmer_register' %}">Register New</a></li>
                        <li class="nav-item"><a class="nav-link" href="/admin/">Admin Panel</a></li>
                        <li class="nav-item">
                            <form method="post" action="{% url 'logout' %}" class="d-inline">
                                {% csrf_token %}
                                <button type="submit" class="nav-link btn btn-link" style="border: none; background: none; text-decoration: none;">Logout ({{ user.username }})</button>
                            </form>
                        </li>
                    {% else %}
                        <li class="nav-item"><a class="nav-link" href="{% url 'login' %}">Login</a></li>
                    {% endif %}
                </ul>
            </div>
        </div>
    </nav>

    {% if messages %}
        <div class="container mt-3">
            {% for message in messages %}
                <div class="alert alert-{{ message.tags }} alert-dismissible fade show">
                    {{ message }}
                    <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
                </div>
            {% endfor %}
        </div>
    {% endif %}

    <main>
        {% block content %}{% endblock %}
    </main>

    <footer class="bg-dark text-white py-4 mt-5">
        <div class="container text-center">
            <p class="mb-0">&copy; 2026 Ministry of Agriculture, Water and Land Reform (MAWLR) - Republic of Namibia</p>
            <small class="text-muted">A National Digital Platform Aligned to SADC AIMS & FAO Standards</small>
        </div>
    </footer>

    <!-- Bootstrap 5 JS Bundle -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
    {% block extra_js %}{% endblock %}
</body>
</html>