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

    <div class="idx12-card idx12-stagger-1">
        <!-- Card Header -->
        <div class="idx12-card-header">
            <div class="idx12-icon"><i class="bi bi-shield-lock-fill"></i></div>
            <h4><?= $title ?></h4>
            <small><?= __('front.welcome_back_sign_in') ?></small>
        </div>

        <!-- Card Body -->
        <div class="idx12-card-body">
            <!-- Tabs -->
            <div class="idx12-tabs mb-4 idx12-stagger-2">
                <a href="<?= base_url() ?>" class="idx12-tab active">
                    <i class="bi bi-box-arrow-in-right"></i><?= __('front.login') ?>
                </a>
                <?php
                    if (isset($store['registration_status']) && $store['registration_status'] != 0) {
                        if (($vendor_marketstatus["marketvendorstatus"] == 1 || $vendor_storestatus['storestatus']) && $store['registration_status'] != 3) {
                            echo '<a href="'. base_url('register') .'" class="idx12-tab"><i class="bi bi-person-plus"></i>'. __('front.register') .'</a>';
                        }
                    } else if ($store['registration_status'] != 2) {
                        echo '<a href="'. base_url('register') .'" class="idx12-tab"><i class="bi bi-person-plus"></i>'. __('front.register') .'</a>';
                    }
                ?>
            </div>

            <!-- Login Form -->
            <form id="login-form" autocomplete="off">
                <div class="mb-3 idx12-stagger-3">
                    <div class="form-floating idx12-input-group">
                        <input type="text" class="form-control idx12-input" id="idx12-username" name="username"
                               placeholder="<?= __('front.username_email') ?>" required>
                        <label for="idx12-username">
                            <i class="bi bi-person-circle me-2" style="color:var(--idx12-primary-light)"></i><?= __('front.username_email') ?>
                        </label>
                    </div>
                </div>

                <div class="mb-3 idx12-stagger-3">
                    <div class="form-floating idx12-input-group">
                        <input type="password" class="form-control idx12-input" id="idx12-password" name="password"
                               placeholder="<?= __('front.password') ?>" required>
                        <label for="idx12-password">
                            <i class="bi bi-shield-lock me-2" style="color:var(--idx12-primary-light)"></i><?= __('front.password') ?>
                        </label>
                        <button type="button" class="toggle-password" data-target="#idx12-password" aria-label="Toggle password">
                            <i class="bi bi-eye"></i>
                        </button>
                    </div>
                </div>

                <div class="mb-3 text-center idx12-stagger-4" id="login-status-msg"></div>

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

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

                <div class="text-center idx12-stagger-5">
                    <a href="<?= base_url('forget-password') ?>" class="idx12-link">
                        <i class="bi bi-question-circle"></i><?= __('front.forget_password') ?>?
                    </a>
                </div>
            </form>
        </div>

        <!-- Card Footer -->
        <div class="idx12-card-footer idx12-stagger-6">
            <small><i class="bi bi-shield-check"></i><?= __('front.your_information_secure') ?></small>
        </div>
    </div>

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