/* ========================================
   VARIABLES CSS POUR LES THÈMES
   ======================================== */
:root {
  /* Thème Sombre (par défaut) */
  --bg-primary: #0f1419;
  --bg-secondary: #1a1f2e;
  --bg-card: #1e2433;
  --bg-card-hover: #252d3f;
  --bg-header: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

  --text-primary: #ffffff;
  --text-secondary: #a0aec0;
  --text-muted: #718096;

  --accent-primary: #667eea;
  --accent-secondary: #764ba2;
  --accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

  --border-color: #2d3748;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);

  /* --- Pas fait (Rouge) --- */
  --badge-disabled-bg: rgba(239, 68, 68, 0.15);
  --badge-disabled-text: #ef4444;

  /* --- Attente (Ambre/Orange) --- */
  --badge-wait-bg: rgba(251, 191, 36, 0.15);
  --badge-wait-text: #fbbf24;

  /* --- À vérifier (Bleu) --- */
  --badge-verif-bg: rgba(59, 130, 246, 0.15);
  --badge-verif-text: #3b82f6;

  /* --- Complété (Cyan/Vert fluo) --- */
  --badge-completed-bg: rgba(0, 255, 183, 0.15);
  --badge-completed-text: #00ffb7;

  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   MODAL DE SÉLECTION DE NIVEAU
   ======================================== */
.level-selection-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.level-selection-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.level-selection-modal {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.level-selection-overlay.visible .level-selection-modal {
  transform: scale(1);
}

.level-selection-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.level-selection-header h3 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.level-selection-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.level-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.level-btn {
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  color: var(--text-primary);
  padding: 1rem 1.5rem;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.level-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: var(--accent-gradient);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 0;
}

.level-btn:hover::before {
  left: 0;
  opacity: 0.1;
}

.level-btn:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.level-btn-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  position: relative;
  z-index: 1;
}

.level-btn-icon {
  font-size: 1.5rem;
}

.level-btn-text {
  text-align: left;
}

.level-btn-title {
  display: block;
  font-size: 1.1rem;
}

.level-btn-subtitle {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 400;
  margin-top: 0.25rem;
}

.level-btn-arrow {
  font-size: 1.2rem;
  opacity: 0.5;
  transition: all 0.3s ease;
  position: relative;
  z-index: 1;
}

.level-btn:hover .level-btn-arrow {
  opacity: 1;
  transform: translateX(4px);
}

/* Styles pour les checkboxes de sélection de niveaux QCM */
.level-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.level-checkbox-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  padding: 1rem 1.25rem;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.level-checkbox-item:hover {
  border-color: var(--accent-primary);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.level-checkbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--accent-primary);
  flex-shrink: 0;
}

.level-checkbox-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.level-checkbox-item .level-btn-icon {
  font-size: 1.5rem;
}

.level-checkbox-item .level-btn-text {
  text-align: left;
}

.level-checkbox-item .level-btn-title {
  display: block;
  font-size: 1rem;
  color: var(--text-primary);
  font-weight: 600;
}

.level-checkbox-item .level-btn-subtitle {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 400;
  margin-top: 0.25rem;
}

.level-question-count {
  display: block;
  font-size: 0.85rem;
  color: var(--accent-primary);
  font-weight: 600;
  margin-top: 0.25rem;
}

.level-checkbox-item:has(.level-checkbox:checked) {
  border-color: var(--accent-primary);
  background: rgba(102, 126, 234, 0.1);
}

.level-selection-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.level-confirm-btn {
  flex: 1;
  background: var(--accent-gradient);
  border: none;
  color: white;
  padding: 0.875rem 1.5rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.level-confirm-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  opacity: 0.9;
}

.level-cancel-btn {
  flex: 1;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.875rem 1.5rem;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
}

.level-cancel-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

/* Thème Clair */
[data-theme="light"] {
  --bg-primary: #f7fafc;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f7fafc;
  --bg-header: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

  --text-primary: #1a202c;
  --text-secondary: #4a5568;
  --text-muted: #718096;

  --accent-primary: #667eea;
  --accent-secondary: #764ba2;

  --border-color: #e2e8f0;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);

  --badge-disabled-bg: rgba(239, 68, 68, 0.1);
  --badge-disabled-text: #dc2626;
  --badge-wait-bg: rgba(251, 191, 36, 0.1);
  --badge-wait-text: #d97706;
  --badge-verif-bg: rgba(59, 130, 246, 0.1);
  --badge-verif-text: #00ffb7;
}

/* ========================================
   RESET & BASE
   ======================================== */
*,
::before,
::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

/* ========================================
   HEADER MODERNE
   ======================================== */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--bg-header);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-md);
  z-index: 100;
  padding: 0 2rem;
  height: 80px;
}

/* ========================================
   COMPTEUR DE STATUTS
   ======================================== */
.status-counter {
  position: fixed;
  bottom: 0px;
  left: 0;
  /* right: 0; */
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  z-index: 99;
  box-shadow: var(--shadow-sm);
}

.status-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0.5rem;
  background: var(--bg-card);
  border-radius: 12px;
  transition: var(--transition);
}

.status-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.status-badge {
  padding: 0.15rem 0.75rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.status-verif {
  background: var(--badge-verif-bg);
  color: var(--badge-verif-text);
}

.status-badge.status-wait {
  background: var(--badge-wait-bg);
  color: var(--badge-wait-text);
}

.status-badge.status-disabled {
  background: var(--badge-disabled-bg);
  color: var(--badge-disabled-text);
}

.status-badge.status-done {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.status-badge.status-total {
  background: rgba(102, 126, 234, 0.15);
  color: var(--accent-primary);
}
/* 
.status-item.status-total {
  background: var(--bg-card);
  border: 2px solid rgba(102, 126, 234, 0.3);
} */

.status-item.status-total:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
}

.disable{
  filter: grayscale(1);
}

.status-count {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 2rem;
  text-align: center;
}

@media (max-width: 768px) {
  .status-counter {
  visibility: hidden;
  }

  .status-item {
    padding: 0.4rem 0.75rem;
    gap: 0.5rem;
  }

  .status-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
  }

  .status-count {
    font-size: 1.25rem;
    min-width: 1.5rem;
  }
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-left-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-right-spacer {
  width: 200px;
  /* Même largeur que header-left-actions pour centrer le titre */
}

.stats-toggle {
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  color: white;
  /* margin-left: 0.5rem; */
}

.stats-toggle {
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  color: white;
}

.qcm-header-toggle {
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  color: white;
}

.qcm-header-toggle:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

.qcm-header-toggle svg {
  stroke: currentColor;
}

.header-text {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
}

.header-text span img {
  max-width: 50px;
}

.header-text h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: white;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-text .subtitle {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.85);
  margin: 0;
  font-weight: 400;
}

/* Bouton de thème */
.theme-toggle {
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

.theme-toggle svg {
  position: absolute;
  transition: var(--transition);
  color: white;
}

.sun-icon {
  opacity: 0;
  transform: rotate(180deg) scale(0);
}

.moon-icon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

[data-theme="light"] .sun-icon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

[data-theme="light"] .moon-icon {
  opacity: 0;
  transform: rotate(-180deg) scale(0);
}

.btn {
  display: flex;
  background: var(--accent-gradient);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  color: var(--text-primary);
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn.hidden {
  display: none !important;
}

/* ========================================
   MAIN CONTENT
   ======================================== */
main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 90px 2rem 3rem;
  min-height: 100vh;
}

/* ========================================
   SECTIONS
   ======================================== */
/* .group {
  margin-top: 2rem;
  animation: fadeInUp 0.6s ease-out;
} */

.group:first-child {
  margin-top: 0;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* margin-bottom: 1.5rem; */
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border-color);
}

.section-title-wrapper {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.section-icon {
  font-size: 2rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.section-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 8px 0 0 0;
}

.toggle-link {
  display: none;
  /* Masqué par défaut, affiché par JS si nécessaire */
  align-items: center;
  gap: 0.5rem;
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  transition: var(--transition);
  background: rgba(102, 126, 234, 0.1);
}

.toggle-link:hover {
  background: rgba(102, 126, 234, 0.2);
  transform: translateX(4px);
}

.toggle-link svg {
  transition: var(--transition);
}

.toggle-link:hover svg {
  transform: translateY(2px);
}

/* ========================================
   CARDS GRID
   ======================================== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1.25rem;
  position: relative;
  opacity: 0;
  margin: 2rem 0 0.8rem 0;
}

.cards-grid.ready {
  opacity: 1;
  transition: opacity 0.3s ease-out;
}

.card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.75rem 1.25rem;
  text-decoration: none;
  color: var(--text-primary);
  transition: var(--transition);
  cursor: pointer;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  justify-content: center;
  align-items: center;
  display: flex;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--accent-gradient);
  transform: scaleX(0);
  transition: var(--transition);
}

.card:hover::before {
  transform: scaleX(1);
}

.card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-primary);
}

.card-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.card-icon {
  font-size: 3rem;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
  transition: var(--transition);
}

.card:hover .card-icon {
  transform: scale(1.1);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
  margin: 0;
}

/* ========================================
   BADGES
   ======================================== */
.badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-disabled {
  background: var(--badge-disabled-bg);
  color: var(--badge-disabled-text);
}

.badge-wait {
  background: var(--badge-wait-bg);
  color: var(--badge-wait-text);
}

.badge-verif {
  background: var(--badge-verif-bg);
  color: var(--badge-verif-text);
}

.badge-completed {
  background: var(--badge-completed-bg);
  color: var(--badge-completed-text);
}

/* États des cartes */
.card.disable {
  opacity: 0.6;
  cursor: not-allowed;
}

.card.disable:hover {
  transform: none;
  box-shadow: var(--shadow-sm);
  border-color: var(--border-color);
}

.card.wait {
  border-color: var(--badge-wait-text);
}

.card.verif {
  border-color: var(--badge-verif-text);
}

.card.completed {
  border-color: var(--badge-completed-text);
}


/* ========================================
   SIDEBAR
   ======================================== */
.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 450px;
  height: 100vh;
  background: var(--bg-secondary);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 9999;
  overflow-y: auto;
  visibility: hidden;
}

.sidebar.visible {
  transform: translateX(0);
  visibility: visible;
}

.sidebar.hidden {
  visibility: hidden;
}

.sidebar.expanded {
  width: 80%;
  max-width: 1200px;
}

.sidebar-header {
  position: sticky;
  top: 0;
  background: var(--bg-header);
  padding: 1.5rem;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.sidebar-title-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow: hidden;
}

.sidebar-category-text {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.875rem;
  font-weight: 500;
  margin: 0;
  letter-spacing: 0.5px;
}

.sidebar-title-text {
  color: white;
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.expand-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
  position: relative;
}

.expand-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

.expand-btn svg {
  position: absolute;
  transition: var(--transition);
}

.expand-icon {
  opacity: 1;
  transform: scale(1);
}

.collapse-icon {
  opacity: 0;
  transform: scale(0);
}

.sidebar.expanded .expand-icon {
  opacity: 0;
  transform: scale(0);
}

.sidebar.expanded .collapse-icon {
  opacity: 1;
  transform: scale(1);
}

.close-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: rotate(90deg);
}

.sidebar-content {
  padding: 2rem;
  color: var(--text-primary);
  background: var(--bg-secondary);
}

/* ========================================
   RECHERCHE FLOTTANTE
   ======================================== */
.search-toggle-icon {
  position: fixed !important;
  bottom: 2rem;
  right: 2rem;
  background: var(--accent-gradient);
  border: none;
  color: white;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  z-index: 999;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  animation: slideInFromBottom 0.5s ease-out 0.3s forwards;
}

@keyframes slideInFromBottom {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.search-toggle-icon:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 40px rgba(102, 126, 234, 0.4);
}

.search-overlay {
  position: fixed;
  bottom: 6rem;
  right: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 1.25rem;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  width: 320px;
  z-index: 999;
  opacity: 0;
  transform: translateY(20px);
  transition: var(--transition);
  pointer-events: none;
}

.search-overlay.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.search-box input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-primary);
  border: 2px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 12px;
  font-size: 0.95rem;
  transition: var(--transition);
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-box input::placeholder {
  color: var(--text-muted);
}

#searchResults {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0 0;
  max-height: 300px;
  overflow-y: auto;
  display: none;
}

#searchResults.visible {
  display: block;
}

#searchResults li {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: var(--transition);
  margin-bottom: 0.5rem;
  background: var(--bg-primary);
  text-transform: capitalize;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#searchResults li:hover {
  background: var(--accent-primary);
  color: white;
  transform: translateX(4px);
}

#searchResults li:hover .search-emoji {
  transform: scale(1.2);
}

.selected-suggestion {
  background: var(--accent-primary) !important;
  color: white !important;
  font-weight: 600;
}

.search-emoji {
  font-size: 1.2rem;
  flex-shrink: 0;
  transition: var(--transition);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.search-terme {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========================================
   CONTENU SIDEBAR (Acronymes, etc.)
   ======================================== */
.content-slidebar p span {
  text-decoration: none !important;
  font-style: italic;
  display: inline-block;
}

.section p {
  font-weight: bold;
  /* text-decoration: underline; */
}

.acronym-list {
  margin-top: 0.5rem;
  padding: 0 1rem;
}

.acronym-list .section-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin: 1.1rem 0 0.75rem 0;
  color: var(--text-primary);
  text-transform: uppercase;
  text-align: left;
  letter-spacing: 1.5px;
  padding: 0 0 0.5rem 0;
  border-bottom: 2px solid var(--border-color);
  position: relative;
  transition: var(--transition);
}

.acronym-list .section-title::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent-gradient);
  transition: var(--transition);
}

/* 
.acronym-list .section-title:hover::after {
  width: 100%;
} */

.section-title span {
  text-decoration: none !important;
  display: inline-block;
  user-select: none;
}

.acronym-entry {
  font-size: 0.95rem;
  color: var(--text-primary);
  padding: 0.3rem 0;
  user-select: none;
}

.acronym-entry span {
  color: var(--text-secondary);
  font-style: italic;
}

.acronym-list hr {
  margin: 0.2rem 0;
  border: none;
  border-top: 1px solid var(--border-color);
  opacity: 0.4;
}

.important::after {
  content: " ❤️";
  color: red;
  font-weight: bold;
  margin-left: 0.5ch;
}

.important.important-no-after::after {
  content: none !important;
}

.t-important::after {
  content: " ❤️❤️";
  color: red;
  font-weight: bold;
  margin-left: 0.5ch;
}

.important.important-no-after::after,
.t-important.important-no-after::after {
  content: none !important;
}

.important {
  color: #ff4444;
  font-weight: bold;
}

.important>span {
  font-weight: normal;
  color: var(--text-secondary);
  font-style: italic;
}

.acronym-entry.details {
  cursor: pointer;
  position: relative;
}

.acronym-description img {
  width: 100%;
}

.acronym-entry .acronym-description {
  display: none;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding-left: 1rem;
}

.acronym-entry.open .acronym-description {
  display: block;
}

.highlighted-acronym {
  background-color: var(--accent-primary) !important;
  padding: 0.2rem;
  border-radius: 6px;
  transition: background 0.3s ease;
}

.acronym-entry.highlighted {
  outline: 2px solid #ff4444;
  background-color: var(--bg-card);
  animation: flashHighlight 1.5s ease-out;
  border-radius: 6px;
  padding: 0.5rem;
}

.highlighted {
  background-color: var(--accent-primary);
  box-shadow: 0 0 8px var(--accent-primary);
  border-radius: 6px;
  transition: background 0.3s ease;
}

.search {
  background-color: var(--bg-card);
  border-left: 2px solid var(--accent-primary);
  padding-left: 0.75rem;
  border-radius: 2px;
  position: relative;
  animation: popSearch 0.3s ease;
}

@keyframes popSearch {
  0% {
    transform: scale(0.98);
    opacity: 0;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes flashHighlight {
  0% {
    background-color: rgba(255, 68, 68, 0.3);
  }

  100% {
    background-color: transparent;
  }
}

/* ========================================
   SWIPER (Documents)
   ======================================== */
.document-slide {
  background: var(--bg-card);
  padding: 1rem;
  width: 110px;
  height: 140px !important;
  border-radius: 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: var(--transition);
  border: 1px solid var(--border-color);
}

.document-slide:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

.document-slide a {
  text-decoration: none;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.doc-icon {
  font-size: 2rem;
  background: var(--accent-gradient);
  color: white;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 0.5rem;
}

.doc-title {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
  header {
    padding: 0 1rem;
    height: 70px;
  }
  .header-left-actions{
    height: 70px !important;
  }
  .header-text h1 {
    font-size: 1.35rem;
  }

  .header-text .subtitle {
    font-size: 0.75rem;
  }


  .section-title {
    font-size: 1.4rem;
  }

  .section-icon {
    font-size: 1.5rem;
  }

  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
  }

  .sidebar {
    width: 100%;
  }

  .search-overlay {
    right: 1rem;
    left: 1rem;
    width: auto;
  }

  .search-toggle-icon {
    right: 1rem;
    bottom: 1.5rem;
  }
}

@media (max-width: 480px) {
  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }

  .card {
    padding: 1.25rem 1rem;
  }

  .card-icon {
    font-size: 2.5rem;
  }

  .card-title {
    font-size: 0.95rem;
  }
}

/* ========================================
   SCROLLBAR PERSONNALISÉE
   ======================================== */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--accent-primary);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-secondary);
}

/* ========================================
   SHOW MORE
   ======================================== */
.show-more {
  display: contents;
}

/* Style pour les éléments .image dans show-more (compatibilité) */
.show-more .image {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.75rem 1.25rem;
  text-decoration: none;
  color: var(--text-primary);
  transition: var(--transition);
  cursor: pointer;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
  min-height: 120px;
}

.show-more .image::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--accent-gradient);
  transform: scaleX(0);
  transition: var(--transition);
}

.show-more .image:hover::before {
  transform: scaleX(1);
}

.show-more .image:hover {
  background: var(--bg-card-hover);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-primary);
}

.show-more .image.disable {
  opacity: 0.6;
  cursor: not-allowed;
}

.show-more .image.disable:hover {
  transform: none;
  box-shadow: var(--shadow-sm);
  border-color: var(--border-color);
}

/* ========================================
   SYSTÈME QCM
   ======================================== */

/* Bouton QCM flottant */
.qcm-toggle-icon {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  background: var(--accent-gradient);
  border: none;
  color: white;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  z-index: 999;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.qcm-toggle-icon:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 40px rgba(102, 126, 234, 0.4);
}

/* Sidebar de sélection QCM */
.qcm-selection-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 400px;
  height: 100vh;
  background: var(--bg-secondary);
  box-shadow: var(--shadow-lg);
  transform: translateX(-100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  visibility: hidden;
}

.qcm-selection-sidebar:not(.hidden) {
  transform: translateX(0);
  visibility: visible;
}

.qcm-selection-sidebar.hidden {
  visibility: hidden;
}

/* Décaler le contenu quand la sidebar QCM est ouverte */
.qcm-selection-mode main {
  margin-left: 400px;
  transition: margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.qcm-sidebar-header {
  position: sticky;
  top: 0;
  background: var(--bg-header);
  padding: 1.5rem;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.qcm-sidebar-title-container {
  flex: 1;
}

.qcm-sidebar-title {
  color: white;
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 0.25rem 0;
}

.qcm-sidebar-subtitle {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.85rem;
  margin: 0;
  font-weight: 400;
}

.qcm-sidebar-content {
  flex: 1;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.qcm-selection-info-box {
  background: var(--bg-card);
  border: 2px solid #667eea38;
  border-radius: 12px;
  padding: 0 1rem 0 1rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.qcm-info-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.qcm-info-text {
  flex: 1;
}

.qcm-info-text strong {
  display: block;
  color: var(--text-primary);
  /* margin-bottom: 0.5rem; */
  font-size: 0.95rem;
  padding: 0.6rem 0;
}

.qcm-info-text p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin: 0;
  line-height: 1.5;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.5rem 0 0.8rem 0;
}

.qcm-selection-counter-box {
  display: flex;
  flex-direction: row;
  background: var(--bg-card);
  border: 2px solid #667eea38;
  border-radius: 12px;
  padding: 1.25rem;
  text-align: center;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
}

.qcm-counter-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
  /* margin-bottom: 0.5rem; */
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.qcm-counter-value {
  font-size: 0.9rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.qcm-selected-themes {
  flex: 1;
  background: var(--bg-card);
  border-radius: 12px;
  padding: 1rem;
  min-height: 200px;
  max-height: 400px;
  overflow-y: auto;
}

.qcm-no-selection {
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
  margin: 2rem 0;
}

.qcm-theme-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
}

.qcm-theme-item:hover {
  border-color: var(--accent-primary);
  transform: translateX(4px);
}

.qcm-theme-name {
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.qcm-theme-icon {
  font-size: 1.2rem;
}

.qcm-theme-remove {
  background: rgba(239, 68, 68, 0.1);
  border: none;
  color: #ef4444;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  /* align-items: center; */
  justify-content: center;
  transition: var(--transition);
  font-size: 1.2rem;
  line-height: 1;
}

.qcm-theme-remove:hover {
  background: #ef4444;
  color: white;
  transform: scale(1.1);
}

.qcm-options-box {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.qcm-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
}

.qcm-checkbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--accent-primary);
}

.qcm-checkbox-text {
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 500;
}

.qcm-sidebar-actions {
  position: sticky;
  bottom: 0;
  background: var(--bg-secondary);
  padding: 1rem 0 1rem 0;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.qcm-action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.qcm-btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.qcm-btn-secondary {
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
}

.qcm-btn-secondary svg {
  width: 16px;
  height: 16px;
}

.qcm-btn-primary {
  background: var(--accent-gradient);
  color: white;
}

.qcm-btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.qcm-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.qcm-btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 2px solid var(--border-color);
}

.qcm-btn-secondary:hover:not(:disabled) {
  background: var(--bg-secondary);
  border-color: var(--accent-primary);
}

.qcm-btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.qcm-btn-large {
  width: 100%;
  padding: 1rem 1.5rem;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.qcm-btn-large svg {
  flex-shrink: 0;
}

/* Cartes en mode sélection */
.qcm-selection-mode .card:not(.disable):not(.wait) {
  cursor: pointer;
  position: relative;
  opacity: 1 !important;
  border: 2px solid var(--accent-primary);
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.2);
  animation: pulse-border 2s ease-in-out infinite;
}

.qcm-selection-mode .card:not(.disable):not(.wait):hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
  border-color: var(--accent-secondary);
}

@keyframes pulse-border {

  0%,
  100% {
    border-color: var(--accent-primary);
  }

  50% {
    border-color: var(--accent-secondary);
  }
}

.qcm-selection-mode .card.disable,
.qcm-selection-mode .card.wait {
  opacity: 0.2;
  pointer-events: none;
  filter: grayscale(1);
}

.qcm-selection-mode .card.qcm-selected {
  border: 3px solid var(--accent-primary);
  background: var(--bg-card-hover);
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 12px 32px rgba(102, 126, 234, 0.5);
  animation: none;
}

.qcm-selection-mode .card.qcm-selected::after {
  content: '✓';
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--accent-primary);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.2rem;
  box-shadow: var(--shadow-md);
  animation: checkmark-pop 0.3s ease-out;
}

@keyframes checkmark-pop {
  0% {
    transform: scale(0);
  }

  50% {
    transform: scale(1.2);
  }

  100% {
    transform: scale(1);
  }
}

/* Badge compteur de questions */
.qcm-question-count {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background: rgba(102, 126, 234, 0.15);
  color: var(--accent-primary);
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  z-index: 10;
  border: 1px solid rgba(102, 126, 234, 0.3);
  opacity: 0.7;
  transition: var(--transition);
}

.qcm-selection-mode .card:not(.disable):not(.wait):hover .qcm-question-count {
  opacity: 1;
  background: rgba(102, 126, 234, 0.25);
  border-color: var(--accent-primary);
}

.qcm-selection-mode .card.qcm-selected .qcm-question-count {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.4);
  opacity: 1;
}

/* Modal QCM */
.qcm-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(10px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.qcm-modal:not(.hidden) {
  opacity: 1;
  pointer-events: all;
}

.qcm-modal-content {
  background: var(--bg-secondary);
  border-radius: 20px;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.qcm-header {
  background: var(--bg-header);
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.qcm-header > div:last-child {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.qcm-progress {
  color: white;
  font-size: 1.2rem;
  font-weight: 600;
}

.qcm-close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.qcm-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  /* transform: rotate(90deg); */
}

.qcm-body {
  padding: 2rem;
  flex: 1;
  overflow-y: auto;
}

.qcm-question-indicator {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  justify-content: center;
}

.qcm-indicator-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border-color);
  transition: var(--transition);
  cursor: pointer;
}

.qcm-indicator-dot:hover {
  transform: scale(1.3);
}

.qcm-indicator-dot.answered {
  background: var(--accent-primary);
}

.qcm-indicator-dot.current {
  background: var(--accent-primary);
  transform: scale(1.5);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

.qcm-question {
  font-size: 1.5rem;
  color: var(--text-primary);
  margin-bottom: 2rem;
  text-align: center;
  line-height: 1.4;
}

.qcm-answers {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.qcm-answer {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 1rem;
  position: relative;
}

.qcm-answer:hover {
  border-color: var(--accent-primary);
  background: var(--bg-card-hover);
  transform: translateX(8px);
}

.qcm-answer.selected {
  border-color: var(--accent-primary);
  background: rgba(102, 126, 234, 0.15);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.qcm-answer-letter {
  background: var(--accent-gradient);
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.qcm-answer-text {
  flex: 1;
  font-size: 1.05rem;
  color: var(--text-primary);
}

.qcm-footer {
  padding: 1.5rem 2rem;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.qcm-nav-btn {
  padding: 0.75rem 1.5rem;
  border: 2px solid var(--border-color);
  background: transparent;
  color: var(--text-primary);
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.qcm-nav-btn:hover:not(:disabled) {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.qcm-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.qcm-finish-btn {
  display: flex;
  background: var(--accent-gradient);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.qcm-finish-btn.hidden {
  display: none !important;
}

.qcm-finish-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Modal Alerte QCM Incomplet */
.qcm-alert-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  z-index: 2002;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.qcm-alert-modal:not(.hidden) {
  opacity: 1;
  pointer-events: all;
}

.qcm-alert-content {
  background: var(--bg-secondary);
  border-radius: 20px;
  padding: 2.5rem;
  max-width: 500px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.qcm-alert-modal:not(.hidden) .qcm-alert-content {
  transform: scale(1);
}

.qcm-alert-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

.qcm-alert-title {
  font-size: 1.75rem;
  color: var(--text-primary);
  margin-bottom: 1rem;
  font-weight: 700;
}

.qcm-alert-message {
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.6;
  margin-bottom: 2rem;
}

.qcm-alert-message strong {
  color: #ef4444;
  font-weight: 700;
}

.qcm-alert-actions {
  display: flex;
  gap: 1rem;
  flex-direction: column;
}

.qcm-alert-actions .qcm-btn {
  width: 100%;
  padding: 1rem 1.5rem;
  font-size: 1.05rem;
}

/* Modal Résultats */
.qcm-results-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(10px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.qcm-results-modal:not(.hidden) {
  opacity: 1;
  pointer-events: all;
}

.qcm-results-content {
  background: var(--bg-secondary);
  border-radius: 20px;
  width: 90%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.qcm-results-header {
  background: var(--bg-header);
  padding: 2rem;
  text-align: center;
}

.qcm-results-header h2 {
  color: white;
  font-size: 2rem;
  margin: 0;
}

.qcm-results-body {
  padding: 2rem;
}

.qcm-score-display {
  text-align: center;
  margin-bottom: 2rem;
}

.qcm-score-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: white;
  font-size: 3rem;
  font-weight: bold;
  margin-bottom: 1.5rem;
  box-shadow: 0 8px 32px rgba(102, 126, 234, 0.4);
  animation: scaleIn 0.5s ease-out;
}

@keyframes scaleIn {
  from {
    transform: scale(0);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.qcm-score-bar {
  width: 100%;
  height: 24px;
  background: var(--bg-card);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

.qcm-score-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 12px;
  transition: width 1s ease-out;
  width: 0;
}

.qcm-score-fill.score-low {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.qcm-score-fill.score-medium {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.qcm-score-fill.score-high {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.qcm-results-details {
  margin-top: 2rem;
}

.qcm-result-item {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  border-left: 4px solid var(--border-color);
}

.qcm-result-item.correct {
  border-left-color: #10b981;
  background: rgba(16, 185, 129, 0.1);
}

.qcm-result-item.incorrect {
  border-left-color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.qcm-result-question {
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.qcm-result-answer {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.qcm-result-answer.user-answer {
  color: var(--text-primary);
}

.qcm-result-answer.correct-answer {
  color: #10b981;
  font-weight: 600;
}

.qcm-result-status {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.qcm-result-status.correct {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}

.qcm-result-status.incorrect {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.qcm-results-footer {
  padding: 2rem;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Responsive QCM */
@media (max-width: 768px) {
  .qcm-toggle-icon {
    left: 1rem;
    bottom: 1.5rem;
    width: 50px;
    height: 50px;
  }

  /* Panneau QCM en bas sur mobile */
  .qcm-selection-sidebar {
    width: 100%;
    height: auto;
    max-height: 40vh;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    transform: translateY(100%);
    border-radius: 20px 20px 0 0;
  }

  .qcm-selection-sidebar:not(.hidden) {
    transform: translateY(0);
  }

  /* Pas de décalage sur mobile */
  .qcm-selection-mode main {
    margin-left: 0;
    margin-bottom: 0;
  }

  .qcm-sidebar-header {
    padding: 1rem 1.5rem;
    border-radius: 20px 20px 0 0;
  }

  .qcm-sidebar-title {
    font-size: 1rem;
  }

  .qcm-sidebar-subtitle {
    display: none;
  }

  .qcm-sidebar-content {
    padding: 1rem 1.5rem;
    gap: 1rem;
  }

  /* Masquer la boîte d'info sur mobile */
  .qcm-selection-info-box {
    display: none;
  }

  /* Masquer la liste des thèmes sélectionnés sur mobile */
  .qcm-selected-themes {
    display: none;
  }

  .qcm-selection-counter-box {
    padding: 0.75rem 1rem;
  }

  .qcm-counter-label {
    font-size: 0.8rem;
  }

  .qcm-counter-value {
    font-size: 1.8rem;
  }

  .qcm-sidebar-actions {
    padding: 0;
    border-top: none;
  }

  .qcm-btn-large {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
  }

  .qcm-modal-content {
    width: 95%;
  }

  .qcm-body {
    padding: 1.5rem;
  }

  .qcm-question {
    font-size: 1.2rem;
  }

  .qcm-answer {
    padding: 1rem;
  }

  .qcm-footer {
    flex-direction: column;
  }

  .qcm-nav-btn {
    width: 100%;
  }

  .qcm-score-circle {
    width: 140px;
    height: 140px;
    font-size: 2.5rem;
  }

  .qcm-results-footer {
    flex-direction: column;
  }

  .qcm-btn {
    width: 100%;
  }
}

/* ========================================
   MODAL STATISTIQUES
   ======================================== */
.stats-toggle {
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  color: white;
  
}

.stats-toggle:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

.stats-toggle svg {
  stroke: currentColor;
}

.stats-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.stats-modal:not(.hidden) {
  opacity: 1;
  pointer-events: all;
}

.stats-modal-content {
  background: var(--bg-secondary);
  border-radius: 20px;
  width: 90%;
  max-width: 1000px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stats-modal:not(.hidden) .stats-modal-content {
  transform: scale(1);
}

.stats-header {
  background: var(--accent-gradient);
  padding: 1.5rem 2rem;
  border-radius: 20px 20px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}

.stats-header h2 {
  margin: 0;
  font-size: 1.75rem;
  color: white;
}

.stats-close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.5rem;
  color: white;
  transition: var(--transition);
}

.stats-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  /* transform: rotate(90deg); */
}

.stats-body {
  padding: 2rem;
}

/* Vue d'ensemble - Cartes de stats */
.stats-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border: 2px solid var(--border-color);
  transition: var(--transition);
}

.stat-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  font-size: 2.5rem;
  line-height: 1;
}

.stat-content {
  flex: 1;
}

.stat-value {
  font-size: 2rem;
  font-weight: bold;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* Graphique de progression */
.stats-chart-container {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  border: 2px solid var(--border-color);
}

.stats-chart-container h3 {
  margin: 0 0 1.5rem 0;
  font-size: 1.25rem;
  color: var(--text-primary);
}

#statsChart {
  max-height: 300px;
}

/* Statistiques par thème */
.stats-themes {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  border: 2px solid var(--border-color);
}

.stats-themes h3 {
  margin: 0 0 1.5rem 0;
  font-size: 1.25rem;
  color: var(--text-primary);
}

.stats-themes-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.theme-stat-item {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border: 1px solid var(--border-color);
}

.theme-stat-icon {
  font-size: 1.5rem;
}

.theme-stat-info {
  flex: 1;
}

.theme-stat-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.theme-stat-details {
  display: flex;
  gap: 1.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.theme-stat-score {
  font-weight: 600;
  font-size: 1.1rem;
}

.theme-stat-score.mastered {
  color: #10b981;
}

.theme-stat-score.good {
  color: #3b82f6;
}

.theme-stat-score.needs-work {
  color: #f59e0b;
}

.theme-stat-score.weak {
  color: #ef4444;
}

.theme-stat-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.theme-stat-badge.mastered {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.theme-stat-badge.needs-work {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

/* Derniers QCM */
.stats-recent {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 1.5rem;
  border: 2px solid var(--border-color);
}

.stats-recent h3 {
  margin: 0 0 1.5rem 0;
  font-size: 1.25rem;
  color: var(--text-primary);
}

.stats-recent-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.recent-qcm-item {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.recent-qcm-item {
  cursor: pointer;
}

.recent-qcm-item:hover {
  border-color: var(--accent-primary);
  transform: translateX(4px);
}

.recent-qcm-info {
  flex: 1;
}

.recent-qcm-themes {
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.recent-qcm-date {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.recent-qcm-score {
  font-size: 1.5rem;
  font-weight: bold;
  padding: 0.5rem 1rem;
  border-radius: 12px;
  min-width: 80px;
  text-align: center;
}

.recent-qcm-score.excellent {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.recent-qcm-score.good {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.recent-qcm-score.average {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.recent-qcm-score.poor {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.stats-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
}

.stats-empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.stats-empty-text {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.stats-empty-hint {
  font-size: 0.9rem;
  color: var(--text-muted);
}

#nbQuestion{
background: var(--bg-card);
  border: 2px solid #667eea38;
  color: var(--text-secondary);
  padding: 1rem;
  border-radius: 12px;
}
/* Responsive */
@media (max-width: 768px) {
  .stats-modal-content {
    width: 95%;
    max-height: 95vh;
  }

  .stats-header {
    padding: 1rem 1.5rem;
  }

  .stats-header h2 {
    font-size: 1.5rem;
  }

  .stats-body {
    padding: 1.5rem;
  }

  .stats-overview {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .stat-card {
    padding: 1rem;
  }

  .stat-icon {
    font-size: 2rem;
  }

  .stat-value {
    font-size: 1.5rem;
  }

  .theme-stat-details {
    flex-direction: column;
    gap: 0.5rem;
  }

  .recent-qcm-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .recent-qcm-score {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .stats-overview {
    grid-template-columns: 1fr;
  }
}