{% extends "layouts/base.html" %}
{% load i18n %}

{% block title %}{{ checklist_item.get_localized_text }} - {% trans "Sign Acknowledgement" %}{% endblock %}

{% block content %}
<div class="p-6 md:p-8 bg-gradient-to-br from-light to-blue-50 min-h-screen">
    <div class="max-w-3xl mx-auto">
        <!-- Back Button -->
        <a href="{% url 'accounts:acknowledgements:ack_dashboard' %}" class="inline-flex items-center gap-2 text-blue hover:text-navy mb-6 font-medium">
            <i data-lucide="arrow-left" class="w-4 h-4"></i>
            {% trans "Back to Dashboard" %}
        </a>

        <!-- Acknowledgement Card -->
        <div class="bg-white rounded-2xl shadow-sm border border-blue-100 overflow-hidden">
            <div class="px-6 py-5 border-b border-blue-100 bg-gradient-to-r from-blue-50 to-transparent">
                <div class="flex items-center gap-3 mb-2">
                    <span class="inline-flex items-center px-3 py-1 bg-blue-100 text-blue-700 rounded-full text-xs font-bold">
                        {{ checklist_item.category.get_localized_name }}
                    </span>
                    {% if checklist_item.is_required %}
                    <span class="inline-flex items-center px-3 py-1 bg-red-100 text-red-700 rounded-full text-xs font-bold">
                        {% trans "Required" %}
                    </span>
                    {% endif %}
                </div>
                <h1 class="text-2xl font-bold text-navy">{{ checklist_item.get_localized_text }}</h1>
            </div>

            <div class="p-6">
                <!-- Content -->
                {% if checklist_item.description_en %}
                <div class="mb-6 p-4 bg-blue-50 rounded-xl border border-blue-100">
                    <h3 class="font-bold text-navy mb-2">{% trans "Important Information" %}</h3>
                    <p class="text-slate">{{ checklist_item.description_en }}</p>
                </div>
                {% endif %}

                <!-- Acknowledgement Text -->
                <div class="mb-6">
                    <h3 class="font-bold text-navy mb-3">{% trans "Acknowledgement Statement" %}</h3>
                    <p class="text-slate leading-relaxed">{{ checklist_item.get_localized_text }}</p>
                </div>

                <!-- Signature Form -->
                <form method="post" class="space-y-6">
                    {% csrf_token %}

                    <div>
                        <label class="block text-sm font-bold text-navy mb-2">
                            {% trans "Your Signature" %} <span class="text-red-500">*</span>
                        </label>
                        <input type="text" name="signature" required
                               class="w-full px-4 py-3 border-2 border-blue-100 rounded-xl text-navy focus:ring-2 focus:ring-blue focus:border-transparent transition"
                               placeholder="{% trans 'Type your full name as signature' %}"
                               value="{{ request.user.get_full_name|default:request.user.email }}">
                        <p class="text-xs text-slate mt-2">
                            {% trans "By typing your name above, you acknowledge that you have read and understood this statement." %}
                        </p>
                    </div>

                    <!-- Info Box -->
                    <div class="bg-amber-50 border border-amber-200 rounded-xl p-4">
                        <div class="flex items-start gap-3">
                            <i data-lucide="info" class="w-5 h-5 text-amber-600 mt-0.5 flex-shrink-0"></i>
                            <div>
                                <p class="text-sm font-bold text-amber-800 mb-1">{% trans "Legal Notice" %}</p>
                                <p class="text-sm text-amber-700">
                                    {% trans "This acknowledgement is legally binding. A PDF copy will be generated and stored in your records." %}
                                </p>
                            </div>
                        </div>
                    </div>

                    <!-- Submit Buttons -->
                    <div class="flex gap-3 pt-6 border-t border-blue-100">
                        <button type="submit" class="flex-1 inline-flex items-center justify-center gap-2 px-6 py-3 bg-gradient-to-r from-blue to-navy text-white rounded-xl font-semibold hover:from-navy hover:to-blue transition shadow-lg shadow-blue-200">
                            <i data-lucide="check-circle" class="w-5 h-5"></i>
                            {% trans "I Acknowledge and Sign" %}
                        </button>
                        <a href="{% url 'accounts:acknowledgements:ack_dashboard' %}" class="inline-flex items-center justify-center gap-2 px-6 py-3 bg-white border-2 border-slate-200 text-slate-700 rounded-xl font-semibold hover:bg-slate-50 transition">
                            <i data-lucide="x" class="w-5 h-5"></i>
                            {% trans "Cancel" %}
                        </a>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<script>
document.addEventListener('DOMContentLoaded', function() {
    lucide.createIcons();
});
</script>
{% endblock %}
