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

<div class="container idx1-page-wrapper">
    <div class="row justify-content-center">
        <div class="col-md-6 col-lg-5 col-xl-4">
            <div class="idx1-card fade-in-up">

                <!-- Card Header -->
                <div class="text-center mb-4 idx1-stagger-1">
                    <div class="idx1-header-icon">
                        <i class="bi bi-box-arrow-in-right"></i>
                    </div>
                    <h3 class="idx1-card-title"><?= __('front.login') ?></h3>
                    <p class="idx1-card-subtitle"><?= __('front.welcome_back_sign_in') ?></p>
                </div>

                <!-- Nav Pills -->
                <ul class="nav nav-pills idx1-nav-pills justify-content-center mb-4 idx1-stagger-2" id="pills-tab" role="tablist">
                    <li class="nav-item flex-fill">
                        <a class="nav-link active" href="<?= base_url() ?>">
                            <i class="bi bi-box-arrow-in-right me-1"></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-1"></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-1"></i>'. __('front.register') .'
                                    </a>
                                  </li>';
                        }
                    ?>
                </ul>

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

                    <!-- Username -->
                    <div class="form-floating idx1-input-group mb-4 idx1-stagger-3">
                        <input type="text"
                               class="form-control idx1-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 idx1-input-group mb-4 position-relative idx1-stagger-4">
                        <input type="password"
                               class="form-control idx1-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 idx1-stagger-5">
                        <?= render_recaptcha_html('affiliate_login') ?>
                    </div>

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

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

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

            </div>
        </div>
    </div>
</div>

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