<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="csrf-token" content="<?php echo e(csrf_token()); ?>">
    <title><?php echo $__env->yieldContent('title', 'Dashboard'); ?> · My MeXCo</title>
    <?php echo $__env->make('partials.mexco-favicon', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
    <?php echo $__env->make('partials.mexco-public-theme', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
    <style>
        * { box-sizing: border-box; }
        body { margin: 0; font-family: Inter, system-ui, sans-serif; background: var(--bg); color: var(--ink); }
        a { text-decoration: none; color: inherit; }
        .shell { display: flex; min-height: 100vh; }
        .sidebar {
            width: 260px; background: var(--mexco-dark); color: #94A3B8;
            position: fixed; inset: 0 auto 0 0; z-index: 200; display: flex; flex-direction: column;
        }
        .sidebar-brand {
            height: auto;
            min-height: 72px;
            padding: .65rem 1.25rem;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: flex-start;
            gap: .2rem;
            background: linear-gradient(180deg, #FAF8FF 0%, #fff 100%);
            border-bottom: 1px solid var(--border);
        }
        .sidebar-brand .brand-logo {
            display: block;
            height: 48px;
            width: auto;
            max-width: 100%;
            object-fit: contain;
        }
        .sidebar-brand .name { font-size: .95rem; font-weight: 800; color: var(--mexco-primary); line-height: 1.15; }
        .sidebar-brand .sub { font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
        .sidebar-nav { padding: 1rem .85rem; flex: 1; overflow-y: auto; }
        .nav-section {
            font-size: .65rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
            color: #64748B; padding: .45rem .9rem .35rem;
        }
        .nav-link {
            display: block; padding: .72rem .9rem; border-radius: 10px; font-size: .875rem; font-weight: 500;
            color: #94A3B8; margin-bottom: .15rem;
        }
        .nav-link:hover { background: rgba(255,255,255,.06); color: #E2E8F0; }
        .nav-link.active { background: var(--mexco-primary); color: #fff; }
        .sidebar-foot { padding: 1rem .85rem; border-top: 1px solid rgba(255,255,255,.08); }
        .sidebar-foot button {
            width: 100%; padding: .6rem; border-radius: 10px; border: 1px solid rgba(255,255,255,.12);
            background: rgba(255,255,255,.05); color: #CBD5E1; font-size: .82rem; font-weight: 600; cursor: pointer;
        }
        .main { margin-left: 260px; flex: 1; min-width: 0; }
        .topbar {
            background: #fff; border-bottom: 1px solid var(--border); height: 72px;
            padding: 0 1.75rem; display: flex; align-items: center; justify-content: space-between;
            position: sticky; top: 0; z-index: 100;
        }
        .topbar .crumb { font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
        .topbar .page { font-size: 1rem; font-weight: 700; }
        .content { padding: 1.5rem 1.75rem 2.5rem; }
        .pg-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
        .pg-head h1 { margin: 0; font-size: 1.5rem; font-weight: 800; }
        .pg-head p { margin: .35rem 0 0; color: var(--muted); font-size: .9rem; }
        .card {
            background: #fff; border: 1px solid var(--border); border-radius: 14px;
            box-shadow: var(--shadow); padding: 1.15rem;
        }
        @media (max-width: 900px) {
            .sidebar { position: static; width: 100%; }
            .shell { flex-direction: column; }
            .main { margin-left: 0; }
        }
    </style>
    <?php echo $__env->yieldPushContent('styles'); ?>
</head>
<body>
<?php
    $user = $user ?? request()->attributes->get('mexcoPortalUser');
    $demoService = app(\App\Services\DemoService::class);
    $activeDemoLicense = null;
    if ($user?->organisation_id) {
        $activeDemoLicense = $demoService->activeDemoForOrganisation((int) $user->organisation_id);
    }
    $isDemoAccount = (bool) $activeDemoLicense;
    $sandbox = $demoService->defaultAccounts();
    $sandboxVisitor = $demoService->primaryVisitor();
    $demoVisitorUrl = url('/mexco');
    $demoEventId = $activeDemoLicense?->event_id ?: $sandbox['event_id'];
    $demoOrganiserUser = $activeDemoLicense?->event?->organiser_username ?: $sandbox['organiser']['username'];
    $demoOrganiserPass = $sandbox['organiser']['password'];
?>
<div class="shell">
    <aside class="sidebar">
        <div class="sidebar-brand">
            <img src="<?php echo e(asset(config('mexco.logos.main'))); ?>" alt="MeXCo" class="brand-logo">
            <div class="name">My MeXCo</div>
            <div class="sub"><?php echo e($isDemoAccount ? 'Demo account' : 'Customer portal'); ?></div>
        </div>
        <nav class="sidebar-nav">
            <div class="nav-section">Main</div>
            <a href="<?php echo e(route('mexco.portal.dashboard')); ?>" class="nav-link <?php echo e(request()->routeIs('mexco.portal.dashboard') ? 'active' : ''); ?>">Dashboard</a>
            <a href="<?php echo e(route('mexco.portal.events')); ?>" class="nav-link <?php echo e(request()->routeIs('mexco.portal.events') ? 'active' : ''); ?>">My events</a>
            <?php if($isDemoAccount): ?>
                <div class="nav-section">Try demo</div>
                <a href="<?php echo e(route('mexco.admin.login')); ?>" class="nav-link" target="_blank" rel="noopener">Organizer ↗</a>
                <div style="padding:.1rem .9rem .45rem;font-size:.72rem;color:#64748B;line-height:1.45">
                    <?php echo e($demoOrganiserUser); ?><br>Password: <?php echo e($demoOrganiserPass); ?>

                </div>
                <a href="<?php echo e($demoVisitorUrl); ?>" class="nav-link" target="_blank" rel="noopener">Visitor Pass ↗</a>
                <?php if($sandboxVisitor): ?>
                    <div style="padding:.1rem .9rem .55rem;font-size:.72rem;color:#64748B;line-height:1.45">
                        <?php echo e($sandboxVisitor['email']); ?><br>IC: <?php echo e($sandboxVisitor['ic']); ?>

                        <?php if($demoEventId): ?><br>Event: <?php echo e($demoEventId); ?><?php endif; ?>
                    </div>
                <?php endif; ?>
            <?php else: ?>
                <a href="<?php echo e(route('mexco.plans')); ?>" class="nav-link">Create event</a>
                <div class="nav-section">SaaS</div>
                <a href="<?php echo e(route('mexco.plans')); ?>" class="nav-link">Plans</a>
                <a href="<?php echo e(route('mexco.campus')); ?>" class="nav-link">Campus</a>
                <div class="nav-section">Account</div>
                <a href="<?php echo e(route('mexco.home')); ?>" class="nav-link">Public website</a>
            <?php endif; ?>
        </nav>
        <div class="sidebar-foot">
            <form method="POST" action="<?php echo e(route('mexco.logout')); ?>">
                <?php echo csrf_field(); ?>
                <button type="submit">Sign out</button>
            </form>
        </div>
    </aside>
    <div class="main">
        <header class="topbar">
            <div>
                <div class="crumb">My MeXCo</div>
                <div class="page"><?php echo $__env->yieldContent('topbar', 'Dashboard'); ?></div>
            </div>
            <div style="text-align:right">
                <div style="font-size:.875rem;font-weight:700"><?php echo e($user?->name); ?></div>
                <div style="font-size:.75rem;color:var(--muted)"><?php echo e($user?->organisation?->name); ?></div>
            </div>
        </header>
        <div class="content">
            <?php if(session('success')): ?>
                <div class="alert-flash alert-success"><?php echo e(session('success')); ?></div>
            <?php endif; ?>
            <?php if(session('error')): ?>
                <div class="alert-flash alert-danger"><?php echo e(session('error')); ?></div>
            <?php endif; ?>
            <?php echo $__env->yieldContent('content'); ?>
        </div>
    </div>
</div>
<?php echo $__env->yieldPushContent('scripts'); ?>
</body>
</html>
<?php /**PATH C:\laragon\www\myapp\resources\views/portal/layout.blade.php ENDPATH**/ ?>