<?php
$page_title = 'Disaster Recovery Command';
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-server" style="color:#ef4444; margin-right:10px;"></i>Disaster Recovery Command</h2>
        <p style="color:#64748b; font-size:0.95rem; margin-top:5px;">Backup orchestration, failover automation, recovery testing, and incident command.</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 #10b981;">
        <div style="color:#64748b; font-size:0.8rem; font-weight:600; margin-bottom:8px;">SYSTEM STATUS</div>
        <div style="font-size:1.6rem; font-weight:700; color:#10b981;">All Green</div>
        <div style="color:#10b981; font-size:0.8rem; margin-top:5px;"><i class="fas fa-check-circle"></i> 99.99% Uptime</div>
    </div>
    <div style="background:#fff; padding:20px; border-radius:12px; border:1px solid #e2e8f0; border-top:4px solid #3b82f6;">
        <div style="color:#64748b; font-size:0.8rem; font-weight:600; margin-bottom:8px;">LAST BACKUP</div>
        <div style="font-size:1.6rem; font-weight:700; color:#0f172a;">4 min</div>
        <div style="color:#3b82f6; font-size:0.8rem; margin-top:5px;"><i class="fas fa-hdd"></i> Incremental</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;">RTO / RPO</div>
        <div style="font-size:1.6rem; font-weight:700; color:#0f172a;">15m / 5m</div>
        <div style="color:#f59e0b; font-size:0.8rem; margin-top:5px;"><i class="fas fa-bolt"></i> Within SLA</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;">DR TESTS</div>
        <div style="font-size:1.6rem; font-weight:700; color:#0f172a;">12</div>
        <div style="color:#8b5cf6; font-size:0.8rem; margin-top:5px;"><i class="fas fa-vial"></i> This Year (All Pass)</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-hdd" style="color:#3b82f6; margin-right:8px;"></i>Backup Orchestration</h3>
        <?php
        $backups = [
            ['Production DB', 'Full + Incremental', '4 min ago', '#10b981', '2.4 TB'],
            ['File Storage', 'Snapshot', '15 min ago', '#3b82f6', '1.8 TB'],
            ['Application Config', 'Git-versioned', '1 hr ago', '#f59e0b', '240 MB'],
            ['Transaction Logs', 'Continuous', 'Real-time', '#8b5cf6', '480 GB'],
        ];
        foreach ($backups as $b): ?>
        <div style="border:1px solid #e2e8f0; border-radius:8px; padding:12px 15px; margin-bottom:8px; display:flex; justify-content:space-between; align-items:center;">
            <div>
                <div style="font-weight:600; font-size:0.9rem;"><?= $b[0] ?></div>
                <div style="font-size:0.75rem; color:#94a3b8;"><?= $b[1] ?> · <?= $b[4] ?></div>
            </div>
            <div style="text-align:right;">
                <span style="background:#dcfce7; color:#166534; padding:3px 8px; border-radius:6px; font-size:0.7rem; font-weight:bold;"><?= $b[2] ?></span>
            </div>
        </div>
        <?php endforeach; ?>
    </div>
    <div style="display:flex; flex-direction:column; gap:24px;">
        <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-exchange-alt" style="color:#ef4444; margin-right:8px;"></i>Failover Status</h3>
            <div style="display:grid; grid-template-columns:1fr 1fr; gap:12px;">
                <div style="background:#dcfce7; padding:12px; border-radius:8px; text-align:center;">
                    <div style="font-weight:700; color:#166534;">Primary</div>
                    <div style="font-size:0.75rem; color:#166534;">Mumbai DC — Active</div>
                </div>
                <div style="background:#f1f5f9; padding:12px; border-radius:8px; text-align:center;">
                    <div style="font-weight:700; color:#475569;">Secondary</div>
                    <div style="font-size:0.75rem; color:#64748b;">Chennai DC — Standby</div>
                </div>
            </div>
        </div>
        <div style="background:linear-gradient(135deg,#ef4444,#dc2626); color:#fff; padding:20px; border-radius:12px;">
            <h3 style="margin:0 0 8px; font-size:1.1rem;"><i class="fas fa-exclamation-triangle"></i> Incident Command</h3>
            <p style="margin:0 0 10px; font-size:0.85rem; opacity:0.85;">No active incidents. Last incident: 42 days ago.</p>
            <div style="display:flex; justify-content:space-between; font-size:0.85rem; margin-bottom:8px;">
                <span>MTTR</span><span style="font-weight:bold;">12 min</span>
            </div>
            <div style="display:flex; justify-content:space-between; font-size:0.85rem;">
                <span>Incident-Free Streak</span><span style="font-weight:bold;">42 days</span>
            </div>
        </div>
    </div>
</div>
<?php require_once __DIR__ . '/footer.php'; ?>
