<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Connexion - <?= APP_NAME ?></title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        body { font-family: 'Inter', sans-serif; }
        .gradient-border { background: linear-gradient(135deg, #0ea5e9, #10b981); padding: 2px; }
        .input-focus:focus { box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15); }
    </style>
</head>
<body class="bg-slate-900 min-h-screen flex">
    
    <!-- Left Side - Branding -->
    <div class="hidden lg:flex lg:w-1/2 bg-gradient-to-br from-slate-800 to-slate-900 relative overflow-hidden">
        <!-- Decorative Elements -->
        <div class="absolute top-20 left-20 w-72 h-72 bg-cyan-500/10 rounded-full blur-3xl"></div>
        <div class="absolute bottom-20 right-20 w-96 h-96 bg-emerald-500/10 rounded-full blur-3xl"></div>
        
        <div class="relative z-10 flex flex-col justify-center px-16">
            <!-- Logo -->
            <div class="flex items-center space-x-4 mb-12">
                <div class="w-14 h-14 bg-gradient-to-br from-cyan-500 to-emerald-500 rounded-2xl flex items-center justify-center shadow-lg shadow-cyan-500/30">
                    <i class="fas fa-headset text-white text-2xl"></i>
                </div>
                <span class="text-3xl font-bold text-white"><?= APP_NAME ?></span>
            </div>
            
            <!-- Tagline -->
            <h1 class="text-4xl xl:text-5xl font-bold text-white leading-tight mb-6">
                Service Client<br>
                <span class="bg-gradient-to-r from-cyan-400 to-emerald-400 bg-clip-text text-transparent">Nouvelle Génération</span>
            </h1>
            
            <p class="text-slate-400 text-lg mb-12 max-w-md">
                Plateforme intelligente de gestion client avec support vocal multilingue et IA conversationnelle.
            </p>
            
            <!-- Features -->
            <div class="space-y-4">
                <div class="flex items-center space-x-3 text-slate-300">
                    <div class="w-8 h-8 bg-cyan-500/20 rounded-lg flex items-center justify-center">
                        <i class="fas fa-microphone text-cyan-400 text-sm"></i>
                    </div>
                    <span>Support vocal en 4 langues locales</span>
                </div>
                <div class="flex items-center space-x-3 text-slate-300">
                    <div class="w-8 h-8 bg-emerald-500/20 rounded-lg flex items-center justify-center">
                        <i class="fas fa-robot text-emerald-400 text-sm"></i>
                    </div>
                    <span>IA conversationnelle avancée</span>
                </div>
                <div class="flex items-center space-x-3 text-slate-300">
                    <div class="w-8 h-8 bg-blue-500/20 rounded-lg flex items-center justify-center">
                        <i class="fas fa-chart-line text-blue-400 text-sm"></i>
                    </div>
                    <span>Analytics et CX Index en temps réel</span>
                </div>
            </div>
        </div>
    </div>
    
    <!-- Right Side - Login Form -->
    <div class="w-full lg:w-1/2 flex items-center justify-center p-8">
        <div class="w-full max-w-md">
            <!-- Mobile Logo -->
            <div class="lg:hidden flex items-center justify-center space-x-3 mb-10">
                <div class="w-12 h-12 bg-gradient-to-br from-cyan-500 to-emerald-500 rounded-xl flex items-center justify-center">
                    <i class="fas fa-headset text-white text-xl"></i>
                </div>
                <span class="text-2xl font-bold text-white"><?= APP_NAME ?></span>
            </div>
            
            <!-- Form Card -->
            <div class="bg-slate-800/50 backdrop-blur-xl rounded-3xl p-8 border border-slate-700/50 shadow-2xl">
                <div class="text-center mb-8">
                    <h2 class="text-2xl font-bold text-white mb-2">Bienvenue</h2>
                    <p class="text-slate-400">Connectez-vous à votre espace</p>
                </div>
                
                <?php if (!empty($error)): ?>
                    <div class="mb-6 p-4 bg-red-500/10 border border-red-500/30 text-red-400 rounded-xl text-center text-sm">
                        <i class="fas fa-exclamation-circle mr-2"></i><?= htmlspecialchars($error) ?>
                    </div>
                <?php endif; ?>
                
                <?php if (!empty($_SESSION['register_success'])): ?>
                    <div class="mb-6 p-4 bg-emerald-500/10 border border-emerald-500/30 text-emerald-400 rounded-xl text-center text-sm">
                        <i class="fas fa-check-circle mr-2"></i><?= htmlspecialchars($_SESSION['register_success']) ?>
                    </div>
                    <?php unset($_SESSION['register_success']); ?>
                <?php endif; ?>
                
                <form action="<?= BASE_URL ?>/auth/login" method="POST" class="space-y-5">
                    <input type="hidden" name="csrf_token" value="<?= $csrf_token ?? '' ?>">
                    
                    <div>
                        <label class="block text-slate-300 text-sm font-medium mb-2" for="email">
                            Email
                        </label>
                        <div class="relative">
                            <span class="absolute inset-y-0 left-0 pl-4 flex items-center text-slate-500">
                                <i class="fas fa-envelope"></i>
                            </span>
                            <input type="email" id="email" name="email" required
                                   class="w-full pl-12 pr-4 py-3.5 bg-slate-700/50 border border-slate-600/50 rounded-xl text-white placeholder-slate-500 focus:border-cyan-500 focus:outline-none input-focus transition"
                                   placeholder="votre@email.com">
                        </div>
                    </div>
                    
                    <div>
                        <label class="block text-slate-300 text-sm font-medium mb-2" for="password">
                            Mot de passe
                        </label>
                        <div class="relative">
                            <span class="absolute inset-y-0 left-0 pl-4 flex items-center text-slate-500">
                                <i class="fas fa-lock"></i>
                            </span>
                            <input type="password" id="password" name="password" required
                                   class="w-full pl-12 pr-4 py-3.5 bg-slate-700/50 border border-slate-600/50 rounded-xl text-white placeholder-slate-500 focus:border-cyan-500 focus:outline-none input-focus transition"
                                   placeholder="••••••••">
                        </div>
                    </div>
                    
                    <div class="flex items-center justify-between text-sm">
                        <label class="flex items-center text-slate-400 cursor-pointer">
                            <input type="checkbox" class="w-4 h-4 rounded border-slate-600 bg-slate-700 text-cyan-500 focus:ring-cyan-500 focus:ring-offset-0 mr-2">
                            Se souvenir de moi
                        </label>
                        <a href="#" class="text-cyan-400 hover:text-cyan-300 transition">Mot de passe oublié?</a>
                    </div>
                    
                    <button type="submit"
                            class="w-full bg-gradient-to-r from-cyan-500 to-emerald-500 text-white py-3.5 px-4 rounded-xl font-semibold hover:from-cyan-600 hover:to-emerald-600 transition duration-200 flex items-center justify-center shadow-lg shadow-cyan-500/25 hover:shadow-cyan-500/40">
                        <i class="fas fa-sign-in-alt mr-2"></i>Se connecter
                    </button>
                </form>
                
                <div class="mt-8 pt-6 border-t border-slate-700/50">
                    <p class="text-center text-slate-400 text-sm">
                        Pas encore de compte? 
                        <a href="<?= BASE_URL ?>/auth/register" class="text-cyan-400 hover:text-cyan-300 font-medium transition">Créer un compte</a>
                    </p>
                </div>
            </div>
            
            <!-- Footer -->
            <div class="text-center mt-8">
                <div class="flex items-center justify-center space-x-4 text-slate-500 text-sm mb-4">
                    <span class="flex items-center"><i class="fas fa-globe-africa mr-1"></i> FR</span>
                    <span>•</span>
                    <span>Bambara</span>
                    <span>•</span>
                    <span>Peulh</span>
                    <span>•</span>
                    <span>Soninké</span>
                </div>
                <p class="text-slate-600 text-sm">&copy; <?= date('Y') ?> <?= APP_NAME ?></p>
            </div>
        </div>
    </div>
</body>
</html>
