<style>
@import url('https://fonts.bunny.net/css?family=figtree:400,500,600,700&display=swap');
:root {
    --accent: #c04849;
    --accent-dark: #a23a3b;
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
}
html, body { margin: 0 !important; padding: 0 !important; background: #0f172a !important; min-height: 100%; font-family: 'Figtree', ui-sans-serif, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
.auth-bg {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 16px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 40%, #334155 100%);
    position: relative;
    overflow: hidden;
}
.auth-bg::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 20%, rgba(192,72,73,0.15) 0%, transparent 50%),
                radial-gradient(ellipse at 70% 80%, rgba(13,148,136,0.1) 0%, transparent 50%);
    animation: authPulse 8s ease-in-out infinite alternate;
}
@keyframes authPulse {
    0% { transform: scale(1) rotate(0deg); }
    100% { transform: scale(1.1) rotate(3deg); }
}
.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 44px 36px 36px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.1) inset;
    animation: cardSlideUp 0.5s ease-out;
}
@keyframes cardSlideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}
.auth-card .brand-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, var(--accent) 0%, #e05252 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(192,72,73,0.35);
}
.auth-card .brand-icon svg { color: #fff; }
.auth-card h2 {
    font-size: 26px;
    font-weight: 800;
    color: var(--gray-900);
    text-align: center;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}
.auth-card .subtitle {
    text-align: center;
    color: var(--gray-500);
    font-size: 14px;
    margin-bottom: 30px;
}
.auth-card label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}
.auth-card .input-group {
    position: relative;
    margin-bottom: 20px;
}
.auth-card .input-group .input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    pointer-events: none;
    transition: color .2s;
}
.auth-card .input-group input {
    width: 100%;
    padding: 12px 14px 12px 44px;
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    color: var(--gray-800);
    background: var(--gray-50);
    transition: all .2s;
    outline: none;
}
.auth-card .input-group input::placeholder { color: var(--gray-400); }
.auth-card .input-group input:focus {
    border-color: var(--accent);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(192,72,73,0.1);
}
.auth-card .input-group input:focus + .input-icon,
.auth-card .input-group input:focus ~ .input-icon { color: var(--accent); }
.auth-card .input-group .toggle-pw {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    padding: 4px;
    border-radius: 6px;
    transition: all .2s;
}
.auth-card .input-group .toggle-pw:hover { color: var(--gray-600); background: var(--gray-100); }
.auth-card .input-error {
    color: #dc2626;
    font-size: 12px;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.auth-card .options-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.auth-card .options-row label {
    margin-bottom: 0;
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--gray-600);
}
.auth-card .options-row label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}
.auth-card .options-row a {
    font-size: 13px;
    color: var(--accent);
    font-weight: 600;
    transition: color .2s;
}
.auth-card .options-row a:hover { color: var(--accent-dark); }
.auth-card .btn-submit {
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent) 0%, #e05252 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all .2s;
    box-shadow: 0 4px 16px rgba(192,72,73,0.35);
    position: relative;
    overflow: hidden;
}
.auth-card .btn-submit::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 100%);
    opacity: 0;
    transition: opacity .2s;
}
.auth-card .btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(192,72,73,0.4);
}
.auth-card .btn-submit:hover::before { opacity: 1; }
.auth-card .btn-submit:active { transform: translateY(0); }
.auth-card .btn-submit-secondary {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    background: var(--white);
    color: var(--gray-600);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all .2s;
    margin-top: 12px;
}
.auth-card .btn-submit-secondary:hover {
    border-color: var(--gray-300);
    background: var(--gray-50);
    color: var(--gray-800);
}
.auth-card .divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
    gap: 12px;
}
.auth-card .divider::before,
.auth-card .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--gray-200);
}
.auth-card .divider span {
    font-size: 12px;
    color: var(--gray-400);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.auth-card .links {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--gray-500);
}
.auth-card .links a {
    color: var(--accent);
    font-weight: 700;
    transition: color .2s;
}
.auth-card .links a:hover { color: var(--accent-dark); }
.auth-card .alert {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.auth-card .alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.auth-card .alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
</style>
<style>
    @import url('https://fonts.bunny.net/css?family=figtree:400,500,600,700&display=swap');
    :root {
        --accent: #c04849;
        --accent-dark: #a23a3b;
        --white: #ffffff;
        --gray-50: #f8fafc;
        --gray-100: #f1f5f9;
        --gray-200: #e2e8f0;
        --gray-300: #cbd5e1;
        --gray-400: #94a3b8;
        --gray-500: #64748b;
        --gray-600: #475569;
        --gray-700: #334155;
        --gray-800: #1e293b;
        --gray-900: #0f172a;
    }
    html, body { margin: 0 !important; padding: 0 !important; min-height: 100%; font-family: 'Figtree', ui-sans-serif, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
    .dash-bg { min-height:100vh; background:var(--gray-50); }
    .dash-topbar { display:flex; justify-content:space-between; align-items:center; padding:16px 32px; background:var(--white); border-bottom:1px solid var(--gray-200); box-shadow:0 1px 3px rgba(0,0,0,0.05); }
    .dash-btn-logout { display:inline-flex; align-items:center; gap:6px; padding:8px 16px; border:1px solid var(--gray-200); border-radius:10px; background:var(--white); color:var(--gray-600); font-size:13px; font-weight:600; font-family:inherit; cursor:pointer; transition:all .2s; }
    .dash-btn-logout:hover { background:#fef2f2; color:#dc2626; border-color:#fecaca; }
    .dash-content { max-width:900px; margin:0 auto; padding:40px 24px; }
    .dash-welcome { display:flex; align-items:center; gap:20px; margin-bottom:36px; }
    .dash-avatar { width:64px; height:64px; border-radius:16px; background:linear-gradient(135deg,var(--accent),#e05252); color:#fff; font-size:28px; font-weight:800; display:flex; align-items:center; justify-content:center; box-shadow:0 8px 24px rgba(192,72,73,0.3); flex-shrink:0; }
    .dash-grid { display:grid; grid-template-columns:1fr 1fr; gap:20px; }
    .dash-card { display:flex; align-items:center; gap:16px; padding:24px; background:var(--white); border:1px solid var(--gray-200); border-radius:16px; box-shadow:0 1px 3px rgba(0,0,0,0.04); transition:box-shadow .2s; }
    .dash-card:hover { box-shadow:0 4px 12px rgba(0,0,0,0.08); }
    .dash-card-icon { width:48px; height:48px; border-radius:12px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
    .dash-card-label { font-size:12px; font-weight:600; color:var(--gray-400); text-transform:uppercase; letter-spacing:0.5px; margin:0 0 4px; }
    .dash-card-value { font-size:16px; font-weight:700; color:var(--gray-900); margin:0; word-break:break-all; }
    .dash-debug { margin-top:36px; border:1px solid var(--gray-200); border-radius:16px; background:var(--white); overflow:hidden; }
    .dash-debug-header { display:flex; justify-content:space-between; align-items:center; padding:14px 20px; background:var(--gray-50); cursor:pointer; user-select:none; }
    .dash-debug-header:hover { background:var(--gray-100); }
    .dash-debug-body { padding:20px; }
    .dash-debug-grid { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
    .dash-debug-card { border:1px solid var(--gray-200); border-radius:12px; padding:16px; }
    .dash-debug-badge { display:inline-block; padding:4px 10px; border-radius:8px; font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:0.5px; margin-bottom:12px; }
    .dash-debug-table { width:100%; border-collapse:collapse; }
    .dash-debug-table td { padding:6px 0; font-size:13px; border-bottom:1px solid var(--gray-100); }
    .dash-debug-table td:first-child { color:var(--gray-500); font-weight:500; width:40%; }
    .dash-debug-table td:last-child { color:var(--gray-900); font-weight:600; }
    .dash-debug-table code { background:var(--gray-100); padding:2px 6px; border-radius:4px; font-size:12px; }
    .dash-debug-pre { background:#1e293b; color:#e2e8f0; padding:14px 16px; border-radius:10px; font-size:11px; line-height:1.6; overflow-x:auto; max-height:300px; white-space:pre-wrap; word-break:break-all; }
    .dash-verify-banner { display:flex; align-items:center; gap:16px; padding:16px 20px; background:#fffbeb; border:1px solid #fde68a; border-radius:14px; margin-bottom:24px; }
    .dash-verify-banner svg { flex-shrink:0; color:#d97706; }
    .dash-verify-banner p { margin:0; font-size:14px; color:#92400e; line-height:1.5; }
    .dash-verify-btn { display:inline-flex; align-items:center; gap:6px; margin-top:10px; padding:8px 16px; background:#d97706; color:#fff; border:none; border-radius:8px; font-size:13px; font-weight:600; font-family:inherit; cursor:pointer; transition:background .2s; }
    .dash-verify-btn:hover { background:#b45309; }
</style>

<div class="dash-bg">
    <div class="dash-topbar">
        <div style="display:flex;align-items:center;gap:10px;">
            <svg width="24" height="24" fill="none" stroke="currentColor" viewBox="0 0 24 24" style="color:var(--accent);"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2V6zM14 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V6zM4 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2v-2zM14 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z"/></svg>
            <span style="font-size:18px;font-weight:700;color:var(--gray-900);">Dashboard</span>
        </div>
        <form method="POST" action="{{ url('/user/logout') }}" style="margin:0;">
            @csrf
            <button type="submit" class="dash-btn-logout">
                <svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"/></svg>
                Logout
            </button>
        </form>
    </div>

    <div class="dash-content">
        <div class="dash-welcome">
            <div class="dash-avatar">{{ strtoupper(substr($user->first_name ?? $user->username, 0, 1)) }}</div>
            <div>
                <h1 style="font-size:24px;font-weight:800;color:var(--gray-900);margin:0;">Welcome back, {{ $user->first_name ?? $user->username }}!</h1>
                <p style="color:var(--gray-500);font-size:14px;margin:4px 0 0;">Here's what's happening with your account.</p>
            </div>
        </div>

        @if(!$user->hasVerifiedEmail())
            <div class="dash-verify-banner">
                <svg width="24" height="24" fill="none" stroke="#fff" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"/></svg>
                <div>
                    <p><strong>Your email is not verified yet.</strong><br>Please check your inbox for the verification link, or click below to resend.</p>
                    @if(session('status') == 'verification-link-sent')
                        <p style="margin:6px 0 0;color:#166534;font-weight:600;">A new verification link has been sent to your email.</p>
                    @endif
                    <form method="POST" action="{{ url('/user/email/verification-notification') }}" style="margin:0;">
                        @csrf
                        <input type="hidden" name="site_slug" value="{{ request()->segment(1) }}">
                        <button type="submit" class="dash-verify-btn">
                            <svg width="16" height="16" fill="none" stroke="#fff" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"/></svg>
                            Resend Verification Email
                        </button>
                    </form>
                </div>
            </div>
        @endif

        <div class="dash-grid">
            <div class="dash-card">
                <div class="dash-card-icon" style="background:linear-gradient(135deg,#3b82f6,#2563eb);">
                    <svg width="22" height="22" fill="none" stroke="#fff" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"/></svg>
                </div>
                <div><p class="dash-card-label">Username</p><p class="dash-card-value">{{ $user->username }}</p></div>
            </div>
            <div class="dash-card">
                <div class="dash-card-icon" style="background:linear-gradient(135deg,#10b981,#059669);">
                    <svg width="22" height="22" fill="none" stroke="#fff" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"/></svg>
                </div>
                <div><p class="dash-card-label">Email</p><p class="dash-card-value">{{ $user->email }}</p></div>
            </div>
            <div class="dash-card">
                <div class="dash-card-icon" style="background:linear-gradient(135deg,#f59e0b,#d97706);">
                    <svg width="22" height="22" fill="none" stroke="#fff" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"/></svg>
                </div>
                <div><p class="dash-card-label">Full Name</p><p class="dash-card-value">{{ $user->full_name ?? $user->first_name . ' ' . $user->last_name }}</p></div>
            </div>
            <div class="dash-card">
                <div class="dash-card-icon" style="background:linear-gradient(135deg,var(--accent),#e05252);">
                    <svg width="22" height="22" fill="none" stroke="#fff" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>
                </div>
                <div><p class="dash-card-label">Last Login</p><p class="dash-card-value">{{ $user->last_login_at ? $user->last_login_at->diffForHumans() : 'First time' }}</p></div>
            </div>
        </div>

        <div class="dash-debug">
            <div class="dash-debug-header" onclick="var el=document.getElementById('debugContent'); el.style.display=el.style.display==='none'?'block':'none';">
                <div style="display:flex;align-items:center;gap:8px;">
                    <svg width="18" height="18" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4"/></svg>
                    <span style="font-weight:700;font-size:14px;">Debug Info (Session & Guards)</span>
                </div>
                <svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"/></svg>
            </div>
            <div id="debugContent" style="display:none;" class="dash-debug-body">
                <div class="dash-debug-grid">
                    <div class="dash-debug-card">
                        <div class="dash-debug-badge" style="background:#dbeafe;color:#1d4ed8;">Frontend User Guard</div>
                        <table class="dash-debug-table">
                            <tr><td>Guard Name</td><td><code>user</code></td></tr>
                            <tr><td>Model</td><td><code>FrontendUser</code></td></tr>
                            <tr><td>Authenticated</td><td><code>{{ Auth::guard('user')->check() ? 'true' : 'false' }}</code></td></tr>
                            <tr><td>User ID</td><td><code>{{ $user->id ?? 'null' }}</code></td></tr>
                            <tr><td>Username</td><td><code>{{ $user->username ?? 'null' }}</code></td></tr>
                            <tr><td>Email</td><td><code>{{ $user->email ?? 'null' }}</code></td></tr>
                            <tr><td>Session Key</td><td><code>login_web_{{ md5(get_class($user)) }}</code></td></tr>
                            <tr><td>Session Has Key</td><td><code>{{ session()->has('login_web_' . md5(get_class($user))) ? 'yes' : 'no' }}</code></td></tr>
                        </table>
                    </div>
                    <div class="dash-debug-card">
                        <div class="dash-debug-badge" style="background:#fef3c7;color:#92400e;">Backend Admin Guard</div>
                        <table class="dash-debug-table">
                            <tr><td>Guard Name</td><td><code>admin</code></td></tr>
                            <tr><td>Model</td><td><code>BackendUser</code></td></tr>
                            <tr><td>Authenticated</td><td><code>{{ Auth::guard('admin')->check() ? 'true' : 'false' }}</code></td></tr>
                            <tr><td>User ID</td><td><code>{{ $admin->id ?? 'null' }}</code></td></tr>
                            <tr><td>Username</td><td><code>{{ $admin->username ?? 'null' }}</code></td></tr>
                            <tr><td>Email</td><td><code>{{ $admin->email ?? 'null' }}</code></td></tr>
                            <tr><td>Session Key</td><td><code>login_admin_{{ md5('App\\Models\\Backend\\BackendUser') }}</code></td></tr>
                            <tr><td>Session Has Key</td><td><code>{{ session()->has('login_admin_' . md5('App\\Models\\Backend\\BackendUser')) ? 'yes' : 'no' }}</code></td></tr>
                        </table>
                    </div>
                </div>
                <div style="margin-top:16px;">
                    <p style="font-size:12px;font-weight:600;color:var(--gray-400);text-transform:uppercase;letter-spacing:0.5px;margin:0 0 8px;">Session Driver & All Data</p>
                    <table class="dash-debug-table" style="margin-bottom:12px;">
                        <tr><td>Session Driver</td><td><code>{{ config('session.driver') }}</code></td></tr>
                        <tr><td>Session ID</td><td><code>{{ session()->getId() }}</code></td></tr>
                        <tr><td>Total Keys</td><td><code>{{ count(session()->all()) }}</code></td></tr>
                        <tr><td>Session Lifetime</td><td><code>{{ config('session.lifetime') }} min</code></td></tr>
                    </table>
                    <p style="font-size:12px;font-weight:600;color:var(--gray-400);text-transform:uppercase;letter-spacing:0.5px;margin:0 0 8px;">All Session Keys</p>
                    <pre class="dash-debug-pre">{{ json_encode(array_keys(session()->all()), JSON_PRETTY_PRINT) }}</pre>
                </div>
            </div>
        </div>
    </div>
</div>