{% extends 'layouts/base.html' %}
{% load i18n static %}

{% block title %}{% trans "Delete Source" %}{% endblock %}

{% block extra_css %}
<style>
    :root {
        --hh-navy: #005696;
        --hh-blue: #007bbd;
        --hh-light: #eef6fb;
        --hh-slate: #64748b;
    }

    .page-header-gradient {
        background: linear-gradient(135deg, var(--hh-navy) 0%, #0069a8 50%, var(--hh-blue) 100%);
        color: white;
        padding: 1.5rem 2rem;
        border-radius: 1rem;
        margin-bottom: 1.5rem;
        box-shadow: 0 10px 15px -3px rgba(0, 86, 150, 0.2);
    }

    .section-card {
        background: white;
        border-radius: 1rem;
        border: 2px solid #e2e8f0;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
        overflow: hidden;
        transition: all 0.3s ease;
    }
    .section-card:hover {
        border-color: #005696;
        box-shadow: 0 10px 25px -5px rgba(0, 86, 150, 0.15);
    }

    .section-header {
        padding: 1rem 1.5rem;
        border-bottom: 2px solid #e2e8f0;
        background: linear-gradient(to right, #f8fafc, #f1f5f9);
        display: flex;
        align-items: center;
        gap: 0.75rem;
    }

    .section-icon {
        width: 40px;
        height: 40px;
        border-radius: 0.75rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .btn-transition {
        transition: all 0.2s ease-in-out;
    }
</style>
{% endblock %}

{% block content %}
<div class="px-6 py-4">
    <div class="page-header-gradient">
        <div class="flex justify-between items-center">
            <div>
                <h1 class="text-2xl font-bold mb-1">{% trans "Delete Source" %}</h1>
                <p class="text-blue-100 text-sm">{% trans "Confirm deletion of standard source" %}</p>
            </div>
            <div class="flex gap-2">
                <a href="{% url 'standards:source_list' %}" class="btn-transition inline-flex items-center px-4 py-2.5 bg-white/10 border-2 border-white/30 text-white font-semibold rounded-xl hover:bg-white hover:text-navy transition">
                    <i data-lucide="arrow-left" class="w-4 h-4 me-2"></i>{% trans "Back to Sources" %}
                </a>
            </div>
        </div>
    </div>

    <div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
        <div class="lg:col-span-2">
            <div class="section-card">
                <div class="p-6">
                    <div class="bg-yellow-50 border-l-4 border-yellow-400 p-4 mb-6 rounded-r-lg">
                        <div class="flex items-start">
                            <i data-lucide="alert-triangle" class="w-5 h-5 text-yellow-600 flex-shrink-0 mt-0.5"></i>
                            <div class="ml-3">
                                <h3 class="text-sm font-semibold text-yellow-800">{% trans "Warning" %}</h3>
                                <p class="text-sm text-yellow-700 mt-1">{% trans "This action cannot be undone." %}</p>
                            </div>
                        </div>
                    </div>

                    <h3 class="text-lg font-semibold text-navy mb-4">{% trans "Are you sure you want to delete this source?" %}</h3>

                    <div class="bg-slate-50 rounded-lg p-4 mb-6">
                        <dl class="divide-y divide-slate-100">
                            <div class="py-3 flex justify-between">
                                <dt class="text-sm font-semibold text-slate">{% trans "Code" %}</dt>
                                <dd class="text-sm font-semibold text-navy">{{ source.code }}</dd>
                            </div>
                            <div class="py-3 flex justify-between">
                                <dt class="text-sm font-semibold text-slate">{% trans "Name" %}</dt>
                                <dd class="text-sm font-semibold text-navy">{{ source.name }}</dd>
                            </div>
                            <div class="py-3 flex justify-between">
                                <dt class="text-sm font-semibold text-slate">{% trans "Arabic Name" %}</dt>
                                <dd class="text-sm text-navy">{{ source.name_ar|default:"-" }}</dd>
                            </div>
                            <div class="py-3 flex justify-between">
                                <dt class="text-sm font-semibold text-slate">{% trans "Description" %}</dt>
                                <dd class="text-sm text-navy">{{ source.description|default:"-" }}</dd>
                            </div>
                            <div class="py-3 flex justify-between">
                                <dt class="text-sm font-semibold text-slate">{% trans "Website" %}</dt>
                                <dd class="text-sm">
                                    {% if source.website %}
                                    <a href="{{ source.website }}" target="_blank" class="text-blue-600 hover:text-blue-800 transition">
                                        {{ source.website }}
                                    </a>
                                    {% else %}
                                    <span class="text-slate-400">-</span>
                                    {% endif %}
                                </dd>
                            </div>
                        </dl>
                    </div>

                    <form method="post">
                        {% csrf_token %}
                        <div class="flex gap-3">
                            <button type="submit" class="btn-transition inline-flex items-center px-6 py-2.5 bg-red-500 text-white font-semibold rounded-xl hover:bg-red-600 transition">
                                <i data-lucide="trash-2" class="w-4 h-4 me-2"></i>{% trans "Delete Source" %}
                            </button>
                            <a href="{% url 'standards:source_list' %}" class="btn-transition inline-flex items-center px-6 py-2.5 border border-slate-200 text-slate rounded-xl font-semibold hover:bg-slate-50 transition">
                                {% trans "Cancel" %}
                            </a>
                        </div>
                    </form>
                </div>
            </div>
        </div>

        <div class="lg:col-span-1">
            <div class="section-card">
                <div class="section-header">
                    <div class="section-icon bg-red-100">
                        <i data-lucide="alert-circle" class="w-5 h-5 text-red-600"></i>
                    </div>
                    <h5 class="text-lg font-semibold text-navy">{% trans "Impact" %}</h5>
                </div>
                <div class="p-6">
                    <p class="text-sm text-slate mb-3">
                        {% trans "Deleting this source will affect:" %}
                    </p>
                    <ul class="text-sm text-slate space-y-2 mb-4">
                        <li class="flex items-start">
                            <i data-lucide="x" class="w-4 h-4 text-red-500 flex-shrink-0 mt-0.5 mr-2"></i>
                            <span>{% trans "All standards linked to this source" %}</span>
                        </li>
                        <li class="flex items-start">
                            <i data-lucide="x" class="w-4 h-4 text-red-500 flex-shrink-0 mt-0.5 mr-2"></i>
                            <span>{% trans "Compliance records for those standards" %}</span>
                        </li>
                        <li class="flex items-start">
                            <i data-lucide="x" class="w-4 h-4 text-red-500 flex-shrink-0 mt-0.5 mr-2"></i>
                            <span>{% trans "Any reports or analytics using this data" %}</span>
                        </li>
                    </ul>
                    <div class="bg-blue-50 rounded-lg p-3 mt-4">
                        <p class="text-xs text-blue-800">
                            <strong>{% trans "Consider:" %}</strong> {% trans "You may want to mark this source as inactive instead of deleting it." %}
                        </p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}
