<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ircquotes: Admin Login</title>
    <link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}" />
    <script>
        // Prevent flash of white content by applying theme immediately
        (function() {
            const savedTheme = localStorage.getItem('theme');
            const prefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
            if (savedTheme === 'dark' || (!savedTheme && prefersDark)) {
                document.documentElement.className = 'dark-theme';
            }
        })();
    </script>
    <script src="{{ url_for('static', filename='theme.js') }}"></script>
</head>
<body bgcolor="#ffffff" text="#000000" link="#c08000" vlink="#c08000" alink="#c08000">

    <!-- Top Navigation Bar -->
    <center>
        <table cellpadding="2" cellspacing="0" width="80%" border="0">
            <tr>
                <td bgcolor="#c08000" align="left">
                    <font size="+1"><b><i>ircquotes</i></b></font>
                </td>
                <td bgcolor="#c08000" align="right">
                    <font face="arial" size="+1"><b>Admin Login</b></font>
                </td>
            </tr>
        </table>

        <!-- Navigation Links -->
        <table cellpadding="2" cellspacing="0" width="80%" border="0">
            <tr>
                <td class="footertext" align="left" bgcolor="#f0f0f0"></td>
                <td align="right" bgcolor="#f0f0f0" class="toplinks" colspan="2">
                    <a href="/">Home</a> /
                    <a href="/random">Random</a> /
                    <a href="/submit">Submit</a> /
                    <a href="/browse">Browse</a> /
                    <a href="/modapp">ModApp</a> /
                    <a href="/search">Search</a> /
                    <a href="/faq">FAQ</a>
                    <button id="theme-toggle" onclick="toggleDarkMode()" title="Toggle dark/light mode">🌙</button>
                </td>
            </tr>
        </table>
    </center>

    <!-- Login Form -->
    <center>
        <h2>Admin Login</h2>
        <form method="POST" action="/login">
            <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
            <table>
                <tr>
                    <td>Username:</td>
                    <td><input type="text" name="username" required></td>
                </tr>
                <tr>
                    <td>Password:</td>
                    <td><input type="password" name="password" required></td>
                </tr>
                <tr>
                    <td colspan="2" align="center">
                        <input type="submit" value="Login" class="button">
                    </td>
                </tr>
            </table>
        </form>
    </center>

    <!-- Footer -->
    <center>
        <table border="0" cellpadding="2" cellspacing="0" width="80%" bgcolor="#c08000">
            <tr>
                <td bgcolor="#f0f0f0" class="toplinks" colspan="2">
                    <a href="/">Home</a> /
                    <a href="/random">Random</a> /
                    <a href="/submit">Submit</a> /
                    <a href="/browse">Browse</a> /
                    <a href="/modapp">ModApp</a> /
                    <a href="/search">Search</a>
                    <a href="/faq">FAQ</a>
                </td>
            </tr>
            <tr>
                <td class="footertext" align="left">&nbsp;</td>
                <td class="footertext" align="right">{{ approved_count }} quotes approved; {{ pending_count }} quotes pending</td>
            </tr>
        </table>

        <font size="-1">@ ircquotes 2024-2025</font>
    </center>

</body>
</html>
