{% extends "base.html" %}
{% from 'components/ui.html' import page_header %}

{% block content %}
{{ page_header(
    icon_class='fas fa-lock',
    title_text='Change Password',
    subtitle_text=(_('You must change your password before continuing.') if current_user.password_change_required else _('Update your password.')),
    breadcrumbs=[
        {'text': 'Profile', 'url': url_for('auth.profile')},
        {'text': 'Change Password'}
    ]
) }}

<div class="bg-card-light dark:bg-card-dark p-4 sm:p-6 rounded-xl border border-border-light dark:border-border-dark shadow-sm max-w-md mx-auto">
    <form method="POST">
        <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
        <div class="space-y-6">
            {% if current_user.has_password %}
            <div>
                <label for="current_password" class="form-label">{{ _('Current Password') }}</label>
                <input type="password" name="current_password" id="current_password" required class="form-input">
            </div>
            {% endif %}
            <div>
                <label for="new_password" class="form-label">{{ _('New Password') }}</label>
                <input type="password" name="new_password" id="new_password" required minlength="8" class="form-input">
                <p class="text-xs text-text-muted-light dark:text-text-muted-dark mt-1">{{ _('Password must be at least 8 characters long.') }}</p>
            </div>
            <div>
                <label for="confirm_password" class="form-label">{{ _('Confirm New Password') }}</label>
                <input type="password" name="confirm_password" id="confirm_password" required minlength="8" class="form-input">
            </div>
        </div>
        <div class="mt-8 border-t border-border-light dark:border-border-dark pt-6 flex flex-col-reverse sm:flex-row justify-end gap-3">
            {% if not current_user.password_change_required %}
            <a href="{{ url_for('auth.profile') }}" class="btn btn-secondary text-center">{{ _('Cancel') }}</a>
            {% endif %}
            <button type="submit" class="btn btn-primary">{{ _('Change Password') }}</button>
        </div>
    </form>
</div>
{% endblock %}

