<?php defined('BASEPATH') or exit('No direct script access allowed'); ?>

<?php
$client_name = !empty($client_info->name) ? $client_info->name : lang('client');
$delete_items = array(
    lang('primary_contact'),
    lang('all_users'),
    lang('messages'),
    lang('mailbox'),
    lang('expense'),
    lang('payments'),
    lang('quotations'),
    lang('tickets'),
    lang('project'),
    lang('milestones'),
    lang('invoices'),
    lang('estimates'),
    lang('bugs'),
    lang('leads'),
    lang('call'),
    lang('mettings'),
    lang('comment'),
    lang('files'),
);
?>

<div class="mx-auto max-w-5xl space-y-6">
    <div class="rounded-2xl border border-rose-200 bg-rose-50/70 p-6 shadow-sm dark:border-rose-900/40 dark:bg-rose-950/20">
        <div class="flex items-start gap-4">
            <div class="flex h-12 w-12 shrink-0 items-center justify-center rounded-2xl bg-rose-100 text-rose-600 dark:bg-rose-900/40 dark:text-rose-300">
                <i data-lucide="alert-triangle" class="h-6 w-6"></i>
            </div>
            <div class="space-y-3">
                <div>
                    <h2 class="text-2xl font-semibold text-slate-900 dark:text-slate-100">
                        <?= lang('delete') . ' ' . html_escape($client_name) ?>
                    </h2>
                    <p class="mt-2 text-sm text-rose-700 dark:text-rose-300">
                        <?= lang('delete_note_1') . ' ' . html_escape($client_name) . ' ' . lang('delete_note_2') ?>
                    </p>
                </div>
                <p class="text-sm font-medium text-slate-700 dark:text-slate-200">
                    <?= lang('delete_note_3') . ' ' . html_escape($client_name) . ' ' . lang('delete_note_4') ?>
                </p>
            </div>
        </div>
    </div>

    <div class="rounded-2xl border border-border bg-card p-6 shadow-sm">
        <form
            role="form"
            enctype="multipart/form-data"
            id="form"
            action="<?= base_url('admin/client/delete_client/' . $client_info->client_id . '/yes') ?>"
            method="post"
            class="space-y-6">

            <div>
                <h3 class="text-sm font-semibold uppercase tracking-[0.18em] text-slate-500 dark:text-slate-400">
                    <?= lang('affected_data') ?: 'Affected Data' ?>
                </h3>
                <p class="mt-2 text-sm text-slate-600 dark:text-slate-300">
                    <?= lang('if_delete_this') ?: 'Deleting this client will also remove the related records below.' ?>
                </p>
            </div>

            <div class="grid gap-3 md:grid-cols-2 xl:grid-cols-3">
                <?php foreach ($delete_items as $item_label) { ?>
                    <div class="flex items-center gap-3 rounded-2xl border border-slate-200 bg-slate-50 px-4 py-3 text-sm font-medium text-slate-700 dark:border-slate-700 dark:bg-slate-800/80 dark:text-slate-200">
                        <span class="inline-flex h-9 w-9 items-center justify-center rounded-xl bg-emerald-100 text-emerald-600 dark:bg-emerald-900/30 dark:text-emerald-300">
                            <i data-lucide="check" class="h-4 w-4"></i>
                        </span>
                        <span><?= html_escape($item_label . ' ' . lang('wil_be_deleted')) ?></span>
                    </div>
                <?php } ?>
            </div>

            <div class="flex flex-wrap items-center gap-3 border-t border-border pt-4">
                <button
                    type="submit"
                    name="submit"
                    value="1"
                    class="inline-flex items-center gap-2 rounded-xl bg-rose-600 px-5 py-3 text-sm font-semibold text-white shadow-sm transition hover:bg-rose-500">
                    <i data-lucide="trash-2" class="h-4 w-4"></i>
                    <?= lang('proceed_anyway') ?>
                </button>
                <a
                    href="<?= base_url('admin/client/manage_client') ?>"
                    class="inline-flex items-center gap-2 rounded-xl border border-slate-300 bg-white px-5 py-3 text-sm font-semibold text-slate-700 transition hover:border-slate-400 hover:bg-slate-50 dark:border-slate-600 dark:bg-slate-900 dark:text-slate-200 dark:hover:bg-slate-800">
                    <i data-lucide="x" class="h-4 w-4"></i>
                    <?= lang('cancel') ?>
                </a>
            </div>
        </form>
    </div>
</div>
