/**
 * style.css
 * Feuilles de styles pour l'application Plick (Projecteur, Scanner, Cartes)
 */

:root {
  --bg-dark: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --color-a: #3b82f6;
  --color-b: #10b981;
  --color-c: #f59e0b;
  --color-d: #8b5cf6;
  
  --color-success: #22c55e;
  --color-danger: #ef4444;
  --color-warning: #f59e0b;
  --color-info: #0ea5e9;

  --border-radius-sm: 8px;
  --border-radius-md: 12px;
  --border-radius-lg: 16px;
  --shadow-main: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* En-tête de navigation */
header.app-header {
  background: rgba(30, 41, 59, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.75rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.2rem;
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.logo-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(to right, #60a5fa, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-tabs {
  display: flex;
  gap: 0.5rem;
}

.nav-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.5rem 0.9rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.nav-tab-btn.active {
  color: #fff;
  background: rgba(59, 130, 246, 0.25);
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.header-status-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Badges de statut */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 9999px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
}

.status-dot.connected {
  background: #22c55e;
  box-shadow: 0 0 10px #22c55e;
  animation: pulse-dot 2s infinite;
}

.status-dot.waiting {
  background: #f59e0b;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.9); }
}

/* Boutons d'action */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--border-radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: #3b82f6;
  color: white;
}
.btn-primary:hover {
  background: #2563eb;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.btn-success {
  background: #10b981;
  color: white;
}
.btn-success:hover {
  background: #059669;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.btn-secondary {
  background: #334155;
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.1);
}
.btn-secondary:hover {
  background: #475569;
}

.btn-danger {
  background: #ef4444;
  color: white;
}
.btn-danger:hover {
  background: #dc2626;
}

.btn-icon {
  padding: 0.55rem;
  border-radius: var(--border-radius-sm);
}

/* Conteneur principal */
main.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

/* SECTION PRÉSENTATION / PROJECTEUR */
.presentation-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 1.5rem;
}

.question-box {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--border-radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-main);
  text-align: center;
  position: relative;
}

.question-counter {
  font-size: 1.1rem;
  font-weight: 700;
  color: #60a5fa;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.75rem;
}

.question-title {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.25;
  color: #fff;
  margin-bottom: 0.5rem;
}

/* Grille des 4 options de réponse */
.options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  flex: 1;
}

.option-card {
  background: var(--bg-card);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem 1.75rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.option-card .letter-badge {
  width: 52px;
  height: 52px;
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 900;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.option-card.option-a .letter-badge { background: var(--color-a); }
.option-card.option-b .letter-badge { background: var(--color-b); }
.option-card.option-c .letter-badge { background: var(--color-c); }
.option-card.option-d .letter-badge { background: var(--color-d); }

.option-card .option-text {
  font-size: 1.5rem;
  font-weight: 600;
  color: #fff;
  flex: 1;
  text-align: left;
  line-height: 1.3;
}

/* Barres de statistiques de vote */
.option-progress-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.07);
  width: 0%;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1;
  pointer-events: none;
}

.option-stats {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-secondary);
  display: none;
  z-index: 2;
}

.option-card .option-content {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  width: 100%;
  z-index: 2;
}

/* État lors de la révélation */
.presentation-view.is-revealed .option-stats {
  display: block;
}

.presentation-view.is-revealed .option-card.is-correct {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.15);
  box-shadow: 0 0 25px rgba(34, 197, 94, 0.3);
  transform: scale(1.02);
}

.presentation-view.is-revealed .option-card.is-correct .letter-badge {
  background: #22c55e;
  box-shadow: 0 0 15px rgba(34, 197, 94, 0.6);
}

.presentation-view.is-revealed .option-card.is-incorrect {
  opacity: 0.45;
  filter: grayscale(0.6);
}

/* Explication pédagogique */
.explanation-box {
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--border-radius-md);
  padding: 1.25rem;
  margin-top: 1rem;
  display: none;
  text-align: left;
  font-size: 1.15rem;
  line-height: 1.5;
  color: #93c5fd;
}

.presentation-view.is-revealed .explanation-box {
  display: block;
  animation: fadeIn 0.4s ease;
}

/* Barre de commandes Enseignant en bas */
.presentation-footer {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--border-radius-lg);
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.footer-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.vote-counter-badge {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.vote-counter-badge .count-highlight {
  color: #38bdf8;
  font-size: 1.35rem;
}

/* Grille des élèves (Roster de pastilles) */
.roster-grid-section {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--border-radius-lg);
  padding: 1.25rem;
}

.roster-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.roster-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.student-badges-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-height: 140px;
  overflow-y: auto;
  padding: 0.25rem;
}

.student-badge {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.35rem 0.65rem;
  border-radius: var(--border-radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.25s ease;
}

.student-badge.has-voted {
  background: rgba(59, 130, 246, 0.25);
  border-color: #3b82f6;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.student-badge.is-correct {
  background: rgba(34, 197, 94, 0.25);
  border-color: #22c55e;
  color: #4ade80;
}

.student-badge.is-incorrect {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #f87171;
}

/* MODALES */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1.5rem;
}

.modal-backdrop.open {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--border-radius-lg);
  width: 100%;
  max-width: 650px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-main);
  padding: 2rem;
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 800;
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}
.close-btn:hover {
  color: #fff;
}

/* Modale Appairage QR Code */
.pairing-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.25rem;
}

.qr-code-wrapper {
  background: white;
  padding: 1rem;
  border-radius: var(--border-radius-md);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.qr-code-wrapper img {
  display: block;
  width: 230px;
  height: 230px;
}

.url-box {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.75rem 1.25rem;
  border-radius: var(--border-radius-sm);
  font-family: monospace;
  font-size: 1.05rem;
  color: #38bdf8;
  word-break: break-all;
  user-select: all;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pairing-notice {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--border-radius-sm);
  padding: 0.85rem;
  font-size: 0.9rem;
  color: #fde047;
  text-align: left;
  line-height: 1.4;
}

/* FORMULAIRES ET ÉDITEURS */
.form-group {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-input, .form-textarea, .form-select {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--border-radius-sm);
  padding: 0.65rem 0.9rem;
  color: #fff;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus, .form-textarea:focus {
  border-color: #3b82f6;
}

.options-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.option-edit-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(15, 23, 42, 0.5);
  padding: 0.5rem;
  border-radius: var(--border-radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* VUE SCANNER MOBILE */
.scanner-body {
  background: #000;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  position: fixed;
  inset: 0;
}

.camera-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
}

#overlay-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
}

.scanner-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 1rem;
  background: linear-gradient(to bottom, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 100%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.scanner-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.scanner-q-title {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scanner-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.25rem 1rem env(safe-area-inset-bottom, 1rem);
  background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0) 100%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.scanner-controls {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: center;
}

/* VUE D'IMPRESSION DES CARTES */
.print-page-wrapper {
  background: #e2e8f0;
  color: #0f172a;
  min-height: 100vh;
  padding: 1.5rem 1rem 3rem 1rem;
}

.print-toolbar {
  background: #fff;
  padding: 1rem 1.5rem;
  border-radius: var(--border-radius-md);
  margin: 0 auto 2rem auto;
  max-width: 1000px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.cards-print-grid {
  display: block;
  margin: 0 auto;
  max-width: 1000px;
}

/* Feuille A4 unitaire (écran et impression) */
.print-sheet {
  background: #ffffff;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border-radius: 4px;
  margin: 0 auto 28px auto;
  box-sizing: border-box;
  width: 210mm;
  max-width: 100%;
  min-height: 275mm;
  padding: 8mm 10mm;
  position: relative;
  page-break-inside: avoid;
  break-inside: avoid;
  page-break-after: always;
  break-after: page;
}

.print-sheet:last-child,
.print-sheet:last-of-type {
  page-break-after: auto;
  break-after: auto;
  margin-bottom: 0;
}

/* 1 carte par page A4 */
.print-sheet.layout-1-per-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 275mm;
}

.print-sheet.layout-1-per-page .plick-card {
  width: 170mm;
  height: 170mm;
  max-width: 90vw;
  max-height: 90vw;
  margin: 0 auto;
}

.print-sheet.layout-1-per-page .card-label .letter {
  font-size: 2.3rem;
}

.print-sheet.layout-1-per-page .card-meta {
  font-size: 1.15rem;
}

/* 2 cartes par page A4 (Recommandé Standard) */
.print-sheet.layout-2-per-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  min-height: 275mm;
}

.print-sheet.layout-2-per-page .plick-card {
  width: 122mm;
  height: 122mm;
  max-width: 80vw;
  max-height: 80vw;
  margin: 0 auto;
}

.print-sheet.layout-2-per-page .card-label .letter {
  font-size: 1.85rem;
}

.print-sheet.layout-2-per-page .card-meta {
  font-size: 0.95rem;
}

/* Ligne pointillée de découpe pour le format 2 cartes */
.cut-guide-line {
  width: 100%;
  max-width: 180mm;
  border-top: 1px dashed #94a3b8;
  position: relative;
  margin: 4mm auto;
  height: 0;
  text-align: center;
}

.cut-guide-line span {
  position: relative;
  top: -8px;
  background: white;
  padding: 0 8px;
  font-size: 11px;
  color: #64748b;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0.5px;
}

/* 4 cartes par page A4 (Compact 2x2) */
.print-sheet.layout-4-per-page {
  display: grid;
  grid-template-columns: repeat(2, 84mm);
  grid-template-rows: repeat(2, 84mm);
  gap: 10mm 10mm;
  justify-content: center;
  align-content: center;
  min-height: 275mm;
}

.print-sheet.layout-4-per-page .plick-card {
  width: 84mm;
  height: 84mm;
  margin: 0;
}

.print-sheet.layout-4-per-page .card-label .letter {
  font-size: 1.3rem;
}

.print-sheet.layout-4-per-page .card-meta {
  font-size: 0.75rem;
}

.print-sheet.layout-4-per-page .card-marker-wrap {
  width: 66%;
  height: 66%;
}

/* Styles des cartes individuelles */
.plick-card {
  background: white;
  border: 2px solid #000;
  position: relative;
  page-break-inside: avoid;
  break-inside: avoid;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.card-inner {
  position: relative;
  width: 90%;
  height: 90%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-meta {
  position: absolute;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 800;
  font-size: 1.1rem;
  color: #000;
}

.card-meta.top-left { top: 0; left: 0; }
.card-meta.top-right { top: 0; right: 0; }
.card-meta.bottom-left { bottom: 0; left: 0; font-size: 0.8rem; color: #555; }
.card-meta.bottom-right { bottom: 0; right: 0; font-size: 0.8rem; color: #555; }

.card-label {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-label .letter {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 900;
  font-size: 2rem;
  color: #000;
}

.card-label.label-a {
  top: 0;
  left: 50%;
  transform: translateX(-50%);
}

.card-label.label-b {
  right: 0;
  top: 50%;
  transform: translateY(-50%) rotate(90deg);
}

.card-label.label-c {
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) rotate(180deg);
}

.card-label.label-d {
  left: 0;
  top: 50%;
  transform: translateY(-50%) rotate(270deg);
}

.card-marker-wrap {
  width: 68%;
  height: 68%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-marker-wrap svg,
.card-marker-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  shape-rendering: crispEdges;
}

/* RÈGLES D'IMPRESSION SPÉCIFIQUES @media print */
@media print {
  @page {
    size: A4 portrait;
    margin: 8mm;
  }

  html, body {
    background: white !important;
    color: black !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .print-toolbar, .app-header {
    display: none !important;
  }

  .print-page-wrapper {
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    min-height: auto !important;
    overflow: visible !important;
  }

  .cards-print-grid {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 0 !important;
    overflow: visible !important;
  }

  .print-sheet {
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 auto !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    page-break-after: always !important;
    break-after: page !important;
    overflow: visible !important;
  }

  .print-sheet:last-child,
  .print-sheet:last-of-type {
    page-break-after: auto !important;
    break-after: auto !important;
  }

  .plick-card {
    border: 2px solid #000 !important;
    box-shadow: none !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    box-sizing: border-box !important;
  }

  .cut-guide-line {
    border-top: 1px dashed #64748b !important;
  }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* GESTION MULTI-CLASSES ET QUESTIONNAIRES */
.master-detail-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.25rem;
  min-height: 420px;
}

@media (max-width: 768px) {
  .master-detail-layout {
    grid-template-columns: 1fr;
  }
}

.master-list-col {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--border-radius-sm);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.master-list-scroll {
  flex: 1;
  overflow-y: auto;
  max-height: 360px;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.list-selectable-item {
  padding: 0.65rem 0.85rem;
  border-radius: var(--border-radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.list-selectable-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.list-selectable-item.active {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.5);
  color: #60a5fa;
}

.detail-view-col {
  background: rgba(15, 23, 42, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--border-radius-sm);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Onglets d'authentification */
.auth-tabs {
  display: flex;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 1.25rem;
  gap: 0.5rem;
}

.auth-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.auth-tab.active {
  color: #60a5fa;
  border-bottom-color: #60a5fa;
}

/* Badge de session en cours */
.session-info-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  color: #93c5fd;
  font-weight: 600;
}

.session-info-pill strong {
  color: #fff;
}

/* Image pour la question */
.question-image-wrap {
  text-align: center;
  margin: 0.75rem 0 1rem 0;
}

.question-image-wrap img {
  max-height: 260px;
  max-width: 100%;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  object-fit: contain;
  cursor: zoom-in;
  transition: transform 0.2s ease;
  background: rgba(0, 0, 0, 0.2);
}

.question-image-wrap img:hover {
  transform: scale(1.02);
}

/* Image pour une option / réponse */
.option-img-thumb {
  max-height: 75px;
  max-width: 110px;
  border-radius: 6px;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
}

/* Editeur d'images dans les formulaires */
.image-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: #e2e8f0;
  cursor: pointer;
  transition: background 0.2s;
}

.image-upload-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.image-thumb-preview {
  height: 32px;
  border-radius: 4px;
  border: 1px solid var(--accent);
  object-fit: cover;
}

/* Lightbox pour agrandir les images */
.image-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(4px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  padding: 1.5rem;
}

.image-lightbox.open {
  display: flex;
}

.image-lightbox img {
  max-width: 92vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
  cursor: default;
}


