CREATE TABLE IF NOT EXISTS nav_menus (
    id INT AUTO_INCREMENT PRIMARY KEY,
    menu_type ENUM('membre','admin') NOT NULL DEFAULT 'membre',
    group_id VARCHAR(60) DEFAULT NULL,
    group_label VARCHAR(100) DEFAULT NULL,
    group_order INT NOT NULL DEFAULT 0,
    item_order INT NOT NULL DEFAULT 0,
    label VARCHAR(120) NOT NULL,
    page VARCHAR(80) DEFAULT NULL,
    href VARCHAR(255) DEFAULT NULL,
    icon_svg TEXT DEFAULT NULL,
    target ENUM('_self','_blank') DEFAULT '_self',
    roles_allowed JSON NOT NULL COMMENT 'Array: prospect|client_essentiel|client_premium|admin|responsable|membre',
    badge_id VARCHAR(60) DEFAULT NULL COMMENT 'ID element DOM pour badge dynamique',
    extra_classes VARCHAR(200) DEFAULT NULL,
    active TINYINT(1) NOT NULL DEFAULT 1,
    created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Seed menu membre
INSERT INTO nav_menus (menu_type, group_id, group_label, group_order, item_order, label, page, icon_svg, roles_allowed, extra_classes) VALUES
('membre', NULL, NULL, 0, 0, 'Accueil', 'dashboard', '<path d="M2 6.5L8 2l6 4.5V14H2V6.5z"/>', '["prospect","client_essentiel","client_premium"]', NULL),
('membre', 'sb-dev', 'Mon développement', 1, 0, 'Mon suivi', 'profil-developpement', '<circle cx="8" cy="5" r="3"/><path d="M2 14c0-3.3 2.7-6 6-6s6 2.7 6 6"/>', '["prospect","client_essentiel","client_premium"]', NULL),
('membre', 'sb-dev', 'Mon développement', 1, 1, 'Où j''en suis ?', 'quiz-profil', '<circle cx="8" cy="8" r="6"/><path d="M8 7c0-1 .8-1.5 1.5-1S11 7.5 8 9v1"/><circle cx="8" cy="12" r=".5" fill="currentColor"/>', '["client_essentiel","client_premium"]', 'sb-quiz-link'),
('membre', 'sb-communaute', 'La Communauté', 2, 0, 'Membres', 'communaute', '<circle cx="6" cy="6" r="3"/><circle cx="11" cy="6" r="2"/><path d="M1 14c0-2.8 2.2-5 5-5s5 2.2 5 5"/><path d="M11 9c1.7 0 3 1.3 3 3"/>', '["client_essentiel","client_premium"]', NULL),
('membre', 'sb-communaute', 'La Communauté', 2, 1, 'Collaboration', 'collaboration', '<path d="M3 2h10v12H3z"/><path d="M6 6h4M6 9h4M6 12h2"/>', '["client_essentiel","client_premium"]', NULL),
('membre', 'sb-ressources', 'Ressources', 3, 0, 'Catalogue', 'developpement', '<rect x="2" y="2" width="5" height="5" rx="1"/><rect x="9" y="2" width="5" height="5" rx="1"/><rect x="2" y="9" width="5" height="5" rx="1"/><rect x="9" y="9" width="5" height="5" rx="1"/>', '["prospect","client_essentiel","client_premium"]', NULL),
('membre', 'sb-ressources', 'Ressources', 3, 1, 'Parcours', 'parcours-liste', '<path d="M2 4h12M2 8h8M2 12h10"/><circle cx="13" cy="12" r="2"/>', '["client_essentiel","client_premium"]', NULL),
('membre', 'sb-ressources', 'Ressources', 3, 2, 'Ma prospection', 'prospection', '<circle cx="7" cy="7" r="4.5"/><path d="M10.2 10.2 L14 14"/>', '["client_essentiel","client_premium"]', NULL),
('membre', 'sb-ressources', 'Ressources', 3, 3, 'Ma vitrine', 'ma-vitrine', '<rect x="2" y="2" width="12" height="10" rx="1.5"/><path d="M5 6h6M5 9h4"/>', '["client_essentiel","client_premium"]', NULL),
('membre', 'sb-ressources', 'Ressources', 3, 4, 'Formules', 'formules', '<rect x="2" y="2" width="5" height="5" rx="1"/><rect x="9" y="2" width="5" height="5" rx="1"/><rect x="2" y="9" width="5" height="5" rx="1"/><rect x="9" y="9" width="5" height="5" rx="1"/>', '["prospect","client_essentiel","client_premium"]', NULL),
('membre', 'sb-ressources', 'Ressources', 3, 5, 'Offres & Services', 'experts', '<path d="M3 2h10v12H3z"/><path d="M6 6h4M6 9h4M6 12h2"/>', '["client_essentiel","client_premium"]', NULL),
('membre', 'sb-ressources', 'Ressources', 3, 6, 'Services Uluana', 'services-uluana', '<circle cx="8" cy="8" r="6.5"/><path d="M8 4.5v4l2.5 1.5"/>', '["prospect","client_essentiel","client_premium"]', NULL),
('membre', NULL, NULL, 4, 0, 'Le Lab', 'le-lab', '<path d="M2 12l4-4 3 3 5-6"/>', '["client_essentiel","client_premium"]', NULL),
('membre', NULL, NULL, 5, 0, 'Groupe WhatsApp', NULL, '<path d="M12.04 2C6.58 2 2.13 6.45 2.13 11.91c0 1.75.46 3.46 1.32 4.96L2.05 22l5.25-1.38a9.9 9.9 0 0 0 4.74 1.2h.01c5.46 0 9.91-4.45 9.91-9.91 0-2.65-1.03-5.14-2.9-7.01A9.85 9.85 0 0 0 12.04 2z"/>', '["client_essentiel","client_premium"]', NULL),

-- Seed menu admin
('admin', NULL, NULL, 0, 0, 'Accueil', 'admin-dashboard', '<path d="M2 6.5L8 2l6 4.5V14H2V6.5z"/>', '["admin","responsable"]', NULL),
('admin', NULL, NULL, 0, 1, 'Candidatures', 'admin-candidatures', '<path d="M3 2h10v12H3z"/><path d="M6 6h4M6 9h4M6 12h2"/>', '["admin","responsable"]', NULL),
('admin', NULL, NULL, 0, 2, 'Suivi clients', 'suivi-clients', '<circle cx="6" cy="5" r="3"/><circle cx="12" cy="5" r="2"/><path d="M1 14c0-2.5 2.2-4.5 5-4.5s5 2 5 4.5"/><path d="M12 9c1.5 0 3 1 3 3"/>', '["admin","responsable"]', NULL),
('admin', NULL, NULL, 0, 3, 'Gérer les parcours', 'admin-parcours', '<path d="M2 4h12M2 8h8M2 12h10"/><circle cx="13" cy="12" r="2"/>', '["admin","responsable"]', NULL),
('admin', NULL, NULL, 0, 4, 'Cartes d''action', 'admin-cards', '<rect x="1.5" y="2" width="13" height="10" rx="1.5"/><path d="M4 6h8M4 9h5"/>', '["admin","responsable"]', NULL),
('admin', NULL, NULL, 0, 5, 'Gérer les partenaires', 'admin-partenaires', '<circle cx="8" cy="6" r="2.5"/><path d="M3 14c0-2.8 2.2-5 5-5s5 2.2 5 5"/>', '["admin","responsable"]', NULL),
('admin', NULL, NULL, 0, 6, 'Partager un fichier', 'partage-fichier', '<path d="M8 2v8M8 2l3 3M8 2L5 5"/><path d="M3 10v3a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-3"/>', '["admin","responsable"]', NULL),
('admin', NULL, NULL, 0, 7, 'Réponses questionnaire', 'admin-activite-diagnostics', '<path d="M4 2h8v12H4z"/><path d="M6 5h4M6 8h4M6 11h2"/>', '["admin","responsable"]', NULL),
('admin', NULL, NULL, 0, 8, 'Landing pages', 'admin-landing-themes', '<rect x="2" y="3" width="12" height="10" rx="1"/><path d="M2 6h12"/>', '["admin","responsable"]', NULL),
('admin', NULL, NULL, 0, 9, 'Prospection', 'admin-prospection', '<circle cx="7" cy="7" r="4.5"/><path d="M10.2 10.2 L14 14"/>', '["admin","responsable"]', NULL),
('admin', NULL, NULL, 0, 10, 'Vitrines créateurs', 'admin-creator-pages', '<rect x="2" y="2" width="12" height="10" rx="1.5"/><path d="M5 8h6M5 11h3"/>', '["admin","responsable"]', NULL),
('admin', NULL, NULL, 0, 11, 'Témoignages', 'admin-temoignages', '<path d="M2 3.5h12v7H6.5L3 13.5v-3H2z"/>', '["admin","responsable"]', NULL),
('admin', NULL, NULL, 0, 12, 'Agent Threads', 'admin-threads', '<path d="M2 3l12 5.5-5 1.5-1.5 5z"/>', '["admin","responsable"]', NULL),
('admin', NULL, NULL, 0, 13, 'Paramétrage menus', 'admin-nav', '<path d="M2 4h12M2 8h12M2 12h8"/><circle cx="13" cy="12" r="2"/>', '["admin"]', NULL);
