<!DOCTYPE html>

<html lang="fr">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Theologia Reformata — Parcours Théologique</title>

    <style>

        :root { --primary: #2c3e50; --secondary: #2980b9; --accent: #e74c3c; --bg: #f4f7f6; --sidebar: #1a252f; --text: #333; }

        body { font-family: 'Segoe UI', system-ui, sans-serif; margin: 0; display: flex; background-color: var(--bg); color: var(--text); min-height: 100vh; }

        nav { width: 280px; background: var(--sidebar); color: white; height: 100vh; position: sticky; top: 0; padding: 25px; box-sizing: border-box; overflow-y: auto; }

        nav h1 { font-size: 1.1rem; border-bottom: 1px solid #34495e; padding-bottom: 15px; margin-bottom: 20px; }

        .nav-group { margin-bottom: 25px; }

        .nav-group h3 { font-size: 0.75rem; text-transform: uppercase; color: #7f8c8d; letter-spacing: 1px; }

        nav ul { list-style: none; padding: 0; }

        nav li { padding: 10px; font-size: 0.9rem; cursor: pointer; border-radius: 5px; transition: 0.2s; }

        nav li:hover { background: #34495e; }

        main { flex: 1; padding: 40px 60px; max-width: 1000px; box-sizing: border-box; }

        .header-card { background: white; padding: 30px; border-radius: 12px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); margin-bottom: 30px; }

        .stats-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 20px; margin: 20px 0; }

        .stat-item { background: #fff; padding: 15px; border-radius: 8px; text-align: center; border: 1px solid #e0e0e0; }

        .stat-item span { display: block; font-size: 1.5rem; font-weight: bold; color: var(--secondary); }

        .stat-item label { font-size: 0.75rem; color: #7f8c8d; }

        h2 { color: var(--primary); border-bottom: 2px solid var(--secondary); padding-bottom: 10px; margin-top: 50px; }

        .box { background: white; padding: 25px; border-radius: 8px; border-left: 4px solid var(--secondary); margin: 20px 0; box-shadow: 0 2px 4px rgba(0,0,0,0.03); }

        .quote { font-style: italic; border-left: 4px solid var(--accent); padding: 15px 25px; background: #fff5f5; margin: 25px 0; }

        table { width: 100%; border-collapse: collapse; margin: 25px 0; background: white; }

        th, td { padding: 12px; border: 1px solid #eee; text-align: left; }

        th { background: var(--primary); color: white; }

        .btn-complete { background: var(--secondary); color: white; border: none; padding: 10px 20px; border-radius: 5px; cursor: pointer; font-weight: bold; transition: 0.3s; }

        .btn-complete:hover { background: #1c5980; }

        .btn-complete:disabled { background: #27ae60; cursor: default; }

        #progress-container { margin-top: 50px; padding: 10px; background: #2c3e50; border-radius: 5px; }

        @media (max-width: 900px) { body { flex-direction: column; } nav { width: 100%; height: auto; position: static; } }

    </style>

</head>

<body>


<nav>

    <h1>✝ THEOLOGIA REFORMATA</h1>

    <div class="nav-group">

        <h3>Théologie</h3>

        <ul><li>📖 Fondements</li><li>🕊 Sotériologie</li><li>⛪ Ecclésiologie</li></ul>

    </div>

    <div id="progress-container">

        <small id="progression-label">Progression : 0%</small>

        <div style="width: 100%; background: #1a252f; height: 8px; border-radius: 4px; margin-top: 5px;">

            <div id="progress-inner" style="width: 0%; background: #27ae60; height: 100%; border-radius: 4px; transition: 0.5s;"></div>

        </div>

    </div>

</nav>


<main>

    <div class="header-card">

        <h1>Parcours Théologique</h1>

        <div class="stats-bar">

            <div class="stat-item"><span id="count-modules">0</span><label>Modules finis</label></div>

            <div class="stat-item"><span id="count-exos">0</span><label>Exercices</label></div>

            <div class="stat-item"><span>1</span><label>Jour actif</label></div>

        </div>

    </div>


    <section>

        <h2>I. Les Fondements</h2>

        <div class="box">

            <p>Le cœur de la Réforme repose sur les <strong>Cinq Solas</strong>.</p>

            <button class="btn-complete" onclick="markAsComplete(1, this)">Valider ce module</button>

        </div>

    </section>


    <section>

        <h2>II. Théologie Comparée</h2>

        <div class="box">

            <p>Étude des divergences entre traditions Protestante, Catholique et Orthodoxe.</p>

            <button class="btn-complete" onclick="markAsComplete(2, this)">Valider ce module</button>

        </div>

    </section>

</main>


<script>

    // Utilisation d'un bloc de sécurité pour éviter les erreurs de chargement

    (function() {

        const totalModules = 2; // Ajustez selon le nombre de boutons

        let userProgress = { completed: [] };


        // Charger les données en toute sécurité

        try {

            const saved = localStorage.getItem('reformata_data');

            if (saved) userProgress = JSON.parse(saved);

        } catch (e) {

            console.error("Erreur LocalStorage:", e);

        }


        window.updateUI = function() {

            const completedCount = userProgress.completed.length;

            const percent = Math.round((completedCount / totalModules) * 100);


            // Mise à jour sécurisée des éléments DOM

            const countEl = document.getElementById('count-modules');

            const labelEl = document.getElementById('progression-label');

            const barEl = document.getElementById('progress-inner');


            if (countEl) countEl.innerText = completedCount;

            if (labelEl) labelEl.innerText = `Progression : ${percent}%`;

            if (barEl) barEl.style.width = percent + '%';


            // Désactivation des boutons

            userProgress.completed.forEach(id => {

                const btn = document.querySelector(`button[onclick*="markAsComplete(${id}"]`);

                if (btn) {

                    btn.innerText = "✓ Terminé";

                    btn.disabled = true;

                }

            });

        };


        window.markAsComplete = function(id, btn) {

            if (!userProgress.completed.includes(id)) {

                userProgress.completed.push(id);

                localStorage.setItem('reformata_data', JSON.stringify(userProgress));

                window.updateUI();

            }

        };


        // Lancement au chargement du DOM

        document.addEventListener('DOMContentLoaded', window.updateUI);

    })();

</script>

</body>

</html>