<?php
$page_title = 'Data Platform';
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-database" style="color:#0ea5e9; margin-right:10px;"></i>Data Platform</h2>
        <p style="color:#64748b; font-size:0.95rem; margin-top:5px;">Warehouse, lakehouse, streaming, BI layer, and ML feature store.</p>
    </div>
</div>
<div class="grid-4" style="margin-bottom:24px;">
    <div style="background:#fff; padding:20px; border-radius:12px; border:1px solid #e2e8f0; border-top:4px solid #0ea5e9;">
        <div style="color:#64748b; font-size:0.8rem; font-weight:600; margin-bottom:8px;">DATA WAREHOUSE</div>
        <div style="font-size:1.6rem; font-weight:700; color:#0f172a;">4.8 TB</div>
        <div style="color:#0ea5e9; font-size:0.8rem; margin-top:5px;"><i class="fas fa-database"></i> Structured Data</div>
    </div>
    <div style="background:#fff; padding:20px; border-radius:12px; border:1px solid #e2e8f0; border-top:4px solid #10b981;">
        <div style="color:#64748b; font-size:0.8rem; font-weight:600; margin-bottom:8px;">DATA LAKE</div>
        <div style="font-size:1.6rem; font-weight:700; color:#0f172a;">12.4 TB</div>
        <div style="color:#10b981; font-size:0.8rem; margin-top:5px;"><i class="fas fa-water"></i> Raw + Processed</div>
    </div>
    <div style="background:#fff; padding:20px; border-radius:12px; border:1px solid #e2e8f0; border-top:4px solid #f59e0b;">
        <div style="color:#64748b; font-size:0.8rem; font-weight:600; margin-bottom:8px;">STREAMING EVENTS</div>
        <div style="font-size:1.6rem; font-weight:700; color:#0f172a;">2.4M/day</div>
        <div style="color:#f59e0b; font-size:0.8rem; margin-top:5px;"><i class="fas fa-stream"></i> Real-time</div>
    </div>
    <div style="background:#fff; padding:20px; border-radius:12px; border:1px solid #e2e8f0; border-top:4px solid #8b5cf6;">
        <div style="color:#64748b; font-size:0.8rem; font-weight:600; margin-bottom:8px;">ML MODELS</div>
        <div style="font-size:1.6rem; font-weight:700; color:#0f172a;">24</div>
        <div style="color:#8b5cf6; font-size:0.8rem; margin-top:5px;"><i class="fas fa-brain"></i> In Production</div>
    </div>
</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-layer-group" style="color:#0ea5e9; margin-right:8px;"></i>Platform Architecture</h3>
        <?php
        $layers = [
            ['Data Warehouse', 'Structured analytics, star schemas, cube processing', '#0ea5e9', 'fas fa-database'],
            ['Data Lakehouse', 'Unified raw + processed with Delta tables', '#10b981', 'fas fa-water'],
            ['Streaming Engine', 'Kafka + Flink for real-time event processing', '#f59e0b', 'fas fa-stream'],
            ['BI Semantic Layer', 'Business metrics, KPI definitions, cube models', '#8b5cf6', 'fas fa-chart-bar'],
            ['ML Feature Store', 'Versioned features for 24 production models', '#ec4899', 'fas fa-brain'],
        ];
        foreach ($layers as $l): ?>
        <div style="border:1px solid #e2e8f0; border-radius:8px; padding:15px; margin-bottom:10px; display:flex; align-items:center; gap:15px;">
            <div style="width:42px; height:42px; border-radius:10px; background:<?= $l[2] ?>15; display:flex; align-items:center; justify-content:center; flex-shrink:0;">
                <i class="<?= $l[3] ?>" style="color:<?= $l[2] ?>;"></i>
            </div>
            <div>
                <div style="font-weight:600; font-size:0.9rem;"><?= $l[0] ?></div>
                <div style="font-size:0.75rem; color:#94a3b8;"><?= $l[1] ?></div>
            </div>
        </div>
        <?php endforeach; ?>
    </div>
    <div style="background:linear-gradient(135deg,#0ea5e9,#0284c7); color:#fff; padding:25px; border-radius:12px;">
        <h3 style="margin:0 0 15px; font-size:1.2rem;"><i class="fas fa-tachometer-alt"></i> Platform Health</h3>
        <div style="display:grid; grid-template-columns:1fr 1fr; gap:15px; margin-bottom:15px;">
            <div style="background:rgba(255,255,255,0.1); padding:12px; border-radius:8px; text-align:center;">
                <div style="font-size:1.5rem; font-weight:700;">99.9%</div>
                <div style="font-size:0.75rem; opacity:0.8;">Uptime</div>
            </div>
            <div style="background:rgba(255,255,255,0.1); padding:12px; border-radius:8px; text-align:center;">
                <div style="font-size:1.5rem; font-weight:700;">45ms</div>
                <div style="font-size:0.75rem; opacity:0.8;">Avg Query</div>
            </div>
        </div>
        <div style="display:flex; justify-content:space-between; font-size:0.85rem; margin-bottom:8px;">
            <span>ETL Jobs Running</span><span style="font-weight:bold;">42</span>
        </div>
        <div style="display:flex; justify-content:space-between; font-size:0.85rem;">
            <span>Last Full Refresh</span><span style="font-weight:bold;">2 min ago</span>
        </div>
    </div>
</div>
<?php require_once __DIR__ . '/footer.php'; ?>
