/* Banc d'assemblage 3D Robot-Lab */

.rl-banc {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1rem;
  min-height: 70vh;
}

@media (max-width: 900px) {
  .rl-banc { grid-template-columns: 1fr; }
}

.rl-3d {
  position: relative;
  overflow: hidden;
}

#rl-viewport {
  width: 100%;
  height: 65vh;
  min-height: 400px;
  background: linear-gradient(180deg, #1c1917 0%, #292524 100%);
}

.rl-3d-hud {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.4rem 0.8rem;
  background: rgba(0, 0, 0, 0.4);
}

.rl-cote .card-body {
  max-height: 70vh;
  overflow-y: auto;
}

.rl-port {
  display: flex;
  align-items: center;
  padding: 0.35rem 0.5rem;
  border-radius: 0.25rem;
  cursor: pointer;
  border: 1px solid transparent;
}

.rl-port:hover { background: rgba(245, 158, 11, 0.08); }
.rl-port.actif { background: rgba(245, 158, 11, 0.15); border-color: rgba(245, 158, 11, 0.4); }
.rl-port .rl-port-nom { flex-grow: 1; font-family: monospace; }
.rl-port .rl-port-attache { color: #84cc16; font-size: 0.8em; }
.rl-port .rl-port-libre { color: #a8a29e; font-size: 0.8em; font-style: italic; }
.rl-port .rl-port-supprimer {
  margin-left: 0.4rem;
  color: #dc2626;
  font-weight: bold;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0 0.3rem;
}

.rl-cata-item {
  display: flex;
  align-items: center;
  padding: 0.35rem 0.5rem;
  border-radius: 0.25rem;
  cursor: pointer;
  border: 1px solid transparent;
}

.rl-cata-item:hover { background: rgba(132, 204, 22, 0.08); }
.rl-cata-item.choisi { background: rgba(132, 204, 22, 0.18); border-color: rgba(132, 204, 22, 0.5); }
.rl-cata-item .rl-cata-icone { width: 1.5rem; text-align: center; }
.rl-cata-item .rl-cata-nom { flex-grow: 1; }


/* Page Programme — Blockly + Python lecture seule */

.rl-prog {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 1rem;
  min-height: 70vh;
}

@media (max-width: 900px) {
  .rl-prog { grid-template-columns: 1fr; }
}

.rl-prog-blockly {
  width: 100%;
  height: 70vh;
  min-height: 480px;
  overflow: hidden;
}

.rl-prog-python {
  display: flex;
  flex-direction: column;
  max-height: 70vh;
}

.rl-python-code {
  flex-grow: 1;
  overflow: auto;
  margin: 0;
  padding: 0.75rem 1rem;
  font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
  font-size: 0.85rem;
  line-height: 1.45;
  color: #d4d4d8;
  background: transparent;
  white-space: pre;
}


/* Page Simulation 2,5D */

.rl-sim {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1rem;
  min-height: 70vh;
}

@media (max-width: 900px) {
  .rl-sim { grid-template-columns: 1fr; }
}

.rl-sim-viewport {
  width: 100%;
  height: 70vh;
  min-height: 500px;
  overflow: hidden;
  background: linear-gradient(180deg, #1c1917 0%, #292524 100%);
}

.rl-sim-side {
  display: flex;
  flex-direction: column;
  max-height: 70vh;
}

.rl-sim-journal {
  flex-grow: 1;
  overflow-y: auto;
  padding: 0.5rem 0.75rem;
  font-family: ui-monospace, "Consolas", monospace;
  font-size: 0.8rem;
  line-height: 1.55;
  color: #d4d4d8;
  white-space: pre;
}


/* Page Programme — mode édition Python (CodeMirror) */

.rl-blocs-desactives { opacity: 0.45; pointer-events: none; }

.rl-prog-python .CodeMirror {
  height: calc(70vh - 2rem);
  font-size: 0.85rem;
  line-height: 1.45;
}


/* Présence + verrou souple — Lot 2.6 (spec D6) */

.rl-presence-badge {
  position: fixed; bottom: 1rem; right: 1rem; z-index: 1000;
  background: rgba(28, 25, 23, 0.92);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 1rem; padding: 0.4rem 0.9rem;
  font-size: 0.85rem; color: #d4d4d8;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  display: flex; align-items: center; gap: 0.3rem;
}
.rl-presence-badge.rl-presence-seul { opacity: 0.45; }
.rl-presence-badge .rl-presence-compte { font-weight: bold; color: #f59e0b; }
.rl-presence-badge .rl-presence-noms {
  color: #a8a29e; font-size: 0.78rem;
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.15rem;
}
.rl-presence-pastille {
  display: inline-block; width: 0.6rem; height: 0.6rem;
  border-radius: 50%; margin-left: 0.4rem;
  vertical-align: middle;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.4);
}
.rl-presence-libelle { color: #d4d4d8; }
.rl-presence-focus { color: #fde047; opacity: 0.85; margin-left: 0.1rem; }

.rl-presence-bandeau {
  position: sticky; top: 0; z-index: 999;
  background: rgba(220, 38, 38, 0.12);
  border-bottom: 1px solid rgba(220, 38, 38, 0.35);
  padding: 0.5rem 1rem; margin: -1rem -1rem 1rem -1rem;
  text-align: center; font-size: 0.9rem; color: #fef3c7;
}

body.rl-mode-observateur .rl-banc,
body.rl-mode-observateur .rl-prog,
body.rl-mode-observateur .rl-sim { opacity: 0.85; }
body.rl-mode-observateur button[type="submit"],
body.rl-mode-observateur #rl-save,
body.rl-mode-observateur #rl-play { filter: grayscale(40%); }
