<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Inbox — {{ \App\Models\Setting::get('project_name', 'WhatsApp') }}</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
    @vite(['resources/css/app.css', 'resources/js/inbox.js'])
    <style>
        * { margin: 0; padding: 0; box-sizing: border-box; }
        html, body { height: 100%; overflow: hidden; background: #0b141a; }
        #inbox-app { height: 100vh; width: 100vw; display: flex; }
    </style>
</head>
<body>

@php
    $waConnected = !empty($user->access_token) && !empty($user->phone_number_id) && !empty($user->waba_id);
    $appLogo     = \App\Models\Setting::get('app_logo', '');
    $hasLogo     = $appLogo && file_exists(public_path('uploads/' . $appLogo));
    $logoUrl     = $hasLogo ? asset('uploads/' . $appLogo) : '';
@endphp

<script>
window.InboxConfig = {
    userId:        {{ auth()->id() }},
    userName:      @json($user->name),
    pusherKey:     @json($pusherKey),
    pusherCluster: @json($pusherCluster),
    csrfToken:     @json(csrf_token()),
    waConnected:   {{ $waConnected ? 'true' : 'false' }},
    logoUrl:       @json($logoUrl),
    routes: {
        dashboard: @json(route('user.dashboard')),
        setup:     @json(route('user.whatsapp-setup')),
        apiDocs:   @json(route('user.api-docs')),
        logout:    @json(route('logout')),
    },
};
</script>

<div id="inbox-app"></div>

</body>
</html>
