<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{title}</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
    <style>
        .sidebar {
            min-height: 100vh;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        .profile-avatar {
            width: 120px;
            height: 120px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        .info-card {
            background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
            color: white;
        }
        .token-info {
            background-color: #f8f9fa;
            border-left: 4px solid #007bff;
        }
    </style>
</head>
<body>
    <div class="container-fluid">
        <div class="row">
            <!-- Sidebar -->
            <nav class="col-md-3 col-lg-2 d-md-block sidebar collapse">
                <div class="position-sticky pt-3">
                    <div class="text-center mb-4">
                        <h4 class="text-white">GBCM</h4>
                        <p class="text-white-50">Global Business Consulting</p>
                    </div>
                    
                    {#if authenticated}
                    <div class="text-center mb-4">
                        <div class="bg-white rounded-circle d-inline-flex align-items-center justify-content-center" 
                             style="width: 50px; height: 50px;">
                            <i class="fas fa-user text-primary"></i>
                        </div>
                        <div class="text-white mt-2">
                            <div class="fw-bold">{user.name}</div>
                            <small class="text-white-50">{user.email}</small>
                        </div>
                    </div>
                    {/if}

                    <ul class="nav nav-pills flex-column mb-auto">
                        <li class="nav-item">
                            <a href="/gbcm/pages/dashboard" class="nav-link text-white">
                                <i class="fas fa-chart-line me-2"></i>
                                Tableau de Bord
                            </a>
                        </li>
                        <li class="nav-item">
                            <a href="/gbcm/pages/clients" class="nav-link text-white">
                                <i class="fas fa-briefcase me-2"></i>
                                Clients
                            </a>
                        </li>
                        <li class="nav-item">
                            <a href="/gbcm/pages/profile" class="nav-link text-white active">
                                <i class="fas fa-user me-2"></i>
                                Profil
                            </a>
                        </li>
                    </ul>
                </div>
            </nav>

            <!-- Main content -->
            <main class="col-md-9 ms-sm-auto col-lg-10 px-md-4">
                <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
                    <h1 class="h2">Profil Utilisateur</h1>
                    <div class="btn-toolbar mb-2 mb-md-0">
                        <div class="btn-group me-2">
                            <button type="button" class="btn btn-outline-primary">
                                <i class="fas fa-edit me-1"></i>
                                Modifier
                            </button>
                            <button type="button" class="btn btn-outline-secondary">
                                <i class="fas fa-key me-1"></i>
                                Changer mot de passe
                            </button>
                        </div>
                    </div>
                </div>

                <div class="row">
                    <!-- Profile Information -->
                    <div class="col-lg-4">
                        <div class="card shadow mb-4">
                            <div class="card-body text-center">
                                <div class="profile-avatar rounded-circle mx-auto d-flex align-items-center justify-content-center mb-3">
                                    <i class="fas fa-user fa-3x text-white"></i>
                                </div>
                                <h5 class="card-title">{user.name}</h5>
                                <p class="text-muted">{user.email}</p>
                                <span class="badge bg-primary fs-6">{user.role}</span>
                                
                                <hr>
                                
                                <div class="row text-center">
                                    <div class="col-4">
                                        <div class="fw-bold text-primary">156</div>
                                        <small class="text-muted">Clients</small>
                                    </div>
                                    <div class="col-4">
                                        <div class="fw-bold text-success">49</div>
                                        <small class="text-muted">Projets</small>
                                    </div>
                                    <div class="col-4">
                                        <div class="fw-bold text-warning">12</div>
                                        <small class="text-muted">Tâches</small>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <!-- Quick Actions -->
                        <div class="card shadow">
                            <div class="card-header">
                                <h6 class="m-0 font-weight-bold text-primary">Actions Rapides</h6>
                            </div>
                            <div class="card-body">
                                <div class="d-grid gap-2">
                                    <button class="btn btn-outline-primary" type="button">
                                        <i class="fas fa-download me-2"></i>
                                        Télécharger mes données
                                    </button>
                                    <button class="btn btn-outline-success" type="button">
                                        <i class="fas fa-file-export me-2"></i>
                                        Exporter rapport
                                    </button>
                                    <button class="btn btn-outline-info" type="button">
                                        <i class="fas fa-bell me-2"></i>
                                        Notifications
                                    </button>
                                    <button class="btn btn-outline-danger" type="button">
                                        <i class="fas fa-sign-out-alt me-2"></i>
                                        Déconnexion
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- Profile Details -->
                    <div class="col-lg-8">
                        <!-- Personal Information -->
                        <div class="card shadow mb-4">
                            <div class="card-header">
                                <h6 class="m-0 font-weight-bold text-primary">Informations Personnelles</h6>
                            </div>
                            <div class="card-body">
                                <form>
                                    <div class="row">
                                        <div class="col-md-6 mb-3">
                                            <label for="firstName" class="form-label">Prénom</label>
                                            <input type="text" class="form-control" id="firstName" value="{user.name}">
                                        </div>
                                        <div class="col-md-6 mb-3">
                                            <label for="lastName" class="form-label">Nom</label>
                                            <input type="text" class="form-control" id="lastName" value="Utilisateur">
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-6 mb-3">
                                            <label for="email" class="form-label">Email</label>
                                            <input type="email" class="form-control" id="email" value="{user.email}">
                                        </div>
                                        <div class="col-md-6 mb-3">
                                            <label for="phone" class="form-label">Téléphone</label>
                                            <input type="tel" class="form-control" id="phone" value="+33 1 23 45 67 89">
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-6 mb-3">
                                            <label for="department" class="form-label">Département</label>
                                            <select class="form-select" id="department">
                                                <option selected>Consulting</option>
                                                <option>Management</option>
                                                <option>Administration</option>
                                                <option>Commercial</option>
                                            </select>
                                        </div>
                                        <div class="col-md-6 mb-3">
                                            <label for="role" class="form-label">Rôle</label>
                                            <input type="text" class="form-control" id="role" value="{user.role}" readonly>
                                        </div>
                                    </div>
                                    <div class="mb-3">
                                        <label for="address" class="form-label">Adresse</label>
                                        <textarea class="form-control" id="address" rows="2">123 Rue de la Paix, 75001 Paris, France</textarea>
                                    </div>
                                </form>
                            </div>
                        </div>

                        <!-- Authentication Information -->
                        {#if authenticated}
                        <div class="card shadow mb-4">
                            <div class="card-header">
                                <h6 class="m-0 font-weight-bold text-primary">Informations d'Authentification</h6>
                            </div>
                            <div class="card-body">
                                <div class="row">
                                    <div class="col-md-6">
                                        <h6 class="text-muted">Statut de connexion</h6>
                                        <span class="badge bg-success fs-6">
                                            <i class="fas fa-check-circle me-1"></i>
                                            Connecté
                                        </span>
                                    </div>
                                    <div class="col-md-6">
                                        <h6 class="text-muted">Dernière connexion</h6>
                                        <p class="mb-0">Aujourd'hui à 14:30</p>
                                    </div>
                                </div>
                                
                                <hr>
                                
                                <div class="token-info p-3 rounded">
                                    <h6 class="text-primary mb-3">
                                        <i class="fas fa-key me-2"></i>
                                        Informations du Token OIDC
                                    </h6>
                                    <pre class="mb-0 small text-dark">{tokenInfo}</pre>
                                </div>
                            </div>
                        </div>
                        {/if}

                        <!-- Activity Log -->
                        <div class="card shadow">
                            <div class="card-header">
                                <h6 class="m-0 font-weight-bold text-primary">Activité Récente</h6>
                            </div>
                            <div class="card-body">
                                <div class="timeline">
                                    <div class="d-flex mb-3">
                                        <div class="flex-shrink-0">
                                            <div class="bg-primary rounded-circle d-flex align-items-center justify-content-center" 
                                                 style="width: 32px; height: 32px;">
                                                <i class="fas fa-sign-in-alt text-white small"></i>
                                            </div>
                                        </div>
                                        <div class="flex-grow-1 ms-3">
                                            <h6 class="mb-1">Connexion réussie</h6>
                                            <p class="text-muted small mb-0">Connexion depuis l'adresse IP 192.168.1.100</p>
                                            <small class="text-muted">Il y a 2 heures</small>
                                        </div>
                                    </div>
                                    
                                    <div class="d-flex mb-3">
                                        <div class="flex-shrink-0">
                                            <div class="bg-success rounded-circle d-flex align-items-center justify-content-center" 
                                                 style="width: 32px; height: 32px;">
                                                <i class="fas fa-edit text-white small"></i>
                                            </div>
                                        </div>
                                        <div class="flex-grow-1 ms-3">
                                            <h6 class="mb-1">Profil mis à jour</h6>
                                            <p class="text-muted small mb-0">Modification des informations de contact</p>
                                            <small class="text-muted">Il y a 1 jour</small>
                                        </div>
                                    </div>
                                    
                                    <div class="d-flex mb-3">
                                        <div class="flex-shrink-0">
                                            <div class="bg-info rounded-circle d-flex align-items-center justify-content-center" 
                                                 style="width: 32px; height: 32px;">
                                                <i class="fas fa-file text-white small"></i>
                                            </div>
                                        </div>
                                        <div class="flex-grow-1 ms-3">
                                            <h6 class="mb-1">Rapport généré</h6>
                                            <p class="text-muted small mb-0">Rapport mensuel des activités clients</p>
                                            <small class="text-muted">Il y a 3 jours</small>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </main>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
