<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ASSESMEN CBT KELAS X</title>

    <!-- Google Font -->
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap" rel="stylesheet">

    <!-- jQuery -->
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>

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

        body {
            font-family: 'Poppins', sans-serif;
            height: 100vh;
            margin: 0;
          
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .login-wrapper {
            width: 100%;
            max-width: 420px;
        }

        .login-box {
            background: #ffffff;
            border-radius: 22px;
            padding: 40px 35px;
            box-shadow: 0 15px 35px rgba(0,0,0,0.25);
            animation: fadeUp 0.9s ease;
        }

        /* pastikan TIDAK ADA frame belakang */
        .login-box::before,
        .login-box::after {
            display: none !important;
        }

        @keyframes fadeUp {
            from { opacity: 0; transform: translateY(25px); }
            to { opacity: 1; transform: translateY(0); }
        }

        .login-logo {
            text-align: center;
            margin-bottom: 20px;
        }

       .login-logo img {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    padding: 2px;
    background: linear-gradient(145deg, #FFD700, #FFC107, #FFB300); /* gradient gold 3D */
    box-shadow: 
        0 4px 12px rgba(255, 215, 0, 0.3),   /* shadow lembut bawah */
        0 0 15px rgba(255, 215, 0, 0.5),     /* glow halo */
        inset 0 2px 6px rgba(255, 255, 255, 0.3); /* refleksi halus */
    border: 1px solid rgba(255, 215, 0, 0.6); /* border tipis gold */
    transition: all 0.4s ease;
}

/* Hover efek glowing lebih hidup */
.login-logo img:hover {
    box-shadow: 
        0 6px 20px rgba(255, 215, 0, 0.5),
        0 0 25px rgba(255, 215, 0, 0.6),
        inset 0 3px 8px rgba(255, 255, 255, 0.4);
    transform: scale(1.05); /* efek sedikit membesar saat hover */
}
        }

        .login-title {
            text-align: center;
            font-size: 22px;
            font-weight: 700;
            color: #1d2671;
            margin-bottom: 5px;
            letter-spacing: 1px;
        }

        .login-subtitle {
            text-align: center;
            font-size: 13px;
            color: #777;
            margin-bottom: 28px;
        }

        .form-group {
            margin-bottom: 18px;
        }

        .form-control {
            width: 100%;
            padding: 14px 15px;
            font-size: 14px;
            border-radius: 12px;
            border: 1px solid #ddd;
            outline: none;
            background: #f9f9f9;
            transition: 0.3s;
        }

        .form-control:focus {
            border-color: #1d2671;
            background: #fff;
            box-shadow: 0 0 0 3px rgba(29,38,113,0.15);
        }

        .checkbox {
            font-size: 13px;
            color: #444;
            margin-bottom: 20px;
            display: flex;
            align-items: center;
        }

        .checkbox input {
            margin-right: 8px;
        }

        .btn-login {
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #90a4ae, #78909c); /* abu futuristik */
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.5px;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(120, 144, 156, 0.4); /* shadow lebih dramatis */
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

/* Hover: floating + glow neon */
.btn-login:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 32px rgba(120, 144, 156, 0.6), 0 0 20px rgba(255, 255, 255, 0.15);
    background: linear-gradient(135deg, #aeb6c1, #78909c);
}

/* Efek glow neon halus */
.btn-login::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.12) 0%, transparent 70%);
    opacity: 0;
    transition: all 0.4s ease;
    pointer-events: none;
}

.btn-login:hover::before {
    opacity: 1;
}

/* Active / klik */
.btn-login:active {
    transform: scale(0.97);
    box-shadow: 0 6px 20px rgba(120, 144, 156, 0.4);
}

/* Disabled */
.btn-login:disabled {
    background: linear-gradient(135deg, #cfd8dc, #eceff1);
    cursor: not-allowed;
    box-shadow: none;
}
        }

        .btn-login:hover {
            transform: translateY(-2px);
            box-shadow: 0 10px 25px rgba(195,55,100,0.45);
        }

        #form-pesan {
            margin-top: 15px;
            font-size: 13px;
            color: #e74c3c;
            text-align: center;
            min-height: 18px;
        }

        .cbt-footer {
            text-align: center;
            font-size: 11px;
            color: #999;
            margin-top: 25px;
        }
    </style>
</head>
<body>

<div class="login-wrapper">
    <div class="login-box">

        <div class="login-logo">
            <img src="https://ujiansmk.my.id/10/fd.png" alt="Logo CBT">
        </div>

       
        <div class="login-subtitle"></div>

        <?php echo form_open('welcome/login', 'id="form-login"'); ?>

            <div class="form-group">
                <input type="text" name="username" class="form-control"
                       placeholder="Username" autocomplete="off" required>
            </div>

            <div class="form-group">
                <input type="password" id="password" name="password" class="form-control"
                       placeholder="Password" autocomplete="off" required>
            </div>

           <div class="toggle-password">
  <input type="checkbox" id="show-password">
  <label for="show-password">Tampilkan Password</label>
</div>

<style>
/* Container toggle */
.toggle-password {
    display: flex;
    align-items: center;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    user-select: none;
}

/* Sembunyikan checkbox default */
.toggle-password input[type="checkbox"] {
    display: none;
}

/* Label sebagai toggle */
.toggle-password label {
    position: relative;
    padding-left: 50px;
    cursor: pointer;
}

/* Track toggle */
.toggle-password label::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 20px;
    border-radius: 12px;
    background: #b0bec5;
    transition: background 0.3s ease;
}

/* Knob toggle */
.toggle-password label::after {
    content: '';
    position: absolute;
    left: 2px;
    top: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    transition: transform 0.3s ease, background 0.3s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* Checked state */
.toggle-password input[type="checkbox"]:checked + label::before {
    background: #1976d2; /* warna aktif */
}

.toggle-password input[type="checkbox"]:checked + label::after {
    transform: translateX(20px);
    background: #ffffff;
}

/* Optional hover effect */
.toggle-password label:hover::before {
    box-shadow: 0 0 6px rgba(25, 118, 210, 0.3);
}
</style>

            <button type="submit" class="btn-login">
                LOGIN
            </button>

            <div id="form-pesan"></div>

        <?php echo form_close(); ?>

        <div class="cbt-footer">
            © <?= date('Y'); ?> smk industri nasional 1
        </div>

    </div>
</div>

<script>
    document.getElementById('show-password').addEventListener('change', function () {
        const pwd = document.getElementById("password");
        pwd.type = this.checked ? "text" : "password";
    });

    $(function () {
        $('#form-login').submit(function (e) {
            e.preventDefault();
            $.ajax({
                url: "<?php echo site_url(); ?>/welcome/login",
                type: "POST",
                data: $(this).serialize(),
                success: function (respon) {
                    var obj = $.parseJSON(respon);
                    if (obj.status == 1) {
                        window.open("<?php echo site_url(); ?>/tes_dashboard", "_self");
                    } else {
                        $('#form-pesan').html(obj.error);
                    }
                }
            });
        });
    });
</script>

</body>
</html>