<!--
  Phase 6: Create Proxy page — wraps ProxyForm in create mode.
-->
<script lang="ts">
	import { goto } from '$app/navigation';
	import type { StandaloneProxy } from '$lib/types';
	import { t } from '$lib/i18n';
	import ProxyForm from '$lib/components/ProxyForm.svelte';
	import { IconGlobe } from '$lib/components/icons';

	function handleSave(_proxy: StandaloneProxy): void {
		goto('/proxies');
	}

	function handleCancel(): void {
		goto('/proxies');
	}
</script>

<svelte:head>
	<title>{$t('proxies.form.title')} - {$t('app.name')}</title>
</svelte:head>

<!-- Back link -->
<div class="mb-6">
	<a
		href="/proxies"
		class="inline-flex items-center gap-1 text-sm text-[var(--text-secondary)] hover:text-[var(--color-brand-600)] transition-colors"
	>
		<svg class="h-4 w-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
			<path d="M19 12H5" /><path d="m12 19-7-7 7-7" />
		</svg>
		{$t('common.back')}
	</a>
</div>

<!-- Header -->
<div class="mb-6 flex items-center gap-3">
	<div class="flex h-10 w-10 items-center justify-center rounded-xl bg-[var(--color-brand-50)] text-[var(--color-brand-600)]">
		<IconGlobe size={22} />
	</div>
	<h1 class="text-xl font-bold text-[var(--text-primary)]">{$t('proxies.form.title')}</h1>
</div>

<!-- Form card -->
<div class="mx-auto max-w-2xl rounded-2xl border border-[var(--border-primary)] bg-[var(--surface-card)] p-6 shadow-[var(--shadow-sm)]">
	<ProxyForm
		mode="create"
		onsave={handleSave}
		oncancel={handleCancel}
	/>
</div>
