<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Admin Panel - SLHD Provinsi DKI Jakarta</title>
    <!-- Tailwind CSS CDN -->
    <script src="https://cdn.tailwindcss.com"></script>
    <!-- Google Fonts -->
    <link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap" rel="stylesheet">
    <!-- Lucide Icons -->
    <script src="https://unpkg.com/lucide@latest"></script>
    <style>
        body { font-family: 'Plus Jakarta Sans', sans-serif; }
        
        /* Sidebar Transitions */
        #sidebar {
            transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }
        
        #sidebar.collapsed {
            width: 80px;
        }

        #sidebar.collapsed .sidebar-text, 
        #sidebar.collapsed .sidebar-header-text,
        #sidebar.collapsed .sidebar-dropdown-icon {
            display: none;
        }

        #sidebar.collapsed .sidebar-section-label {
            text-align: center;
            font-size: 8px;
            padding-left: 0;
            padding-right: 0;
        }

        .sidebar-item-active {
            background: rgba(59, 130, 246, 0.1);
            color: #2563eb;
            border-right: 4px solid #2563eb;
        }

        /* Nested Menu Style */
        .submenu {
            display: none;
            background: #f8fafc;
        }
        
        #sidebar.collapsed .submenu {
            display: none !important;
        }

        .custom-scrollbar::-webkit-scrollbar {
            width: 4px;
        }
        .custom-scrollbar::-webkit-scrollbar-thumb {
            background: #e2e8f0;
            border-radius: 10px;
        }
    </style>
</head>
<body class="bg-slate-50 text-slate-900 overflow-hidden">

    <div class="flex h-screen overflow-hidden">
        
        <!-- Sidebar -->
        <aside id="sidebar" class="w-64 bg-white border-r border-slate-200 flex flex-col hidden md:flex z-30">
            <!-- Logo & Toggle Container -->
            <div class="p-6 border-b border-slate-50 flex items-center justify-between">
                <div class="flex items-center space-x-3 overflow-hidden">
                    <div class="bg-blue-600 p-2 rounded-lg text-white shrink-0">
                        <i data-lucide="layers" class="w-5 h-5"></i>
                    </div>
                    <div class="sidebar-header-text">
                        <h1 class="font-bold text-lg tracking-tight text-blue-900 leading-none">SLHD</h1>
                        <p class="text-[9px] uppercase tracking-widest text-blue-600 font-bold">Admin Panel</p>
                    </div>
                </div>
                <!-- Desktop Toggle Button -->
                <button id="toggle-sidebar" class="text-slate-400 hover:text-blue-600 transition-colors">
                    <i data-lucide="chevron-left" id="toggle-icon" class="w-5 h-5"></i>
                </button>
            </div>

            <!-- Navigation -->
            <nav class="flex-1 overflow-y-auto py-4 custom-scrollbar">
                <div class="sidebar-section-label px-4 mb-2 text-[10px] font-bold text-slate-400 uppercase tracking-widest transition-all">Menu Utama</div>
                
                <a href="#" class="sidebar-item-active flex items-center px-6 py-3 transition-all group">
                    <i data-lucide="layout-dashboard" class="w-5 h-5 shrink-0"></i>
                    <span class="sidebar-text font-semibold text-sm ml-3">Dashboard</span>
                </a>

                <!-- Nested Menu: Manajemen Data -->
                <div class="menu-dropdown">
                    <button class="w-full flex items-center justify-between px-6 py-3 text-slate-500 hover:text-blue-600 hover:bg-slate-50 transition-all dropdown-trigger group">
                        <div class="flex items-center">
                            <i data-lucide="database" class="w-5 h-5 shrink-0"></i>
                            <span class="sidebar-text font-semibold text-sm ml-3">Manajemen Data</span>
                        </div>
                        <i data-lucide="chevron-down" class="sidebar-dropdown-icon w-4 h-4 transition-transform duration-200"></i>
                    </button>
                    <div class="submenu">
                        <a href="#" class="flex items-center pl-14 pr-6 py-2.5 text-xs font-medium text-slate-500 hover:text-blue-600 transition-colors">Data Air</a>
                        <a href="#" class="flex items-center pl-14 pr-6 py-2.5 text-xs font-medium text-slate-500 hover:text-blue-600 transition-colors">Data Udara</a>
                        <a href="#" class="flex items-center pl-14 pr-6 py-2.5 text-xs font-medium text-slate-500 hover:text-blue-600 transition-colors">Data Sampah</a>
                    </div>
                </div>

                <a href="#" class="flex items-center px-6 py-3 text-slate-500 hover:text-blue-600 hover:bg-slate-50 transition-all group">
                    <i data-lucide="file-text" class="w-5 h-5 shrink-0"></i>
                    <span class="sidebar-text font-semibold text-sm ml-3">Laporan Publikasi</span>
                </a>
                
                <div class="menu-dropdown">
                    <button class="w-full flex items-center justify-between px-6 py-3 text-slate-500 hover:text-blue-600 hover:bg-slate-50 transition-all dropdown-trigger group">
                        <div class="flex items-center">
                            <i data-lucide="bar-chart-3" class="w-5 h-5 shrink-0"></i>
                            <span class="sidebar-text font-semibold text-sm ml-3">Visualisasi</span>
                        </div>
                        <i data-lucide="chevron-down" class="sidebar-dropdown-icon w-4 h-4"></i>
                    </button>
                    <div class="submenu">
                        <a href="#" class="flex items-center pl-14 pr-6 py-2.5 text-xs font-medium text-slate-500 hover:text-blue-600 transition-colors">Peta Interaktif</a>
                        <a href="#" class="flex items-center pl-14 pr-6 py-2.5 text-xs font-medium text-slate-500 hover:text-blue-600 transition-colors">Grafik Tahunan</a>
                    </div>
                </div>

                <div class="sidebar-section-label px-4 mt-8 mb-2 text-[10px] font-bold text-slate-400 uppercase tracking-widest transition-all">Sistem</div>
                
                <a href="#" class="flex items-center px-6 py-3 text-slate-500 hover:text-blue-600 hover:bg-slate-50 transition-all group">
                    <i data-lucide="users" class="w-5 h-5 shrink-0"></i>
                    <span class="sidebar-text font-semibold text-sm ml-3">Manajemen User</span>
                </a>
                <a href="#" class="flex items-center px-6 py-3 text-slate-500 hover:text-blue-600 hover:bg-slate-50 transition-all group">
                    <i data-lucide="settings" class="w-5 h-5 shrink-0"></i>
                    <span class="sidebar-text font-semibold text-sm ml-3">Pengaturan</span>
                </a>
            </nav>

            <!-- Bottom Profile -->
            <div class="p-4 border-t border-slate-100">
                <div class="flex items-center p-3 bg-slate-50 rounded-xl overflow-hidden">
                    <div class="w-10 h-10 rounded-full bg-blue-100 flex items-center justify-center text-blue-600 font-bold border border-blue-200 shrink-0">
                        AD
                    </div>
                    <div class="sidebar-text ml-3 overflow-hidden">
                        <p class="text-sm font-bold text-slate-900 truncate">Admin DLH</p>
                        <p class="text-[10px] text-slate-500 truncate">admin@jakarta.go.id</p>
                    </div>
                    <a href="login.html" class="sidebar-text ml-auto text-slate-400 hover:text-red-500 transition-colors">
                        <i data-lucide="log-out" class="w-4 h-4"></i>
                    </a>
                </div>
            </div>
        </aside>

        <!-- Main Content Area -->
        <main class="flex-1 flex flex-col overflow-hidden">
            
            <!-- Top Header -->
            <header class="h-20 bg-white border-b border-slate-200 flex items-center justify-between px-8 shrink-0">
                <div class="flex items-center">
                    <button id="mobile-toggle" class="p-2 text-slate-600 md:hidden">
                        <i data-lucide="menu" class="w-6 h-6"></i>
                    </button>
                    <div class="hidden md:block">
                        <h2 class="text-xl font-bold text-slate-900">Dashboard Utama</h2>
                        <p class="text-xs text-slate-500">Ringkasan sistem SLHD Provinsi DKI Jakarta</p>
                    </div>
                </div>
                
                <div class="flex items-center space-x-4">
                    <div class="relative hidden sm:block">
                        <i data-lucide="search" class="absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400"></i>
                        <input type="text" placeholder="Cari fitur..." class="pl-10 pr-4 py-2 bg-slate-50 border border-slate-200 rounded-xl text-sm outline-none focus:ring-2 focus:ring-blue-500 w-48 lg:w-64">
                    </div>
                    <button class="relative p-2 text-slate-400 hover:text-blue-600 transition-colors">
                        <i data-lucide="bell" class="w-5 h-5"></i>
                        <span class="absolute top-2 right-2 w-2 h-2 bg-red-500 rounded-full border-2 border-white"></span>
                    </button>
                    <div class="h-8 w-px bg-slate-200 mx-2"></div>
                    <button class="bg-blue-600 text-white px-4 py-2 rounded-lg text-sm font-bold hover:bg-blue-700 transition-all flex items-center shadow-lg shadow-blue-100">
                        <i data-lucide="plus" class="w-4 h-4 mr-2"></i> Tambah Data
                    </button>
                </div>
            </header>

            <!-- Dashboard Content (Scrollable) -->
            <div class="flex-1 overflow-y-auto p-8 custom-scrollbar">
                
                <!-- Stats Cards -->
                <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8">
                    <!-- Card 1 -->
                    <div class="bg-white p-6 rounded-2xl border border-slate-200 shadow-sm hover:shadow-md transition-shadow">
                        <div class="flex justify-between items-start mb-4">
                            <div class="p-2 bg-blue-50 rounded-lg text-blue-600">
                                <i data-lucide="database" class="w-5 h-5"></i>
                            </div>
                            <span class="text-xs font-bold text-green-500 bg-green-50 px-2 py-1 rounded">+12%</span>
                        </div>
                        <p class="text-slate-500 text-[10px] font-bold uppercase tracking-wider">Total Dataset</p>
                        <h4 class="text-2xl font-black text-slate-900 mt-1">1,284</h4>
                    </div>
                    <!-- Card 2 -->
                    <div class="bg-white p-6 rounded-2xl border border-slate-200 shadow-sm hover:shadow-md transition-shadow">
                        <div class="flex justify-between items-start mb-4">
                            <div class="p-2 bg-green-50 rounded-lg text-green-600">
                                <i data-lucide="download" class="w-5 h-5"></i>
                            </div>
                            <span class="text-xs font-bold text-green-500 bg-green-50 px-2 py-1 rounded">+5%</span>
                        </div>
                        <p class="text-slate-500 text-[10px] font-bold uppercase tracking-wider">Unduhan Data</p>
                        <h4 class="text-2xl font-black text-slate-900 mt-1">45.2K</h4>
                    </div>
                    <!-- Card 3 -->
                    <div class="bg-white p-6 rounded-2xl border border-slate-200 shadow-sm hover:shadow-md transition-shadow">
                        <div class="flex justify-between items-start mb-4">
                            <div class="p-2 bg-orange-50 rounded-lg text-orange-600">
                                <i data-lucide="file-check" class="w-5 h-5"></i>
                            </div>
                            <span class="text-xs font-bold text-slate-400 bg-slate-50 px-2 py-1 rounded">Stabil</span>
                        </div>
                        <p class="text-slate-500 text-[10px] font-bold uppercase tracking-wider">Publikasi Aktif</p>
                        <h4 class="text-2xl font-black text-slate-900 mt-1">312</h4>
                    </div>
                    <!-- Card 4 -->
                    <div class="bg-white p-6 rounded-2xl border border-slate-200 shadow-sm hover:shadow-md transition-shadow">
                        <div class="flex justify-between items-start mb-4">
                            <div class="p-2 bg-purple-50 rounded-lg text-purple-600">
                                <i data-lucide="eye" class="w-5 h-5"></i>
                            </div>
                            <span class="text-xs font-bold text-red-500 bg-red-50 px-2 py-1 rounded">-2%</span>
                        </div>
                        <p class="text-slate-500 text-[10px] font-bold uppercase tracking-wider">Kunjungan</p>
                        <h4 class="text-2xl font-black text-slate-900 mt-1">2,840</h4>
                    </div>
                </div>

                <!-- Datatable Section -->
                <div class="bg-white rounded-3xl border border-slate-200 shadow-sm overflow-hidden">
                    <div class="p-6 border-b border-slate-100 flex flex-col md:flex-row md:items-center justify-between gap-4">
                        <div>
                            <h3 class="text-lg font-bold text-slate-900">Dataset Lingkungan Terbaru</h3>
                            <p class="text-xs text-slate-500 font-medium">Pengelolaan data masuk dari berbagai stasiun pemantauan.</p>
                        </div>
                        <div class="flex items-center space-x-2">
                            <button class="p-2 border border-slate-200 rounded-xl hover:bg-slate-50 transition-colors flex items-center text-sm font-semibold text-slate-600">
                                <i data-lucide="download-cloud" class="w-4 h-4 mr-2"></i> Ekspor
                            </button>
                            <button class="p-2 bg-slate-900 text-white rounded-xl hover:bg-slate-800 transition-colors flex items-center text-sm font-semibold">
                                <i data-lucide="filter" class="w-4 h-4 mr-2"></i> Filter
                            </button>
                        </div>
                    </div>

                    <div class="overflow-x-auto">
                        <table class="w-full text-left border-collapse">
                            <thead class="bg-slate-50/50 border-b border-slate-100">
                                <tr>
                                    <th class="text-[10px] border font-bold text-slate-900 text-center">Judul Dataset</th>
                                    <th class="text-[10px] border font-bold text-slate-900 text-center">Kategori</th>
                                    <th class="text-[10px] border font-bold text-slate-900 text-center">Terakhir Update</th>
                                    <th class="text-[10px] border font-bold text-slate-900 text-center">Status</th>
                                    <th class="text-[10px] border font-bold text-slate-900 text-center text-right">Aksi</th>
                                </tr>
                            </thead>
                            <tbody class="divide-y divide-slate-100">
                                <tr class="hover:bg-slate-50 transition-colors group">
                                    <td class="px-6 py-4">
                                        <div class="flex items-center">
                                            <div class="w-8 h-8 rounded bg-blue-100 flex items-center justify-center text-blue-600 mr-3">
                                                <i data-lucide="file-spreadsheet" class="w-4 h-4"></i>
                                            </div>
                                            <div>
                                                <p class="text-sm font-bold text-slate-900">Kualitas Air Sungai Jakarta 2024</p>
                                                <p class="text-[10px] text-slate-400 font-medium">CSV, XLS • 12.5 MB</p>
                                            </div>
                                        </div>
                                    </td>
                                    <td class="px-6 py-4">
                                        <span class="text-xs text-slate-600 font-semibold bg-slate-100 px-2 py-1 rounded">Air Limbah</span>
                                    </td>
                                    <td class="px-6 py-4 text-xs text-slate-500 font-medium">12 Feb 2026</td>
                                    <td class="px-6 py-4">
                                        <div class="flex items-center">
                                            <span class="w-2 h-2 bg-green-500 rounded-full mr-2"></span>
                                            <span class="text-[10px] font-bold text-green-700 uppercase">Terverifikasi</span>
                                        </div>
                                    </td>
                                    <td class="px-6 py-4 text-right">
                                        <button class="text-slate-400 hover:text-blue-600 p-1 transition-colors"><i data-lucide="more-vertical" class="w-5 h-5"></i></button>
                                    </td>
                                </tr>
                                <tr class="hover:bg-slate-50 transition-colors group">
                                    <td class="px-6 py-4">
                                        <div class="flex items-center">
                                            <div class="w-8 h-8 rounded bg-orange-100 flex items-center justify-center text-orange-600 mr-3">
                                                <i data-lucide="trash-2" class="w-4 h-4"></i>
                                            </div>
                                            <div>
                                                <p class="text-sm font-bold text-slate-900">Volume Sampah Per Kecamatan</p>
                                                <p class="text-[10px] text-slate-400 font-medium">PDF, XLS • 8.2 MB</p>
                                            </div>
                                        </div>
                                    </td>
                                    <td class="px-6 py-4">
                                        <span class="text-xs text-slate-600 font-semibold bg-slate-100 px-2 py-1 rounded">Persampahan</span>
                                    </td>
                                    <td class="px-6 py-4 text-xs text-slate-500 font-medium">08 Feb 2026</td>
                                    <td class="px-6 py-4">
                                        <div class="flex items-center">
                                            <span class="w-2 h-2 bg-yellow-500 rounded-full mr-2"></span>
                                            <span class="text-[10px] font-bold text-yellow-700 uppercase">Draft</span>
                                        </div>
                                    </td>
                                    <td class="px-6 py-4 text-right">
                                        <button class="text-slate-400 hover:text-blue-600 p-1 transition-colors"><i data-lucide="more-vertical" class="w-5 h-5"></i></button>
                                    </td>
                                </tr>
                                <tr class="hover:bg-slate-50 transition-colors group">
                                    <td class="px-6 py-4">
                                        <div class="flex items-center">
                                            <div class="w-8 h-8 rounded bg-purple-100 flex items-center justify-center text-purple-600 mr-3">
                                                <i data-lucide="wind" class="w-4 h-4"></i>
                                            </div>
                                            <div>
                                                <p class="text-sm font-bold text-slate-900">ISPU Real-time Station</p>
                                                <p class="text-[10px] text-slate-400 font-medium">JSON API • Live Stream</p>
                                            </div>
                                        </div>
                                    </td>
                                    <td class="px-6 py-4">
                                        <span class="text-xs text-slate-600 font-semibold bg-slate-100 px-2 py-1 rounded">Udara</span>
                                    </td>
                                    <td class="px-6 py-4 text-xs text-slate-500 font-medium">Hari ini</td>
                                    <td class="px-6 py-4">
                                        <div class="flex items-center">
                                            <span class="w-2 h-2 bg-blue-500 rounded-full mr-2 animate-pulse"></span>
                                            <span class="text-[10px] font-bold text-blue-700 uppercase">Otomatis</span>
                                        </div>
                                    </td>
                                    <td class="px-6 py-4 text-right">
                                        <button class="text-slate-400 hover:text-blue-600 p-1 transition-colors"><i data-lucide="more-vertical" class="w-5 h-5"></i></button>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>

            </div>
        </main>
    </div>

    <!-- jQuery CDN -->
    <script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
    <script>
        $(document).ready(function() {
            lucide.createIcons();

            // 1. Sidebar Collapse Logic
            $('#toggle-sidebar').click(function() {
                const sidebar = $('#sidebar');
                const icon = $('#toggle-icon');
                
                sidebar.toggleClass('collapsed');
                
                // Change icon direction
                if (sidebar.hasClass('collapsed')) {
                    icon.attr('data-lucide', 'chevron-right');
                } else {
                    icon.attr('data-lucide', 'chevron-left');
                }
                
                // Re-init icons to apply changes
                lucide.createIcons();
            });

            // 2. Nested Menu / Dropdown Logic
            $('.dropdown-trigger').click(function() {
                // If sidebar is collapsed, don't allow open dropdown (or expand it first)
                if($('#sidebar').hasClass('collapsed')) {
                    $('#sidebar').removeClass('collapsed');
                    $('#toggle-icon').attr('data-lucide', 'chevron-left');
                    lucide.createIcons();
                }

                const submenu = $(this).next('.submenu');
                const icon = $(this).find('.sidebar-dropdown-icon');
                
                // Toggle Submenu
                submenu.slideToggle(300);
                
                // Rotate Icon
                icon.toggleClass('rotate-180');
                
                // Optional: Close other open dropdowns
                $('.submenu').not(submenu).slideUp(300);
                $('.sidebar-dropdown-icon').not(icon).removeClass('rotate-180');
            });

            // Mobile Menu Toggle
            $('#mobile-toggle').click(function() {
                $('#sidebar').toggleClass('hidden').toggleClass('fixed inset-0 w-full');
            });
        });
    </script>
</body>
</html>