<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="<?=$res_site[0]['site_name'];?>">
    <meta name="author" content="<?=$res_site[0]['site_name'];?>">
    <link rel="icon" type="image/png" href="/img/<?=$res_site[0]['logo'];?>">
    <title><?=$res_site[0]['site_name'];?></title>
    <link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
    <link href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap" rel="stylesheet">
    <script src="./vendor/sweetalert/sweetalert.js"></script>

<style>
* { margin:0; padding:0; box-sizing:border-box; }

html, body {
    height: 100vh;
    width: 100vw;
    font-family: 'Nunito', sans-serif;
    overflow: hidden;
}

/* ==============================
   FULL PAGE WRAPPER
============================== */
.pg-wrap {
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* ==============================
   BACKGROUND IMAGE (LEFT SIDE)
============================== */
.pg-bg {
    position: absolute;
    inset: 0;
   background: url('img/loginbg.png') center center / cover no-repeat;
    z-index: 0;
}

/* Dark overlay */
.pg-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        100deg,
        rgba(0,30,10,0.55) 0%,
        rgba(0,40,15,0.30) 55%,
        rgba(0,0,0,0.05) 100%
    );
}

/* ==============================
   GOLDEN CORNER ACCENTS
============================== */
.corner-tl {
    position: absolute;
    top: 0; left: 0;
    width: 180px; height: 180px;
    background: linear-gradient(135deg, rgba(212,175,55,0.45) 0%, transparent 60%);
    z-index: 1;
    pointer-events: none;
}

.corner-br {
    position: absolute;
    bottom: 0; right: 0;
    width: 180px; height: 180px;
    background: linear-gradient(315deg, rgba(212,175,55,0.35) 0%, transparent 60%);
    z-index: 1;
    pointer-events: none;
}

/* Dot pattern accent */
.dot-pattern {
    position: absolute;
    top: 16px; right: 420px;
    width: 80px; height: 80px;
    background-image: radial-gradient(circle, rgba(255,255,255,0.25) 1.5px, transparent 1.5px);
    background-size: 12px 12px;
    z-index: 1;
    pointer-events: none;
}

/* ==============================
   MAIN CONTENT
============================== */
.pg-main {
    flex: 1;
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 20px 50px 20px 40px;
    min-height: 0;
}

/* ==============================
   WHITE CARD
============================== */
.pg-card {
    background: #ffffff;
    border-radius: 22px;
    padding: 32px 32px 24px;
    width: 370px;
    flex-shrink: 0;
    box-shadow: 0 30px 80px rgba(0,0,0,0.40), 0 0 0 1px rgba(255,255,255,0.15);
    position: relative;
    overflow: hidden;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.pg-card::-webkit-scrollbar { display: none; }

/* Gold top border */
.pg-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, #1a7a3a, #d4af37, #1a3a6b);
}

/* Gold right border */
.pg-card::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, #d4af37, #1a7a3a, transparent);
    border-radius: 0 22px 22px 0;
}

/* ==============================
   LOGO
============================== */
.pg-logo {
    text-align: center;
    margin-bottom: 4px;
}

.pg-logo img {
    height: 80px;
    object-fit: contain;
}

/* ==============================
   ADMIN PANEL TITLE
============================== */
.pg-title {
    text-align: center;
    margin-bottom: 18px;
}

.pg-title h2 {
    font-size: 22px;
    font-weight: 900;
    color: #1a7a3a;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.pg-title .pg-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.pg-title .pg-dots span {
    width: 28px;
    height: 2.5px;
    background: #1a7a3a;
    border-radius: 3px;
}

.pg-title .pg-dots i {
    width: 6px;
    height: 6px;
    background: #d4af37;
    border-radius: 50%;
    display: inline-block;
}

/* ==============================
   INPUT FIELDS
============================== */
.pg-field {
    position: relative;
    margin-bottom: 14px;
}

.pg-field .pg-ico {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #bbb;
    font-size: 15px;
    pointer-events: none;
}

.pg-field input {
    width: 100%;
    padding: 13px 44px 13px 46px;
    border: 1.5px solid #e8e8e8;
    border-radius: 12px;
    font-size: 13.5px;
    color: #333;
    background: #fafbfc;
    outline: none;
    transition: all 0.25s;
    font-family: 'Nunito', sans-serif;
}

.pg-field input:focus {
    border-color: #1a7a3a;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(26,122,58,0.10);
}

.pg-field input::placeholder {
    color: #ccc;
    font-size: 13px;
}

/* Eye button */
.pg-eye {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    outline: none;
    color: #bbb;
    font-size: 15px;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s;
}

.pg-eye:hover { color: #1a7a3a; }

/* ==============================
   REMEMBER + FORGOT
============================== */
.pg-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.pg-remember {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    color: #888;
    cursor: pointer;
}

.pg-remember input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: #1a7a3a;
    cursor: pointer;
    border-radius: 4px;
}

.pg-forgot {
    font-size: 12.5px;
    color: #1a7a3a;
    font-weight: 800;
    text-decoration: none;
}

.pg-forgot:hover { text-decoration: underline; }

/* ==============================
   LOGIN BUTTON
============================== */
.pg-btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(90deg, #1a7a3a 0%, #145e2d 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 900;
    letter-spacing: 3px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: 'Nunito', sans-serif;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.pg-btn-login:hover {
    background: linear-gradient(90deg, #145e2d, #0d3d1c);
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(26,122,58,0.45);
}

/* ==============================
   OR DIVIDER
============================== */
.pg-or {
    text-align: center;
    font-size: 11.5px;
    color: #bbb;
    letter-spacing: 1.5px;
    margin-bottom: 14px;
    position: relative;
}

.pg-or::before,
.pg-or::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 36%;
    height: 1px;
    background: #eee;
}

.pg-or::before { left: 0; }
.pg-or::after  { right: 0; }

/* ==============================
   SECURE ACCESS
============================== */
.pg-secure {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px;
    background: #f8fafb;
    border: 1px solid #eee;
    border-radius: 12px;
    margin-bottom: 16px;
}

.pg-secure i {
    font-size: 22px;
    color: #ccc;
}

.pg-secure span {
    font-size: 11px;
    color: #bbb;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

/* ==============================
   CREATE ACCOUNT
============================== */
.pg-create {
    text-align: center;
    font-size: 12.5px;
    color: #aaa;
}

.pg-create a {
    color: #1a7a3a;
    font-weight: 800;
    text-decoration: none;
}

.pg-create a:hover { text-decoration: underline; }

/* ==============================
   FOOTER
============================== */
.pg-footer {
    position: relative;
    z-index: 2;
    background: rgba(0, 20, 10, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid rgba(212,175,55,0.25);
    padding: 12px 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 50px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.pg-fi {
    display: flex;
    align-items: center;
    gap: 13px;
}

.pg-fi-ico {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #1a7a3a;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(26,122,58,0.45);
}

.pg-fi-ico i {
    color: #fff;
    font-size: 16px;
}

.pg-fi-lbl {
    font-size: 10px;
    color: #7aad90;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.pg-fi-val {
    font-size: 13px;
    color: #ffffff;
    font-weight: 800;
}

.pg-sep {
    width: 1px;
    height: 38px;
    background: rgba(255,255,255,0.10);
}

/* ==============================
   RESPONSIVE
============================== */
@media (max-width: 768px) {
    html, body { overflow: auto; }
    .pg-main {
        justify-content: center;
        padding: 20px 16px;
    }
    .pg-card {
        width: 100%;
        max-height: none;
    }
    .pg-footer {
        gap: 18px;
        padding: 12px 16px;
    }
    .pg-sep { display: none; }
    .dot-pattern { display: none; }
}
</style>
</head>

<body>
<div class="pg-wrap">

    <!-- Background -->
    <div class="pg-bg"></div>

    <!-- Gold Corner Accents -->
    <div class="corner-tl"></div>
    <div class="corner-br"></div>
    <div class="dot-pattern"></div>

    <!-- Main Content -->
    <div class="pg-main">

        <!-- White Card -->
        <div class="pg-card">

            <!-- Logo -->
            <div class="pg-logo">
                <img src="img/<?=$res_site[0]['logo'];?>" alt="<?=$res_site[0]['site_name'];?>" />
            </div>

            <!-- Title -->
            <div class="pg-title">
                <h2>Admin Panel</h2>
                <div class="pg-dots">
                    <span></span>
                    <i></i><i></i><i></i>
                    <span></span>
                </div>
            </div>

            <!-- LOGIN FORM -->
            <div id="form_login">
                <form name="bz" id="bz" method="post" action="login_check.php" onsubmit="return false;">

                    <!-- Username -->
                    <div class="pg-field">
                        <i class="far fa-user pg-ico"></i>
                        <input type="text"
                               id="email"
                               name="email"
                               placeholder="Username"
                               required="required" />
                    </div>

                    <!-- Password -->
                    <div class="pg-field">
                        <i class="fas fa-lock pg-ico"></i>
                        <input type="password"
                               id="password"
                               name="password"
                               placeholder="Password"
                               required="required" />
                        <button type="button" class="pg-eye" onclick="togglePass()">
                            <i class="fas fa-eye" id="eyeIco"></i>
                        </button>
                    </div>

                    <!-- Remember + Forgot -->
                    <div class="pg-options">
                        <label class="pg-remember">
                            <input type="checkbox" name="remember" />
                            Remember Me
                        </label>
                        <a class="pg-forgot" href="#" onclick="forgot_password()">Forgot Password?</a>
                    </div>

                    <!-- Hidden -->
                    <input type="hidden" name="updte" id="updte" value="1" />
                    <input type="hidden" name="msg_id" id="msg_id" value="<?=$msg_id;?>" />

                    <!-- Login Button -->
                    <button type="submit" name="login" id="login" class="pg-btn-login">
                        LOGIN &nbsp;<i class="fas fa-arrow-right"></i>
                    </button>

                </form>

                <!-- OR -->
                <div class="pg-or">or login with</div>

                <!-- Secure Access -->
                <div class="pg-secure">
                    <i class="fas fa-lock"></i>
                    <span>Secure Access</span>
                </div>

                <!-- Create Account -->
                <div class="pg-create">
                    Not a Member?
                    <a href="#" onclick="create_account()">Create an Account!</a>
                </div>
            </div>

            <!-- All Panels -->
            <?php include "templates/default/forgot_password.php"; ?>
            <?php include "templates/default/register.php"; ?>
            <?php include "templates/default/verify_otp.php"; ?>
            <?php include "templates/default/reset_password.php"; ?>
            <?php include "templates/default/opt_verify.php"; ?>
            <div id="processing" style="display:none;width:100%;text-align:center;">
                <?php include "templates/default/processing.php"; ?>
            </div>

        </div>
        <!-- End Card -->

    </div>
    <!-- End Main -->

    <!-- Footer -->
    <footer class="pg-footer">

        <div class="pg-fi">
            <div class="pg-fi-ico"><i class="fas fa-phone-alt"></i></div>
            <div>
                <div class="pg-fi-lbl">Contact Us</div>
                <div class="pg-fi-val"><?=$res_site[0]['mobile'];?></div>
            </div>
        </div>

        <div class="pg-sep"></div>

        <div class="pg-fi">
            <div class="pg-fi-ico"><i class="fas fa-envelope"></i></div>
            <div>
                <div class="pg-fi-lbl">Email Us</div>
                <div class="pg-fi-val"><?=$res_site[0]['email'];?></div>
            </div>
        </div>

        <div class="pg-sep"></div>

        <div class="pg-fi">
            <div class="pg-fi-ico"><i class="fas fa-globe"></i></div>
            <div>
                <div class="pg-fi-lbl">Website</div>
                <div class="pg-fi-val"><?=$res_site[0]['site_url'];?></div>
            </div>
        </div>

    </footer>

</div>

<!-- Scripts -->
<script src="vendor/jquery/jquery.min.js"></script>
<script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="vendor/jquery-easing/jquery.easing.min.js"></script>
<script src="js/sb-admin-2.min.js"></script>
<script src="js/login.js"></script>

<script>
function togglePass() {
    var p = document.getElementById('password');
    var i = document.getElementById('eyeIco');
    if (p.type === 'password') {
        p.type = 'text';
        i.classList.replace('fa-eye','fa-eye-slash');
    } else {
        p.type = 'password';
        i.classList.replace('fa-eye-slash','fa-eye');
    }
}
</script>

</body>
</html>
