{% load i18n %}
{% load static %}
<!DOCTYPE html>
<html lang="{{ LANGUAGE_CODE|default:'en' }}" dir="{% if LANGUAGE_CODE == 'ar' %}rtl{% else %}ltr{% endif %}">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% trans "Investigation Response" %} - PX360</title>
    <link rel="stylesheet" href="{% static 'dist/css/tailwind.css' %}">
    <style>
        @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
        body { font-family: 'Inter', sans-serif; }
        .page-header-gradient {
            background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 50%, #3b82f6 100%);
            color: white; padding: 1.5rem 2rem; border-radius: 1rem; margin-bottom: 1.5rem;
            box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.2);
        }
        .form-section {
            background: #fff; border: 2px solid #e2e8f0; border-radius: 1rem;
            padding: 1.5rem; margin-bottom: 1.5rem;
        }
        .form-label { display: block; font-size: 0.875rem; font-weight: 600; color: #1e293b; margin-bottom: 0.5rem; }
        .form-control {
            width: 100%; padding: 0.75rem 1rem; border: 2px solid #e2e8f0;
            border-radius: 0.75rem; font-size: 0.875rem; transition: all 0.2s ease;
        }
        .form-control:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }
        .btn-primary {
            display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
            padding: 0.75rem 1.5rem; background: #005696; color: white; border-radius: 0.75rem;
            font-weight: 600; transition: all 0.2s ease; border: none; cursor: pointer; width: 100%;
        }
        .btn-primary:hover { background: #007bbd; }
    </style>
</head>
<body class="bg-gray-50 min-h-screen flex items-center py-8 px-4">
    <div class="w-full max-w-3xl mx-auto">
        <div class="page-header-gradient text-center">
            <h1 class="text-2xl font-bold">{% trans "Investigation Questions" %}</h1>
            <p class="text-white/80 mt-1">{% trans "Please answer the following questions" %}</p>
        </div>

        <div class="form-section">
            <div class="p-4 rounded-lg mb-6" style="background:#f0f9ff;border:1px solid #bae6fd">
                <div class="flex items-center gap-2 mb-1">
                    <svg class="w-5 h-5" style="color:#0369a1" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
                    <span class="font-semibold text-sm" style="color:#0369a1">{% trans "Requested by" %}</span>
                </div>
                <p class="font-bold" style="color:#0c4a6e">{{ inv_response.investigation.champion.get_full_name }}</p>
                <p class="text-sm" style="color:#0369a1">{% trans "Department Champion" %}</p>
            </div>

            <div class="border border-gray-200 rounded-xl p-4 mb-6" style="background:#f8fafc">
                <h3 class="text-sm font-semibold text-gray-700 mb-1">{% trans "Complaint" %} #{{ complaint.reference_number }}</h3>
                <p class="text-sm text-gray-600">{{ complaint.title }}</p>
            </div>

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

                {% for pair in question_answer_pairs %}
                <div class="p-4 border-2 border-gray-100 rounded-xl" style="background:#fafafa">
                    <div class="flex items-start gap-2 mb-3">
                        <span class="flex-shrink-0 w-7 h-7 flex items-center justify-center rounded-full text-white text-sm font-bold" style="background:#005696">{{ forloop.counter }}</span>
                        <p class="font-semibold text-gray-800 pt-0.5">{{ pair.question.question_text }}</p>
                    </div>
                    <textarea name="question_{{ pair.question.id }}" rows="4" class="form-control resize-none"
                        placeholder="{% trans 'Type your answer here...' %}"
                        required>{{ pair.existing_answer }}</textarea>
                </div>
                {% endfor %}

                <div class="p-4 rounded-xl" style="background:#fef3c7;border:1px solid #fbbf24">
                    <p class="text-sm" style="color:#92400e">
                        <strong>{% trans "Important:" %}</strong> {% trans "This link can only be used once. After submitting, it will expire." %}
                    </p>
                </div>

                <button type="submit" class="btn-primary py-4 text-lg">
                    {% trans "Submit My Answers" %}
                </button>
            </form>
        </div>

        <div class="text-center mt-6">
            <p class="text-gray-400 text-xs">{% trans "PX360 Complaint Management System" %}</p>
        </div>
    </div>
</body>
</html>
