<?php include_once "header.php"; ?>

<!-- Glass Login Card -->
<div class="glass-card fade-in-up">

    <!-- Card Header -->
    <div class="glass-card-header text-center">
        <div class="header-icon mb-3">
            <i class="bi bi-box-arrow-in-right"></i>
        </div>
        <h3 class="fw-bold mb-1"><?= __('front.login') ?></h3>
        <p class="text-white-50 mb-0"><?= __('front.welcome_back_sign_in') ?></p>
    </div>

    <!-- Login/Register Nav -->
    <ul class="nav nav-pills glass-nav-pills mb-4" id="auth-tabs">
        <li class="nav-item flex-fill">
            <a class="nav-link active" href="<?= base_url() ?>">
                <i class="bi bi-box-arrow-in-right me-2"></i><?= __('front.login') ?>
            </a>
        </li>
        <?php
            if (isset($store['registration_status']) && $store['registration_status'] != 0) {
                if (($vendor_marketstatus["marketvendorstatus"] == 1 || $vendor_storestatus['storestatus']) && $store['registration_status'] != 3) {
                    echo '<li class="nav-item flex-fill">
                            <a class="nav-link" href="'. base_url('register') .'">
                                <i class="bi bi-person-plus me-2"></i>'. __('front.register') .'
                            </a>
                          </li>';
                }
            } else if ($store['registration_status'] != 2) {
                echo '<li class="nav-item flex-fill">
                        <a class="nav-link" href="'. base_url('register') .'">
                            <i class="bi bi-person-plus me-2"></i>'. __('front.register') .'
                        </a>
                      </li>';
            }
        ?>
    </ul>

    <!-- Login Form -->
    <form id="login-form">

        <!-- Username -->
        <div class="form-floating glass-input-group mb-4">
            <input type="text"
                   class="form-control glass-input"
                   id="username"
                   name="username"
                   placeholder="<?= __('front.enter_username_email') ?>"
                   required>
            <label for="username">
                <i class="bi bi-person-circle me-2"></i><?= __('front.username_email') ?>
            </label>
        </div>

        <!-- Password -->
        <div class="form-floating glass-input-group mb-4 position-relative">
            <input type="password"
                   class="form-control glass-input"
                   id="password"
                   name="password"
                   placeholder="<?= __('front.password') ?>"
                   required>
            <label for="password">
                <i class="bi bi-shield-lock me-2"></i><?= __('front.password') ?>
            </label>
            <button type="button"
                    class="btn btn-sm toggle-password"
                    tabindex="-1"
                    aria-label="Toggle Password Visibility">
                <i class="bi bi-eye"></i>
            </button>
        </div>

        <!-- Status Message -->
        <div class="mb-3 text-center" id="login-status-msg"></div>

        <!-- reCAPTCHA -->
        <div class="mb-4">
            <?= render_recaptcha_html('affiliate_login') ?>
        </div>

        <!-- Login Button -->
        <div class="d-grid mb-3">
            <button type="submit"
                    id="login_button"
                    class="btn glass-btn-primary btn-lg fw-bold py-3">
                <i class="bi bi-box-arrow-in-right me-2"></i><?= __('front.login') ?>
            </button>
        </div>

        <!-- Forgot Password -->
        <div class="text-center">
            <a href="<?= base_url('forget-password') ?>" class="glass-link">
                <i class="bi bi-question-circle me-1"></i><?= __('front.forget_password') ?>?
            </a>
        </div>
    </form>

    <!-- Security Footer -->
    <div class="glass-card-footer text-center mt-4">
        <small>
            <i class="bi bi-shield-check me-1"></i><?= __('front.your_information_secure') ?>
        </small>
    </div>
</div>

<?php include_once "footer.php"; ?>
