<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>ROMEK-XD-V2-PAIR</title>
  <link rel="stylesheet" href="css/all.min.css">
  <style>
    body {
      display: flex;
      justify-content: center;
      align-items: center;
      height: 100vh;
      margin: 0;
      background: linear-gradient(135deg, #2e2e2e, #1e1e1e);
      font-family: 'Roboto', sans-serif;
      color: white;
    }

    .container {
      text-align: center;
      padding: 20px;
      background: rgba(0, 0, 0, 0.8);
      border-radius: 15px;
      box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
      max-width: 400px;
      width: 100%;
    }

    h3, h6 {
      margin: 10px 0;
      color: #00ffff;
      text-shadow: 0 0 10px #00ffff, 0 0 20px #00bfff;
    }

    h6 {
      font-weight: normal;
      font-size: 0.9rem;
    }

    .input-container {
      margin-top: 20px;
      display: flex;
      background: #1a1a1a;
      border-radius: 8px;
      overflow: hidden;
      border: 2px solid #00bfff;
    }

    .input-container input {
      flex: 1;
      padding: 10px;
      font-size: 1rem;
      background: transparent;
      color: #fff;
      border: none;
      outline: none;
    }

    .input-container input::placeholder {
      color: #bbb;
    }

    .input-container button {
      background: linear-gradient(135deg, #00ffff, #0066ff);
      padding: 10px 20px;
      color: white;
      font-size: 1rem;
      border: none;
      cursor: pointer;
      text-transform: uppercase;
      font-weight: bold;
      transition: all 0.3s ease-in-out;
      box-shadow: 0 0 10px #00ffff, 0 0 20px #0066ff;
    }

    .input-container button:hover {
      background: linear-gradient(135deg, #32cd32, #228b22);
      box-shadow: 0 0 15px #32cd32, 0 0 30px #228b22;
    }

    .message {
      margin-top: 20px;
      font-size: 1rem;
      color: #ff6347;
    }

    .glowing-text {
      margin-top: 20px;
      font-size: 1rem;
      color: #fff;
      text-shadow: 0 0 10px #ff4500, 0 0 20px #ff6347;
      animation: glow 2s infinite;
    }

    @keyframes glow {
      0% {
        text-shadow: 0 0 10px #ff4500, 0 0 20px #ff6347;
      }
      50% {
        text-shadow: 0 0 15px #ff4500, 0 0 25px #ff6347;
      }
      100% {
        text-shadow: 0 0 10px #ff4500, 0 0 20px #ff6347;
      }
    }
  </style>
</head>
<body>
  <div class="container">
    <h3>PAIR-CODE</h3>
    <h6>MADE BY ROMEK-XD</h6>
    <h6>Enter your phone number with country code</h6>
    <div class="input-container">
      <input id="number" type="number" placeholder="91934137XXX">
      <button id="submit">Submit</button>
    </div>
    <div id="pair" class="message"></div>
    <div class="glowing-text">Powered By ROMEK-XD-V2</div>
  </div>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/axios/1.0.0-alpha.1/axios.min.js"></script>
  <script>
    const submitButton = document.getElementById('submit');
    const numberInput = document.getElementById('number');
    const pairDiv = document.getElementById('pair');

    submitButton.addEventListener('click', async () => {
      const number = numberInput.value.trim();
      if (!number || number.length < 11) {
        pairDiv.innerHTML = 'Invalid Number';
        return;
      }
      pairDiv.innerHTML = 'Processing...';
      try {
        const response = await axios.get(`/code?number=${number}`);
        const code = response.data.code || 'Service Unavailable';
        pairDiv.innerHTML = `<button onclick="copyToClipboard('${code}')">Copy Code</button>`;
      } catch (error) {
        pairDiv.innerHTML = 'Error fetching code. Try again.';
      }
    });

    function copyToClipboard(text) {
      navigator.clipboard.writeText(text);
      alert('Code copied to clipboard!');
    }
  </script>
</body>
</html>
