<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{ _('Forgot password') }} - {{ app_name }}</title>
    <link rel="icon" type="image/svg+xml" href="{{ url_for('static', filename='images/timetracker-logo.svg') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='dist/output.css') }}?v={{ app_version }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='toast-notifications.css') }}?v={{ app_version }}">
</head>
<body class="font-sans antialiased bg-background-light dark:bg-background-dark text-text-light dark:text-text-dark">
    <div class="min-h-screen flex items-center justify-center px-4">
        <div class="w-full max-w-lg bg-card-light dark:bg-card-dark border border-border-light dark:border-border-dark rounded-xl shadow-lg overflow-hidden p-6 sm:p-8">
            <div class="flex items-center gap-3 mb-4">
                <img src="{{ url_for('static', filename='images/timetracker-logo.svg') }}" alt="TimeTracker Logo" class="w-10 h-10">
                <span class="text-xl font-bold bg-gradient-to-r from-primary to-secondary bg-clip-text text-transparent">TimeTracker</span>
            </div>

            <h2 class="text-2xl font-bold tracking-tight">{{ _('Reset your password') }}</h2>
            <p class="mt-2 text-sm text-text-muted-light dark:text-text-muted-dark">
                {{ _('Enter your username or email address. If an account matches and email is configured, we will send you a reset link.') }}
            </p>

            <form class="mt-6" method="POST" action="{{ url_for('auth.forgot_password') }}">
                <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">

                <label for="identifier" class="block mb-2 text-sm font-medium">{{ _('Username or email') }}</label>
                <input type="text" name="identifier" id="identifier" autocomplete="username email"
                       class="w-full bg-background-light dark:bg-gray-700 border border-border-light dark:border-border-dark rounded-lg px-3 py-2.5 text-base text-text-light dark:text-text-dark placeholder-text-muted-light dark:placeholder-text-muted-dark focus:outline-none focus:ring-2 focus:ring-primary"
                       placeholder="{{ _('your-username or you@example.com') }}" required>

                <button type="submit" class="btn btn-primary w-full mt-6">{{ _('Send reset link') }}</button>

                <div class="mt-4 text-center">
                    <a href="{{ url_for('auth.login') }}" class="text-sm text-primary hover:underline">{{ _('Back to sign in') }}</a>
                </div>
            </form>
        </div>
    </div>

    <!-- Flash Messages (hidden; converted to toasts) -->
    <div id="flash-messages-container" class="hidden">
        {% with messages = get_flashed_messages(with_categories=true) %}
            {% if messages %}
                {% for category, message in messages %}
                    <div class="alert {% if category == 'success' %}alert-success{% elif category == 'error' %}alert-danger{% elif category == 'warning' %}alert-warning{% else %}alert-info{% endif %}" data-toast-message="{{ message }}" data-toast-type="{{ category }}"></div>
                {% endfor %}
            {% endif %}
        {% endwith %}
    </div>

    <script src="{{ url_for('static', filename='toast-notifications.js') }}?v={{ app_version }}"></script>
    <script src="{{ url_for('static', filename='error-handling-enhanced.js') }}"></script>
</body>
</html>

