/* =====================================================================
   mapping-editor.css — LA FENÊTRE « EDIT MAPPING » DU LOGICIEL, EN CSS
   ---------------------------------------------------------------------
   Reprise règle à règle de la feuille de style Qt de
   `src/mapping-editor/mappingeditordialog.cpp` (feuilleDeStyle), de celle
   des assistants (`assistantsui.cpp`, styleAssistant), du panneau des pads
   (`panneaupads.cpp`) et du dialogue de nom (`nouveaumapping.cpp`).
   Les noms d'objets Qt sont devenus des classes préfixées `sbxe-`.

   Tout est confiné sous `.sbxe-root` : la page du site ne déteint pas sur
   la fenêtre, et la fenêtre ne déteint pas sur la page.
   ===================================================================== */

.sbxe-root, .sbxe-root * { box-sizing: border-box; }
.sbxe-root {
  --sbxe-dlg: #12151b; --sbxe-row: #171b22; --sbxe-line: #232a35; --sbxe-accent: #1A79EB;
  --sbxe-btn: #1B252E; --sbxe-text: #e8e8e8; --sbxe-hint: #8b93a0; --sbxe-off: #5a6270;
  font-family: "Segoe UI", "Noto Sans", system-ui, -apple-system, sans-serif;
  font-size: 12px; color: var(--sbxe-text); line-height: 1.3;
  -webkit-font-smoothing: antialiased;
}
.sbxe-root button { font-family: inherit; line-height: 1.2; margin: 0; }

/* --- Le voile et la fenêtre (§3.2 : sans cadre, 680 px, 80 % de haut) --- */
.sbxe-overlay {
  position: fixed; inset: 0; z-index: 9000; background: rgba(4, 6, 9, .72);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.sbxe-overlay[hidden] { display: none; }
.sbxe-dlg {
  width: 680px; max-width: 100%; height: 80vh; max-height: 100%;
  display: flex; flex-direction: column;
  background: var(--sbxe-dlg); border-radius: 4px; border: 1px solid #1a1f27;
  padding: 22px 22px 18px 22px; box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
}

/* --- L'en-tête --- */
.sbxe-head { display: flex; align-items: center; gap: 0; min-width: 0; }
.sbxe-title { color: #ffffff; font-size: 20px; font-weight: bold; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; min-width: 120px; flex: 0 1 auto; }
.sbxe-rename { background: transparent; border: none; padding: 3px; border-radius: 4px; margin-left: 4px;
  cursor: pointer; display: inline-flex; flex: none; }
.sbxe-rename:hover { background: rgba(255, 255, 255, .10); }
.sbxe-rename svg { width: 14px; height: 14px; display: block; }
.sbxe-rename[hidden] { display: none; }
.sbxe-help { background: transparent; color: var(--sbxe-hint); border: 1px solid #6a7280; border-radius: 9px;
  width: 18px; height: 18px; min-width: 18px; padding: 0; margin: 0 0 0 8px; font-size: 12px; font-weight: bold;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.sbxe-help:hover { background: var(--sbxe-accent); color: #fff; border-color: var(--sbxe-accent); }
.sbxe-stretch { flex: 1 1 auto; }
.sbxe-close { background: var(--sbxe-btn); color: var(--sbxe-text); border: none; border-radius: 5px;
  padding: 9px 14px; font-size: 12px; font-weight: bold; cursor: pointer; flex: none; white-space: nowrap; }
.sbxe-close:hover { background: var(--sbxe-accent); color: #fff; }

.sbxe-hint { color: var(--sbxe-hint); font-size: 12px; white-space: pre-line; }
.sbxe-dlg > .sbxe-hint { margin-top: 4px; margin-bottom: 14px; }
.sbxe-status { color: var(--sbxe-hint); font-size: 12px; padding: 8px 2px 0 2px; min-height: 1.3em; }
.sbxe-status.err { color: #ff5d5d; }

/* --- Les onglets (QTabBar::tab) --- */
.sbxe-tabs { display: flex; gap: 4px; overflow-x: auto; flex: none; scrollbar-width: none; }
.sbxe-tabs::-webkit-scrollbar { display: none; }
.sbxe-tab { background: var(--sbxe-row); color: var(--sbxe-hint); padding: 8px 18px; border: none;
  border-top-left-radius: 6px; border-top-right-radius: 6px; font-size: 14px; font-weight: bold;
  cursor: pointer; white-space: nowrap; flex: none; }
.sbxe-tab.sel { background: var(--sbxe-accent); color: #fff; }

/* --- La page qui défile, et sa barre dessinée comme le reste --- */
.sbxe-page { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; padding: 10px 8px 0 0; min-height: 0;
  display: flex; flex-direction: column; gap: 6px; scrollbar-width: thin; scrollbar-color: #242b36 var(--sbxe-dlg); }
.sbxe-page::-webkit-scrollbar { width: 10px; }
.sbxe-page::-webkit-scrollbar-track { background: var(--sbxe-dlg); }
.sbxe-page::-webkit-scrollbar-thumb { background: #242b36; border-radius: 5px; min-height: 30px; }
.sbxe-page::-webkit-scrollbar-thumb:hover { background: #2e3644; }
.sbxe-page > * { flex: none; }

.sbxe-group { color: var(--sbxe-accent); font-size: 14px; font-weight: bold; padding: 14px 0 4px 2px; }
.sbxe-page > .sbxe-hint { padding: 0 0 8px 2px; }

/* --- Une ligne (StemboxMapRow) --- */
.sbxe-row { background: var(--sbxe-row); border-radius: 8px; padding: 8px 10px 8px 14px;
  display: flex; align-items: center; gap: 8px; min-width: 0; }
.sbxe-action { color: var(--sbxe-text); font-size: 14px; }
.sbxe-row > .sbxe-action { flex: 0 1 auto; min-width: 0; }
.sbxe-row .sbxe-texts { display: flex; flex-direction: column; gap: 1px; flex: 1 1 auto; }
.sbxe-row > .sbxe-stretch { flex: 1 1 0; }
.sbxe-chip, .sbxe-chip-off, .sbxe-chip-listen, .sbxe-chip-warn {
  font-size: 12px; border-radius: 5px; padding: 3px 9px; white-space: nowrap; flex: none; }
.sbxe-chip { color: #22A558; font-weight: bold; background: #13241a; }
.sbxe-chip-off { color: var(--sbxe-off); background: #191d24; }
.sbxe-chip-listen, .sbxe-chip-warn { color: #f0a500; font-weight: bold; background: #2a2213; }
.sbxe-learn { background: var(--sbxe-btn); color: var(--sbxe-text); border: none; border-radius: 6px;
  padding: 7px 16px; font-weight: bold; font-size: 12px; cursor: pointer; white-space: nowrap; flex: none; }
.sbxe-learn:hover, .sbxe-learn.checked { background: var(--sbxe-accent); color: #fff; }
.sbxe-learn:disabled { color: var(--sbxe-off); cursor: default; }
.sbxe-learn:disabled:hover { background: var(--sbxe-btn); }

/* Une moitié écartée : grisée SANS être éteinte (griserSansEteindre). */
.sbxe-grey { opacity: .45; pointer-events: none; }

/* --- Les cellules sans bouton « Learn » séparé (StemboxHoldCell) --- */
.sbxe-hold { background: var(--sbxe-row); border-radius: 8px; padding: 6px 10px; display: flex;
  flex-direction: column; gap: 3px; align-items: stretch; flex: 0 1 auto; min-width: 0; }
.sbxe-hold .sbxe-chip, .sbxe-hold .sbxe-chip-off, .sbxe-hold .sbxe-chip-listen, .sbxe-hold .sbxe-chip-warn {
  font-size: 10px; padding: 2px 6px; align-self: center; }
.sbxe-hold .sbxe-learn { padding: 6px 10px; }
.sbxe-holds { display: flex; gap: 8px; padding-left: 2px; flex-wrap: wrap; }

/* --- Les boutons de CHOIX, illustrés ou non (boutonDeChoix) --- */
.sbxe-pick { background: var(--sbxe-btn); color: var(--sbxe-text); border: none; border-radius: 6px;
  padding: 7px 14px 8px 14px; cursor: pointer; display: flex; flex-direction: column; align-items: center;
  gap: 6px; min-width: 0; }
.sbxe-pick:hover, .sbxe-pick.checked { background: var(--sbxe-accent); }
.sbxe-pick-text { color: var(--sbxe-text); font-size: 13px; font-weight: bold; text-align: center; }
.sbxe-pick:hover .sbxe-pick-text, .sbxe-pick.checked .sbxe-pick-text { color: var(--sbxe-text); }
.sbxe-pair { display: flex; gap: 24px; padding-left: 2px; }
.sbxe-pair > * { flex: 1 1 0; }
.sbxe-illu { display: flex; align-items: center; gap: 4px; pointer-events: none; }
.sbxe-brick { display: inline-flex; align-items: center; justify-content: center; border-radius: 3px;
  font-weight: bold; color: #0b0e13; }

/* --- Le panneau de sélection d'effets (50/50) --- */
.sbxe-selpanel { display: flex; flex-direction: column; gap: 6px; padding-top: 6px; }
.sbxe-selpanel > .sbxe-group { padding: 8px 0 4px 2px; }
.sbxe-halves { display: flex; gap: 12px; }
.sbxe-half { flex: 1 1 0; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sbxe-subhint { color: var(--sbxe-hint); font-size: 12px; padding: 0 0 4px 4px; }
.sbxe-fxgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding-left: 4px; }
.sbxe-fx { background: var(--sbxe-btn); color: var(--sbxe-text); border: none; border-radius: 6px; padding: 6px;
  font-size: 10px; font-weight: bold; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sbxe-fx:hover { background: var(--sbxe-accent); color: #fff; }
.sbxe-fx.dead { background: var(--sbxe-row); color: var(--sbxe-off); pointer-events: none; }

/* --- Le zoom des ondes --- */
.sbxe-zoomgrid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 12px; row-gap: 6px; padding-left: 2px; }

/* --- Les cartes de plateau --- */
.sbxe-cards { display: flex; gap: 10px; }
.sbxe-card { background: var(--sbxe-row); border-radius: 8px; padding: 14px 12px; flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.sbxe-disc { width: 128px; height: 128px; border-radius: 64px; background: transparent; border: none; cursor: pointer;
  padding: 12px; display: flex; align-items: center; justify-content: center; }
.sbxe-disc:hover { background: var(--sbxe-btn); }
.sbxe-disc svg { width: 104px; height: 104px; display: block; }

/* --- Les pads (panneaupads.cpp) --- */
.sbxe-pads { display: flex; flex-direction: column; gap: 8px; }
.sbxe-pads-help { color: var(--sbxe-hint); font-size: 12px; }
.sbxe-pads-tabs { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; }
.sbxe-padzone { position: relative; display: flex; justify-content: center; transition: opacity .15s; }
.sbxe-padgrid { display: grid; grid-template-columns: repeat(4, 80px); gap: 6px; }
.sbxe-padgrid .gap { grid-column: 1 / -1; height: 0; }
.sbxe-cell { border: 1px solid #232a35; border-radius: 6px; background: #171b22; color: #8b93a0; font-weight: bold;
  font-size: 10px; padding: 0; width: 80px; height: 22px; cursor: default; display: flex; align-items: center;
  justify-content: center; overflow: hidden; white-space: nowrap; }
.sbxe-cell.pad { height: 80px; cursor: pointer; }
.sbxe-cell.pad:hover { border-color: var(--sbxe-accent); }
.sbxe-padblock { position: relative; grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 80px); gap: 6px; }
.sbxe-pencil { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px;
  background: rgba(26, 121, 235, .92); color: #fff; border: none; border-radius: 6px; font-size: 20px; cursor: pointer;
  display: none; align-items: center; justify-content: center; }
.sbxe-pencil:hover { background: var(--sbxe-accent); }
.sbxe-padblock.show-pencil .sbxe-pencil, .sbxe-padblock.can-pencil:hover .sbxe-pencil { display: flex; }

/* --- Les lampes : VU et anneaux --- */
.sbxe-band { display: flex; gap: 8px; padding-left: 2px; }
.sbxe-band > .sbxe-hold { flex: 1 1 0; padding: 12px 8px 10px 8px; gap: 7px; align-items: center; }
.sbxe-band > .sbxe-hold .sbxe-learn { align-self: stretch; }
.sbxe-vu { display: flex; gap: 5px; pointer-events: none; }
.sbxe-vu > div { display: flex; flex-direction: column; gap: 2px; }
.sbxe-vu i { display: block; width: 6px; height: 4px; border-radius: 1px; background: #1e2530; }
.sbxe-rings { display: flex; gap: 10px; pointer-events: none; }
.sbxe-rings i { display: block; width: 26px; height: 26px; border-radius: 13px; background: #11161d; border: 2px solid #1e2530; }
.sbxe-rings i.on { border-color: #fff; }

/* --- Les assistants (styleAssistant) --- */
.sbxe-modal { position: fixed; inset: 0; z-index: 9100; background: rgba(4, 6, 9, .55); display: flex;
  align-items: center; justify-content: center; padding: 16px; }
.sbxe-assist { background: #12151b; border: 1px solid #232a35; border-radius: 8px; padding: 16px 24px 22px 24px;
  display: flex; flex-direction: column; gap: 12px; width: 520px; max-width: 100%; max-height: 100%; overflow-y: auto; }
.sbxe-assist .a-head { display: flex; align-items: flex-start; }
.sbxe-assist .a-title { font-size: 18px; font-weight: bold; color: #fff; flex: 1 1 auto; }
.sbxe-assist .a-x { background: transparent; color: #8b93a0; font-size: 16px; padding: 2px 8px; border: none;
  border-radius: 6px; width: 30px; height: 30px; cursor: pointer; }
.sbxe-assist .a-x:hover { background: #1B252E; color: #fff; }
.sbxe-assist .a-label { color: #e8e8e8; font-size: 15px; }
.sbxe-assist .a-live { color: #1A79EB; font-size: 20px; font-weight: bold; text-align: center; }
.sbxe-assist .a-hint { color: #8b93a0; font-size: 12px; text-align: center; }
.sbxe-assist .a-count { color: #5a6270; font-size: 11px; text-align: center; }
.sbxe-assist .a-stats { color: #c8cdd6; font-size: 13px; background: #171b22; border-radius: 6px; padding: 10px 12px; overflow-x: auto; }
.sbxe-assist .a-stats td { padding-right: 18px; white-space: nowrap; }
.sbxe-assist .a-warn { color: #f0a500; font-size: 13px; font-weight: bold; text-align: center; }
.sbxe-assist .a-info { color: #e8e8e8; font-size: 14px; white-space: pre-line; }
.sbxe-assist .a-bar { height: 5px; background: #171b22; border-radius: 2px; overflow: hidden; }
.sbxe-assist .a-bar > i { display: block; height: 100%; background: #1A79EB; border-radius: 2px; width: 0; }
.sbxe-assist .a-btns { display: flex; justify-content: flex-end; gap: 10px; }
.sbxe-assist .a-btns.center { justify-content: center; flex-wrap: wrap; }
.sbxe-assist .a-btn { background: #1B252E; color: #e8e8e8; border: none; border-radius: 6px; padding: 10px 18px;
  font-weight: bold; font-size: 14px; cursor: pointer; }
.sbxe-assist .a-btn:hover { background: #1A79EB; color: #fff; }
.sbxe-assist .a-btn.primary { background: #1A79EB; color: #fff; padding: 11px 30px; }
.sbxe-assist .a-btn.primary:hover { background: #3C91F5; }
.sbxe-assist .a-disc { align-self: center; width: 122px; height: 122px; }
.sbxe-bilan { color: #f2f4f7; }
.sbxe-bilan .b-top { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.sbxe-bilan .b-tick { width: 46px; height: 46px; flex: none; }
.sbxe-bilan .b-h { font-size: 19px; font-weight: bold; }
.sbxe-bilan .b-sub { font-size: 14px; color: #8b93a0; margin-top: 4px; }
.sbxe-bilan .b-row { display: flex; align-items: center; height: 20px; margin-bottom: 10px; font-size: 13px; }
.sbxe-bilan .b-row .l { width: 78px; flex: none; white-space: pre; }
.sbxe-bilan .b-row .bar { flex: 1 1 auto; height: 10px; border-radius: 5px; background: #222731; margin-right: 16px; position: relative; }
.sbxe-bilan .b-row .bar > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; background: #1A79EB; min-width: 10px; }
.sbxe-bilan .b-row .n { width: 78px; flex: none; text-align: right; color: #8b93a0; }
.sbxe-bilan .b-pill { display: inline-flex; align-items: center; gap: 8px; height: 30px; border-radius: 15px; padding: 0 16px 0 10px;
  font-size: 13px; font-weight: bold; margin: 8px 0 14px 0; }
.sbxe-bilan .b-pill i { width: 8px; height: 8px; border-radius: 4px; display: block; }
.sbxe-bilan .b-note { font-size: 12px; color: #5a6270; }

/* --- Le dialogue de nom (nouveaumapping.cpp) --- */
.sbxe-nm { background: #12151b; border-radius: 6px; padding: 22px 26px 20px 26px; display: flex; flex-direction: column;
  gap: 6px; width: 640px; max-width: 100%; max-height: 100%; overflow-y: auto; }
.sbxe-nm .nm-title { color: #fff; font-size: 20px; font-weight: bold; }
.sbxe-nm .nm-field { background: #171b22; border: 1px solid #232a35; border-radius: 8px; color: #fff; font-size: 18px;
  padding: 10px 12px; margin-top: 10px; font-family: inherit; width: 100%; outline: none; }
.sbxe-nm .nm-field:focus { border-color: #1A79EB; }
.sbxe-nm .nm-field::selection { background: #1A79EB; }
.sbxe-nm .nm-warn { color: #E5484D; font-size: 12px; font-weight: bold; }
.sbxe-nm .nm-kb { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.sbxe-nm .nm-kb-row { display: flex; justify-content: center; gap: 6px; }
.sbxe-nm .nm-key { background: #2e2e2e; border: none; border-radius: 6px; color: #fff; font-size: 18px; font-weight: bold;
  width: 46px; height: 46px; cursor: pointer; flex: 0 1 46px; min-width: 0; padding: 0; }
.sbxe-nm .nm-key.w70 { width: 70px; flex-basis: 70px; font-size: 14px; }
.sbxe-nm .nm-key.w130 { width: 130px; flex-basis: 130px; font-size: 14px; }
.sbxe-nm .nm-key:active { background: #3d3d3d; }
.sbxe-nm .nm-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.sbxe-nm .nm-cancel { background: #1B252E; color: #e8e8e8; border: none; border-radius: 6px; padding: 9px 18px;
  font-size: 13px; font-weight: bold; cursor: pointer; }
.sbxe-nm .nm-cancel:hover { background: #232f3a; }
.sbxe-nm .nm-create { background: #1A79EB; color: #fff; border: none; border-radius: 6px; padding: 9px 22px;
  font-size: 13px; font-weight: bold; cursor: pointer; }
.sbxe-nm .nm-create:hover { background: #3b8ef0; }
.sbxe-nm .nm-create:disabled { background: #1B252E; color: #5a6270; cursor: default; }

/* --- Largeur téléphone : rien ne casse, tout s'empile --- */
@media (max-width: 640px) {
  .sbxe-overlay { padding: 0; }
  .sbxe-dlg { height: 100%; border-radius: 0; padding: 14px 12px 12px 12px; }
  .sbxe-title { font-size: 17px; }
  .sbxe-row { flex-wrap: wrap; }
  .sbxe-row > .sbxe-action, .sbxe-row .sbxe-texts { flex: 1 1 100%; }
  .sbxe-row > .sbxe-stretch { display: none; }
  .sbxe-row > .sbxe-chip, .sbxe-row > .sbxe-chip-off, .sbxe-row > .sbxe-chip-listen, .sbxe-row > .sbxe-chip-warn { margin-left: auto; }
  .sbxe-halves, .sbxe-cards, .sbxe-pair { flex-direction: column; gap: 10px; }
  .sbxe-band { flex-wrap: wrap; }
  .sbxe-band > .sbxe-hold { flex: 1 1 40%; }
  .sbxe-padgrid, .sbxe-padblock { grid-template-columns: repeat(4, minmax(0, 72px)); }
  .sbxe-cell { width: auto; }
  .sbxe-cell.pad { height: 64px; }
  .sbxe-nm .nm-key { height: 40px; font-size: 15px; }
  .sbxe-nm .nm-kb-row { gap: 3px; }
}

/* Les six pages, empilées : une seule visible (l'onglet choisi). */
.sbxe-pages { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.sbxe-pages > .sbxe-page[hidden] { display: none; }

/* Titre avec « ? » (SHIFT channel) et sa bulle d'aide, comme l'infobulle Qt du logiciel. */
.sbxe-group-aide { position: relative; display: flex; align-items: center; }
.sbxe-group-aide .sbxe-help { margin-left: 8px; }
.sbxe-bulle { position: absolute; left: 2px; top: 100%; z-index: 20; max-width: 360px;
  background: #23262d; color: #e8e8e8; border: 1px solid #1A79EB; border-radius: 4px;
  padding: 8px 10px; font-size: 12.5px; font-weight: normal; line-height: 1.5; box-shadow: 0 6px 18px rgba(0,0,0,.4); }
.sbxe-bulle[hidden] { display: none; }

/* CROSSFADER ASSIGN (07/10) : trois cases collees A | THRU | B, comme les pads. */
.sbxe-xf { display: flex; gap: 0; margin: 14px 0 4px 0; }
.sbxe-xf-case { flex: 1 1 0; min-width: 110px; min-height: 70px; color: #e8e8e8; font-size: 16px;
  font-weight: bold; background: #20242b; border: 2px solid #2a2f37; cursor: pointer; }
.sbxe-xf-case.ecoute { border-color: #1A79EB; background: #14304f; }
.sbxe-xf-case.appris { border-color: #2FD94A; background: #163a22; }

/* Nom de commande suivi d'un « ? » a infobulle (08/10, FX apply to master). */
.sbxe-infobulle { position: relative; display: inline-flex; align-items: center; gap: 8px; }
.sbxe-infobulle .sbxe-bulle { width: 320px; }
