

<?php $__env->startSection('title', 'Dashboard'); ?>

<?php $__env->startPush('styles'); ?>
<style>
.hero-section {
    position: relative;
    overflow: hidden;
    border-radius: 28px;
    padding: 36px 36px 24px;
    background: linear-gradient(135deg, #7c3aed 0%, #4338ca 42%, #312e81 100%);
    color: #fff;
    margin-bottom: 28px;
}
.hero-section::before {
    content: '';
    position: absolute;
    top: -20%;
    left: -10%;
    width: 340px;
    height: 340px;
    background: radial-gradient(circle, rgba(167,139,250,0.35) 0%, transparent 65%);
    filter: blur(28px);
    pointer-events: none;
}
.hero-section::after {
    content: '';
    position: absolute;
    right: -10%;
    bottom: -18%;
    width: 280px;
    height: 280px;
    background: radial-gradient(circle, rgba(99,102,241,0.22) 0%, transparent 60%);
    filter: blur(30px);
    pointer-events: none;
}
.hero-content { position: relative; z-index: 1; }
.hero-title {
    font-size: clamp(1.95rem, 2.8vw, 2.9rem);
    font-weight: 800;
    line-height: 1.05;
    margin-bottom: 16px;
    max-width: 780px;
}
.hero-title .highlight {
    color: #facc15;
    text-shadow: 0 0 18px rgba(250,204,21,0.32);
}
.hero-sub {
    color: rgba(255,255,255,0.92);
    max-width: 700px;
    font-size: 1rem;
    line-height: 1.8;
    margin-bottom: 24px;
}
.hero-dots {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
    align-items: center;
}
.hero-dot {
    width: 12px;
    height: 12px;
    border-radius: 9999px;
    animation: pulse 1.8s ease-in-out infinite;
}
.hero-dot:nth-child(1) { background: #c084fc; animation-delay: 0s; }
.hero-dot:nth-child(2) { background: #818cf8; animation-delay: 0.25s; }
.hero-dot:nth-child(3) { background: #fde68a; animation-delay: 0.5s; }
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 28px;
}
.quick-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 18px;
    border-radius: 14px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    transition: transform .2s ease, background .2s ease, border-color .2s ease;
    min-height: 58px;
}
.quick-action-btn:hover {
    transform: translateY(-2px);
    background: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.32);
}
.quick-action-btn i { font-size: 1.05rem; }
@keyframes pulse {
    0%,100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.74); opacity: 0.45; }
}
@media (max-width: 768px) {
    .hero-section { padding: 24px 22px 20px; }
    .hero-title { font-size: 2rem; }
    .quick-actions { grid-template-columns: 1fr; }
}
</style>
<?php $__env->stopPush(); ?>

<?php $__env->startSection('content'); ?>

<div class="page-header d-flex align-items-start justify-content-between mb-4 flex-column flex-md-row gap-3">
    <div>
        <h1 class="page-header-title">Dashboard</h1>
        <p class="page-header-sub">Ringkasan singkat aktivitas platform</p>
    </div>
    <div class="d-flex align-items-center gap-2 flex-wrap">
        <a href="<?php echo e(route('events.create')); ?>" class="btn btn-primary">Buat Event</a>
        <a href="<?php echo e(route('events.index')); ?>" class="btn btn-outline-soft">Kelola Events</a>
    </div>
</div>

<div class="hero-section">
    <div class="hero-content">
        <div class="hero-title">Selamat datang, <span class="highlight">admin</span> — Pantau dan kelola seluruh sistem pemesanan tiket konser Anda dari satu tempat.</div>
        <p class="hero-sub">Semua informasi kunci kini tersusun rapih di dashboard ini, sehingga Anda bisa mengambil keputusan lebih cepat dan menjaga pengalaman pengguna tetap premium.</p>
        <div class="hero-dots">
            <div class="hero-dot"></div>
            <div class="hero-dot"></div>
            <div class="hero-dot"></div>
        </div>
    </div>
</div>

<div class="quick-actions mb-4">
    <a href="<?php echo e(route('events.create')); ?>" class="quick-action-btn">
        <i class="bi bi-plus-circle-fill"></i> Tambah Event
    </a>
    <a href="<?php echo e(route('tiket.create')); ?>" class="quick-action-btn">
        <i class="bi bi-ticket-perforated-fill"></i> Buat Tiket
    </a>
    <a href="<?php echo e(route('transaksi.create')); ?>" class="quick-action-btn">
        <i class="bi bi-cart-plus-fill"></i> Transaksi Baru
    </a>
    <a href="<?php echo e(route('laporan.index')); ?>" class="quick-action-btn">
        <i class="bi bi-bar-chart-line-fill"></i> Lihat Laporan
    </a>
</div>

<div class="row g-3 mb-4">
    <div class="col-6 col-md-3">
        <div class="stat-card purple">
            <div class="stat-icon"><i class="bi bi-music-note-beamed"></i></div>
            <div class="stat-value"><?php echo e($totalEvents ?? 0); ?></div>
            <div class="stat-label">Total Events</div>
            <div class="trend-up mt-2"><i class="bi bi-arrow-up-right"></i> +3 bulan ini</div>
        </div>
    </div>
    <div class="col-6 col-md-3">
        <div class="stat-card indigo">
            <div class="stat-icon"><i class="bi bi-ticket-perforated-fill"></i></div>
            <div class="stat-value"><?php echo e($totalTiketTerjual ?? 0); ?></div>
            <div class="stat-label">Tiket Terjual</div>
            <div class="trend-up mt-2"><i class="bi bi-arrow-up-right"></i> +12% bulan ini</div>
        </div>
    </div>
    <div class="col-6 col-md-3">
        <div class="stat-card gold">
            <div class="stat-icon"><i class="bi bi-cash-stack"></i></div>
            <div class="stat-value"><?php echo e($totalPendapatan ? 'Rp'.number_format($totalPendapatan/1000000,0).'JT' : 'Rp0'); ?></div>
            <div class="stat-label">Total Pendapatan</div>
            <div class="trend-up mt-2"><i class="bi bi-arrow-up-right"></i> +8% vs bulan lalu</div>
        </div>
    </div>
    <div class="col-6 col-md-3">
        <div class="stat-card green">
            <div class="stat-icon"><i class="bi bi-people-fill"></i></div>
            <div class="stat-value"><?php echo e($totalUsers ?? 0); ?></div>
            <div class="stat-label">Total Pengguna</div>
            <div class="trend-up mt-2"><i class="bi bi-arrow-up-right"></i> +5 minggu ini</div>
        </div>
    </div>
</div>

<div class="row g-3 mb-4">
    <div class="col-lg-8">
        <div class="card-dark p-3 h-100">
            <div class="card-header d-flex align-items-center justify-content-between">
                <h5 class="mb-0">Pendapatan & Transaksi (Preview)</h5>
            </div>
            <div class="card-body">
                <canvas id="dashboardChart" height="190"></canvas>
            </div>
        </div>
    </div>
    <div class="col-lg-4">
        <div class="card-dark p-3 h-100">
            <div class="card-header"><h5 class="mb-0">Transaksi Terbaru</h5></div>
            <div class="card-body" style="padding:0">
                <table class="table table-dark-custom mb-0">
                    <thead>
                        <tr><th>Pembeli</th><th>Event</th><th>Jumlah</th><th>Total</th><th>Status</th></tr>
                    </thead>
                    <tbody>
                        <?php $__empty_1 = true; $__currentLoopData = $recentTransaksi ?? []; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $t): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                            <tr>
                                <td><?php echo e($t->nama_pembeli); ?></td>
                                <td><?php echo e($t->tiket->event->nama_event ?? '-'); ?></td>
                                <td><?php echo e($t->jumlah); ?> tiket</td>
                                <td>Rp<?php echo e(number_format($t->total_harga)); ?></td>
                                <td><span class="badge-status badge-available"><?php echo e($t->status); ?></span></td>
                            </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                            <tr><td colspan="5"><div class="empty-state py-3"><i class="bi bi-receipt" style="font-size:1.5rem"></i><p>Belum ada transaksi</p></div></td></tr>
                        <?php endif; ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>

<div class="row g-3">
    <div class="col-md-6">
        <div class="card-dark">
            <div class="card-header d-flex align-items-center justify-content-between">
                <div style="font-weight:700">Event Mendatang</div>
                <a href="<?php echo e(route('events.index')); ?>" class="btn-outline-soft">Semua <i class="bi bi-arrow-right"></i></a>
            </div>
            <div class="card-body">
                <?php $__empty_1 = true; $__currentLoopData = $upcomingEvents ?? []; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $event): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                    <div class="event-row">
                        <div class="event-thumb">🎤</div>
                        <div class="event-info">
                            <div class="event-name"><?php echo e($event->nama_event); ?></div>
                            <div class="event-meta"><i class="bi bi-geo-alt-fill" style="color:var(--accent-1)"></i> <?php echo e($event->lokasi->nama_lokasi ?? '-'); ?> • <?php echo e(\Carbon\Carbon::parse($event->tanggal)->format('d M Y')); ?></div>
                        </div>
                        <div class="event-tiket"><div class="sold"><?php echo e($event->tikets->sum('stok') ?? 0); ?></div><div class="label">stok</div></div>
                    </div>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                    <div class="empty-state"><i class="bi bi-calendar-event"></i><p>Belum ada event terjadwal</p></div>
                <?php endif; ?>
            </div>
        </div>
    </div>
    <div class="col-md-6">
        <div class="card-dark">
            <div class="card-header"><div style="font-weight:700">Distribusi Kategori Event</div></div>
            <div class="card-body">
                <?php
                    $categories = [
                        ['name' => 'Pop/Rock','pct' => 40,'col' => 'var(--accent-1)'],
                        ['name' => 'Jazz','pct' => 25,'col' => 'var(--accent-2)'],
                        ['name' => 'EDM','pct' => 20,'col' => 'var(--accent-gold)'],
                        ['name' => 'Indie','pct' => 15,'col' => '#22c55e'],
                    ];
                ?>
                <?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cat): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <div class="mb-3">
                        <div class="d-flex justify-content-between mb-1" style="font-size:0.8rem"><span><?php echo e($cat['name']); ?></span><span style="color:var(--text-muted)"><?php echo e($cat['pct']); ?>%</span></div>
                        <div style="height:6px; background:rgba(255,255,255,0.06); border-radius:3px; overflow:hidden;">
                            <div style="height:100%; width:<?php echo e($cat['pct']); ?>%; background:<?php echo e($cat['col']); ?>; border-radius:3px;"></div>
                        </div>
                    </div>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </div>
        </div>
    </div>
</div>

<div class="row mt-4">
    <div class="col-md-6">
        <div class="card-dark p-3">
            <div class="card-header d-flex justify-content-between align-items-center"><div style="font-weight:700">Calendar</div><div style="font-size:0.85rem; color:var(--text-muted)"><?php echo e(\Carbon\Carbon::now()->format('F Y')); ?></div></div>
            <div class="card-body">
                <?php
                    $now = \Carbon\Carbon::now();
                    $start = $now->copy()->startOfMonth();
                    $end = $now->copy()->endOfMonth();
                    $startWeekDay = (int)$start->dayOfWeek;
                    $days = [];
                    for ($i = 0; $i < $startWeekDay; $i++) { $days[] = null; }
                    for ($d = $start->copy(); $d->lte($end); $d->addDay()) { $days[] = $d->format('Y-m-d'); }
                    $eventDates = collect($upcomingEvents ?? [])->map(fn($e) => \Carbon\Carbon::parse($e->tanggal)->format('Y-m-d'))->toArray();
                ?>
                <div class="mini-calendar">
                    <div class="month d-flex justify-content-between align-items-center mb-2"><div style="font-weight:700"><?php echo e($now->format('F Y')); ?></div><div style="font-size:0.85rem; color:var(--text-muted)">Today: <?php echo e($now->format('d M')); ?></div></div>
                    <div class="grid">
                        <?php $__currentLoopData = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $d): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <div class="cell" style="font-size:0.75rem;font-weight:700;color:var(--text-muted)"><?php echo e($d); ?></div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        <?php $__currentLoopData = $days; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $day): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <?php if(!$day): ?>
                                <div class="cell"></div>
                            <?php else: ?>
                                <?php $isToday = $day === \Carbon\Carbon::now()->format('Y-m-d'); $hasEvent = in_array($day, $eventDates); ?>
                                <div class="cell <?php echo e($isToday ? 'today' : ''); ?> <?php echo e($hasEvent ? 'event' : ''); ?>"><?php echo e(\Carbon\Carbon::parse($day)->format('j')); ?></div>
                            <?php endif; ?>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<?php $__env->stopSection(); ?>

<?php $__env->startPush('scripts'); ?>
<script>
document.addEventListener('DOMContentLoaded', function () {
    if (window.AOS) AOS.init();
    const ctx = document.getElementById('dashboardChart');
    if (!ctx) return;

    new Chart(ctx, {
        type: 'line',
        data: {
            labels: ['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],
            datasets: [{
                label: 'Pendapatan',
                data: [120, 200, 150, 300, 250, 320, 400],
                borderColor: getComputedStyle(document.documentElement).getPropertyValue('--accent-1') || '#7C3AED',
                backgroundColor: 'rgba(124,58,237,0.12)',
                fill: true,
                tension: 0.35,
                pointRadius: 3,
                borderWidth: 2,
            }]
        },
        options: {
            responsive: true,
            maintainAspectRatio: false,
            plugins: { legend: { display: false } },
            scales: {
                x: { grid: { display: false }, ticks: { color: '#cbd5e1' } },
                y: { beginAtZero: true, grid: { color: 'rgba(255,255,255,0.08)' }, ticks: { color: '#cbd5e1' } }
            }
        }
    });
});
</script>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH D:\tugas pa asur\konser-ticket\resources\views/dashboard.blade.php ENDPATH**/ ?>