<?php

require_once __DIR__ . '/vendor/autoload.php';

use PHPNative\Framework\Application;
use PHPNative\Ui\Widget\Container;
use PHPNative\Ui\Widget\Label;
use PHPNative\Ui\Window;

$app = new Application();
$window = new Window('Scroll Test', 400, 300);

// Main container
$mainContainer = new Container('flex flex-col bg-white');

// Create a scrollable container with fixed height
$scrollContainer = new Container('flex flex-col w-full h-48 overflow-auto bg-gray-100 border-2 border-red-500');

// Add many labels to force scrolling
for ($i = 1; $i <= 30; $i++) {
    $label = new Label("Item $i", 'px-4 py-2 border-b border-gray-300 text-black bg-white');
    $scrollContainer->addComponent($label);
}

$mainContainer->addComponent(new Label('Scroll Test (red box should be scrollable)', 'text-xl font-bold p-4 text-black'));
$mainContainer->addComponent($scrollContainer);
$mainContainer->addComponent(new Label('Try scrolling with mouse wheel over the red box', 'p-4 text-black'));

$window->setRoot($mainContainer);
$app->addWindow($window);

echo "Scroll Test started!\n";
echo "- Red box should show scrollbar\n";
echo "- Try scrolling with mouse wheel\n\n";

$app->run();
