<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <title>@yield('title', 'Verificateur') - ATARA</title>
    <link rel="icon" type="image/svg+xml" href="{{ asset('favicon.svg') }}">
    <link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.min.css">
    <style>
        :root { --sidebar-width: 260px; }
        body { background-color: #f8f9fa; }
        .sidebar {
            width: var(--sidebar-width);
            height: 100vh;
            position: fixed;
            left: 0;
            top: 0;
            background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
            color: white;
            padding: 1rem;
            overflow-y: auto;
        }
        .sidebar .nav-link {
            color: rgba(255,255,255,0.8);
            border-radius: 8px;
            margin-bottom: 0.25rem;
            padding: 0.75rem 1rem;
        }
        .sidebar .nav-link:hover, .sidebar .nav-link.active {
            background: rgba(255,255,255,0.15);
            color: white;
        }
        .main-content {
            margin-left: var(--sidebar-width);
            padding: 2rem;
            min-height: 100vh;
        }
        .stat-card {
            border-radius: 12px;
            border: none;
            box-shadow: 0 2px 12px rgba(0,0,0,0.08);
        }
        .badge-pending { background-color: #f59e0b; }
        .badge-approved { background-color: #10b981; }
        .badge-rejected { background-color: #ef4444; }
    </style>
</head>
<body>
    @include('components.impersonate-banner')
    <nav class="sidebar">
        <div class="mb-4">
            <h4 class="fw-bold"><i class="bi bi-shield-check me-2"></i>Verificateur</h4>
            <small class="opacity-75">Panel de verification</small>
        </div>
        
        <ul class="nav flex-column">
            <li class="nav-item">
                <a class="nav-link {{ request()->routeIs('verifier.dashboard') ? 'active' : '' }}" href="{{ route('verifier.dashboard') }}">
                    <i class="bi bi-speedometer2 me-2"></i> Tableau de bord
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link {{ request()->routeIs('verifier.kyc.*') ? 'active' : '' }}" href="{{ route('verifier.kyc.index') }}">
                    <i class="bi bi-person-badge me-2"></i> Verification KYC
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link {{ request()->routeIs('verifier.delivery.*') ? 'active' : '' }}" href="{{ route('verifier.delivery.index') }}">
                    <i class="bi bi-truck me-2"></i> Preuves Livraison
                </a>
            </li>
        </ul>
        
        <hr class="my-4 opacity-25">
        
        <ul class="nav flex-column">
            <li class="nav-item">
                <form action="{{ route('logout') }}" method="POST">
                    @csrf
                    <button type="submit" class="nav-link w-100 text-start border-0 bg-transparent">
                        <i class="bi bi-box-arrow-left me-2"></i> Deconnexion
                    </button>
                </form>
            </li>
        </ul>
    </nav>

    <main class="main-content">
        <div class="d-flex justify-content-between align-items-center mb-4">
            <h2 class="mb-0">@yield('page-title', 'Tableau de bord')</h2>
            <span class="text-muted">{{ auth()->user()->name }}</span>
        </div>
        
        @if(session('success'))
            <div class="alert alert-success alert-dismissible fade show">
                {{ session('success') }}
                <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
            </div>
        @endif
        
        @if(session('error'))
            <div class="alert alert-danger alert-dismissible fade show">
                {{ session('error') }}
                <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
            </div>
        @endif
        
        @yield('content')
    </main>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
    
    <!-- SweetAlert2 Ultra Modern Theme -->
    @include('components.swal-modern-theme')
    
    <script>
        @if(session('success'))
            showSuccess('Succès !', '{{ session('success') }}');
        @endif
        
        @if(session('error'))
            showError('Erreur !', '{{ session('error') }}');
        @endif
        
        @if(session('warning'))
            showWarning('Attention !', '{{ session('warning') }}');
        @endif
        
        @if(session('info'))
            showInfo('Information', '{{ session('info') }}');
        @endif
    </script>
    
    @stack('scripts')
</body>
</html>
