@page "/logout2"
@{
    ViewData["Title"] = "Logout 2";
}
@{
    ViewData["SidebarVariant"] = "2";
    ViewData["HideChrome"] = true;
    ViewData["Css:auth2.css"] = "css/auth2.css";

}

<section class="min-h-screen flex" x-data="{ loading: false, notification: { show: false, message: '' }, logoutSuccess: false }">
    <div class="hidden lg:flex w-1/2 bg-gradient-to-br from-blue-50/30 to-white items-center justify-center p-12">
        <div class="max-w-md">
            <div class="flex items-center gap-3 mb-8">
                <div class="w-14 h-14 bg-blue-600 rounded-xl flex items-center justify-center shadow-lg shadow-blue-200">
                    <svg class="w-8 h-8 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"/></svg>
                </div>
                <div>
                    <div class="text-2xl font-bold text-gray-900">EnterpriseKit</div>
                    <div class="text-sm text-gray-500">Enterprise Application Platform</div>
                </div>
            </div>
            <h2 class="text-3xl font-bold text-gray-900 leading-tight mb-4">Secure<br/>Session Logout</h2>
            <p class="text-gray-500 leading-relaxed mb-8">End your current session securely. All active sessions will be terminated and you will be redirected to the login page.</p>
            <div class="space-y-4">
                <div class="flex items-start gap-3">
                    <div class="w-5 h-5 rounded bg-blue-50 flex items-center justify-center flex-shrink-0 mt-0.5"><svg class="w-3 h-3 text-blue-600" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="3"><path stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"/></svg></div>
                    <div><span class="font-semibold text-gray-900 text-sm">Secure Session Termination</span><p class="text-xs text-gray-400 mt-0.5">All tokens and sessions are invalidated immediately</p></div>
                </div>
                <div class="flex items-start gap-3">
                    <div class="w-5 h-5 rounded bg-blue-50 flex items-center justify-center flex-shrink-0 mt-0.5"><svg class="w-3 h-3 text-blue-600" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="3"><path stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"/></svg></div>
                    <div><span class="font-semibold text-gray-900 text-sm">Data Protection</span><p class="text-xs text-gray-400 mt-0.5">Your data remains encrypted and protected after logout</p></div>
                </div>
                <div class="flex items-start gap-3">
                    <div class="w-5 h-5 rounded bg-blue-50 flex items-center justify-center flex-shrink-0 mt-0.5"><svg class="w-3 h-3 text-blue-600" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="3"><path stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"/></svg></div>
                    <div><span class="font-semibold text-gray-900 text-sm">Quick Re-Access</span><p class="text-xs text-gray-400 mt-0.5">Sign back in anytime with your credentials</p></div>
                </div>
            </div>
            <div class="mt-10 p-4 bg-blue-50/30 border border-blue-100 rounded-xl">
                <div class="flex items-center gap-3">
                    <div class="w-10 h-10 rounded-full bg-blue-100 flex items-center justify-center flex-shrink-0">
                        <svg class="w-5 h-5 text-blue-600" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="1.5"><path stroke-linecap="round" stroke-linejoin="round" d="M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z"/></svg>
                    </div>
                    <div>
                        <div class="text-sm font-semibold text-gray-900">Secure by Default</div>
                        <div class="text-xs text-gray-400">All sessions are encrypted with enterprise-grade security</div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="w-full lg:w-1/2 flex items-center justify-center p-6 sm:p-10 lg:p-16">
        <div class="w-full max-w-md">
            <div class="text-center mb-8">
                <h2 class="text-2xl font-bold text-gray-900">Logout</h2>
                <p class="text-gray-500 text-sm mt-3 max-w-sm mx-auto">Are you sure you want to logout? Click below button to confirm.</p>
            </div>

            <div class="space-y-3">
                <button class="btn-primary" type="button" @@click="
                    loading = true;
                    logoutSuccess = false;
                    setTimeout(() => {
                        loading = false;
                        logoutSuccess = true;
                        notification = { show: true, message: 'You have been logged out successfully. Redirecting to login page...' };
                        setTimeout(() => { notification.show = false; }, 4000);
                    }, 3000);
                " :disabled="loading">
                    <template x-if="!loading">
                        <span class="flex items-center gap-2">
                            <svg class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M15.75 9V5.25A2.25 2.25 0 0013.5 3h-6a2.25 2.25 0 00-2.25 2.25v13.5A2.25 2.25 0 007.5 21h6a2.25 2.25 0 002.25-2.25V15M12 9l-3 3m0 0l3 3m-3-3h12.75"/></svg>
                            Logout
                        </span>
                    </template>
                    <template x-if="loading">
                        <span class="flex items-center gap-2">
                            <svg class="animate-spin w-4 h-4" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"/><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"/></svg>
                            Logging out...
                        </span>
                    </template>
                </button>
                <a href="/dashboard2" class="btn-outline block text-center no-underline" :class="{ 'pointer-events-none opacity-50': loading }">
                    <span class="flex items-center gap-2 justify-center">
                        <svg class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M9 15L3 9m0 0l6-6M3 9h12a6 6 0 010 12h-3"/></svg>
                        Cancel
                    </span>
                </a>
            </div>
        </div>
    </div>
<div class="fixed top-4 right-4 z-[200] transition-all duration-300"
     x-show="notification.show"
     x-transition:enter="transform ease-out duration-300"
     x-transition:enter-start="translate-x-full opacity-0"
     x-transition:enter-end="translate-x-0 opacity-100"
     x-transition:leave="transform ease-in duration-200"
     x-transition:leave-start="translate-x-0 opacity-100"
     x-transition:leave-end="translate-x-full opacity-0"
     x-cloak>
    <div class="flex items-center gap-3 bg-white border border-blue-100 shadow-lg shadow-blue-100/30 rounded-xl px-5 py-4 min-w-[320px]">
        <div class="w-8 h-8 rounded-full bg-green-100 flex items-center justify-center flex-shrink-0">
            <svg class="w-4 h-4 text-green-600" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"/></svg>
        </div>
        <div class="flex-1">
            <p class="text-sm font-semibold text-gray-900">Logout Successful</p>
            <p class="text-xs text-gray-500" x-text="notification.message"></p>
        </div>
        <button class="text-gray-400 hover:text-gray-600" @@click="notification.show = false">
            <svg class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12"/></svg>
        </button>
    </div>
</div>

</section>
