<?php
// Bible Study: 1 John, 2 John, 3 John - Updated with Faith and Finished Work

$johnLetters = [
    "title" => "Bible Study on 1 John, 2 John, and 3 John",
    
    "overview" => "The letters of John focus on love, truth, fellowship with God, obedience, and discernment of false teachings. The key commandment is to believe in Jesus Christ whom God has sent. Perfection is not achieved by self-effort, but through faith in Christ and His finished work. Walking in the light begins by acknowledging sin and trusting Jesus, not by claiming to be without sin.",

    "books" => [
        "1 John" => [
            "focus" => "Walking in the light, love, and assurance of salvation through faith in Jesus",
            "key_points" => [
                "Believe in Jesus Christ, the Son of God (1 John 3:23). Faith in Him is the foundation of our relationship with God.",
                "Confess and acknowledge sin; walking in the light begins with honesty about our condition (1 John 1:8-9).",
                "Perfection is by faith, not works: trusting in Jesus’ finished work on the cross, not self-effort.",
                "Love others as evidence of living in the light (1 John 4:7-12).",
                "Test spirits and reject false teachings (1 John 4:1-3)."
            ]
        ],
        "2 John" => [
            "focus" => "Walking in truth and love; guarding against deception",
            "key_points" => [
                "Faithful obedience to God’s commandment is evidence of truth and love: believe in Jesus (2 John 1:6).",
                "Reject deceivers who deny Christ coming in the flesh (2 John 1:7-11).",
                "Show practical love by welcoming and supporting fellow believers, not false teachers.",
                "Do not confuse perfection with human works; love flows from trusting Christ."
            ]
        ],
        "3 John" => [
            "focus" => "Support for faithful servants; warning against pride and division",
            "key_points" => [
                "Commendation for walking in truth and love by faith in Jesus (3 John 1:1-8).",
                "Beware of pride, divisiveness, and refusing Godly authority (3 John 1:9-10).",
                "Encourage and support those faithfully following Christ.",
                "Perfection is not measured by human success, morality, or influence, but by faith in Jesus."
            ]
        ]
    ],
    
    "common_themes" => [
        "Faith in Jesus" => [
            "description" => "The central commandment is to believe in Jesus Christ. Our relationship with God, assurance, and perfection come through trusting His finished work.",
            "supporting_verses" => [
                "1 John 3:23 – 'And this is His command: to believe in the name of His Son, Jesus Christ…'",
                "2 John 1:6 – 'This is love: that we walk in obedience to His commands… which includes faith in the Son.'",
                "3 John 1:4 – 'I have no greater joy than to hear that my children are walking in the truth.'"
            ]
        ],
        "Confession of Sin / Walking in the Light" => [
            "description" => "Perfection is not self-achieved. Confession and reliance on Christ bring forgiveness and purification.",
            "supporting_verses" => [
                "1 John 1:8-9 – 'If we claim to be without sin, we deceive ourselves. If we confess our sins, God is faithful and just to forgive us…'",
                "1 John 2:1-2 – 'If anybody sins, we have an advocate with the Father—Jesus Christ the righteous…'"
            ]
        ],
        "Love as Evidence" => [
            "description" => "Love for God and others shows we are in the light; it is the fruit of faith, not the means to earn perfection.",
            "supporting_verses" => [
                "1 John 4:7-12 – Love one another because God is love",
                "2 John 1:5-6 – Walk in love",
                "3 John 1:6 – Demonstrate love by supporting faithful servants"
            ]
        ],
        "Discernment and Obedience" => [
            "description" => "Walking in faith involves rejecting false teaching and living in obedience, empowered by belief in Jesus, not self-effort.",
            "supporting_verses" => [
                "1 John 4:1 – Test the spirits",
                "2 John 1:7 – Beware deceivers",
                "3 John 1:9-10 – Avoid divisive leaders and follow godly examples"
            ]
        ]
    ],
    
    "practical_application" => [
        "Daily confess sin and rely on Jesus’ finished work, not your own perfection.",
        "Examine whether your love flows from faith, not obligation or moral effort.",
        "Encourage and support others walking faithfully in truth and love.",
        "Practice discernment; reject false teaching and deceptive influences.",
        "Rest in the assurance of faith: perfection comes through Christ, not human effort."
    ],
    
    "group_discussion_questions" => [
        "Why do some people confuse faith with self-effort and think they must be perfect on their own?",
        "How does confessing sin and trusting Jesus’ finished work relieve guilt and bring assurance?",
        "In what ways can love be a practical evidence of faith rather than a performance?",
        "How can we recognize and avoid deception while walking in truth?",
        "How can this understanding change your daily relationship with God and others?"
    ]
];

?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title><?php echo $johnLetters['title']; ?></title>
    <style>
        body { font-family: Arial, sans-serif; line-height: 1.6; margin: 20px; max-width: 900px; }
        h1, h2, h3 { color: #2c3e50; }
        ul { margin-bottom: 20px; }
        li { margin-bottom: 10px; }
        .section { margin-bottom: 30px; padding-bottom: 20px; border-bottom: 1px solid #ccc; }
        .theme { font-style: italic; color: #34495e; }
    </style>
</head>
<body>

<h1><?php echo $johnLetters['title']; ?></h1>
<p><?php echo $johnLetters['overview']; ?></p>

<h2>1. Key Focus of Each Book</h2>
<?php foreach ($johnLetters['books'] as $book => $details) { ?>
    <div class="section">
        <h3><?php echo $book; ?></h3>
        <p><strong>Focus:</strong> <?php echo $details['focus']; ?></p>
        <p><strong>Key Points:</strong></p>
        <ul>
        <?php foreach ($details['key_points'] as $point) {
            echo "<li>$point</li>";
        } ?>
        </ul>
    </div>
<?php } ?>

<h2>2. Common Themes Across John’s Letters</h2>
<?php foreach ($johnLetters['common_themes'] as $theme => $details) { ?>
    <div class="section">
        <h3><?php echo $theme; ?></h3>
        <p class="theme"><?php echo $details['description']; ?></p>
        <p><strong>Supporting Verses:</strong></p>
        <ul>
        <?php foreach ($details['supporting_verses'] as $verse) {
            echo "<li>$verse</li>";
        } ?>
        </ul>
    </div>
<?php } ?>

<h2>3. Practical Application</h2>
<ul>
<?php foreach ($johnLetters['practical_application'] as $action) {
    echo "<li>$action</li>";
} ?>
</ul>

<h2>4. Group Discussion Questions</h2>
<ul>
<?php foreach ($johnLetters['group_discussion_questions'] as $question) {
    echo "<li>$question</li>";
} ?>
</ul>

</body>
</html>
