/* ===== Visualiseur DICOM Sinus — ENStips ===== */

:root {
  --fond: #0d1117;
  --fond-panneau: #161b22;
  --fond-carte: #1c2330;
  --bordure: #2d3644;
  --texte: #e6edf3;
  --texte-doux: #9aa7b4;
  /* Couleur du logo enstips.com (bleu-gris), éclaircie pour les états actifs
     sur fond sombre */
  --accent: #7aa8c2;
  --accent-fonce: #6799b2;
  --vert: #3fb950;
  --rouge: #f85149;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--fond);
  color: var(--texte);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  overflow: hidden;
}

.accent { color: var(--accent); }

/* ===== Boutons ===== */
.btn {
  background: var(--fond-carte);
  color: var(--texte);
  border: 1px solid var(--bordure);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: #253044; border-color: var(--accent); }
.btn-principal {
  background: var(--accent-fonce);
  border-color: var(--accent-fonce);
  font-size: 16px;
  font-weight: 600;
  padding: 12px 28px;
}
.btn-principal:hover { background: var(--accent); border-color: var(--accent); }
.btn-petit { font-size: 12px; padding: 5px 10px; }
.btn-preset.actif { border-color: var(--accent); background: #21395c; }

/* ===== Écran d'accueil ===== */
.ecran-accueil[hidden] { display: none; }
.ecran-accueil {
  height: 100%;
  display: flex;
  align-items: safe center;
  justify-content: safe center;
  overflow-y: auto;
  scrollbar-width: thin;                 /* Firefox */
  scrollbar-color: #3a4656 transparent;  /* Firefox */
}
.ecran-accueil::-webkit-scrollbar { width: 8px; }
.ecran-accueil::-webkit-scrollbar-track { background: transparent; }
.ecran-accueil::-webkit-scrollbar-thumb {
  background-color: #3a4656;
  border-radius: 4px;
  border: 2px solid var(--fond);
}
.ecran-accueil::-webkit-scrollbar-thumb:hover { background-color: var(--accent); }
.accueil-contenu {
  max-width: 640px;
  padding: 32px 24px;
  text-align: center;
}
.accueil-contenu h1 {
  font-size: 32px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
img.logo-accueil { height: 52px; width: 52px; }
@media (max-width: 480px) {
  .accueil-contenu h1 { flex-direction: column; gap: 8px; font-size: 26px; }
}
.sous-titre { color: var(--texte-doux); margin-bottom: 28px; line-height: 1.5; }

.zone-depot {
  border: 2px dashed var(--bordure);
  border-radius: 16px;
  padding: 36px 24px;
  background: var(--fond-panneau);
  transition: border-color .2s, background .2s;
}
.zone-depot.survol { border-color: var(--accent); background: #16233a; }
.zone-depot-icone { width: 48px; height: 48px; margin: 0 auto 12px; color: var(--accent); }
.zone-depot-icone svg { width: 100%; height: 100%; stroke-width: 1.5; }
.zone-depot-texte { color: var(--texte-doux); line-height: 1.6; }
.zone-depot-ou { color: var(--texte-doux); margin: 14px 0; font-size: 13px; }

.note-confidentialite {
  margin-top: 22px;
  padding: 14px 18px;
  background: rgba(103, 153, 178, .1);
  border: 1px solid rgba(103, 153, 178, .4);
  border-radius: 10px;
  color: #bfd8e6;
  font-size: 14px;
  line-height: 1.5;
  text-align: left;
}

.zone-reprise[hidden] { display: none; }
.zone-reprise {
  margin-top: 18px;
  padding: 14px 18px;
  background: rgba(77, 163, 255, .07);
  border: 1px solid rgba(77, 163, 255, .35);
  border-radius: 10px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}
.zone-reprise .note-plan { margin: 0; width: 100%; text-align: center; }
.bib-titre { width: 100%; font-size: 14px; color: var(--texte); text-align: center; }
.liste-exam-locaux { list-style: none; width: 100%; display: flex; flex-direction: column; gap: 6px; }
.liste-exam-locaux li { display: flex; gap: 6px; }
.liste-exam-locaux .btn-exam-local { flex: 1; text-align: left; font-size: 13px; line-height: 1.4; }
.liste-exam-locaux .exam-meta { color: var(--texte-doux); font-size: 12px; }
#taille-bibliotheque { color: var(--texte); margin: 0 6px; }
#comparer-bibliotheque { margin-bottom: 10px; }
#liste-comparer-bib { margin-top: 4px; }
#liste-comparer-bib .btn { font-size: 12.5px; }

.zone-progression { margin-top: 24px; }
#btn-annuler-chargement { margin-top: 12px; }

.mpr-chargement.avec-annulation {
  white-space: normal;
  display: flex;
  align-items: center;
  gap: 10px;
}
#texte-progression { color: var(--texte-doux); font-size: 14px; margin-bottom: 8px; }
.barre-progression {
  height: 8px;
  background: var(--fond-carte);
  border-radius: 4px;
  overflow: hidden;
}
.barre-remplissage {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 4px;
  transition: width .15s;
}

.message-erreur {
  margin-top: 20px;
  padding: 12px 16px;
  background: rgba(248, 81, 73, .1);
  border: 1px solid rgba(248, 81, 73, .4);
  border-radius: 10px;
  color: #ffb3ae;
  font-size: 14px;
  line-height: 1.5;
}

/* ===== Écran visualiseur ===== */
.ecran-visualiseur {
  display: flex;
  height: 100%;
}
.ecran-visualiseur[hidden] { display: none; }

.panneau-lateral {
  width: 280px;
  min-width: 280px;
  background: var(--fond-panneau);
  border-right: 1px solid var(--bordure);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;                 /* Firefox */
  scrollbar-color: #3a4656 transparent;  /* Firefox */
}
.panneau-lateral::-webkit-scrollbar { width: 8px; }
.panneau-lateral::-webkit-scrollbar-track { background: transparent; }
.panneau-lateral::-webkit-scrollbar-thumb {
  background-color: #3a4656;
  border-radius: 4px;
  border: 2px solid var(--fond-panneau);
}
.panneau-lateral::-webkit-scrollbar-thumb:hover { background-color: var(--accent); }
.panneau-entete {
  padding: 14px 16px;
  border-bottom: 1px solid var(--bordure);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.panneau-entete h2 { font-size: 16px; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.logo-app { height: 26px; width: 26px; object-fit: contain; flex-shrink: 0; }

.panneau-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--bordure);
}
.panneau-section h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--texte-doux);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.chevron-icone {
  width: 15px;
  height: 15px;
  color: var(--accent);
  flex-shrink: 0;
  transition: transform .15s;
}
.chevron-icone svg { stroke-width: 2.5; }
.panneau-section.replie h3 { margin-bottom: 0; }
.panneau-section.replie .chevron-icone { transform: rotate(-90deg); }
.panneau-section.replie > *:not(h3) { display: none; }

/* ===== Icônes SVG (remplacent les emojis) ===== */
.icone {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  vertical-align: -3px;
}
.icone svg { width: 100%; height: 100%; }
.btn .icone { color: inherit; }
.btn-fleche .icone { width: 15px; height: 15px; }

.info-patient { font-size: 13px; line-height: 1.7; color: var(--texte); word-break: break-word; }
.info-patient .etiquette { color: var(--texte-doux); }

.liste-series { list-style: none; }
.liste-series li {
  padding: 9px 11px;
  border: 1px solid var(--bordure);
  border-radius: 8px;
  margin-bottom: 7px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.45;
  transition: border-color .15s, background .15s;
}
.liste-series li:hover { border-color: var(--accent); }
.liste-series li.active { border-color: var(--accent); background: #21395c; }
.liste-series .serie-desc { font-weight: 600; }
.liste-series .serie-meta { color: var(--texte-doux); font-size: 12px; }

.groupe-boutons { display: flex; flex-direction: column; gap: 7px; }
.groupe-boutons .btn { text-align: left; font-size: 13px; }

.groupe-boutons-ligne { display: flex; gap: 7px; }
.groupe-boutons-ligne .btn { flex: 1; text-align: center; font-size: 13px; padding: 8px 4px; }
.btn-plan.actif { border-color: var(--accent); background: #21395c; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn:disabled:hover { background: var(--fond-carte); border-color: var(--bordure); }
.note-plan { margin-top: 9px; font-size: 11.5px; color: var(--texte-doux); line-height: 1.5; }

.mpr-chargement {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(13, 17, 23, .92);
  border: 1px solid var(--bordure);
  border-radius: 10px;
  padding: 14px 22px;
  font-size: 14px;
  color: var(--texte);
  z-index: 10;
  white-space: nowrap;
}

.liste-aide {
  list-style: none;
  font-size: 12.5px;
  color: var(--texte-doux);
  line-height: 1.9;
}
.liste-aide strong { color: var(--texte); }

.panneau-pied {
  margin-top: auto;
  padding: 12px 16px;
  font-size: 11.5px;
  color: var(--texte-doux);
  line-height: 1.5;
}
.panneau-pied a { color: var(--accent); text-decoration: none; }
.panneau-pied .pied-licence { display: block; margin-top: 6px; color: var(--texte-doux); opacity: .8; font-size: 11px; }

/* ===== Zone principale ===== */
.zone-principale {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.conteneur-vues {
  flex: 1;
  display: flex;
  min-height: 0;
  gap: 2px;
  background: var(--bordure);
}

.vue-bloc {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--fond);
}

.reglage-seuil { margin-top: 9px; font-size: 12.5px; color: var(--texte-doux); }
.reglage-seuil label { display: block; margin-bottom: 4px; }
.reglage-seuil input[type="range"] { width: 100%; accent-color: var(--accent); cursor: pointer; }
#valeur-seuil-air { color: var(--texte); font-weight: 600; }

.viewport {
  flex: 1;
  position: relative;
  background: #000;
  min-height: 0;
  min-width: 0;
  touch-action: none;
}
.viewport canvas { display: block; }
.conteneur-vues.comparaison .viewport.vue-active { outline: 2px solid var(--accent); outline-offset: -2px; }
.etiquette-examen {
  display: inline-block;
  background: var(--accent-fonce);
  color: #fff;
  border-radius: 5px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 3px;
}

.canvas-mesures {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
}
.viewport.mode-mesure { cursor: crosshair; }
.viewport.mode-note { cursor: copy; }
.viewport.mode-air { cursor: crosshair; }

.btn-fermer-vue {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 8;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid var(--bordure);
  background: rgba(13, 17, 23, .78);
  color: var(--texte);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn-fermer-vue:hover { background: var(--rouge); border-color: var(--rouge); color: #fff; }
/* En comparaison, on décale le texte de coupe pour laisser la place à la croix */
.conteneur-vues.comparaison .overlay-hd { padding-top: 40px; }
.groupe-boutons .btn.actif { border-color: var(--accent); background: #21395c; }

.overlay {
  position: absolute;
  font-size: 12.5px;
  color: #d9e6f2;
  text-shadow: 0 1px 3px rgba(0,0,0,.9);
  pointer-events: none;
  line-height: 1.55;
  z-index: 5;
  padding: 10px 12px;
}
.overlay-hg { top: 0; left: 0; }
.overlay-hd { top: 0; right: 0; text-align: right; }
.overlay-bg { bottom: 0; left: 0; }
.overlay-bd { bottom: 0; right: 0; text-align: right; }

/* Repères d'orientation anatomique (R/L, A/P, S/I) au centre des bords */
.ov-orient {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  font-size: 13px;
  font-weight: 700;
  color: #cfe0ee;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .9);
}
.ov-orient-t { top: 4px; left: 50%; transform: translateX(-50%); }
.ov-orient-b { bottom: 4px; left: 50%; transform: translateX(-50%); }
.ov-orient-l { left: 5px; top: 50%; transform: translateY(-50%); }
.ov-orient-r { right: 5px; top: 50%; transform: translateY(-50%); }

.barre-coupes {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--fond-panneau);
  border-top: 1px solid var(--bordure);
}
.bc-curseur-wrap {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  padding-bottom: 9px; /* place pour les repères, sous la piste */
}
.barre-coupes input[type="range"] {
  width: 100%;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  height: 16px;
}
.barre-coupes input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  /* Remplissage jusqu'au curseur : --pct est mis à jour en JS */
  background: linear-gradient(to right,
    var(--accent) var(--pct, 0%), var(--bordure) var(--pct, 0%));
}
.barre-coupes input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: -3.5px;
  border: none;
}
.barre-coupes input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: var(--bordure);
}
.barre-coupes input[type="range"]::-moz-range-progress {
  height: 4px;
  border-radius: 2px;
  background: var(--accent);
}
.barre-coupes input[type="range"]::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
}
/* Repères des coupes annotées (mesure / lasso d'air / note) : sous la piste,
   jamais au-dessus (sinon ils capturent les clics destinés au curseur natif) */
.bc-marqueurs {
  position: absolute;
  left: 7px;
  right: 7px;
  bottom: 0;
  height: 9px;
  pointer-events: none;
}
.bc-marqueurs .marque {
  position: absolute;
  top: 0;
  width: 11px;
  height: 9px;
  margin-left: -5.5px;
  padding: 0 4px;
  background-clip: content-box;
  border-radius: 1px;
  background-color: #f2c94c;
  cursor: pointer;
  pointer-events: auto;
}
.bc-marqueurs .marque:hover { background-color: #ffd76a; }
}
.btn-fleche { padding: 6px 12px; }
.label-coupes {
  font-size: 13px;
  color: var(--texte-doux);
  min-width: 70px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ===== Sélecteur de langue ===== */
.choix-langue { display: flex; gap: 3px; }
.btn-langue {
  background: var(--fond-carte);
  color: var(--texte-doux);
  border: 1px solid var(--bordure);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.btn-langue:hover { border-color: var(--accent); }
.btn-langue.actif { background: var(--accent-fonce); border-color: var(--accent-fonce); color: #fff; }
.choix-langue-accueil { position: absolute; top: 14px; right: 16px; z-index: 5; }
.ecran-accueil { position: relative; }
.entete-actions { display: flex; align-items: center; gap: 6px; }

.accueil-boutons { justify-content: center; }
.accueil-boutons .btn { flex: 0 1 auto; }

/* ===== Tutoriel de première visite ===== */
.tuto-fond {
  position: fixed;
  inset: 0;
  background: rgba(6, 9, 14, .78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.tuto-fond[hidden] { display: none; }
.tuto-boite {
  max-width: 520px;
  background: var(--fond-panneau);
  border: 1px solid var(--bordure);
  border-radius: 14px;
  padding: 26px 28px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .55);
}
.tuto-boite h2 { margin-bottom: 14px; font-size: 20px; }
.tuto-liste { list-style: none; margin-bottom: 18px; }
.tuto-liste li { padding: 7px 0; font-size: 14px; line-height: 1.55; color: var(--texte); }
.tuto-liste strong { color: var(--accent); }

/* ===== Plein écran (panneau masqué) ===== */
.zone-principale { position: relative; }
.btn-flottant {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 9;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 7px;
  border: 1px solid var(--bordure);
  background: rgba(13, 17, 23, .78);
  color: var(--texte);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.btn-flottant:hover { border-color: var(--accent); background: #21395c; }
body.plein-ecran .panneau-lateral { display: none; }
.overlay-hg { padding-left: 48px; }

/* ===== Responsive ===== */
@media (max-width: 760px) {
  html, body { overflow: auto; }
  .ecran-visualiseur { flex-direction: column; height: auto; min-height: 100%; }
  .panneau-lateral { width: 100%; min-width: 0; border-right: none; order: 2; }
  .zone-principale { order: 1; flex: 0 0 70vh; height: 70vh; }
  .conteneur-vues.comparaison { flex-direction: column; }
}
