<?php
include 'includes/header.php';

$questions = [
    [
        'question' => 'When learning a new skill, you prefer to:',
        'options' => [
            'v' => 'Watch a video demonstration.',
            'a' => 'Listen to an instructor explain it.',
            'r' => 'Read the instructions or a manual.',
            'k' => 'Jump in and try it yourself.',
        ],
    ],
    [
        'question' => 'What do you remember most from a movie?',
        'options' => [
            'v' => 'The scenery and visuals.',
            'a' => 'The soundtrack and dialogue.',
            'r' => 'The plot details and story.',
            'k' => 'The feelings it gave you.',
        ],
    ],
    [
        'question' => 'When assembling furniture, you first:',
        'options' => [
            'v' => 'Look at the diagrams.',
            'a' => 'Ask someone to read the steps to you.',
            'r' => 'Read the entire instruction booklet.',
            'k' => 'Start putting the pieces together.',
        ],
    ],
    [
        'question' => 'If you need directions to a place, you prefer:',
        'options' => [
            'v' => 'A map.',
            'a' => 'Someone to tell you the directions.',
            'r' => 'Written turn-by-turn directions.',
            'k' => 'To follow someone or use GPS to guide you as you go.',
        ],
    ],
    [
        'question' => "You're trying to spell a difficult word. You:",
        'options' => [
            'v' => 'Visualize the word in your mind.',
            'a' => 'Sound it out.',
            'r' => 'Write it down a few times.',
            'k' => 'Trace the letters with your finger.',
        ],
    ],
    [
        'question' => 'When you meet someone new, you remember them by:',
        'options' => [
            'v' => 'Their face.',
            'a' => 'Their name (after hearing it).',
            'r' => 'Their name (after seeing it written).',
            'k' => 'How you felt during your interaction.',
        ],
    ],
    [
        'question' => "In a new city, you'd love to:",
        'options' => [
            'v' => 'Go to a museum with great art.',
            'a' => 'Attend a concert or a musical.',
            'r' => 'Visit a library or historical archive.',
            'k' => 'Take a walking tour.',
        ],
    ],
    [
        'question' => 'What kind of phone app do you use most?',
        'options' => [
            'v' => 'Photo editing or video streaming.',
            'a' => 'Podcasts or music streaming.',
            'r' => 'News or e-reader apps.',
            'k' => 'Games or fitness tracking apps.',
        ],
    ],
    [
        'question' => 'When you study for a test, you:',
        'options' => [
            'v' => 'Create charts and diagrams.',
            'a' => 'Read your notes out loud.',
            'r' => 'Rewrite your notes.',
            'k' => 'Pace around while studying.',
        ],
    ],
    [
        'question' => 'You are most distracted by:',
        'options' => [
            'v' => 'Visual clutter or untidiness.',
            'a' => 'Unexpected noises.',
            'r' => 'Poorly written text.',
            'k' => 'Sitting still for too long.',
        ],
    ],
    [
        'question' => 'How do you prefer to get news updates?',
        'options' => [
            'v' => 'Watching the news on TV.',
            'a' => 'Listening to a news radio station.',
            'r' => 'Reading a newspaper or news website.',
            'k' => 'Discussing events with others.',
        ],
    ],
    [
        'question' => 'When you cook a new recipe, you:',
        'options' => [
            'v' => 'Watch a cooking show.',
            'a' => 'Have someone tell you the steps.',
            'r' => 'Follow a written recipe.',
            'k' => 'Taste and experiment as you go.',
        ],
    ],
    [
        'question' => "What's your favorite part of a presentation?",
        'options' => [
            'v' => 'The slides and images.',
            'a' => "The speaker's tone and stories.",
            'r' => 'The handouts and notes.',
            'k' => 'The interactive Q&A session.',
        ],
    ],
    [
        'question' => 'You learn a new software program by:',
        'options' => [
            'v' => 'Watching tutorial videos.',
            'a' => 'Following along with audio instructions.',
            'r' => 'Reading the help documentation.',
            'k' => 'Clicking around and figuring it out.',
        ],
    ],
    [
        'question' => 'When choosing a book, you are drawn to:',
        'options' => [
            'v' => 'The cover art.',
            'a' => 'An audiobook version.',
            'r' => 'The description on the back.',
            'k' => 'The feel of the book in your hands.',
        ],
    ],
    [
        'question' => 'How do you best give feedback to someone?',
        'options' => [
            'v' => 'Show them what to do differently.',
            'a' => 'Talk it through with them.',
            'r' => 'Write them an email or note.',
            'k' => 'Role-play the scenario.',
        ],
    ],
    [
        'question' => 'When bored, you are most likely to:',
        'options' => [
            'v' => 'Doodle or watch something.',
            'a' => 'Listen to music or a podcast.',
            'r' => 'Read an article or book.',
            'k' => 'Fidget or walk around.',
        ],
    ],
    [
        'question' => 'You have to memorize a phone number. You:',
        'options' => [
            'v' => 'Picture the numbers on the keypad.',
            'a' => 'Repeat the number out loud.',
            'r' => 'Write the number down.',
            'k' => 'Press the numbers on a keypad.',
        ],
    ],
    [
        'question' => 'Your ideal learning environment has:',
        'options' => [
            'v' => 'Lots of posters and colors.',
            'a' => 'Occasional background music.',
            'r' => 'A quiet space with reference books.',
            'k' => 'Space to move around.',
        ],
    ],
    [
        'question' => 'When recalling a happy memory, you think of:',
        'options' => [
            'v' => 'The sights and what things looked like.',
            'a' => 'The sounds and conversations.',
            'r' => 'The details of what happened in order.',
            'k' => 'The emotions and physical sensations.',
        ],
    ],
];
?>

<div class="card p-4 p-md-5">
    <h2 class="text-center mb-4">VARK Learning Style Quiz</h2>
    <form action="results.php" method="post">
        <div class="mb-4">
            <label for="user_name" class="form-label fw-bold fs-5">Your Name:</label>
            <input type="text" class="form-control" id="user_name" name="user_name" required>
        </div>
        <?php foreach ($questions as $i => $q): ?>
            <div class="mb-4">
                <p class="fw-bold fs-5"><?php echo ($i + 1) . '. ' . htmlspecialchars($q['question']); ?></p>
                <?php foreach ($q['options'] as $key => $option): ?>
                    <div class="form-check">
                        <input class="form-check-input" type="radio" name="q<?php echo $i; ?>" id="q<?php echo $i . $key; ?>" value="<?php echo $key; ?>" required>
                        <label class="form-check-label" for="q<?php echo $i . $key; ?>">
                            <?php echo htmlspecialchars($option); ?>
                        </label>
                    </div>
                <?php endforeach; ?>
            </div>
        <?php endforeach; ?>

        <div class="d-grid">
            <button type="submit" class="btn btn-primary btn-lg">Find My Style!</button>
        </div>
    </form>
</div>

<?php include 'includes/footer.php'; ?>