<?= $this->extend(config('Auth')->views['layout']) ?>

<?= $this->section('title') ?><?= lang('Auth.login') ?><?= $this->endSection() ?>

<?= $this->section('main') ?>

<!-- Content -->
<div class="authentication-wrapper authentication-cover authentication-bg">
    <div class="authentication-inner row">
        <!-- /Left Text -->
        <div class="d-none d-lg-flex col-lg-7 p-0">
            <div class="auth-cover-bg auth-cover-bg-color d-flex justify-content-center align-items-center">
                <img
                        src="<?= site_url('themes/vuexy/img/safekat/login/auth-login-illustration-light.png') ?>"
                        alt="auth-login-cover"
                        class="img-fluid my-5 auth-illustration"
                />

                <img
                        src="<?= site_url('themes/vuexy/img/illustrations/bg-shape-image-light.png'); ?>"
                        alt="auth-login-cover"
                        class="platform-bg"
                />
            </div>
        </div>
        <!-- /Left Text -->

        <!-- Login -->
        <div class="d-flex col-12 col-lg-5 align-items-center p-sm-5 p-4">
            <div class="w-px-400 mx-auto">
                <!-- Logo -->
                <div class="app-brand mb-4">
                    <a href="<?= site_url('login'); ?>" class="app-brand-link gap-2">
                <span class="app-brand-logo">
                  <img src="<?= site_url('themes/vuexy/img/safekat/logos/sk-logo.png') ?>">
                </span>
                    </a>
                </div>
                <!-- /Logo -->
                <h3 class="mb-1 fw-bold"><?= lang('Auth.login') ?></h3>

                <?php if (session('error') !== null) : ?>
                    <div class="alert alert-danger" role="alert"><?= session('error') ?></div>
                <?php elseif (session('errors') !== null) : ?>
                    <div class="alert alert-danger" role="alert">
                        <?php if (is_array(session('errors'))) : ?>
                            <?php foreach (session('errors') as $error) : ?>
                                <?= $error ?>
                                <br>
                            <?php endforeach ?>
                        <?php else : ?>
                            <?= session('errors') ?>
                        <?php endif ?>
                    </div>
                <?php endif ?>

                <?php if (session('message') !== null) : ?>
                    <div class="alert alert-success" role="alert"><?= session('message') ?></div>
                <?php endif ?>

                <form id="formAuthentication" class="mb-3" action="<?= url_to('login') ?>" method="POST">
                    <?= csrf_field() ?>
                    <!-- Email -->
                    <div class="mb-3">
                        <label for="floatingEmailInput" class="form-label"><?= lang('Auth.email') ?></label>
                        <input
                                type="email"
                                class="form-control"
                                id="floatingEmailInput"
                                name="email"
                                inputmode="email"
                                placeholder="<?= lang('Auth.email') ?>"
                                value="<?= old('email') ?>"
                                required
                                autofocus
                        />
                    </div>

                    <!-- Password -->
                    <div class="mb-3 form-password-toggle">
                        <div class="d-flex justify-content-between">
                            <label class="form-label" for="password"><?= lang('Auth.password') ?></label>
                            <?php if (setting('Auth.allowMagicLinkLogins')): ?>
                                <a href="<?= url_to('magic-link') ?>">
                                <small><?= lang('Auth.forgotPassword') ?></small>
                                </a>
                            <?php endif; ?>
                        </div>
                        <div class="input-group input-group-merge">
                            <input
                                    type="password"
                                    class="form-control"
                                    id="floatingPasswordInput"
                                    name="password"
                                    inputmode="text"
                                    autocomplete="current-password"
                                    placeholder="<?= lang('Auth.password') ?>"
                                    required
                                    onclick="pass()"
                            />
                            <span id="show_pass" class="input-group-text cursor-pointer"><i
                                        class="ti ti-eye-off"></i></span>
                        </div>
                    </div>

                    <!-- Remember me -->
                    <?php if (setting('Auth.sessionConfig')['allowRemembering']): ?>
                        <div class="mb-3">
                            <div class="form-check">
                                <input type="checkbox" name="remember"
                                       class="form-check-input" <?php if (old('remember')): ?> checked<?php endif ?>>
                                <label class="form-check-label"
                                       for="remember"> <?= lang('Auth.rememberMe') ?> </label>
                            </div>
                        </div>
                    <?php endif; ?>
                    <button class="btn btn-primary d-grid w-100"><?= lang('Auth.login') ?></button>
                </form>

                <?php if (setting('Auth.allowRegistration')) : ?>
                    <p class="text-center">
                        <span><?= lang('Auth.needAccount') ?></span>
                        <a href="<?= url_to('register') ?>">
                            <span><?= lang('Auth.register') ?></span>
                        </a>
                    </p>
                <?php endif; ?>

            </div>
        </div>
        <!-- /Login -->
    </div>
</div>
<!-- / Content -->

<?= $this->endSection() ?>
