<?php
$page_title = 'No-Code / Low-Code Builder';
require_once __DIR__ . '/../config.php';
if (session_status() === PHP_SESSION_NONE) { session_start(); }
if (!isset($_SESSION['admin_id'])) { redirect(SITE_URL . '/admin/login.php'); }
require_once __DIR__ . '/header.php';
?>

<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:24px;">
    <div>
        <h2 style="font-family:'Outfit', sans-serif; font-size:1.8rem; color:#0f172a; margin:0;"><i class="fas fa-puzzle-piece" style="color:#ec4899; margin-right:10px;"></i>No-Code / Low-Code Builder</h2>
        <p style="color:#64748b; font-size:0.95rem; margin-top:5px;">Build forms, workflows, reports, dashboards, and apps without writing code.</p>
    </div>
</div>

<div class="grid-4" style="margin-bottom:24px; gap:20px;">
    <?php
    $builders = [
        ['Form Builder', 'fas fa-wpforms', '#3b82f6', '42 Forms', 'Drag & Drop UI'],
        ['Workflow Builder', 'fas fa-project-diagram', '#10b981', '18 Flows', 'Visual Logic'],
        ['Report Builder', 'fas fa-chart-bar', '#f59e0b', '56 Reports', 'SQL-Free'],
        ['Dashboard Builder', 'fas fa-tachometer-alt', '#8b5cf6', '24 Boards', 'Real-time Widgets'],
        ['App Builder', 'fas fa-mobile-alt', '#ec4899', '8 Apps', 'PWA Ready'],
        ['Rules Engine', 'fas fa-code-branch', '#06b6d4', '120 Rules', 'If-Then Logic'],
        ['Automation Builder', 'fas fa-robot', '#ef4444', '35 Bots', 'Trigger-based'],
    ];
    foreach ($builders as $b): ?>
    <div style="background:#fff; border-radius:12px; border:1px solid #e2e8f0; padding:25px; text-align:center; cursor:pointer; transition:all 0.3s; box-shadow:0 2px 4px rgba(0,0,0,0.02);" onmouseover="this.style.transform='translateY(-4px)'; this.style.boxShadow='0 8px 25px rgba(0,0,0,0.1)'" onmouseout="this.style.transform='translateY(0)'; this.style.boxShadow='0 2px 4px rgba(0,0,0,0.02)'">
        <div style="width:60px; height:60px; border-radius:16px; background:<?= $b[2] ?>15; display:flex; align-items:center; justify-content:center; margin:0 auto 15px;">
            <i class="<?= $b[1] ?>" style="font-size:1.5rem; color:<?= $b[2] ?>;"></i>
        </div>
        <h3 style="margin:0 0 5px; color:#0f172a; font-size:1rem;"><?= $b[0] ?></h3>
        <p style="font-size:0.8rem; color:#94a3b8; margin:0 0 12px;"><?= $b[4] ?></p>
        <span style="background:<?= $b[2] ?>15; color:<?= $b[2] ?>; padding:4px 12px; border-radius:8px; font-size:0.75rem; font-weight:bold;"><?= $b[3] ?></span>
    </div>
    <?php endforeach; ?>
</div>

<div class="grid-2">
    <div style="background:#fff; padding:20px; border-radius:12px; border:1px solid #e2e8f0;">
        <h3 style="margin:0 0 15px; font-size:1.15rem; color:#0f172a;"><i class="fas fa-history" style="color:#6366f1; margin-right:8px;"></i>Recently Built</h3>
        <?php
        $recent = [
            ['Dealer Onboarding Form', 'Form', 'Ramesh K.', '2 hrs ago', '#3b82f6'],
            ['Monthly Sales Report', 'Report', 'Priya S.', '5 hrs ago', '#f59e0b'],
            ['Leave Approval Flow', 'Workflow', 'HR Team', '1 day ago', '#10b981'],
            ['Inventory Tracker Board', 'Dashboard', 'Ops Team', '2 days ago', '#8b5cf6'],
        ];
        foreach ($recent as $r): ?>
        <div style="display:flex; justify-content:space-between; align-items:center; padding:12px 0; border-bottom:1px solid #f1f5f9;">
            <div>
                <div style="font-weight:600; font-size:0.9rem; color:#0f172a;"><?= $r[0] ?></div>
                <div style="font-size:0.75rem; color:#94a3b8;">By <?= $r[2] ?> · <?= $r[3] ?></div>
            </div>
            <span style="background:<?= $r[4] ?>15; color:<?= $r[4] ?>; padding:3px 10px; border-radius:10px; font-size:0.7rem; font-weight:bold;"><?= $r[1] ?></span>
        </div>
        <?php endforeach; ?>
    </div>

    <div style="background:linear-gradient(135deg,#ec4899,#be185d); color:#fff; padding:30px; border-radius:12px; display:flex; flex-direction:column; justify-content:center;">
        <i class="fas fa-rocket" style="font-size:2.5rem; margin-bottom:15px; opacity:0.8;"></i>
        <h3 style="margin:0 0 10px; font-size:1.3rem;">Start Building Now</h3>
        <p style="margin:0 0 20px; font-size:0.9rem; opacity:0.85;">Create enterprise apps in minutes. No developers needed.</p>
        <button style="background:#fff; color:#ec4899; border:none; padding:12px 24px; border-radius:8px; font-size:0.95rem; cursor:pointer; font-weight:700; align-self:flex-start;">Open Builder Studio</button>
    </div>
</div>

<?php require_once __DIR__ . '/footer.php'; ?>
