<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Professional Student Dashboard</title>
    <!-- Load Tailwind CSS -->
    <script src="https://cdn.tailwindcss.com"></script>
    <!-- Set up Tailwind configuration for Inter font and a professional color palette -->
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        'primary-blue': '#1E3A8A', // Deep Indigo/Navy
                        'background-light': '#F8FAFC', // Slate 50
                        'text-dark': '#1F2937', // Gray 800
                        'accent-subtle': '#E5E7EB', // Gray 200
                    },
                    fontFamily: {
                        sans: ['Inter', 'sans-serif'],
                    },
                }
            }
        }
    </script>
    <style>
        /* Ensuring full page height and scrolling */
        html, body {
            height: 100%;
        }
        /* Custom scrollbar for a cleaner look */
        ::-webkit-scrollbar {
            width: 8px;
            height: 8px;
        }
        ::-webkit-scrollbar-thumb {
            background-color: #D1D5DB; /* Gray 300 */
            border-radius: 4px;
        }
        ::-webkit-scrollbar-track {
            background-color: transparent;
        }
    </style>
</head>
<body class="bg-background-light font-sans text-text-dark min-h-screen">

    <!-- Firebase SDK Imports and Setup (Mandatory for a full web app) -->
    <!-- Authentication state is mocked for design preview -->
    <script type="module">
        import { initializeApp } from "https://www.gstatic.com/firebasejs/11.6.1/firebase-app.js";
        import { getAuth, signInAnonymously, signInWithCustomToken } from "https://www.gstatic.com/firebasejs/11.6.1/firebase-auth.js";
        import { getFirestore } from "https://www.gstatic.com/firebasejs/11.6.1/firebase-firestore.js";
        import { setLogLevel } from "https://www.gstatic.com/firebasejs/11.6.1/firebase-firestore.js";

        // Set logging level for debugging
        setLogLevel('Debug');

        const appId = typeof __app_id !== 'undefined' ? __app_id : 'default-app-id';
        const firebaseConfig = JSON.parse(typeof __firebase_config !== 'undefined' ? __firebase_config : '{}');

        if (Object.keys(firebaseConfig).length > 0) {
            const app = initializeApp(firebaseConfig);
            const db = getFirestore(app);
            const auth = getAuth(app);

            // Authentication logic
            async function authenticate() {
                try {
                    if (typeof __initial_auth_token !== 'undefined') {
                        await signInWithCustomToken(auth, __initial_auth_token);
                    } else {
                        await signInAnonymously(auth);
                    }
                    console.log("Firebase Auth successful. User ID:", auth.currentUser.uid);
                    document.getElementById('userIdDisplay').textContent = auth.currentUser.uid;
                } catch (error) {
                    console.error("Firebase Auth failed:", error);
                }
            }
            authenticate();
        } else {
            console.warn("Firebase config not available. Running in mock mode.");
        }
    </script>

    <!-- Main Application Container -->
    <div id="app" class="flex">

        <!-- Sidebar Navigation (Desktop View) -->
        <aside class="hidden lg:block w-64 bg-white border-r border-accent-subtle p-6 shadow-sm sticky top-0 h-screen">
            <div class="flex flex-col h-full">
                <!-- Logo/Title -->
                <div class="text-xl font-extrabold text-primary-blue mb-10 tracking-wider">
                    ACADEMIA HUB
                </div>

                <!-- Navigation Links -->
                <nav class="space-y-2 flex-grow">
                    <a href="#" class="flex items-center space-x-3 p-3 rounded-lg bg-primary-blue text-white font-semibold transition duration-150 shadow-md">
                        <!-- Icon Placeholder: Home -->
                        <span class="w-5 h-5">🏠</span>
                        <span>Dashboard</span>
                    </a>
                    <a href="#" class="flex items-center space-x-3 p-3 rounded-lg text-text-dark hover:bg-accent-subtle transition duration-150">
                        <!-- Icon Placeholder: Book -->
                        <span class="w-5 h-5">📚</span>
                        <span>My Courses</span>
                    </a>
                    <a href="#" class="flex items-center space-x-3 p-3 rounded-lg text-text-dark hover:bg-accent-subtle transition duration-150">
                        <!-- Icon Placeholder: Checkmark -->
                        <span class="w-5 h-5">✅</span>
                        <span>Grades & Reports</span>
                    </a>
                    <a href="#" class="flex items-center space-x-3 p-3 rounded-lg text-text-dark hover:bg-accent-subtle transition duration-150">
                        <!-- Icon Placeholder: Calendar -->
                        <span class="w-5 h-5">📅</span>
                        <span>Calendar</span>
                    </a>
                </nav>

                <!-- Footer/User Info (Bottom of Sidebar) -->
                <div class="mt-8 pt-4 border-t border-accent-subtle">
                    <p class="text-xs text-gray-500 mb-2">Authenticated User ID:</p>
                    <p id="userIdDisplay" class="text-xs text-gray-700 truncate font-mono bg-accent-subtle p-1 rounded">...Loading</p>
                </div>
            </div>
        </aside>

        <!-- Main Content Area -->
        <main class="flex-1 overflow-y-auto">

            <!-- Top Bar (Mobile/Desktop Header) -->
            <header class="bg-white shadow-sm sticky top-0 z-10 border-b border-accent-subtle">
                <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-4 flex justify-between items-center">
                    <h1 class="text-2xl font-bold text-text-dark">Student Dashboard</h1>
                    
                    <div class="flex items-center space-x-4">
                        <!-- User Profile Dropdown (Mock) -->
                        <div class="relative group">
                            <button class="flex items-center space-x-2 p-2 rounded-full hover:bg-accent-subtle transition duration-150">
                                <span class="text-sm font-medium hidden sm:inline">Jane Doe</span>
                                <img class="h-10 w-10 rounded-full border-2 border-primary-blue object-cover" src="https://placehold.co/100x100/1E3A8A/ffffff?text=JD" alt="User Avatar">
                            </button>
                            <!-- Mobile Menu Button (Hamburger) -->
                            <button class="lg:hidden p-2 rounded-lg text-text-dark hover:bg-accent-subtle ml-4" id="mobileMenuButton">
                                <span class="text-xl">☰</span>
                            </button>
                        </div>
                    </div>
                </div>
            </header>

            <!-- Mobile Navigation Overlay (Hidden by default) -->
            <div id="mobileMenu" class="fixed inset-0 bg-white z-20 p-6 transform -translate-x-full transition-transform duration-300 lg:hidden">
                <div class="flex justify-between items-center mb-10">
                    <div class="text-xl font-extrabold text-primary-blue tracking-wider">ACADEMIA HUB</div>
                    <button id="closeMobileMenu" class="text-3xl text-text-dark">&times;</button>
                </div>
                <nav class="space-y-4">
                    <!-- Links repeated from sidebar -->
                    <a href="#" class="block p-3 rounded-lg bg-primary-blue text-white font-semibold">🏠 Dashboard</a>
                    <a href="#" class="block p-3 rounded-lg text-text-dark hover:bg-accent-subtle">📚 My Courses</a>
                    <a href="#" class="block p-3 rounded-lg text-text-dark hover:bg-accent-subtle">✅ Grades & Reports</a>
                    <a href="#" class="block p-3 rounded-lg text-text-dark hover:bg-accent-subtle">📅 Calendar</a>
                </nav>
            </div>

            <!-- Dashboard Content Grid -->
            <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8 lg:py-12 grid grid-cols-1 lg:grid-cols-3 gap-8">

                <!-- Column 1 & 2: Main Focus -->
                <section class="lg:col-span-2 space-y-8">
                    
                    <!-- Welcome Banner -->
                    <div class="bg-white p-6 sm:p-8 rounded-xl shadow-lg border border-accent-subtle">
                        <h2 class="text-3xl font-bold text-primary-blue mb-2">Good morning, Jane Doe.</h2>
                        <p class="text-gray-600">You have **2** overdue tasks. Time to focus on your **CS 401: Compiler Design** course.</p>
                    </div>

                    <!-- Quick Stats / Key Metrics -->
                    <div class="grid grid-cols-1 sm:grid-cols-3 gap-6">
                        <!-- Stat Card 1 -->
                        <div class="bg-white p-6 rounded-xl shadow-lg border border-accent-subtle text-center">
                            <p class="text-4xl font-extrabold text-primary-blue">3.85</p>
                            <p class="text-sm font-medium text-gray-500 mt-1">Current GPA (Expected)</p>
                        </div>
                        <!-- Stat Card 2 -->
                        <div class="bg-white p-6 rounded-xl shadow-lg border border-accent-subtle text-center">
                            <p class="text-4xl font-extrabold text-primary-blue">6</p>
                            <p class="text-sm font-medium text-gray-500 mt-1">Courses Enrolled</p>
                        </div>
                        <!-- Stat Card 3 -->
                        <div class="bg-white p-6 rounded-xl shadow-lg border border-accent-subtle text-center">
                            <p class="text-4xl font-extrabold text-red-600" id="overdueCount">2</p>
                            <p class="text-sm font-medium text-gray-500 mt-1">Overdue Assignments</p>
                        </div>
                    </div>
                    
                    <!-- Enrolled Courses (Primary Section) -->
                    <div>
                        <h2 class="text-2xl font-semibold mb-4 text-text-dark">Courses In Progress</h2>
                        <div class="space-y-4" id="enrolledCourses">
                            <!-- Course Card 1: High Progress -->
                            <div class="course-card bg-white p-6 rounded-xl shadow-lg border-l-4 border-primary-blue hover:shadow-xl transition duration-200 cursor-pointer">
                                <div class="flex justify-between items-start mb-2">
                                    <h3 class="text-lg font-bold">CS 401: Compiler Design</h3>
                                    <span class="text-xs font-semibold text-white bg-primary-blue px-3 py-1 rounded-full">Active</span>
                                </div>
                                <p class="text-sm text-gray-600 mb-4">Category: Computer Science</p>
                                
                                <div class="w-full bg-accent-subtle rounded-full h-2.5">
                                    <div class="bg-primary-blue h-2.5 rounded-full" style="width: 85%"></div>
                                </div>
                                <p class="text-right text-sm font-medium text-primary-blue mt-1">85% Complete (17/20 Lessons)</p>
                            </div>

                            <!-- Course Card 2: Medium Progress -->
                            <div class="course-card bg-white p-6 rounded-xl shadow-lg border-l-4 border-green-600 hover:shadow-xl transition duration-200 cursor-pointer">
                                <div class="flex justify-between items-start mb-2">
                                    <h3 class="text-lg font-bold">ECON 202: Macroeconomics</h3>
                                    <span class="text-xs font-semibold text-white bg-green-600 px-3 py-1 rounded-full">Active</span>
                                </div>
                                <p class="text-sm text-gray-600 mb-4">Category: Economics</p>
                                
                                <div class="w-full bg-accent-subtle rounded-full h-2.5">
                                    <div class="bg-green-600 h-2.5 rounded-full" style="width: 45%"></div>
                                </div>
                                <p class="text-right text-sm font-medium text-green-600 mt-1">45% Complete (9/20 Lessons)</p>
                            </div>

                            <!-- Course Card 3: Completed Course (Subtler Styling) -->
                            <div class="course-card bg-white p-6 rounded-xl shadow-lg border-l-4 border-gray-400 opacity-80 cursor-default">
                                <div class="flex justify-between items-start mb-2">
                                    <h3 class="text-lg font-bold text-gray-600">PHIL 101: Introduction to Logic</h3>
                                    <span class="text-xs font-semibold text-white bg-gray-500 px-3 py-1 rounded-full">Completed</span>
                                </div>
                                <p class="text-sm text-gray-500 mb-4">Category: Humanities</p>
                                
                                <div class="w-full bg-accent-subtle rounded-full h-2.5">
                                    <div class="bg-gray-500 h-2.5 rounded-full" style="width: 100%"></div>
                                </div>
                                <p class="text-right text-sm font-medium text-gray-500 mt-1">100% Complete (Completed on 2025-11-01)</p>
                            </div>
                        </div>
                        <a href="#" class="mt-4 block text-primary-blue hover:text-primary-blue/80 font-semibold text-center py-2 border-t border-accent-subtle bg-white rounded-b-xl">View All Courses →</a>
                    </div>
                </section>

                <!-- Column 3: Secondary Information / Utility -->
                <aside class="lg:col-span-1 space-y-8">

                    <!-- Upcoming Assignments -->
                    <div class="bg-white p-6 rounded-xl shadow-lg border border-accent-subtle">
                        <h2 class="text-xl font-semibold mb-4 text-text-dark">Upcoming Deadlines</h2>
                        <ul class="space-y-4">
                            <!-- Assignment 1 (Overdue) -->
                            <li class="border-l-4 border-red-500 pl-3">
                                <p class="text-sm font-bold text-red-600">Compiler Design Final Report</p>
                                <p class="text-xs text-gray-500">CS 401 | Overdue since Nov 25</p>
                            </li>
                            <!-- Assignment 2 -->
                            <li class="border-l-4 border-primary-blue pl-3">
                                <p class="text-sm font-bold">Macroeconomics Midterm</p>
                                <p class="text-xs text-gray-500">ECON 202 | Due: Dec 5</p>
                            </li>
                            <!-- Assignment 3 -->
                            <li class="border-l-4 border-gray-400 pl-3">
                                <p class="text-sm font-bold">Database Schema Design</p>
                                <p class="text-xs text-gray-500">CS 305 | Due: Dec 12</p>
                            </li>
                        </ul>
                        <a href="#" class="mt-4 block text-sm text-primary-blue hover:text-primary-blue/80 font-medium">View Full Calendar</a>
                    </div>

                    <!-- Quick Actions -->
                    <div class="bg-white p-6 rounded-xl shadow-lg border border-accent-subtle">
                        <h2 class="text-xl font-semibold mb-4 text-text-dark">Quick Actions</h2>
                        <div class="grid grid-cols-2 gap-3">
                            <button class="flex flex-col items-center justify-center p-4 bg-accent-subtle rounded-lg hover:bg-gray-300 transition duration-150 text-text-dark text-sm font-medium">
                                <!-- Icon Placeholder: Mail -->
                                <span>📧</span>
                                <span class="mt-1">Email Instructor</span>
                            </button>
                            <button class="flex flex-col items-center justify-center p-4 bg-accent-subtle rounded-lg hover:bg-gray-300 transition duration-150 text-text-dark text-sm font-medium">
                                <!-- Icon Placeholder: Search -->
                                <span>🔍</span>
                                <span class="mt-1">Course Search</span>
                            </button>
                            <button class="flex flex-col items-center justify-center p-4 bg-accent-subtle rounded-lg hover:bg-gray-300 transition duration-150 text-text-dark text-sm font-medium">
                                <!-- Icon Placeholder: Help -->
                                <span>❓</span>
                                <span class="mt-1">Get Help</span>
                            </button>
                            <button class="flex flex-col items-center justify-center p-4 bg-accent-subtle rounded-lg hover:bg-gray-300 transition duration-150 text-text-dark text-sm font-medium">
                                <!-- Icon Placeholder: Settings -->
                                <span>⚙️</span>
                                <span class="mt-1">Settings</span>
                            </button>
                        </div>
                    </div>
                </aside>
            </div>
        </main>
    </div>

    <!-- JavaScript for Mobile Menu Functionality -->
    <script>
        const mobileMenuButton = document.getElementById('mobileMenuButton');
        const closeMobileMenu = document.getElementById('closeMobileMenu');
        const mobileMenu = document.getElementById('mobileMenu');

        if (mobileMenuButton && closeMobileMenu && mobileMenu) {
            mobileMenuButton.addEventListener('click', () => {
                mobileMenu.classList.remove('-translate-x-full');
            });

            closeMobileMenu.addEventListener('click', () => {
                mobileMenu.classList.add('-translate-x-full');
            });

            // Close menu when a link is clicked
            mobileMenu.querySelectorAll('a').forEach(link => {
                link.addEventListener('click', () => {
                    mobileMenu.classList.add('-translate-x-full');
                });
            });
        }
    </script>
</body>
</html>