<!DOCTYPE html>
<html lang="tr" data-theme="dark">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php echo htmlspecialchars($title ?? 'Yönetici Girişi'); ?></title>
    <meta name="robots" content="noindex,nofollow">
    <link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🔒</text></svg>">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="<?php echo $baseUrl; ?>/assets/css/admin.css?v=20260709">
    <script>
        (function(){
            var t = localStorage.getItem('admin_theme') || 'dark';
            document.documentElement.setAttribute('data-theme', t);
        })();
    </script>
</head>
<body class="admin-body">

<div class="login-bg">
    <div class="login-card">

        <div class="login-icon-wrap">
            <i class="fa fa-lock"></i>
        </div>

        <h2>Yönetim Paneli</h2>
        <p class="subtitle">Devam etmek için giriş yapın</p>

        <?php if (isset($error)): ?>
        <div class="login-error">
            <i class="fa fa-exclamation-circle"></i>
            <?php echo htmlspecialchars($error); ?>
        </div>
        <?php endif; ?>

        <form action="<?php echo $baseUrl; ?>/admin/auth" method="POST" id="loginForm">
            <div class="login-field">
                <label for="username">Kullanıcı Adı</label>
                <div class="input-wrap">
                    <i class="fa fa-user"></i>
                    <input type="text" id="username" name="username" required
                           placeholder="Kullanıcı adınızı girin"
                           autocomplete="username" autofocus>
                </div>
            </div>

            <div class="login-field">
                <label for="password">Şifre</label>
                <div class="input-wrap">
                    <i class="fa fa-lock"></i>
                    <input type="password" id="password" name="password" required
                           placeholder="••••••••"
                           autocomplete="current-password">
                </div>
            </div>

            <button type="submit" class="login-submit" id="submitBtn">
                <i class="fa fa-sign-in"></i>
                <span>Giriş Yap</span>
            </button>
        </form>

        <div class="login-divider">
            <hr><span>Veya</span><hr>
        </div>

        <a href="<?php echo $baseUrl; ?>/auth/google?from=admin" class="login-google">
            <img src="https://www.google.com/favicon.ico" alt="Google" width="18" height="18"
                 onerror="this.style.display='none'">
            Google ile Giriş Yap
        </a>

        <a href="<?php echo $baseUrl; ?>/" class="login-back">
            <i class="fa fa-arrow-left" style="margin-right:6px;"></i>
            Mağazaya Dön
        </a>

    </div>
</div>

<script>
/* Submit button loading state */
document.getElementById('loginForm').addEventListener('submit', function() {
    var btn = document.getElementById('submitBtn');
    btn.innerHTML = '<i class="fa fa-spinner fa-spin"></i> Giriş yapılıyor...';
    btn.disabled = true;
});
</script>

</body>
</html>