/* =========================================================
   CONNECTER UN APPAREIL — BALEYAGE
   ========================================================= */

#connecterAppareilSection {
    width: 100%;
    padding: 8px 0 24px;
    box-sizing: border-box;
}


/* =========================================================
   TITRE
   ========================================================= */

#connecterAppareilTitre {
    margin: 0 0 8px;
    color: #222;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.3;
}


/* =========================================================
   DESCRIPTION
   ========================================================= */

#connecterAppareilDescription {
    margin: 0 0 20px;
    color: #6b7280;
    font-size: 0.92rem;
    line-height: 1.5;
}


/* =========================================================
   BOUTON BALAYAGE
   ========================================================= */

#balayageBtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    margin: 0 0 20px;
    padding: 10px 18px;

    border: 0;
    border-radius: 8px;

    background: #007bff;
    color: #fff;

    font-size: 0.92rem;
    font-weight: 600;

    cursor: pointer;

    transition:
        background 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

#balayageBtn:hover {
    background: #0069d9;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10);
    transform: translateY(-1px);
}

#balayageBtn:active {
    transform: translateY(0);
}


/* =========================================================
   LISTE DES OPTIONS
   ========================================================= */

#balayageOptions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;

    width: 100%;
    max-width: 850px;
}


/* =========================================================
   BOUTONS OPTIONS
   ========================================================= */

#balayageOptions .option {
    width: 100%;
    min-height: 78px;

    display: flex;
    align-items: center;

    gap: 12px;

    padding: 14px 16px;

    box-sizing: border-box;

    border: 1px solid #e1e5ea;
    border-radius: 10px;

    background: #fff;
    color: #222;

    text-align: left;

    cursor: pointer;

    transition:
        border-color 0.2s ease,
        background 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

#balayageOptions .option:hover {
    border-color: #007bff;
    background: #f8fbff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.07);
    transform: translateY(-1px);
}

#balayageOptions .option:active {
    transform: translateY(0);
}


/* =========================================================
   OPTION ACTIVE / CONNECTÉE
   ========================================================= */

#balayageOptions .option.appareil-selectionne {
    border-color: #007bff;
    background: #f1f7ff;
    box-shadow: 0 0 0 1px rgba(0, 123, 255, 0.08);
}


/* =========================================================
   ICÔNE
   ========================================================= */

#balayageOptions .option-icon {
    width: 40px;
    height: 40px;

    flex: 0 0 40px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 9px;

    background: #f1f5f9;

    font-size: 1.2rem;
    line-height: 1;
}


/* =========================================================
   ZONE TEXTE
   ========================================================= */

#balayageOptions .option-text {
    min-width: 0;
    flex: 1;

    display: flex;
    flex-direction: column;

    gap: 4px;
}


/* =========================================================
   NOM DE L'OPTION
   ========================================================= */

#balayageOptions .option-name {
    display: block;

    color: #222;

    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.3;
}


/* =========================================================
   DESCRIPTION DE L'OPTION
   ========================================================= */

#balayageOptions .option-desc {
    display: block;

    color: #70757a;

    font-size: 0.81rem;
    line-height: 1.4;
}


/* =========================================================
   FLÈCHE
   ========================================================= */

#balayageOptions .chevron {
    flex: 0 0 auto;

    margin-left: auto;

    color: #8a8f98;

    font-size: 1.35rem;
    line-height: 1;
}


/* =========================================================
   MESSAGE D'ÉTAT
   ========================================================= */

#balayageMessage {
    min-height: 20px;

    margin: 14px 0 0;

    color: #666;

    font-size: 0.86rem;
    line-height: 1.4;
}


/* =========================================================
   ÉCRAN PLUS PETIT
   ========================================================= */

@media (max-width: 700px) {

    #balayageOptions {
        grid-template-columns: 1fr;
    }

    #balayageBtn {
        width: 100%;
    }
}

/* =========================================================
   PANNEAU FLOTTANT « BALAYAGE » (formulaire)
   ========================================================= */

#balayage-panneau {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9500;
  width: min(340px, calc(100vw - 24px));
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  border: 1px solid #dbe3ee;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(15, 23, 42, .22);
  color: #263247;
  font-size: 14px;
}

#balayage-panneau[hidden] {
  display: none !important;
}

#balayage-panneau .balayage-entete {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid #e5eaf1;
  background: #193b7a;
  color: #fff;
  border-radius: 14px 14px 0 0;
}

#balayage-panneau .balayage-fermer {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .15);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

#balayage-panneau .balayage-onglets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid #e5eaf1;
}

#balayage-panneau .balayage-onglets button {
  padding: 10px 4px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  color: #64748b;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

#balayage-panneau .balayage-onglets button[aria-selected="true"] {
  border-bottom-color: #244d9b;
  color: #193b7a;
}

#balayage-panneau .balayage-vue {
  padding: 12px 14px;
}

#balayage-panneau .balayage-aide {
  margin: 0 0 10px;
  color: #475569;
  line-height: 1.45;
}

#balayage-panneau .balayage-qr {
  display: grid;
  place-items: center;
  width: 196px;
  height: 196px;
  margin: 0 auto;
  padding: 8px;
  border: 1px solid #e5eaf1;
  border-radius: 10px;
  background: #fff;
  color: #64748b;
  font-size: 12px;
  text-align: center;
}

#balayage-panneau .balayage-qr img,
#balayage-panneau .balayage-qr canvas {
  display: block;
}

#balayage-panneau .balayage-etat {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #475569;
  font-size: 13px;
  text-align: center;
}

#balayage-panneau .balayage-etat.connecte {
  background: #dcfce7;
  color: #166534;
  font-weight: 600;
}

#balayage-panneau .balayage-details {
  margin-top: 8px;
  color: #64748b;
  font-size: 12px;
}

#balayage-panneau .balayage-details summary {
  cursor: pointer;
}

#balayage-panneau .balayage-code-session {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 15px;
  letter-spacing: .12em;
  color: #193b7a;
}

#balayage-panneau .balayage-camera {
  overflow: hidden;
  min-height: 180px;
  border-radius: 10px;
  background: #0f172a;
}

#balayage-panneau .balayage-manuel {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

#balayage-panneau .balayage-manuel input {
  min-height: 38px;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  font: inherit;
}

#balayage-panneau .balayage-journal {
  margin: 0;
  padding: 0 14px 12px;
  list-style: none;
}

#balayage-panneau .balayage-journal li {
  padding: 6px 8px;
  margin-top: 6px;
  border-radius: 7px;
  font-size: 12px;
  line-height: 1.35;
}

#balayage-panneau .balayage-journal li.ok {
  background: #f0fdf4;
  color: #166534;
}

#balayage-panneau .balayage-journal li.erreur {
  background: #fef2f2;
  color: #991b1b;
}

#balayage-panneau button:focus-visible,
#balayage-panneau input:focus-visible {
  outline: 3px solid #93c5fd;
  outline-offset: 2px;
}

/* Ligne de facture qui vient d'être ajoutée */
.ligne-facture-item.balayage-ligne-ajoutee {
  animation: balayage-flash 1.2s ease-out;
}

@keyframes balayage-flash {
  0%   { background: #bbf7d0; }
  100% { background: transparent; }
}

/* =========================================================
   CHOIX DU CONDITIONNEMENT (Unité / Demi-carton / Carton)
   ========================================================= */

.balayage-choix-fond {
  position: fixed;
  inset: 0;
  z-index: 9600;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(15, 23, 42, .4);
}

.balayage-choix {
  width: min(380px, 100%);
  padding: 18px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 20px 50px rgba(15, 23, 42, .25);
  color: #263247;
}

.balayage-choix-titre {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.balayage-choix-aide {
  margin: 4px 0 12px;
  color: #64748b;
}

.balayage-choix-options {
  display: grid;
  gap: 8px;
}

.balayage-choix-options button {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 10px;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.balayage-choix-options button:hover,
.balayage-choix-options button:focus-visible {
  border-color: #244d9b;
  background: #eef3fb;
  outline: none;
}

.balayage-choix-options strong {
  font-size: 15px;
}

.balayage-choix-options span {
  grid-column: 1;
  color: #64748b;
  font-size: 13px;
}

.balayage-choix-options kbd {
  grid-row: 1 / 3;
  grid-column: 2;
  padding: 2px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
  font-size: 12px;
}

.balayage-choix-annuler {
  width: 100%;
  margin-top: 10px;
  padding: 9px;
  border: 0;
  border-radius: 8px;
  background: #f1f5f9;
  color: #475569;
  font: inherit;
  cursor: pointer;
}

/* ================= PASTILLE « TÉLÉPHONE CONNECTÉ » (fenêtre réduite) ================= */

#balayage-pastille {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9500;
  display: flex;
  align-items: center;
  overflow: hidden;
  border-radius: 999px;
  background: #193b7a;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .28);
  color: #fff;
  font-size: 14px;
}

#balayage-pastille[hidden] {
  display: none !important;
}

#balayage-pastille button {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

#balayage-pastille .balayage-pastille-ouvrir {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 8px 0 16px;
  font-weight: 700;
}

#balayage-pastille .balayage-pastille-point {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 0 rgba(74, 222, 128, .7);
  animation: balayage-pulse 1.8s infinite;
}

#balayage-pastille .balayage-pastille-fermer {
  width: 40px;
  min-height: 44px;
  border-left: 1px solid rgba(255, 255, 255, .2) !important;
  font-size: 20px;
}

#balayage-pastille button:hover {
  background: rgba(255, 255, 255, .12);
}

#balayage-pastille button:focus-visible {
  outline: 3px solid #93c5fd;
  outline-offset: -3px;
}

@keyframes balayage-pulse {
  0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, .7); }
  70% { box-shadow: 0 0 0 8px rgba(74, 222, 128, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

@media (prefers-reduced-motion: reduce) {
  #balayage-pastille .balayage-pastille-point { animation: none; }
}
