/* BarberPay — écran de caisse. Référence : docs/DESIGN-caisse-barber.md (§4 mise en page, §5 composants). */

.visuellement-cache { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

body.caisse { overflow: hidden; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
body.caisse input, body.caisse select { user-select: text; -webkit-user-select: text; }
button { font: inherit; color: inherit; }

/* §4 : trois colonnes */
.app { display: flex; flex-wrap: wrap; height: 100vh; height: 100dvh; min-height: 640px; background: var(--bg-app); }

/* ── §5.1–5.3 Barre latérale ────────────────────────────────────────── */
.barre {
  flex: 0 0 96px; display: flex; flex-direction: column; align-items: center; gap: 22px;
  padding: 18px 8px; background: var(--bg-sidebar); border-right: 1px solid var(--border-side);
  height: 100%; overflow-y: auto;
}
.logo { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.categories { display: flex; flex-direction: column; gap: 10px; }
.bouton-categorie {
  width: 78px; min-height: 84px; padding: 8px 4px; border: 0; border-radius: var(--r-md);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: transparent; color: var(--text-side-inactive); font-size: 13px; font-weight: 600; line-height: 1.15; cursor: pointer;
}
.bouton-categorie:hover { background: var(--bg-card); }
.bouton-categorie[aria-pressed="true"] { background: var(--gold); color: var(--text-on-gold); }
.outils { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.bouton-outil {
  width: 78px; min-height: 56px; border: 0; border-radius: var(--r-sm); background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--text-side); font-size: 11px; font-weight: 500; text-decoration: none; cursor: pointer;
}
.bouton-outil:hover { color: var(--text-on-dark); background: var(--bg-card); }

/* ── §5.4 Liste ─────────────────────────────────────────────────────── */
.liste { flex: 999 1 520px; min-width: 0; height: 100%; display: flex; flex-direction: column; gap: 20px; padding: 24px 24px 24px 28px; }
.liste-entete { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.liste-entete h1 { font-family: var(--font-display); font-weight: 600; font-size: 32px; letter-spacing: 1.5px; text-transform: uppercase; margin: 0; line-height: 1.1; }
.compteur { color: var(--text-muted-dark); font-size: 14px; margin: 2px 0 0; }
.recherche { position: relative; width: 340px; min-width: 220px; flex: 0 1 340px; }
.recherche .icone { position: absolute; left: 14px; top: 14px; color: var(--text-muted-dark); pointer-events: none; }
.recherche input { height: 48px; padding-left: 44px; background: var(--bg-card); border-color: var(--border-dark); font-size: 15px; }

/* §5.5 Cartes */
.grille {
  flex: 1 1 auto; overflow-y: auto; align-content: start;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px;
  padding-bottom: 8px; overscroll-behavior: contain;
}
.carte-article {
  position: relative; min-height: 112px; padding: 16px; text-align: left;
  display: flex; flex-direction: column; justify-content: space-between; gap: 12px;
  background: var(--bg-card); border: 1.5px solid var(--border-dark); border-radius: var(--r-md); cursor: pointer;
  transition: background .12s, border-color .12s, transform .06s;
}
.carte-article:hover { background: var(--bg-card-hover); }
.carte-article:active { transform: scale(.98); }
.carte-article.dans-ticket { border-color: var(--gold); }
.carte-nom { font-size: 16px; font-weight: 600; line-height: 1.3; padding-right: 30px; color: var(--text-on-dark); }
.carte-bas { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.carte-meta { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted-dark); font-size: 13px; }
.carte-meta.stock-vide { color: #F2B08F; }
.carte-prix { font-family: var(--font-display); font-weight: 500; font-size: 26px; line-height: 1; color: var(--gold); white-space: nowrap; }
.carte-badge {
  position: absolute; top: 12px; right: 12px; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  background: var(--gold); color: var(--text-on-gold); font-size: 13px; font-weight: 700;
}
.aucun { color: var(--text-muted-dark); text-align: center; margin: 40px 0; }

/* ── §5.6 Panneau ticket ────────────────────────────────────────────── */
.caisse-panneau { flex: 1 1 420px; max-width: 460px; height: 100%; padding: 16px 16px 16px 0; }
.ticket { height: 100%; background: var(--bg-ticket); color: var(--text-on-light); border-radius: var(--r-lg); overflow: hidden; display: flex; flex-direction: column; }
.liseret { flex: 0 0 6px; background: repeating-linear-gradient(-45deg, var(--pole-red) 0 10px, var(--pole-white) 10px 16px, var(--pole-blue) 16px 26px, var(--pole-white) 26px 32px); }
.ticket-entete { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 20px 14px; border-bottom: 1px solid var(--divider-light); }
.ticket-entete h2 { font-family: var(--font-display); font-weight: 600; font-size: 24px; letter-spacing: 1px; text-transform: uppercase; margin: 0; }
.ticket-outils { display: flex; align-items: center; gap: 8px; min-width: 0; }
.choix-barbier { position: relative; display: flex; align-items: center; height: 44px; border: 1px solid var(--border-light); border-radius: var(--r-sm); padding: 0 6px 0 12px; gap: 8px; margin: 0; min-width: 0; }
.choix-barbier select { height: 42px; border: 0; background: transparent; color: var(--text-on-light); font-weight: 600; font-size: 14px; padding: 0 4px; min-width: 0; max-width: 150px; }
.choix-barbier .pastille { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }
.bouton-pause { position: relative; width: 44px; height: 44px; flex: 0 0 auto; border: 1px solid var(--border-light); border-radius: var(--r-sm); background: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-on-light); }
.bouton-pause:hover { background: var(--bg-ticket-btn); }
.badge-attente { position: absolute; top: -7px; right: -7px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--bg-total); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }

.ticket-lignes { flex: 1 1 auto; overflow-y: auto; padding: 6px 20px; overscroll-behavior: contain; }
.ligne-ticket { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 6px 10px; padding: 12px 0; border-bottom: 1px solid var(--row-divider); }
/* Le nom occupe toute la 1re rangée ; prix × quantité, boutons et total sont sur la 2e. */
.ligne-texte { grid-column: 1 / -1; min-width: 0; border: 0; background: none; text-align: left; padding: 2px 0; cursor: pointer; color: var(--text-on-light); }
.ligne-nom { display: block; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.ligne-detail { display: block; min-width: 0; font-size: 13px; color: var(--text-muted-light); cursor: pointer; }
.ligne-detail .remise-ligne { color: #8A5A00; font-weight: 600; }
.stepper { display: flex; align-items: center; border: 1px solid var(--border-light); border-radius: var(--r-sm); overflow: hidden; }
.stepper button { width: 40px; height: 44px; border: 0; background: var(--bg-ticket-btn); color: var(--text-on-light); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.stepper button:hover { background: #ECECEC; }
.stepper output { min-width: 32px; text-align: center; font-size: 15px; font-weight: 700; }
.ligne-total { min-width: 76px; text-align: right; font-family: var(--font-display); font-weight: 500; font-size: 19px; white-space: nowrap; }
.ligne-total s { display: block; font-size: 13px; color: var(--text-muted-light); font-family: var(--font-body); }

.ticket-vide { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--text-muted-light); padding: 20px; gap: 4px; }
.ticket-vide .icone { color: #B8B8B8; margin-bottom: 8px; }
.ticket-vide p { margin: 0; font-size: 14px; }
.ticket-vide .vide-titre { font-size: 16px; font-weight: 600; color: var(--text-on-light); }

.ticket-pied { padding: 16px 20px 20px; border-top: 1px solid var(--divider-light); display: flex; flex-direction: column; gap: 12px; }
.pied-boutons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bouton-clair { height: 48px; border: 1px solid var(--border-light); border-radius: var(--r-sm); background: #fff; color: var(--text-on-light); font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; white-space: nowrap; }
.bouton-clair:hover { background: var(--bg-ticket-btn); }
.bouton-clair.actif { border-color: var(--text-on-light); background: var(--bg-ticket-btn); }
.bloc-total { background: var(--bg-total); color: var(--text-on-dark); border-radius: var(--r-md); padding: 16px 18px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.total-details { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--text-side); min-width: 0; }
.total-details #total-remise { color: var(--gold-hover); }
/* Le montant ne passe jamais à la ligne (maquette : le « € » tombait seul sur une deuxième ligne). */
.total-montant { font-family: var(--font-display); font-weight: 600; font-size: 40px; line-height: 1; white-space: nowrap; flex: 0 0 auto; }
.total-montant.long { font-size: 32px; }
.bouton-encaisser {
  height: 64px; border: 0; border-radius: var(--r-md); background: var(--gold); color: var(--text-on-gold);
  font-family: var(--font-display); font-weight: 600; font-size: 22px; letter-spacing: 2px; text-transform: uppercase;
  display: flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer;
}
.bouton-encaisser:hover { background: var(--gold-hover); }
.bouton-encaisser:disabled { opacity: .45; cursor: default; }

/* ── Fenêtres ───────────────────────────────────────────────────────── */
.fenetre { border: 0; padding: 0; border-radius: var(--r-lg); background: var(--bg-card); color: var(--text-on-dark); width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.fenetre::backdrop { background: rgba(0, 0, 0, .65); }
.fenetre-contenu { padding: 20px 22px; display: flex; flex-direction: column; gap: 12px; margin: 0; }
.fenetre h2 { font-family: var(--font-display); font-weight: 600; font-size: 24px; letter-spacing: 1px; text-transform: uppercase; margin: 0; }
.fenetre p { margin: 0; color: var(--text-side); }
.fenetre label { margin: 0 0 6px; }
.fenetre-actions { display: flex; gap: 10px; margin-top: 4px; }
.fenetre-actions button { flex: 1; }
.bouton-f { min-height: 52px; border-radius: var(--r-sm); border: 1.5px solid var(--border-dark); background: transparent; color: var(--text-on-dark); font-weight: 600; font-size: 16px; cursor: pointer; padding: 0 14px; }
.bouton-f:hover { background: var(--bg-card-hover); }
.bouton-f.principal { background: var(--gold); border-color: var(--gold); color: var(--text-on-gold); }
.bouton-f.principal:hover { background: var(--gold-hover); }
.bouton-f.danger { color: var(--danger); border-color: rgba(255,138,128,.45); }
.segments { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--bg-app); border: 1px solid var(--border-dark); border-radius: var(--r-sm); padding: 4px; gap: 4px; }
.segments button { min-height: 44px; border: 0; border-radius: 9px; background: transparent; color: var(--text-side-inactive); font-weight: 600; cursor: pointer; }
.segments button[aria-pressed="true"] { background: var(--gold); color: var(--text-on-gold); }
.affichage { font-family: var(--font-display); font-size: 36px; font-weight: 600; text-align: right; background: var(--bg-app); border: 1px solid var(--border-dark); border-radius: var(--r-sm); padding: 10px 16px; min-height: 60px; white-space: nowrap; overflow: hidden; }
.raccourcis { display: flex; flex-wrap: wrap; gap: 8px; }
.raccourcis button { min-height: 44px; padding: 0 14px; border-radius: 22px; border: 1px solid var(--border-dark); background: var(--bg-app); color: var(--text-on-dark); font-weight: 600; cursor: pointer; }
.raccourcis button[aria-pressed="true"] { border-color: var(--gold); color: var(--gold-hover); }
.pave { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pave button { height: 56px; border-radius: var(--r-sm); border: 1px solid var(--border-dark); background: var(--bg-app); color: var(--text-on-dark); font-family: var(--font-display); font-size: 26px; font-weight: 500; cursor: pointer; }
.pave button:active { background: var(--bg-card-hover); }
.pave .touche-texte { font-family: var(--font-body); font-size: 15px; font-weight: 600; }
.liste-attente { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow-y: auto; }
.liste-attente li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border-dark); border-radius: var(--r-sm); background: var(--bg-app); }
.liste-attente .infos { flex: 1 1 auto; min-width: 0; }
.liste-attente .infos strong { display: block; }
.liste-attente .infos span { font-size: 13px; color: var(--text-muted-dark); }
.liste-attente .montant { font-family: var(--font-display); font-size: 20px; color: var(--gold); white-space: nowrap; }
.liste-attente button { min-height: 44px; }
.choix-membres { display: flex; flex-wrap: wrap; gap: 8px; }
.choix-membres button { min-height: 48px; padding: 0 16px; border-radius: 24px; border: 1.5px solid var(--border-dark); background: var(--bg-app); color: var(--text-on-dark); font-weight: 600; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.choix-membres button[aria-pressed="true"] { border-color: var(--gold); }
.choix-membres .pastille, .verrou-membres .pastille { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }

/* ── Mode formation ─────────────────────────────────────────────────── */
.bandeau-formation { position: fixed; top: 0; left: 0; right: 0; z-index: 40; background: #E08A5E; color: #0A0A0A; text-align: center; font-weight: 700; padding: 6px 12px; font-size: 14px; letter-spacing: .5px; }
.bandeau-formation a { color: #0A0A0A; margin-left: 10px; }
.app-formation { padding-top: 32px; }

/* ── Encaissement ───────────────────────────────────────────────────── */
.encaisse-total { font-family: var(--font-display); font-weight: 600; font-size: 44px; color: var(--text-on-dark) !important; text-align: center; margin: 0; line-height: 1.1; }
.encaisse-reste { text-align: center; font-weight: 600; color: var(--gold-hover) !important; }
.encaisse-rendu { text-align: center; font-weight: 600; color: var(--text-on-dark) !important; min-height: 22px; }
.encaisse-rendu.grand { font-family: var(--font-display); font-size: 32px; color: var(--gold-hover) !important; }
.encaisse-numero { text-align: center; font-weight: 600; font-size: 18px; color: var(--text-on-dark) !important; }
.moyens { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bouton-moyen { min-height: 72px; border-radius: var(--r-md); border: 1.5px solid var(--border-dark); background: var(--bg-app); color: var(--text-on-dark); font-weight: 600; font-size: 17px; cursor: pointer; }
.bouton-moyen:hover { border-color: var(--gold); }
.qr { background: #fff; border-radius: var(--r-md); padding: 12px; width: 220px; max-width: 100%; margin: 0 auto; }
.qr svg { display: block; width: 100%; height: auto; }
.qr-lien { color: #111 !important; font-size: 12px; overflow-wrap: anywhere; text-align: center; }
.qr-texte { text-align: center; font-size: 13px; }
.bouton-f:disabled { opacity: .4; cursor: default; }

/* ── Verrouillage ───────────────────────────────────────────────────── */
.verrou { position: fixed; inset: 0; z-index: 50; background: rgba(10, 10, 10, .97); display: flex; align-items: center; justify-content: center; padding: 16px; overflow-y: auto; }
.verrou[hidden] { display: none; }
.verrou-boite { width: min(420px, 100%); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.verrou h2 { font-family: var(--font-display); font-weight: 600; font-size: 28px; letter-spacing: 1px; text-transform: uppercase; margin: 6px 0 0; }
.verrou-consigne { color: var(--text-side); margin: 0; }
.verrou-membres { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; width: 100%; }
.verrou-membres button { min-height: 72px; border-radius: var(--r-md); border: 1.5px solid var(--border-dark); background: var(--bg-card); color: var(--text-on-dark); font-weight: 600; font-size: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; cursor: pointer; }
.verrou-membres button:hover { border-color: var(--gold); }
.verrou-membres button:disabled { opacity: .4; cursor: default; }
.verrou-membres small { font-size: 11px; color: var(--text-muted-dark); font-weight: 500; }
.verrou-pin { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.verrou-pin[hidden] { display: none; }
.verrou-points { font-size: 34px; letter-spacing: 12px; min-height: 44px; margin: 0; color: var(--gold); }
.verrou-erreur { color: var(--danger); min-height: 20px; margin: 0; font-size: 14px; }
.bouton-lien { background: none; border: 0; color: var(--text-side); text-decoration: underline; min-height: 44px; cursor: pointer; }

/* ── Message éphémère ───────────────────────────────────────────────── */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; background: #F5F5F5; color: #111; padding: 12px 18px; border-radius: var(--r-sm); font-weight: 600; box-shadow: 0 8px 30px rgba(0,0,0,.4); max-width: calc(100vw - 32px); }
.toast.erreur { background: #FFE1DD; color: #8B1A10; }

/* ── Écran étroit (< 980 px) : les colonnes s'empilent (DESIGN.md §4) ─ */
@media (max-width: 980px) {
  body.caisse { overflow: auto; }
  .app { height: auto; min-height: 100vh; }
  .barre { flex: 1 1 100%; height: auto; flex-direction: row; gap: 10px; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--border-side); overflow-x: auto; }
  .barre .logo { display: none; }
  .categories, .outils { flex-direction: row; }
  .outils { margin: 0 0 0 auto; }
  .bouton-categorie { width: auto; min-height: 56px; flex-direction: row; padding: 0 14px; }
  .bouton-outil { width: auto; padding: 0 10px; }
  .liste { height: auto; padding: 18px 16px; }
  .grille { overflow: visible; }
  .recherche { width: 100%; flex: 1 1 100%; }
  .caisse-panneau { flex: 1 1 100%; max-width: none; height: auto; padding: 0 16px 16px; }
  .ticket { height: auto; }
  .ticket-lignes { max-height: none; }
}
@media (prefers-reduced-motion: reduce) {
  .carte-article { transition: none; }
}

/* Écrans peu hauts (tablette 1024×768 en paysage) : pavé plus compact pour que les boutons restent visibles. */
@media (max-height: 820px) {
  .fenetre .pave button { height: 48px; font-size: 22px; }
  .fenetre .affichage { min-height: 52px; font-size: 30px; padding: 6px 14px; }
  .fenetre .segments button, .fenetre .raccourcis button { min-height: 44px; }
}
/* Démo : bandeau fixe au-dessus de l'écran de caisse (même principe que le mode formation). */
body.caisse .bandeau-demo { position: fixed; top: 0; left: 0; right: 0; z-index: 40; }
.app-demo { padding-top: 34px; }
@media (max-width: 980px) { body.caisse .bandeau-demo { position: static; } .app-demo { padding-top: 0; } }
