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

<?php $__env->startPush('styles'); ?>
    <link href="https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.min.css" rel="stylesheet">
    <style>
        /* Karşılama kartı metinleri — açık temadaki siyah görünüm aynen korunur,
           satır içi style yerine sınıf kullanıldığı için koyu tema override edebiliyor. */
        .dash-hero-title {
            color: #000;
        }

        .dash-hero-sub {
            color: #000;
        }

        .stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            gap: 1.5rem;
            margin-bottom: 2rem;
        }

        .content-grid {
            display: grid;
            grid-template-columns: 2fr 1fr;
            gap: 2rem;
            margin-bottom: 2rem;
        }

        .chart-container {
            position: relative;
            height: 350px;
            width: 100%;
        }

        .activity-item {
            display: flex;
            align-items: flex-start;
            gap: 1rem;
            padding: 1rem;
            border-radius: 12px;
            margin-bottom: 1rem;
            transition: all 0.3s ease;
        }

        .activity-item:hover {
            background: var(--gray-50);
        }

        .activity-icon {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 16px;
            flex-shrink: 0;
        }

        .activity-content {
            flex: 1;
            min-width: 0;
        }

        .activity-title {
            font-size: 14px;
            font-weight: 600;
            color: var(--gray-900);
            margin-bottom: 4px;
        }

        .activity-desc {
            font-size: 13px;
            color: var(--gray-600);
            margin-bottom: 4px;
        }

        .activity-time {
            font-size: 12px;
            color: var(--gray-400);
        }

        .tour-item {
            display: flex;
            align-items: center;
            gap: 1rem;
            padding: 1rem;
            border-radius: 12px;
            margin-bottom: 1rem;
            transition: all 0.3s ease;
        }

        .tour-item:hover {
            background: var(--gray-50);
        }

        .tour-image {
            width: 60px;
            height: 60px;
            border-radius: 12px;
            object-fit: cover;
            background: var(--gray-200);
            flex-shrink: 0;
        }

        .tour-info {
            flex: 1;
            min-width: 0;
        }

        .tour-title {
            font-size: 14px;
            font-weight: 600;
            color: var(--gray-900);
            margin-bottom: 4px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .tour-stats {
            display: flex;
            gap: 1rem;
            font-size: 12px;
            color: var(--gray-500);
        }

        .booking-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 1rem;
            border-radius: 12px;
            margin-bottom: 1rem;
            transition: all 0.3s ease;
        }

        .booking-item:hover {
            background: var(--gray-50);
        }

        .booking-info {
            flex: 1;
            min-width: 0;
        }

        .customer-name {
            font-size: 14px;
            font-weight: 600;
            color: var(--gray-900);
            margin-bottom: 2px;
        }

        .tour-name {
            font-size: 13px;
            color: var(--gray-600);
            margin-bottom: 4px;
        }

        .booking-date {
            font-size: 12px;
            color: var(--gray-400);
        }

        .status-badge {
            padding: 6px 12px;
            border-radius: 20px;
            font-size: 11px;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .status-pending {
            background: var(--warning-100);
            color: var(--warning-700);
        }

        .status-confirmed {
            background: var(--success-100);
            color: var(--success-700);
        }

        .status-cancelled {
            background: var(--danger-100);
            color: var(--danger-700);
        }

        @media (max-width: 1200px) {
            .content-grid {
                grid-template-columns: 1fr;
            }
        }

        @media (max-width: 768px) {
            .stats-grid {
                grid-template-columns: 1fr;
            }
        }
    </style>
<?php $__env->stopPush(); ?>

<?php $__env->startSection('content'); ?>
    <div class="container-fluid">
        <!-- Welcome Section -->
        <div class="row mb-4">
            <div class="col-12">
                <div class="card border-0 bg-primary text-white overflow-hidden">
                    <div class="card-body position-relative">
                        <div class="row align-items-center">
                            <div class="col-md-8">
                                <h2 class="h3 mb-2 dash-hero-title">Hoş geldin, <?php echo e(auth()->user()->first_name); ?>! 👋
                                </h2>
                                <p class="mb-0 opacity-75 dash-hero-sub"><?php echo e($agency->name ?? 'Acente Paneli'); ?> için bugünün özeti</p>
                            </div>
                            <div class="col-md-4 text-end d-none d-md-block">
                                <i class="fas fa-chart-line fa-3x opacity-25"></i>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- Stats Cards -->
        <div class="stats-grid">
            <div class="stats-card">
                <div class="stats-icon">
                    <i class="fas fa-map-marked-alt"></i>
                </div>
                <div class="stats-content">
                    <div class="stats-number"><?php echo e($stats['total_tours'] ?? 0); ?></div>
                    <div class="stats-label">Toplam Tur</div>
                    <div class="stats-change">
                        <small class="text-muted"><?php echo e($stats['active_tours'] ?? 0); ?> aktif tur</small>
                    </div>
                </div>
            </div>

            <div class="stats-card stats-success">
                <div class="stats-icon">
                    <i class="fas fa-calendar-check"></i>
                </div>
                <div class="stats-content">
                    <div class="stats-number"><?php echo e($stats['total_bookings'] ?? 0); ?></div>
                    <div class="stats-label">Bu Ay Rezervasyon</div>
                    <div class="stats-change <?php echo e(($stats['bookings_change'] ?? 0) >= 0 ? 'positive' : 'negative'); ?>">
                        <i class="fas fa-arrow-<?php echo e(($stats['bookings_change'] ?? 0) >= 0 ? 'up' : 'down'); ?>"></i>
                        %<?php echo e(abs($stats['bookings_change'] ?? 0)); ?> geçen aya göre
                    </div>
                </div>
            </div>

            <div class="stats-card stats-info">
                <div class="stats-icon">
                    <i class="fas fa-users"></i>
                </div>
                <div class="stats-content">
                    <div class="stats-number"><?php echo e($stats['total_customers'] ?? 0); ?></div>
                    <div class="stats-label">Toplam Müşteri</div>
                    <div class="stats-change">
                        <small class="text-muted">Benzersiz müşteri sayısı</small>
                    </div>
                </div>
            </div>

            <div class="stats-card stats-warning">
                <div class="stats-icon">
                    <i class="fas fa-lira-sign"></i>
                </div>
                <div class="stats-content">
                    <div class="stats-number">₺<?php echo e(number_format($stats['monthly_revenue'] ?? 0, 0, ',', '.')); ?></div>
                    <div class="stats-label">Bu Ay Gelir</div>
                    <div class="stats-change <?php echo e(($stats['revenue_change'] ?? 0) >= 0 ? 'positive' : 'negative'); ?>">
                        <i class="fas fa-arrow-<?php echo e(($stats['revenue_change'] ?? 0) >= 0 ? 'up' : 'down'); ?>"></i>
                        %<?php echo e(abs($stats['revenue_change'] ?? 0)); ?> geçen aya göre
                    </div>
                </div>
            </div>
        </div>

        <!-- Main Content Grid -->
        <div class="content-grid">
            <!-- Charts & Analytics -->
            <div class="col">
                <!-- Revenue Chart -->
                <div class="card mb-4">
                    <div class="card-header d-flex justify-content-between align-items-center">
                        <div>
                            <h5 class="card-title mb-1">Aylık Gelir Trendi</h5>
                            <p class="text-muted mb-0">Son 6 aylık gelir durumu</p>
                        </div>
                        <div class="dropdown">
                            <button class="btn btn-outline-secondary btn-sm dropdown-toggle" data-bs-toggle="dropdown">
                                Son 6 Ay
                            </button>
                            <ul class="dropdown-menu">
                                <li><a class="dropdown-item" href="#">Son 3 Ay</a></li>
                                <li><a class="dropdown-item" href="#">Son 6 Ay</a></li>
                                <li><a class="dropdown-item" href="#">Son Yıl</a></li>
                            </ul>
                        </div>
                    </div>
                    <div class="card-body">
                        <div class="chart-container">
                            <canvas id="revenueChart"></canvas>
                        </div>
                    </div>
                </div>

                <!-- Popular Tours -->
                <div class="card">
                    <div class="card-header d-flex justify-content-between align-items-center">
                        <div>
                            <h5 class="card-title mb-1">Popüler Turlar</h5>
                            <p class="text-muted mb-0">En çok rezervasyon alan turlar</p>
                        </div>
                        <a href="" class="btn btn-outline-primary btn-sm">
                            Tümünü Gör
                        </a>
                    </div>
                    <div class="card-body p-0">
                        <?php $__empty_1 = true; $__currentLoopData = $popularTours; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $popularTour): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                            <div class="tour-item">
                                <div class="tour-info">
                                    <div class="tour-title"><?php echo e($popularTour->name); ?></div>
                                    <div class="tour-stats">
                                        <span><i class="fas fa-calendar-check me-1"></i> <?php echo e($popularTour->bookings_count); ?> rezervasyon</span>
                                        <span><i class="fas fa-lira-sign me-1"></i> <?php echo e(number_format($popularTour->total_revenue, 0, ',', '.')); ?></span>
                                    </div>
                                </div>
                            </div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                            <div class="p-4 text-center text-muted">Henüz veri bulunmuyor.</div>
                        <?php endif; ?>
                    </div>
                </div>
            </div>

            <!-- Sidebar -->
            <div class="col">
                <!-- Quick Stats -->
                <div class="card mb-4">
                    <div class="card-header">
                        <h5 class="card-title mb-0">Hızlı Durum</h5>
                    </div>
                    <div class="card-body">
                        <div class="d-flex justify-content-between align-items-center mb-3">
                            <span class="text-muted">Bekleyen Rezervasyonlar</span>
                            <span class="badge bg-warning"><?php echo e($stats['pending_bookings'] ?? 0); ?></span>
                        </div>
                        <div class="d-flex justify-content-between align-items-center mb-3">
                            <span class="text-muted">Onaylanan Rezervasyonlar</span>
                            <span class="badge bg-success"><?php echo e($stats['confirmed_bookings'] ?? 0); ?></span>
                        </div>
                        <div class="d-flex justify-content-between align-items-center">
                            <span class="text-muted">Aktif Turlar</span>
                            <span class="badge bg-info"><?php echo e($stats['active_tours'] ?? 0); ?></span>
                        </div>
                    </div>
                </div>

                <!-- Recent Bookings -->
                <div class="card mb-4">
                    <div class="card-header d-flex justify-content-between align-items-center">
                        <h5 class="card-title mb-0">Son Rezervasyonlar</h5>
                        <a href="<?php echo e(route('agency.sales.index')); ?>" class="btn btn-outline-primary btn-sm">
                            Tümünü Gör
                        </a>
                    </div>
                    <div class="card-body p-0">
                        <?php $__empty_1 = true; $__currentLoopData = $recentBookings; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $booking): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                            <div class="booking-item">
                                <div class="booking-info">
                                    <div class="customer-name"><?php echo e($booking->first_name); ?> <?php echo e($booking->last_name); ?></div>
                                    <div class="tour-name"><?php echo e($booking->tour_title); ?></div>
                                    <div class="booking-date"><?php echo e(\Carbon\Carbon::parse($booking->created_at)->format('d.m.Y H:i')); ?></div>
                                </div>
                                <span class="status-badge status-<?php echo e($booking->status); ?>">
                                    <?php echo e($booking->status); ?>

                                </span>
                            </div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                            <div class="p-4 text-center text-muted">Henüz rezervasyon bulunmuyor.</div>
                        <?php endif; ?>
                    </div>
                </div>

                <!-- Recent Activities -->
                <div class="card">
                    <div class="card-header">
                        <h5 class="card-title mb-0">Son Aktiviteler</h5>
                    </div>
                    <div class="card-body p-0">
                        <?php $__empty_1 = true; $__currentLoopData = $recentActivities; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $activity): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                            <div class="activity-item">
                                <div class="activity-icon bg-<?php echo e($activity['color']); ?>">
                                    <i class="<?php echo e($activity['icon']); ?>"></i>
                                </div>
                                <div class="activity-content">
                                    <div class="activity-title"><?php echo e($activity['title']); ?></div>
                                    <div class="activity-desc"><?php echo e($activity['description']); ?></div>
                                    <div class="activity-time"><?php echo e($activity['time']); ?></div>
                                </div>
                            </div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                            <div class="p-4 text-center text-muted">Henüz aktivite bulunmuyor.</div>
                        <?php endif; ?>
                    </div>
                </div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('scripts'); ?>
    <script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.min.js"></script>
<?php $__env->stopPush(); ?>
<?php echo $__env->make('agency.layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\acente\resources\views/agency/dashboard.blade.php ENDPATH**/ ?>