<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Automated MOD Inspection Ledger</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <style>
        .custom-toggle:checked + label { background-color: #22c55e; color: white; }
        .custom-toggle-no:checked + label { background-color: #ef4444; color: white; }
        @media print {
            .no-print { display: none !important; }
            body { background: white; color: black; }
            .section-card { box-shadow: none !important; border: 1px solid #e2e8f0 !important; page-break-inside: avoid; }
        }
    </style>
</head>
<body class="bg-slate-50 min-h-screen text-slate-800 antialiased">

    <!-- Top Navigation Control Bar -->
    <header class="bg-slate-950 text-white sticky top-0 z-50 p-4 shadow-md no-print">
        <div class="max-w-7xl mx-auto flex justify-between items-center">
            <div>
                <h1 class="text-lg font-black tracking-tight uppercase">Manager On Duty Portal</h1>
                <p class="text-xs text-slate-400 font-mono">Automated Operations Engine</p>
            </div>
            <div class="flex gap-3">
                <button onclick="window.print()" class="bg-blue-600 hover:bg-blue-700 px-4 py-2 rounded-xl text-xs font-bold transition shadow">
                    🖨️ Print Night Summary
                </button>
                <button form="modForm" type="submit" class="bg-green-600 hover:bg-green-700 px-4 py-2 rounded-xl text-xs font-bold transition shadow">
                    🚀 Dispatch Logbook
                </button>
            </div>
        </div>
    </header>

    <main class="max-w-5xl mx-auto p-4 sm:p-6 lg:p-8">
        
        <!-- Header Operational Identification Coordinates -->
        <div class="bg-white p-6 rounded-2xl border border-slate-100 shadow-sm mb-6 grid grid-cols-1 md:grid-cols-3 gap-4">
            <div>
                <label class="block text-[10px] font-bold text-slate-400 uppercase tracking-wider mb-1">Operational Shift Date</label>
                <input type="date" value="2026-06-20" class="w-full bg-slate-50 border border-slate-200 rounded-xl p-2.5 font-mono text-sm font-bold">
            </div>
            <div>
                <label class="block text-[10px] font-bold text-slate-400 uppercase tracking-wider mb-1">Assigned Manager on Duty</label>
                <input type="text" value="IGANRAN WILLIAMS" class="w-full bg-slate-50 border border-slate-200 rounded-xl p-2.5 text-sm font-bold text-slate-700">
            </div>
            <div>
                <label class="block text-[10px] font-bold text-slate-400 uppercase tracking-wider mb-1">Timeline Window Watch</label>
                <input type="text" value="06:00PM (20/06) TO 07:00AM (21/06)" class="w-full bg-slate-50 border border-slate-200 rounded-xl p-2.5 text-sm font-mono font-bold text-slate-600">
            </div>
        </div>

        <form id="modForm" method="POST" action="process_mod.php" class="space-y-6">
            
            <!-- SECTION 1: FRONT OFFICE -->
            <div class="section-card bg-white rounded-2xl border border-slate-100 shadow-sm overflow-hidden">
                <div class="bg-slate-900 text-white px-5 py-3 text-xs font-black uppercase tracking-wider flex justify-between items-center">
                    <span>🛎️ Front Office & Reception</span>
                    <span class="bg-blue-500/20 text-blue-400 text-[10px] px-2 py-0.5 rounded font-mono">Zone 01</span>
                </div>
                <div class="p-5 divide-y divide-slate-100">
                    
                    <!-- Roll Call Counter Box -->
                    <div class="py-4 first:pt-0 grid grid-cols-1 md:grid-cols-2 gap-4 items-center">
                        <div>
                            <p class="text-sm font-bold text-slate-800">Personnel Roll Call</p>
                            <p class="text-xs text-slate-400">Total operational shift staff present</p>
                        </div>
                        <input type="text" name="fo_rollcall" value="4 Persons" class="border border-slate-200 rounded-xl p-2 bg-slate-50 text-xs font-bold text-slate-700">
                    </div>

                    <!-- Toggle Audit Item Row -->
                    <div class="py-4 grid grid-cols-1 md:grid-cols-3 gap-4 items-center">
                        <div class="md:col-span-2">
                            <p class="text-sm font-bold text-slate-800">Expected Arrival / VIP Departure / Room Position verified?</p>
                        </div>
                        <div class="flex items-center gap-3 justify-end">
                            <div class="inline-flex rounded-xl p-1 bg-slate-100 border border-slate-200">
                                <input type="radio" id="fo_1_y" name="fo_arr" value="YES" checked class="hidden custom-toggle">
                                <label for="fo_1_y" class="px-3 py-1 text-xs font-black rounded-lg cursor-pointer">YES</label>
                                <input type="radio" id="fo_1_n" name="fo_arr" value="NO" class="hidden custom-toggle-no">
                                <label for="fo_1_n" class="px-3 py-1 text-xs font-black rounded-lg cursor-pointer">NO</label>
                            </div>
                            <input type="text" name="fo_arr_comment" value="1 ARRIVAL, 13 DEPARTURE" class="border border-slate-200 rounded-xl p-2 bg-slate-50 text-xs text-slate-600 w-full md:w-48">
                        </div>
                    </div>

                    <!-- Toggle Audit Item Row -->
                    <div class="py-4 grid grid-cols-1 md:grid-cols-3 gap-4 items-center">
                        <div class="md:col-span-2">
                            <p class="text-sm font-bold text-slate-800">Number of Long Stay Guests mapped accurately?</p>
                        </div>
                        <div class="flex items-center gap-3 justify-end">
                            <div class="inline-flex rounded-xl p-1 bg-slate-100 border border-slate-200">
                                <input type="radio" id="fo_2_y" name="fo_long" value="YES" checked class="hidden custom-toggle">
                                <label for="fo_2_y" class="px-3 py-1 text-xs font-black rounded-lg cursor-pointer">YES</label>
                                <input type="radio" id="fo_2_n" name="fo_long" value="NO" class="hidden custom-toggle-no">
                                <label for="fo_2_n" class="px-3 py-1 text-xs font-black rounded-lg cursor-pointer">NO</label>
                            </div>
                            <input type="text" name="fo_long_comment" value="5 Rooms (Rm 215, 203, 116, 114, 107)" class="border border-slate-200 rounded-xl p-2 bg-slate-50 text-xs text-slate-600 w-full md:w-48">
                        </div>
                    </div>
                </div>
            </div>

            <!-- SECTION 2: ENGINEERING & GENERATORS -->
            <div class="section-card bg-white rounded-2xl border border-slate-100 shadow-sm overflow-hidden">
                <div class="bg-slate-900 text-white px-5 py-3 text-xs font-black uppercase tracking-wider flex justify-between items-center">
                    <span>⚙️ Engineering, CCTV, & Infrastructure Logs</span>
                    <span class="bg-amber-500/20 text-amber-400 text-[10px] px-2 py-0.5 rounded font-mono">Zone 02</span>
                </div>
                <div class="p-5 space-y-4">
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-4 border-b border-slate-100 pb-4">
                        <div>
                            <label class="block text-xs font-bold text-slate-500 uppercase mb-1">Generator 1 Tracking Runtime</label>
                            <textarea name="gen1_time" rows="2" class="w-full bg-slate-50 border border-slate-200 rounded-xl p-2.5 font-mono text-xs text-slate-700">On 09:13AM = 09:37AM, 09:53AM = 06:19PM, 07:48PM = 09:33PM, 10:01PM = TILL DAWN</textarea>
                        </div>
                        <div>
                            <label class="block text-xs font-bold text-slate-500 uppercase mb-1">Generator 2 Tracking Runtime</label>
                            <textarea name="gen2_time" rows="2" class="w-full bg-slate-50 border border-slate-200 rounded-xl p-2.5 font-mono text-xs text-slate-700">On 09:37AM = 09:53AM</textarea>
                        </div>
                    </div>

                    <div class="grid grid-cols-2 sm:grid-cols-4 gap-4 pt-2">
                        <div class="bg-slate-50 p-3 rounded-xl border border-slate-200/60 text-center">
                            <span class="text-[9px] uppercase font-bold text-slate-400 tracking-wider block">Gen 1 Fuel</span>
                            <input type="text" name="g1_fuel" value="200 ltrs" class="w-full bg-transparent text-center font-mono font-black text-slate-800 text-xs focus:outline-none">
                        </div>
                        <div class="bg-slate-50 p-3 rounded-xl border border-slate-200/60 text-center">
                            <span class="text-[9px] uppercase font-bold text-slate-400 tracking-wider block">Gen 2 Fuel</span>
                            <input type="text" name="g2_fuel" value="200 ltrs" class="w-full bg-transparent text-center font-mono font-black text-slate-800 text-xs focus:outline-none">
                        </div>
                        <div class="bg-slate-50 p-3 rounded-xl border border-slate-200/60 text-center">
                            <span class="text-[9px] uppercase font-bold text-slate-400 tracking-wider block">Surface Tank</span>
                            <input type="text" name="surface_fuel" value="1,900 ltrs" class="w-full bg-transparent text-center font-mono font-black text-slate-800 text-xs focus:outline-none">
                        </div>
                        <div class="bg-slate-50 p-3 rounded-xl border border-slate-200/60 text-center">
                            <span class="text-[9px] uppercase font-bold text-slate-400 tracking-wider block">Underground Tank</span>
                            <input type="text" name="underground_fuel" value="11,000 Liters" class="w-full bg-transparent text-center font-mono font-black text-slate-800 text-xs focus:outline-none">
                        </div>
                    </div>
                </div>
            </div>

            <!-- SECTION 3: ROOM CLEANLINESS & DEFECTS EXCEPTION AUDIT -->
            <div class="section-card bg-white rounded-2xl border border-slate-100 shadow-sm overflow-hidden">
                <div class="bg-slate-900 text-white px-5 py-3 text-xs font-black uppercase tracking-wider flex justify-between items-center">
                    <span>🛏️ Structural Room Status & Failure Auditing</span>
                    <span class="bg-emerald-500/20 text-emerald-400 text-[10px] px-2 py-0.5 rounded font-mono">Zone 03</span>
                </div>
                <div class="p-5 space-y-4">
                    <div>
                        <div class="flex justify-between items-center mb-1">
                            <label class="block text-xs font-bold text-slate-500 uppercase">Verified Vacant Room Inventory Tracker</label>
                            <span class="bg-slate-100 text-slate-700 font-mono text-[10px] font-bold px-2 py-0.5 rounded">19 Rooms Checked</span>
                        </div>
                        <textarea name="vacant_rooms" rows="2" class="w-full bg-slate-50 border border-slate-200 rounded-xl p-2.5 font-mono text-xs font-bold text-slate-700">406, 404, 403, 315, 309, 307, 308, 305, 207, 202, 208, 210, 214, 109, 115, 110, 125, 112, 111</textarea>
                    </div>

                    <div class="bg-red-50/50 p-4 rounded-xl border border-red-100 space-y-3">
                        <p class="text-xs font-black text-red-800 uppercase tracking-wider">⚠️ System Identified Defects & Maintenance Exceptions:</p>
                        
                        <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                            <div class="bg-white p-3 rounded-lg border border-red-200/60 flex flex-col justify-center">
                                <span class="text-[10px] font-bold text-slate-400 block uppercase">AC Service Signal Block</span>
                                <span class="text-xs font-black text-slate-800 font-mono mt-0.5">Maint. Check 210 AC</span>
                            </div>
                            <div class="bg-white p-3 rounded-lg border border-red-200/60 flex flex-col justify-center">
                                <span class="text-[10px] font-bold text-slate-400 block uppercase">Electrical Fitting Failure</span>
                                <span class="text-xs font-black text-slate-800 font-mono mt-0.5">Room 110 - one Bed side light is bad.</span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Submit Button Interaction -->
            <div class="text-right no-print">
                <button type="submit" class="bg-slate-900 hover:bg-slate-800 text-white font-bold py-3.5 px-8 rounded-xl text-xs uppercase tracking-widest shadow-md transition active:scale-[0.99]">
                    Commit Night Audit to Database Ledger
                </button>
            </div>
        </form>
    </main>

    <script>
        // Form interactivity logic can go here to track and alert on critical "NO" status choices instantly
        document.getElementById('modForm').addEventListener('submit', function(e) {
            // Optional AJAX engine binding logic
        });
    </script>
</body>
</html>