<?php
$direction = is_rtl() ? 'rtl' : 'ltr';
$langCode = current_lang();
$clubName = Config::get('club_name_en', 'Club Management');
$pageTitle = ($title ?? 'Login') . ' | ' . $clubName;
?>
<!DOCTYPE html>
<html lang="<?= $langCode ?>" dir="<?= $direction ?>">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="csrf-token" content="<?= csrf_token() ?>">
    <title><?= e($pageTitle) ?></title>
    <?php if (is_rtl()): ?>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.rtl.min.css" rel="stylesheet">
    <?php else: ?>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <?php endif; ?>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" rel="stylesheet">
    <link href="/assets/css/app.css" rel="stylesheet">
    <?php if (is_rtl()): ?>
    <link href="/assets/css/rtl.css" rel="stylesheet">
    <?php endif; ?>
</head>
<body class="auth-body">
    <div class="auth-wrapper">
        <div class="auth-card card shadow">
            <div class="card-body p-4 p-md-5">
                <div class="text-center mb-4">
                    <i class="fas fa-shield-alt fa-3x text-primary mb-3"></i>
                    <h4><?= e($clubName) ?></h4>
                </div>
                <!-- Flash Alerts - uses same helper as app layout -->
                <?php $alerts = get_flash_alerts(); ?>
                <?php foreach ($alerts as $alert): ?>
                <div class="alert alert-<?= e($alert['type']) ?> alert-dismissible fade show" role="alert">
                    <?= e($alert['message']) ?>
                    <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                </div>
                <?php endforeach; ?>
                <?= $content ?>
            </div>
        </div>
        <div class="text-center mt-3">
            <a href="/lang/en" class="text-muted small me-2">English</a>
            <a href="/lang/ar" class="text-muted small">العربية</a>
        </div>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>