<!DOCTYPE html>

<html lang="pl">

<head>

  <meta charset="UTF-8">

  <title>Cadspace Lead Form</title>

  <style>

    body { font-family: Arial, sans-serif; background: #f5f5f5; margin: 0; padding: 0; }

    .container { max-width: 480px; margin: 40px auto; background: #fff; padding: 20px; border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }

    h2 { margin-top: 0; }

    label { display: block; margin: 12px 0 4px; font-weight: bold; }

    input[type="text"], input[type="email"], textarea, select {

      width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px;

      box-sizing: border-box; font-size: 14px;

    }

    textarea { resize: vertical; }

    .checkbox-label { display: flex; align-items: center; margin: 12px 0; }

    .checkbox-label input { margin-right: 8px; }

    .btn { display: inline-block; background: #007bff; color: #fff; padding: 10px 16px; font-size: 16px;

      border: none; border-radius: 4px; cursor: pointer; text-decoration: none; }

    .btn:disabled { background: #a0c5f5; cursor: not-allowed; }

    .thank-you { text-align: center; display: none; }

    .error { color: #d00; font-size: 13px; display: none; }

  </style>

</head>

<body>

  <div class="container" id="form-container">

    <h2>Zoptymalizuj linię produkcyjną z Cadspace!</h2>

    <p>Wypełnij krótki formularz, a nasi inżynierowie skontaktują się w ciągu 24 h.</p>

    <form id="leadForm" novalidate>

      <label for="name">Imię i nazwisko *</label>

      <input type="text" id="name" name="name" required>

      <div class="error" id="err-name">Podaj imię i nazwisko.</div>


      <label for="company">Nazwa firmy *</label>

      <input type="text" id="company" name="company" required>

      <div class="error" id="err-company">Podaj nazwę firmy.</div>


      <label for="email">E‑mail służbowy *</label>

      <input type="email" id="email" name="email" required>

      <div class="error" id="err-email">Podaj poprawny adres e‑mail.</div>


      <label for="phone">Telefon</label>

      <input type="text" id="phone" name="phone" pattern="^[0-9 +()-]{6,20}$">

      <div class="error" id="err-phone">Podaj poprawny numer (cyfry, spacje, +, -).</div>


      <label for="sector">Branża / sektor</label>

      <select id="sector" name="sector">

        <option value="">— wybierz —</option>

        <option>Automotive</option>

        <option>Przemysł drzewny</option>

        <option>Tworzywa sztuczne</option>

        <option>Inne</option>

      </select>


      <label for="challenge">Opis wyzwania / projektu</label>

      <textarea id="challenge" name="challenge" rows="3" maxlength="300"></textarea>


      <label for="deadline">Planowany termin realizacji</label>

      <select id="deadline" name="deadline">

        <option value="">— wybierz —</option>

        <option>Do 1 miesiąca</option>

        <option>1–3 miesiące</option>

        <option>3–6 miesięcy</option>

        <option>Powyżej 6 miesięcy</option>

      </select>


      <label for="budget">Szacowany budżet netto</label>

      <select id="budget" name="budget">

        <option value="">— wybierz —</option>

        <option>&lt; 10 000 €</option>

        <option>10–30 000 €</option>

        <option>30–50 000 €</option>

        <option>&gt; 50 000 €</option>

      </select>


      <div class="checkbox-label">

        <input type="checkbox" id="consent" name="consent" required>

        <label for="consent">Wyrażam zgodę na przetwarzanie danych zgodnie z Polityką Prywatności *</label>

      </div>

      <div class="error" id="err-consent">Musisz wyrazić zgodę.</div>


      <button type="submit" class="btn" id="submitBtn">Wyślij i umów konsultację</button>

    </form>

  </div>


  <div class="container thank-you" id="thankYou">

    <h2>Dziękujemy za zgłoszenie!</h2>

    <p>Skontaktujemy się w ciągu 24 h.</p>

    <p>W międzyczasie możesz zobaczyć nasze case studies:</p>

    <p><a href="https://cadspace.com.pl/case-studies" target="_blank" class="btn">Case Studies</a></p>

  </div>


  <script>

    document.getElementById('leadForm').addEventListener('submit', function(e) {

      e.preventDefault();

      let valid = true;


      // helper

      function check(id, cond) {

        const err = document.getElementById('err-' + id);

        if (!cond) { err.style.display = 'block'; valid = false; }

        else { err.style.display = 'none'; }

      }


      const name = document.getElementById('name').value.trim();

      const company = document.getElementById('company').value.trim();

      const email = document.getElementById('email').value.trim();

      const phone = document.getElementById('phone').value.trim();

      const phonePattern = /^[0-9 +()-]{6,20}$/;

      const consent = document.getElementById('consent').checked;


      check('name', name !== '');

      check('company', company !== '');

      check('email', /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email));

      check('phone', phone === '' || phonePattern.test(phone));

      check('consent', consent);


      if (!valid) return;


      // tu możesz dodać AJAX do wysyłki na swój serwer


      // pokaż podziękowanie

      document.getElementById('form-container').style.display = 'none';

      document.getElementById('thankYou').style.display = 'block';

    });

  </script>

</body>

</html>