<!DOCTYPE html>
<html lang="bn">
<head>
  <meta charset="UTF-8">
  <title>Login - Cv111</title>
  <meta name="description" content="Cv111-এ Login করে খেলো Slot, Fishing, Live Casino। bKash/Nagad দিয়ে সহজ Deposit-Withdraw।">
  <meta name="keywords" content="Cv111 login, online casino login bangladesh, casino sign in">
  <link rel="canonical" href="https://cv111.site/newlogin.php">
  <meta property="og:type" content="website">
  <meta property="og:title" content="Login - Cv111">
  <meta property="og:url" content="https://cv111.site/newlogin.php">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
  <style>
    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
      font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    }

    body {
      background: linear-gradient(rgba(4, 38, 28, 0.88), rgba(4, 38, 28, 0.88)),
                  url('https://images.unsplash.com/photo-1540747913346-19e32dc3e97e?auto=format&fit=crop&q=80&w=1000') no-repeat center center/cover;
      min-height: 100vh;
      display: flex;
      justify-content: center;
      align-items: center;
    }

    .container {
      width: 100%;
      max-width: 400px;
      padding: 25px;
      position: relative;
    }

    .back-btn {
      color: #ffb700;
      font-size: 20px;
      text-decoration: none;
      position: absolute;
      top: 10px;
      left: 20px;
    }

    .logo-container {
      text-align: center;
      margin-top: 15px;
      margin-bottom: 30px;
    }

    .logo {
      font-size: 32px;
      font-weight: 900;
      letter-spacing: -1px;
    }

    .logo .tk { color: #00e676; }
    .logo .divider { color: #388e3c; font-weight: 300; }
    .logo .wintk { color: #ffffff; }

    h2.title {
      color: #ffb700;
      text-align: center;
      font-size: 26px;
      margin-bottom: 8px;
    }

    .register-text {
      text-align: center;
      color: #e0e0e0;
      font-size: 14px;
      margin-bottom: 25px;
    }

    .register-text a {
      color: #00e676;
      text-decoration: underline;
      font-weight: 600;
    }

    .input-group {
      position: relative;
      margin-bottom: 16px;
    }

    .input-group i.left-icon {
      position: absolute;
      left: 16px;
      top: 50%;
      transform: translateY(-50%);
      color: #00e676;
      font-size: 16px;
    }

    .input-group i.right-icon {
      position: absolute;
      right: 16px;
      top: 50%;
      transform: translateY(-50%);
      color: #00e676;
      font-size: 16px;
      cursor: pointer;
    }

    .input-group input {
      width: 100%;
      padding: 14px 16px 14px 48px;
      background-color: #032117;
      border: 1px solid #00e676;
      border-radius: 25px;
      color: #00e676;
      font-size: 15px;
      outline: none;
    }

    .input-group input::placeholder {
      color: #00e676;
      opacity: 0.9;
    }

    .options-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-top: 18px;
      margin-bottom: 25px;
      font-size: 14px;
    }

    .remember-me {
      display: flex;
      align-items: center;
      color: #ffffff;
      cursor: pointer;
    }

    .remember-me input { display: none; }

    .custom-checkbox {
      width: 18px;
      height: 18px;
      background-color: #1a3a2f;
      border: 1px solid #ffb700;
      border-radius: 50%;
      display: flex;
      justify-content: center;
      align-items: center;
      margin-right: 8px;
      transition: background-color .15s ease;
    }
    .remember-me input:checked ~ .custom-checkbox { background-color: #ffb700; }

    .custom-checkbox i {
      color: #032117;
      font-size: 11px;
    }

    .forgot-pass {
      color: #ffb700;
      text-decoration: none;
    }

    .login-btn {
      width: 100%;
      padding: 12px;
      background: linear-gradient(to bottom, #ffe000, #ff9900);
      border: none;
      border-radius: 25px;
      color: #804000;
      font-size: 18px;
      font-weight: 700;
      cursor: pointer;
      box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    }
    .login-btn:disabled { opacity: .7; cursor: not-allowed; }

    .error-box {
      display: none;
      background: rgba(255,92,92,.12);
      border: 1px solid rgba(255,92,92,.4);
      color: #ff8a8a;
      font-size: 13px;
      font-weight: 600;
      padding: 10px 14px;
      border-radius: 12px;
      margin-bottom: 16px;
    }

    .divider-text {
      display: flex;
      align-items: center;
      text-align: center;
      color: #ffffff;
      font-size: 13px;
      margin: 30px 0 20px 0;
    }

    .divider-text::before,
    .divider-text::after {
      content: '';
      flex: 1;
      border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    }

    .divider-text span { padding: 0 10px; }

    .social-login {
      display: flex;
      justify-content: center;
      gap: 15px;
    }

    .social-btn {
      width: 45px;
      height: 45px;
      border-radius: 50%;
      display: flex;
      justify-content: center;
      align-items: center;
      text-decoration: none;
      font-size: 22px;
      cursor: pointer;
      border: none;
    }

    .facebook { background-color: #3b5998; color: #ffffff; }
    .google { background-color: #ffffff; }
    .google-icon { width: 22px; height: 22px; }

    .toast {
      position: fixed;
      top: 20px;
      left: 50%;
      transform: translateX(-50%);
      background: #032117;
      border: 1px solid #00e676;
      color: #fff;
      padding: 12px 20px;
      border-radius: 12px;
      font-size: 13px;
      z-index: 99;
      display: none;
    }
  </style>
</head>
<body>
<?php $pt = __DIR__ . '/page_transition.php'; if (file_exists($pt)) { include $pt; } ?>

  <div class="container">
    <a href="/newhome.php" class="back-btn"><i class="fa-solid fa-chevron-left"></i></a>

    <div class="logo-container">
      <div class="logo">
        <span class="tk">CV</span><span class="divider">|</span><span class="wintk">111</span>
      </div>
    </div>

    <h2 class="title">Login</h2>
    <p class="register-text">No account yet? <a href="/newregister.php">Register</a></p>

    <div id="errorBox" class="error-box"></div>

    <form onsubmit="return false;">
      <div class="input-group">
        <i class="fa-solid fa-phone left-icon"></i>
        <input type="tel" id="username" placeholder="Phone number">
      </div>

      <div class="input-group">
        <i class="fa-solid fa-lock left-icon"></i>
        <input type="password" id="password" placeholder="Password">
        <i class="fa-solid fa-eye-slash right-icon" id="eyeIcon" onclick="togglePwd()"></i>
      </div>

      <div class="options-row">
        <label class="remember-me">
          <input type="checkbox" id="rememberMe" checked>
          <span class="custom-checkbox"><i class="fa-solid fa-check"></i></span>
          Remember
        </label>
        <a href="/newforgotpassword.php" class="forgot-pass">Forgot password?</a>
      </div>

      <button type="submit" class="login-btn" id="loginBtn" onclick="doLogin()">Login</button>
    </form>

    <div class="divider-text">
      <span>Or Connect With</span>
    </div>

    <div class="social-login">
      <button class="social-btn facebook" onclick="comingSoon()" type="button">
        <i class="fa-brands fa-facebook-f"></i>
      </button>
      <button class="social-btn google" onclick="comingSoon()" type="button">
        <svg class="google-icon" viewBox="0 0 24 24">
          <path fill="#4285F4" d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"/>
          <path fill="#34A853" d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"/>
          <path fill="#FBBC05" d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.06H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.94l2.85-2.22.81-.63z"/>
          <path fill="#EA4335" d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.06l3.66 2.84c.87-2.6 3.3-4.52 6.16-4.52z"/>
        </svg>
      </button>
    </div>
  </div>

  <div class="toast" id="toast">শীঘ্রই আসছে! আপাতত Mobile দিয়ে Login করো।</div>

<script>
function comingSoon() {
    const toast = document.getElementById('toast');
    toast.style.display = 'block';
    setTimeout(() => toast.style.display = 'none', 2500);
}

function togglePwd() {
    const input = document.getElementById('password');
    const icon = document.getElementById('eyeIcon');
    if (input.type === 'password') {
        input.type = 'text';
        icon.className = 'fa-solid fa-eye right-icon';
    } else {
        input.type = 'password';
        icon.className = 'fa-solid fa-eye-slash right-icon';
    }
}

function md5(str) {
    function rotateLeft(n, s) { return (n << s) | (n >>> (32 - s)); }
    function toHex(n) { let s = '', v; for (let i = 0; i < 4; i++) { v = (n >>> (i * 8)) & 255; s += ('0' + v.toString(16)).slice(-2); } return s; }
    function utf8Encode(str) { return unescape(encodeURIComponent(str)); }
    str = utf8Encode(str);
    const msgLen = str.length;
    const numBlocks = (((msgLen + 8) >>> 6) + 1) * 16;
    const M = new Array(numBlocks).fill(0);
    for (let i = 0; i < msgLen; i++) M[i >> 2] |= str.charCodeAt(i) << ((i % 4) * 8);
    M[msgLen >> 2] |= 0x80 << ((msgLen % 4) * 8);
    M[numBlocks - 2] = msgLen * 8;
    let a = 1732584193, b = -271733879, c = -1732584194, d = 271733878;
    const S = [7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21];
    const K = [];
    for (let i = 0; i < 64; i++) K[i] = (Math.floor(Math.abs(Math.sin(i + 1)) * 4294967296)) | 0;
    for (let i = 0; i < numBlocks; i += 16) {
        let A = a, B = b, C = c, D = d;
        for (let j = 0; j < 64; j++) {
            let F, g;
            if (j < 16) { F = (B & C) | (~B & D); g = j; }
            else if (j < 32) { F = (D & B) | (~D & C); g = (5 * j + 1) % 16; }
            else if (j < 48) { F = B ^ C ^ D; g = (3 * j + 5) % 16; }
            else { F = C ^ (B | ~D); g = (7 * j) % 16; }
            F = (F + A + K[j] + (M[i + g] | 0)) | 0;
            A = D; D = C; C = B;
            B = (B + rotateLeft(F, S[j])) | 0;
        }
        a = (a + A) | 0; b = (b + B) | 0; c = (c + C) | 0; d = (d + D) | 0;
    }
    return toHex(a) + toHex(b) + toHex(c) + toHex(d);
}

async function doLogin() {
    const username = document.getElementById('username').value.trim();
    const password = document.getElementById('password').value;
    const errorBox = document.getElementById('errorBox');
    const btn = document.getElementById('loginBtn');

    errorBox.style.display = 'none';

    if (!username || !password) {
        errorBox.style.display = 'block';
        errorBox.innerHTML = '<i class="fa-solid fa-circle-exclamation"></i> Phone Number আর Password দুটোই দাও।';
        return;
    }

    btn.disabled = true;
    btn.textContent = 'Login হচ্ছে...';

    const language = 1, logintype = 'mobile', phonetype = 2;
    const random = Math.random().toString(36).substring(2, 15);
    const shonustr = `{"language":${language},"logintype":"${logintype}","phonetype":${phonetype},"pwd":"${password}","random":"${random}","username":"${username}"}`;
    const signature = md5(shonustr).toUpperCase();

    const payload = { language, logintype, phonetype, pwd: password, random, signature, username, timestamp: Date.now() };

    try {
        const res = await fetch('/deepanshu/api/webapi/Login.php', {
            method: 'POST',
            headers: { 'Content-Type': 'application/json' },
            body: JSON.stringify(payload)
        });
        const data = await res.json();

        if (data.code === 0 && data.data && data.data.token) {
            localStorage.setItem('token', data.data.token);
            localStorage.setItem('showSpinPopupAfterLogin', '1');
            window.location.href = '/newhome.php';
        } else {
            errorBox.style.display = 'block';
            errorBox.innerHTML = '<i class="fa-solid fa-circle-exclamation"></i> ' + (data.msg || 'Login ব্যর্থ হয়েছে। Phone/Password চেক করো।');
            btn.disabled = false;
            btn.textContent = 'Login';
        }
    } catch (e) {
        errorBox.style.display = 'block';
        errorBox.innerHTML = '<i class="fa-solid fa-circle-exclamation"></i> একটা সমস্যা হয়েছে, আবার চেষ্টা করো।';
        btn.disabled = false;
        btn.textContent = 'Login';
    }
}
</script>

</body>
</html>
