<?php
$page_title = 'AI Copilot Suite';
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-magic" style="color:#8b5cf6; margin-right:10px;"></i>AI Copilot Suite</h2>
        <p style="color:#64748b; font-size:0.95rem; margin-top:5px;">Department-specific AI copilots for sales, HR, factory, finance, and support.</p>
    </div>
</div>
<div class="grid-4" style="margin-bottom:24px; gap:20px;">
    <?php
    $copilots = [
        ['Sales Copilot', 'fas fa-chart-line', '#10b981', '2,400 assists/mo', 'Deal insights, lead scoring, pricing recommendations'],
        ['HR Copilot', 'fas fa-users', '#3b82f6', '840 assists/mo', 'Leave analysis, attrition prediction, policy Q&A'],
        ['Factory Copilot', 'fas fa-industry', '#f59e0b', '1,200 assists/mo', 'OEE optimization, predictive maintenance, quality alerts'],
        ['Finance Copilot', 'fas fa-calculator', '#8b5cf6', '960 assists/mo', 'Cash flow forecasting, variance analysis, audit prep'],
        ['Support Copilot', 'fas fa-headset', '#ec4899', '3,800 assists/mo', 'Auto-response, ticket classification, sentiment detection'],
    ];
    foreach ($copilots as $c): ?>
    <div style="background:#fff; border-radius:12px; border:1px solid #e2e8f0; padding:25px; text-align:center; cursor:pointer; transition:all 0.3s;" 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='none'">
        <div style="width:60px; height:60px; border-radius:16px; background:<?= $c[2] ?>15; display:flex; align-items:center; justify-content:center; margin:0 auto 15px;">
            <i class="<?= $c[1] ?>" style="font-size:1.5rem; color:<?= $c[2] ?>;"></i>
        </div>
        <h3 style="margin:0 0 5px; color:#0f172a; font-size:1rem;"><?= $c[0] ?></h3>
        <p style="font-size:0.75rem; color:#94a3b8; margin:0 0 10px;"><?= $c[4] ?></p>
        <span style="background:<?= $c[2] ?>15; color:<?= $c[2] ?>; padding:4px 12px; border-radius:8px; font-size:0.75rem; font-weight:bold;"><?= $c[3] ?></span>
    </div>
    <?php endforeach; ?>
</div>
<div class="grid-2">
    <div style="background:#fff; border-radius:12px; border:1px solid #e2e8f0; display:flex; flex-direction:column; height:350px;">
        <div style="padding:15px 20px; border-bottom:1px solid #e2e8f0; background:#f8fafc; border-radius:12px 12px 0 0;">
            <h3 style="margin:0; font-size:1rem;"><i class="fas fa-comment-dots" style="color:#8b5cf6; margin-right:8px;"></i>Copilot Console</h3>
        </div>
        <div style="flex:1; padding:20px; overflow-y:auto; background:#f1f5f9; display:flex; flex-direction:column; gap:12px;">
            <div style="align-self:flex-end; background:#2563eb; color:#fff; padding:10px 15px; border-radius:16px 16px 0 16px; font-size:0.85rem; max-width:80%;">What's our top-selling product this quarter?</div>
            <div style="align-self:flex-start; background:#fff; border:1px solid #e2e8f0; padding:12px 15px; border-radius:16px 16px 16px 0; font-size:0.85rem; max-width:85%;">
                <div style="color:#8b5cf6; font-weight:bold; font-size:0.75rem; margin-bottom:5px;"><i class="fas fa-robot"></i> SALES COPILOT</div>
                SS 304 Cold Rolled Sheets lead with ₹12.4 Cr revenue (+18% QoQ). Recommend increasing stock allocation by 15%.
            </div>
        </div>
        <div style="padding:12px; border-top:1px solid #e2e8f0; background:#fff; border-radius:0 0 12px 12px;">
            <div style="display:flex; gap:8px;">
                <input type="text" placeholder="Ask any copilot..." style="flex:1; padding:10px 15px; border:1px solid #e2e8f0; border-radius:20px; font-size:0.85rem; outline:none; background:#f8fafc;">
                <button style="width:40px; height:40px; border-radius:50%; background:#8b5cf6; color:#fff; border:none; cursor:pointer;"><i class="fas fa-paper-plane"></i></button>
            </div>
        </div>
    </div>
    <div style="background:linear-gradient(135deg,#8b5cf6,#7c3aed); color:#fff; padding:25px; border-radius:12px;">
        <h3 style="margin:0 0 15px; font-size:1.2rem;"><i class="fas fa-chart-pie"></i> Copilot Impact</h3>
        <div style="font-size:2.5rem; font-weight:700; margin-bottom:10px;">9,200</div>
        <p style="margin:0 0 15px; font-size:0.85rem; opacity:0.85;">Total AI assists this month across all copilots.</p>
        <div style="display:flex; justify-content:space-between; font-size:0.85rem; margin-bottom:8px;">
            <span>Time Saved</span><span style="font-weight:bold;">1,840 hrs</span>
        </div>
        <div style="display:flex; justify-content:space-between; font-size:0.85rem; margin-bottom:8px;">
            <span>Accuracy Rate</span><span style="font-weight:bold;">94.2%</span>
        </div>
        <div style="display:flex; justify-content:space-between; font-size:0.85rem;">
            <span>User Satisfaction</span><span style="font-weight:bold;">4.6/5.0</span>
        </div>
    </div>
</div>
<?php require_once __DIR__ . '/footer.php'; ?>
