/* Variables CSS */
:root {
  --primary-color: #4f46e5;
  --primary-light: #818cf8;
  --primary-dark: #3730a3;
  --primary-hover: #4338ca;
  --secondary-color: #06b6d4;
  --success-color: #10b981;
  --success-hover: #059669;
  --success-bg: #f0fdf4;
  --warning-color: #f59e0b;
  --warning-bg: #fffbeb;
  --error-color: #ef4444;
  --danger-color: #dc2626;
  --danger-hover: #b91c1c;
  --info-bg: #eff6ff;

  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-accent: #f1f5f9;

  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;

  --border-color: #e2e8f0;
  --border-light: #f1f5f9;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1),
    0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1),
    0 8px 10px -6px rgb(0 0 0 / 0.1);

  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;

  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
}

/* Reset et base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* Container principal */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--spacing-lg) var(--spacing-xl);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary-color);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  cursor: pointer;
  transition: all 0.3s ease;
}

.logo:hover {
  color: var(--primary-dark);
  transform: scale(1.05);
}

.beta-badge {
  background: linear-gradient(135deg, #ff6b6b, #ff8e8e);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 4px rgba(255, 107, 107, 0.3);
  animation: pulse 2s infinite;
  margin-left: var(--spacing-xs);
}

@keyframes pulse {
  0% {
    box-shadow: 0 2px 4px rgba(255, 107, 107, 0.3);
  }
  50% {
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.5);
  }
  100% {
    box-shadow: 0 2px 4px rgba(255, 107, 107, 0.3);
  }
}

.nav {
  display: flex;
  gap: var(--spacing-sm);
}

.nav-btn {
  background: transparent;
  border: 2px solid transparent;
  padding: var(--spacing-sm) var(--spacing-lg);
  border-radius: var(--radius-lg);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.nav-btn:hover {
  background: var(--bg-accent);
  color: var(--text-primary);
}

.nav-btn.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* Style spécifique pour le bouton À propos */
#about-btn {
  background: var(--bg-secondary);
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
  font-weight: 600;
}

#about-btn:hover {
  background: var(--primary-color);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Style spécifique pour le bouton Contribuer */
#contribute-btn {
  background: var(--success-color);
  border: 2px solid var(--success-color);
  color: white;
  font-weight: 600;
}

#contribute-btn:hover {
  background: var(--success-hover);
  border-color: var(--success-hover);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

#contribute-btn:active {
  background: var(--success-color);
  color: white;
  transform: translateY(0);
}

/* Main content */
.main-content {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--spacing-xl);
  width: 100%;
}

.content-section {
  display: none;
}

.content-section.active {
  display: block;
}

/* Filtres */
.filters-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-lg);
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  padding: var(--spacing-xl);
  margin-bottom: var(--spacing-xl);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
}

/* Colonne de gauche : BA et Matières */
.filters-left {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

/* Colonne de droite : Tags */
.filters-right {
  display: flex;
  flex-direction: column;
}

/* Filtres BA (Bloc d'Année) */
.ba-filter {
  margin-bottom: 0;
  padding: var(--spacing-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.ba-filter h3 {
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: var(--spacing-md);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.ba-buttons {
  display: flex;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}

.subject-filter {
  margin-bottom: 0;
  padding: var(--spacing-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  /* Retrait du scroll ici: le scroll se fait désormais sur .subject-buttons */
}

/* Scrollbar inherits global styles; custom rules removed intentionally */

/* Titres filtres (matières & tags) */
.subject-filter h3,
.tags-filter h3 {
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: var(--spacing-md);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.tags-filter {
  margin-bottom: 0;
  padding: var(--spacing-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.subject-buttons {
  display: flex;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
  max-height: 160px; /* même hauteur qu'avant pour la zone scrollable */
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px; /* un léger espace pour la scrollbar verticale */
  /* Indiquer explicitement une scrollbar fine (Firefox) */
  scrollbar-width: thin;
  scrollbar-color: var(--primary-color) transparent;
}

@media (max-width: 600px) {
  .subject-buttons {
    max-height: 120px; /* hauteur réduite sur mobile pour laisser plus de place au contenu */
  }
}

/* Scrollbar verticale spécifique à la liste des matières */
.subject-buttons::-webkit-scrollbar {
  width: 8px;
}

.subject-buttons::-webkit-scrollbar-track {
  background: transparent; /* garder le fond neutre */
  border-radius: 8px;
}

.subject-buttons::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 8px;
  border: 2px solid var(--bg-secondary); /* anneau pour contraste */
}

.subject-buttons::-webkit-scrollbar-thumb:hover {
  background: var(--primary-light);
}

.subject-btn {
  background: var(--bg-primary);
  border: 2px solid var(--border-color);
  padding: var(--spacing-sm) var(--spacing-lg);
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 80px;
  text-align: center;
}

.subject-btn:hover {
  border-color: var(--primary-light);
  color: var(--primary-color);
}

.subject-btn.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

/* Styles pour les boutons de BA */
.ba-btn {
  background: var(--bg-primary);
  border: 2px solid var(--border-color);
  padding: var(--spacing-sm) var(--spacing-lg);
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 60px;
  text-align: center;
}

.ba-btn:hover {
  border-color: var(--primary-light);
  color: var(--primary-color);
}

.ba-btn.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

.search-box {
  position: relative;
  margin-bottom: var(--spacing-md);
}

.search-box input {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-lg);
  padding-right: 3rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  font-size: 0.95rem;
  transition: border-color 0.2s ease;
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.search-box i {
  position: absolute;
  right: var(--spacing-lg);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  max-height: 200px;
  overflow-y: auto;
}

.tag {
  background: var(--bg-accent);
  border: 1px solid var(--border-color);
  padding: var(--spacing-xs) var(--spacing-md);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tag:hover {
  background: var(--primary-light);
  color: white;
  border-color: var(--primary-light);
}

.tag.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* Examens */
.exams-container {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  padding: var(--spacing-xl);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
}

.exams-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-xl);
  padding-bottom: var(--spacing-lg);
  border-bottom: 1px solid var(--border-light);
}

.exams-header h2 {
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.results-count {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.exams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: var(--spacing-lg);
}

.exam-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  cursor: pointer;
  transition: all 0.2s ease;
}

.exam-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

.exam-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--spacing-md);
}

.exam-actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.exam-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

.exam-year {
  background: var(--primary-color);
  color: white;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
}

.exam-subject {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: var(--spacing-sm);
}

.exam-file-info {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: var(--spacing-sm);
  font-style: italic;
}

.exam-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
  margin-top: var(--spacing-sm);
}

.exam-tag {
  background: var(--bg-accent);
  color: var(--text-secondary);
  padding: 2px var(--spacing-sm);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
}

.exam-actions {
  display: flex;
  gap: var(--spacing-sm);
}

.has-correction {
  background: var(--success-color);
  color: white;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
}

.btn-edit-exam,
.btn-delete-exam {
  background: var(--error-color);
  color: white;
  border: none;
  padding: var(--spacing-xs);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  font-size: 0.75rem;
  opacity: 1;
}

.btn-edit-exam {
  background: var(--secondary-color);
}

.btn-edit-exam:hover {
  background: #0891b2;
  opacity: 1;
  transform: scale(1.1);
}

.btn-delete-exam:hover {
  background: #dc2626;
  opacity: 1;
  transform: scale(1.1);
}

.exam-card:hover .btn-edit-exam,
.exam-card:hover .btn-delete-exam {
  opacity: 1;
  transform: scale(1.1);
}

.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--spacing-2xl);
  color: var(--text-muted);
}

.no-results i {
  font-size: 3rem;
  margin-bottom: var(--spacing-lg);
  opacity: 0.5;
}

.no-results h3 {
  font-size: 1.25rem;
  margin-bottom: var(--spacing-sm);
}

/* Upload Section */
.upload-container {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  padding: var(--spacing-xl);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
  max-width: 600px;
  margin: 0 auto;
}

.upload-container h2 {
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: var(--spacing-xl);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  text-align: center;
  justify-content: center;
}

.upload-form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.form-group label {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.form-group input,
.form-group select {
  padding: var(--spacing-md);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  font-size: 0.95rem;
  transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-color);
}

.form-group small {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: var(--spacing-md) var(--spacing-xl);
  border-radius: var(--radius-lg);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 2px solid var(--border-color);
  padding: var(--spacing-md) var(--spacing-xl);
  border-radius: var(--radius-lg);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
}

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

/* Boutons de gestion des fichiers */
.storage-info {
  position: fixed;
  bottom: var(--spacing-lg);
  right: var(--spacing-lg);
  z-index: 1000;
  display: flex;
  gap: var(--spacing-sm);
  flex-direction: column;
}

/* File upload areas */
.file-upload-area {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
  background: var(--bg-color);
  position: relative; /* Important pour contenir les inputs absolus */
}

.file-upload-area.dragover {
  border-color: var(--primary-color);
  background: var(--primary-light);
}

.file-upload-area.file-selected {
  border-color: var(--success-color);
  background: rgba(34, 197, 94, 0.1);
}

.file-upload-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-sm);
}

.file-upload-content i {
  font-size: 2rem;
  color: var(--text-muted);
}

.file-upload-area.file-selected .file-upload-content i {
  color: var(--success-color);
}

.file-upload-content p {
  margin: 0;
  font-weight: 500;
  color: var(--text-color);
}

.file-info {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: var(--spacing-xs);
}

.file-upload-area input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* API Key container */
.api-key-container {
  display: flex;
  gap: var(--spacing-sm);
  align-items: stretch;
}

.api-key-container input {
  flex: 1;
}

.btn-clear-api {
  background: var(--error-color);
  color: white;
  border: none;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
}

.btn-clear-api:hover {
  background: #dc2626;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-clear-api:active {
  transform: translateY(0);
}

/* Progress bar */
.progress-container {
  margin-top: var(--spacing-lg);
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-accent);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(
    90deg,
    var(--primary-color),
    var(--secondary-color)
  );
  width: 0%;
  transition: width 0.3s ease;
}

#progress-text {
  text-align: center;
  margin-top: var(--spacing-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Messages de notification */
.message-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  max-width: 400px;
}

.message {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-weight: 500;
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.message.visible {
  transform: translateX(0);
  opacity: 1;
}

.message.success-message {
  background: linear-gradient(
    135deg,
    rgba(16, 185, 129, 0.95),
    rgba(5, 150, 105, 0.95)
  );
  color: white;
  border-color: rgba(16, 185, 129, 0.3);
}

.message.error-message {
  background: linear-gradient(
    135deg,
    rgba(239, 68, 68, 0.95),
    rgba(220, 38, 38, 0.95)
  );
  color: white;
  border-color: rgba(239, 68, 68, 0.3);
}

.message i {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.message span {
  flex: 1;
  font-size: 0.95rem;
}

/* Animations */
@keyframes fileSelected {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
  }
  100% {
    transform: scale(1);
  }
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 1000px;
  max-height: 90%;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-lg) var(--spacing-xl);
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.btn-delete-modal {
  background: var(--error-color);
  color: white;
  border: none;
  padding: var(--spacing-sm);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.btn-delete-modal:hover {
  background: #dc2626;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--spacing-sm);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--bg-accent);
  color: var(--text-primary);
}

.modal-body {
  padding: var(--spacing-xl);
}

/* Footer Styles */
.app-footer {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  color: white;
  padding: var(--spacing-xl) 0 var(--spacing-lg);
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--spacing-xl);
  margin-bottom: var(--spacing-lg);
}

.footer-section {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.footer-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  color: white;
}

.footer-subtitle {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 var(--spacing-sm) 0;
  color: rgba(255, 255, 255, 0.9);
}

.footer-description {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.8);
  margin: 0;
  line-height: 1.5;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.footer-links li {
  margin: 0;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  transition: color 0.3s ease;
}

.footer-links a:hover {
  color: white;
  text-decoration: underline;
}

.footer-links a i {
  width: 16px;
  text-align: center;
}

.footer-contact {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.footer-contact-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
}

.footer-contact-item i {
  width: 16px;
  text-align: center;
}

.footer-contact-item a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-contact-item a:hover {
  color: white;
  text-decoration: underline;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: var(--spacing-lg);
  text-align: center;
  max-width: 1200px;
  margin: 0 auto;
  padding-left: var(--spacing-lg);
  padding-right: var(--spacing-lg);
}

.footer-disclaimer {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
  margin: 0 0 var(--spacing-sm) 0;
  font-weight: 500;
  padding: var(--spacing-sm);
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  border-left: 4px solid rgba(255, 255, 255, 0.3);
}

.footer-feedback {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.9);
  margin: 0 0 var(--spacing-sm) 0;
  font-style: italic;
  padding: var(--spacing-sm);
  background: rgba(34, 197, 94, 0.1);
  border-radius: var(--radius-sm);
  border-left: 4px solid rgba(34, 197, 94, 0.4);
  text-align: center;
}

.footer-copyright {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
  margin: 0 0 var(--spacing-xs) 0;
}

.footer-additional {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
  margin: 0;
  font-style: italic;
}

/* Responsive Footer */
@media (max-width: 768px) {
  .footer-content {
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
    text-align: center;
  }

  .footer-links {
    align-items: center;
  }

  .footer-contact {
    align-items: center;
  }

  .footer-contact-item {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .app-footer {
    padding: var(--spacing-lg) 0;
  }

  .footer-content {
    padding: 0 var(--spacing-md);
  }

  .footer-bottom {
    padding-left: var(--spacing-md);
    padding-right: var(--spacing-md);
  }
}

.exam-tabs {
  display: flex;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-lg);
}

.tab-btn {
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  padding: var(--spacing-sm) var(--spacing-lg);
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  border-color: var(--primary-light);
  color: var(--primary-color);
}

.tab-btn.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

.pdf-viewer {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  margin-bottom: var(--spacing-lg);
}

.exercise-tags {
  background: var(--bg-secondary);
  padding: var(--spacing-lg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.exercise-tags h4 {
  margin-bottom: var(--spacing-md);
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
}

.exercise-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.exercise-item {
  background: var(--bg-primary);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.exercise-title {
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: var(--spacing-sm);
}

.exercise-item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
}

/* Section Exercices */
.exercises-container {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  padding: var(--spacing-xl);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
}

.exercises-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
  padding-bottom: var(--spacing-lg);
  border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap;
}

.btn-back {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: var(--spacing-sm) var(--spacing-lg);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: 0.9rem;
  font-weight: 500;
}

.btn-back:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.exercises-header h2 {
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
  flex: 1;
}

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}

.filter-tag {
  background: var(--primary-color);
  color: white;
  padding: var(--spacing-xs) var(--spacing-md);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.filter-tag .remove-filter {
  background: rgba(255, 255, 255, 0.3);
  border: none;
  color: white;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.7rem;
}

.filter-tag .remove-filter:hover {
  background: rgba(255, 255, 255, 0.5);
}

.exercises-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: var(--spacing-lg);
}

.exercise-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  transition: all 0.2s ease;
}

.exercise-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

.exercise-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--spacing-md);
}

.exercise-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  flex: 1;
}

.exercise-source {
  color: var(--text-muted);
  font-size: 0.8rem;
  background: var(--bg-accent);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  margin-left: var(--spacing-sm);
}

.exercise-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
  margin-top: var(--spacing-sm);
}

.exercise-tag {
  background: white;
  color: var(--text-primary);
  border: 1px solid var(--primary-color);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.exercise-tag:hover {
  background: var(--primary-color);
  color: white;
  transform: translateY(-1px);
}

/* Styles spéciaux pour les cartes d'exercices */
.qcm-card {
  border-left: 4px solid #3b82f6; /* Bleu pour QCM */
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.05) 0%,
    var(--bg-secondary) 100%
  );
}

.qcm-card:hover {
  border-left-color: #2563eb;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.truefalse-card {
  border-left: 4px solid #f59e0b; /* Orange pour Vrai/Faux */
  background: linear-gradient(
    135deg,
    rgba(245, 158, 11, 0.05) 0%,
    var(--bg-secondary) 100%
  );
}

.truefalse-card:hover {
  border-left-color: #d97706;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15);
}

.open-card {
  border-left: 4px solid #10b981; /* Vert pour exercices ouverts */
  background: linear-gradient(
    135deg,
    rgba(16, 185, 129, 0.05) 0%,
    var(--bg-secondary) 100%
  );
}

.open-card:hover {
  border-left-color: #059669;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

/* Numérotation des exercices */
.exercise-number {
  background: var(--primary-color);
  color: white;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  margin-right: var(--spacing-sm);
  display: inline-block;
}

.exercise-title {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.exercise-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  width: fit-content;
}

.exercise-title-text {
  font-weight: 600;
  color: var(--text-primary);
}

.exercise-points {
  font-weight: 700;
  color: var(--warning-color);
  font-size: 0.9em;
  margin: 0;
  padding: var(--spacing-xs) var(--spacing-sm);
  background-color: rgba(255, 193, 7, 0.15);
  border: 2px solid var(--warning-color);
  border-radius: var(--radius-md);
  display: inline-block;
  opacity: 1;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  width: fit-content;
}

/* Champ durée de l'examen */
.form-help {
  display: block;
  margin-top: var(--spacing-xs);
  font-size: 0.8em;
  color: var(--text-secondary);
  font-style: italic;
}

/* Temps de l'exercice */
.exercise-time {
  display: inline-block;
  margin-left: var(--spacing-sm);
  padding: var(--spacing-xs) var(--spacing-sm);
  background-color: var(--primary-color);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 0.85em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Actions des exercices */
.exercise-actions {
  display: flex;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-md);
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--border-color);
}

/* Styles pour l'admin */
.admin-btn {
  background-color: var(--primary-color);
  color: white;
}

.admin-btn:hover {
  background-color: var(--primary-hover);
}

/* Bouton statistiques (admin uniquement) */
#stats-logs-btn {
  background-color: var(--secondary-color);
  color: white;
}

#stats-logs-btn:hover {
  background-color: #0891b2;
}

/* Classe pour masquer les éléments admin */
.admin-hidden {
  display: none !important;
}

/* Modale admin */
#admin-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}

#admin-modal.active {
  display: flex;
}

.admin-modal-content {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  box-shadow: var(--shadow-xl);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Contenu scrollable de la modal admin */
#admin-modal .modal-body {
  overflow-y: auto;
  flex: 1;
  padding: var(--spacing-xl);
  max-height: calc(90vh - 120px); /* Hauteur totale moins header et footer */
}

/* Header de la modal admin */
#admin-modal .modal-header {
  flex-shrink: 0;
  padding: var(--spacing-xl);
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-primary);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

/* Améliorer l'apparence du scroll dans la modal admin */
#admin-modal .modal-body::-webkit-scrollbar {
  width: 6px;
}

#admin-modal .modal-body::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 3px;
}

#admin-modal .modal-body::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 3px;
}

#admin-modal .modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--primary-hover);
}

/* Responsive pour la modal admin */
@media (max-width: 768px) {
  .admin-modal-content {
    width: 95%;
    max-height: 95vh;
    margin: var(--spacing-sm);
  }

  #admin-modal .modal-body {
    max-height: calc(95vh - 100px);
    padding: var(--spacing-md);
  }

  #admin-modal .modal-header {
    padding: var(--spacing-md);
  }
}

.admin-form {
  margin-bottom: var(--spacing-lg);
}

/* Interface de configuration du mot de passe */
.password-setup {
  text-align: center;
}

.setup-header {
  margin-bottom: var(--spacing-xl);
  padding: var(--spacing-lg);
  background: var(--info-bg);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--primary-color);
}

.setup-header h3 {
  color: var(--primary-color);
  margin-bottom: var(--spacing-sm);
}

.setup-header p {
  color: var(--text-secondary);
  margin: 0;
}

.setup-info {
  margin-top: var(--spacing-lg);
  padding: var(--spacing-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--warning-color);
}

.setup-info p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9em;
}

.setup-info i {
  color: var(--warning-color);
  margin-right: var(--spacing-xs);
}

.admin-info {
  margin-top: var(--spacing-md);
  padding: var(--spacing-md);
  background-color: var(--info-bg);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--primary-color);
}

.admin-info code {
  background-color: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: monospace;
  font-weight: 600;
}

.text-small {
  font-size: 0.85em;
  color: var(--text-muted);
  margin-top: var(--spacing-xs);
}

/* Panneau admin */
.admin-panel {
  animation: fadeIn 0.3s ease-in;
}

.admin-welcome {
  text-align: center;
  margin-bottom: var(--spacing-lg);
  padding: var(--spacing-md);
  background-color: var(--success-bg);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--success-color);
}

.admin-welcome h4 {
  color: var(--success-color);
  margin-bottom: var(--spacing-xs);
}

.admin-login-time {
  color: var(--text-secondary);
  font-size: 0.9em;
}

.admin-actions {
  border-top: 1px solid var(--border-color);
  padding-top: var(--spacing-lg);
}

.admin-actions h4 {
  margin-bottom: var(--spacing-md);
  color: var(--text-primary);
}

.admin-action {
  margin-bottom: var(--spacing-md);
}

.admin-action button {
  width: 100%;
  justify-content: center;
}

.btn-danger {
  background-color: var(--danger-color);
  color: white;
  border: 1px solid var(--danger-color);
}

.btn-danger:hover {
  background-color: var(--danger-hover);
  border-color: var(--danger-hover);
}

.btn-warning {
  background-color: var(--warning-color);

  color: white;
  border: 1px solid var(--warning-color);
}

.btn-warning:hover {
  background-color: #d97706;
  border-color: #d97706;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Améliorations pour utilisateurs non-admin */
.exam-card {
  position: relative;
}

.exam-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Masquer gracieusement les éléments admin */
.btn-edit-exam,
.btn-delete-exam {
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.btn-edit-exam[style*="display: none"],
.btn-delete-exam[style*="display: none"] {
  opacity: 0;
  visibility: hidden;
}

/* Ajustement des cartes quand les boutons admin sont masqués */
.exam-actions:not([style*="display: flex"]) {
  display: none;
}

.exam-actions:empty {
  display: none;
}

/* Message informatif pour les utilisateurs non-admin */
.user-info-message {
  background-color: var(--info-bg);
  border: 1px solid var(--primary-color);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  margin: var(--spacing-lg) 0;
  text-align: center;
}

.user-info-message h4 {
  color: var(--primary-color);
  margin-bottom: var(--spacing-sm);
}

.user-info-message p {
  color: var(--text-secondary);
  margin: 0;
}

.btn-open-exam,
.btn-open-correction {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  flex: 1;
  justify-content: center;
}

.btn-open-correction {
  background: var(--success-color);
}

.btn-open-exam:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-open-correction:hover {
  background: #059669;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-open-correction:disabled,
.btn-open-exam:disabled {
  background: var(--text-muted);
  color: var(--bg-secondary);
  cursor: not-allowed;
  opacity: 0.5;
}

.btn-open-correction:disabled:hover,
.btn-open-exam:disabled:hover {
  background: var(--text-muted);
  transform: none;
  box-shadow: none;
}

.no-exercises {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--spacing-2xl);
  color: var(--text-muted);
}

.no-exercises i {
  font-size: 3rem;
  margin-bottom: var(--spacing-lg);
  opacity: 0.5;
}

.no-exercises h3 {
  font-size: 1.25rem;
  margin-bottom: var(--spacing-sm);
}

/* Bouton "Charger plus" */
.load-more-btn {
  display: block;
  margin: var(--spacing-xl) auto;
  padding: var(--spacing-md) var(--spacing-xl);
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.load-more-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.load-more-btn:active {
  transform: translateY(0);
}

.load-more-btn i {
  margin-right: var(--spacing-sm);
}

/* Responsive */
@media (max-width: 768px) {
  .header-content {
    padding: var(--spacing-md);
    flex-direction: column;
    gap: var(--spacing-md);
  }

  .beta-badge {
    font-size: 0.6rem;
    padding: 0.2rem 0.4rem;
  }

  /* Boutons de navigation plus petits sur mobile */
  .nav-btn {
    padding: 6px 16px;
    font-size: 0.85rem;
    min-height: 38px;
    flex: 0 0 auto;
  }

  /* Plage de tags moins haute sur mobile */
  .tags-container {
    max-height: 120px;
  }

  /* Tags plus petits sur mobile */
  .tag {
    padding: 2px var(--spacing-sm);
    font-size: 0.8rem;
  }

  .main-content {
    padding: var(--spacing-md);
  }

  .filters-container,
  .exams-container,
  .upload-container {
    padding: var(--spacing-lg);
  }

  .exams-grid {
    grid-template-columns: 1fr;
  }

  .exams-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-sm);
  }

  .subject-buttons {
    justify-content: center;
  }

  .modal-content {
    width: 95%;
    margin: var(--spacing-md);
  }

  .modal-body {
    padding: var(--spacing-md);
  }
}

@media (max-width: 480px) {
  .nav {
    width: 100%;
    justify-content: center;
  }

  .exam-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-sm);
  }
}

/* Mobile portrait - écrans très petits : nav horizontale scrollable */
@media (max-width: 480px) {
  .header-content {
    padding: var(--spacing-sm);
    gap: var(--spacing-xs);
  }

  .nav {
    display: flex;
    flex-wrap: nowrap; /* pas de retour ligne */
    gap: var(--spacing-xs);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scroll-snap-type: x proximity;
    padding: 2px 2px 6px;
    width: 100%;
  }
  .nav::-webkit-scrollbar {
    height: 6px;
  }
  .nav::-webkit-scrollbar-track {
    background: transparent;
  }
  .nav::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
  }

  .nav-btn {
    padding: 6px 14px;
    font-size: 0.78rem;
    min-height: 34px;
    flex: 0 0 auto; /* largeur auto */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.2;
    scroll-snap-align: start;
    white-space: nowrap; /* empêcher retour mot */
  }

  .nav-btn i {
    font-size: 0.85rem;
  }

  .tags-container {
    max-height: 100px;
  }
  .tag {
    padding: 1px var(--spacing-xs);
    font-size: 0.75rem;
  }
  .logo {
    font-size: 1.45rem;
  }
  .beta-badge {
    font-size: 0.55rem;
    padding: 0.15rem 0.3rem;
  }
}

/* Styles pour l'aperçu des exercices (Analyse1) */
.exam-exercises-preview {
  margin-top: var(--spacing-md);
  padding: var(--spacing-sm);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.exercise-type-section {
  margin-bottom: var(--spacing-sm);
}

.exercise-type-section:last-child {
  margin-bottom: 0;
}

.exercise-type-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  margin-bottom: var(--spacing-xs);
  font-weight: 600;
  color: var(--text-primary);
}

.exercise-type-header i {
  font-size: 0.9rem;
  color: var(--primary-color);
}

.exercise-type-title {
  font-size: 0.9rem;
}

.exercise-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.exercise-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  background: var(--bg-primary);
  border-left: 3px solid transparent;
}

.qcm-item {
  border-left-color: #3b82f6; /* Bleu pour QCM */
  background: rgba(59, 130, 246, 0.05);
}

.truefalse-item {
  border-left-color: #f59e0b; /* Orange pour Vrai/Faux */
  background: rgba(245, 158, 11, 0.05);
}

.open-item {
  border-left-color: #10b981; /* Vert pour exercices ouverts */
  background: rgba(16, 185, 129, 0.05);
}

.other-item {
  border-left-color: #6b7280; /* Gris pour autres */
  background: rgba(107, 114, 128, 0.05);
}

.exercise-title {
  flex: 1;
  color: var(--text-primary);
  font-weight: 500;
}

.exercise-points {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.exercise-more {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: 4px;
}

/* Styles pour les filtres spéciaux */
.special-filter {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-weight: 600;
  background: var(--bg-accent);
  border: 1px solid rgb(16, 185, 129);
  padding: var(--spacing-xs) var(--spacing-md);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: rgb(16, 185, 129);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.special-filter:hover {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgb(16, 185, 129);
  color: rgb(16, 185, 129);
}

.special-filter i {
  font-size: 0.9rem;
}

.special-filter-tag {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-weight: 600;
}

.special-filter-tag i {
  font-size: 0.9rem;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.exam-card {
  animation: fadeIn 0.3s ease;
}

.tag {
  animation: fadeIn 0.2s ease;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-accent);
  border-radius: var(--radius-md);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-md);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Styles pour la section de modification des points Analyse 1 */
#analyse1-points-section {
  background: var(--bg-accent);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  margin-top: var(--spacing-md);
}

#analyse1-points-section h4 {
  color: var(--primary-color);
  margin-bottom: var(--spacing-md);
  font-size: 1.1rem;
  font-weight: 600;
}

.points-controls {
  display: grid;
  gap: var(--spacing-md);
}

.points-controls .form-group {
  margin-bottom: 0;
}

.points-controls .form-group label {
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: var(--spacing-xs);
}

.points-controls .form-group small {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: var(--spacing-xs);
  display: block;
}

.points-summary {
  background: var(--primary-color);
  color: white;
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  text-align: center;
  margin-top: var(--spacing-md);
}

.points-summary strong {
  font-size: 1.1rem;
}

#edit-total-points {
  color: var(--warning-color);
  font-weight: 700;
}

/* Styles spécifiques pour le modal d'édition */
#edit-modal .modal-content {
  max-height: 95vh;
  overflow: hidden;
}

#edit-modal .modal-body {
  overflow-y: auto;
  flex: 1;
  padding: var(--spacing-xl);
  max-height: calc(95vh - 120px); /* Hauteur totale moins header et footer */
}

#edit-modal .form-actions {
  flex-shrink: 0;
  padding: var(--spacing-lg) var(--spacing-xl);
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
  margin: 0 calc(-1 * var(--spacing-xl));
  margin-top: var(--spacing-lg);
}

/* Styles pour la modal À propos */
.about-modal-content {
  max-width: 800px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.about-modal-content .modal-body {
  overflow-y: auto;
  flex: 1;
  padding: var(--spacing-xl);
  max-height: calc(90vh - 80px); /* Hauteur totale moins le header */
}

/* Barre de défilement personnalisée pour la modal À propos */
.about-modal-content .modal-body::-webkit-scrollbar {
  width: 8px;
}

.about-modal-content .modal-body::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 4px;
}

.about-modal-content .modal-body::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 4px;
}

.about-modal-content .modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--primary-hover);
}

.about-content {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xl);
}

.about-header {
  text-align: center;
  padding-bottom: var(--spacing-lg);
  border-bottom: 2px solid var(--border-color);
}

.about-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin: var(--spacing-sm) 0;
}

.about-description {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
  margin: var(--spacing-md) 0;
}

.about-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--spacing-lg);
}

.feature-item {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-md);
  padding: var(--spacing-lg);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--primary-color);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.feature-icon {
  font-size: 1.5rem;
  color: var(--primary-color);
  margin-top: var(--spacing-xs);
  flex-shrink: 0;
}

.feature-content h4 {
  margin: 0 0 var(--spacing-xs) 0;
  color: var(--text-primary);
  font-size: 1.1rem;
}

.feature-content p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

.about-section {
  background: var(--bg-secondary);
  padding: var(--spacing-lg);
  border-radius: var(--radius-md);
}

.about-section h3 {
  margin: 0 0 var(--spacing-md) 0;
  color: var(--primary-color);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.upcoming-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.upcoming-list li {
  padding: var(--spacing-sm) 0;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.upcoming-list li:last-child {
  border-bottom: none;
}

.upcoming-list li::before {
  content: "•";
  font-size: 1rem;
  color: var(--primary-color);
  font-weight: bold;
}

.about-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--spacing-lg);
  border-top: 2px solid var(--border-color);
  flex-wrap: wrap;
  gap: var(--spacing-md);
}

.version-info {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.version-info span {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.contact-info {
  text-align: center;
  flex: 1;
}

.contact-info p {
  margin: 0 0 var(--spacing-sm) 0;
  color: var(--text-primary);
  font-style: italic;
}

.contact-info a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s ease;
}

.contact-info a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

.credits {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: var(--spacing-md);
}

/* Styles pour la modal Contribution */
.contribute-modal-content {
  max-width: 600px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.contribute-modal-content .modal-body {
  overflow-y: auto;
  flex: 1;
  padding: var(--spacing-xl);
  max-height: calc(90vh - 80px);
}

/* Barre de défilement personnalisée pour la modal Contribution */
.contribute-modal-content .modal-body::-webkit-scrollbar {
  width: 8px;
}

.contribute-modal-content .modal-body::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 4px;
}

.contribute-modal-content .modal-body::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 4px;
}

.contribute-modal-content .modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--primary-hover);
}

.contribute-intro {
  margin-bottom: var(--spacing-xl);
  padding: var(--spacing-lg);
  background: var(--info-bg);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--info-color);
}

.contribute-intro p {
  margin: 0 0 var(--spacing-md) 0;
  color: var(--text-primary);
  font-size: 1.1rem;
}

.requirements h4 {
  margin: 0 0 var(--spacing-sm) 0;
  color: var(--info-color);
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.requirements ul {
  margin: 0;
  padding-left: var(--spacing-lg);
  color: var(--text-secondary);
}

.requirements li {
  margin-bottom: var(--spacing-xs);
  font-size: 0.9rem;
}

.contribute-form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.contribute-form .form-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.contribute-form label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.contribute-form input,
.contribute-form select,
.contribute-form textarea {
  padding: var(--spacing-sm);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 1rem;
  transition: border-color 0.3s ease;
  background: var(--bg-primary);
  color: var(--text-primary);
}

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

.contribute-form textarea {
  resize: vertical;
  min-height: 100px;
}

/* Centrer le widget reCAPTCHA */
.contribute-form .g-recaptcha {
  display: flex;
  justify-content: center;
  margin: var(--spacing-md) 0;
}

.file-upload-area {
  position: relative;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: var(--bg-secondary);
}

.file-upload-area:hover {
  border-color: var(--primary-color);
  background: var(--bg-accent);
}

.file-upload-area input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.file-upload-content {
  pointer-events: none;
}

.file-upload-content i {
  font-size: 2rem;
  color: var(--primary-color);
  margin-bottom: var(--spacing-sm);
}

.file-upload-content p {
  margin: 0 0 var(--spacing-xs) 0;
  font-weight: 600;
  color: var(--text-primary);
}

.file-upload-content .file-info {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-style: italic;
}

.contribute-form .form-actions {
  display: flex;
  gap: var(--spacing-md);
  justify-content: flex-end;
  margin-top: var(--spacing-lg);
  padding-top: var(--spacing-lg);
  border-top: 1px solid var(--border-color);
}

/* Responsive pour la modal À propos */
@media (max-width: 768px) {
  .about-modal-content {
    width: 95%;
    max-height: 95vh;
    margin: var(--spacing-sm);
  }

  .about-content {
    gap: var(--spacing-lg);
  }

  .about-features {
    grid-template-columns: 1fr;
  }

  .feature-item {
    padding: var(--spacing-md);
  }

  .about-footer {
    flex-direction: column;
    text-align: center;
  }

  .version-info {
    align-items: center;
  }

  /* Responsive pour la modal Contribution */
  .contribute-modal-content {
    width: 95%;
    max-height: 95vh;
    margin: var(--spacing-sm);
  }

  .contribute-form .form-actions {
    flex-direction: row;
  }

  .contribute-form .form-actions .btn {
    width: 100%;
  }
}

/* Styles pour les notifications */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--spacing-md);
  z-index: 1000;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  border-left: 4px solid var(--primary-color);
  max-width: 400px;
}

.notification.show {
  transform: translateX(0);
}

.notification-success {
  border-left-color: var(--success-color);
}

.notification-error {
  border-left-color: var(--error-color);
}

.notification-content {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.notification-content i {
  font-size: 1.2rem;
}

.notification-success .notification-content i {
  color: var(--success-color);
}

.notification-error .notification-content i {
  color: var(--error-color);
}

.notification-content span {
  color: var(--text-primary);
  font-weight: 500;
}

/* Styles pour les zones de drag & drop */
.file-upload-area.drag-over {
  border-color: var(--primary-color);
  background: var(--primary-light);
  transform: scale(1.02);
}

/* Styles pour la modale des logs admin */
#admin-logs-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}

#admin-logs-modal.show {
  display: flex;
}

#log-details-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}

#log-details-modal.show {
  display: flex;
}

.log-details-modal-content {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
}

.logs-modal-content {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 1200px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  margin: auto;
}

.logs-modal-content .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-lg) var(--spacing-xl);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.logs-modal-content .modal-body {
  overflow-y: auto;
  flex: 1;
  padding: var(--spacing-xl);
  max-height: calc(90vh - 120px);
}

/* Contrôles des logs */
.logs-controls {
  display: flex;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  flex-wrap: wrap;
}

.logs-controls button {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.logs-controls .btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.logs-controls .btn-secondary:hover {
  background: var(--bg-accent);
  border-color: var(--primary-color);
}

.logs-controls .btn-warning {
  background: var(--warning-color);
  color: white;
}

.logs-controls .btn-warning:hover {
  background: #d97706;
  transform: translateY(-1px);
}

/* Container des logs */
.logs-container {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  min-height: 400px;
  max-height: 60vh;
  overflow-y: auto;
}

.logs-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--text-muted);
  text-align: center;
}

.logs-empty i {
  font-size: 3rem;
  margin-bottom: var(--spacing-md);
  opacity: 0.5;
}

/* Entrées de logs */
.log-entry {
  display: flex;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-sm);
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--border-color);
  transition: all 0.2s ease;
}

.log-entry:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.log-entry.success {
  border-left-color: var(--success-color);
}

.log-entry.failure {
  border-left-color: var(--error-color);
}

.log-info {
  min-width: 200px;
  flex-shrink: 0;
}

.log-timestamp {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: var(--spacing-xs);
}

.log-ip {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: monospace;
  background: var(--bg-accent);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  display: inline-block;
}

.log-details {
  flex: 1;
}

.log-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: var(--spacing-xs);
}

.log-status.success {
  background: var(--success-light);
  color: var(--success-color);
}

.log-status.failure {
  background: var(--error-light);
  color: var(--error-color);
}

/* Responsive pour les filtres */
@media (max-width: 768px) {
  .filters-container {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }

  .filters-left {
    gap: var(--spacing-sm);
  }

  .ba-buttons,
  .subject-buttons {
    gap: var(--spacing-xs);
  }

  .ba-btn,
  .subject-btn {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.8rem;
  }
}

/* Responsive pour la modale des logs */
@media (max-width: 768px) {
  .logs-modal-content {
    width: 95%;
    max-height: 95vh;
    margin: var(--spacing-sm);
  }

  .logs-modal-content .modal-body {
    max-height: calc(95vh - 100px);
    padding: var(--spacing-md);
  }

  .logs-modal-content .modal-header {
    padding: var(--spacing-md);
  }

  .log-entry {
    flex-direction: column;
    gap: var(--spacing-sm);
  }

  .log-info {
    min-width: auto;
  }

  .logs-controls {
    flex-direction: column;
  }

  .logs-controls button {
    justify-content: center;
  }
}

/* Bouton logs dans la navigation */
.logs-btn {
  background: var(--warning-color);
  color: white;
}

.logs-btn:hover {
  background: #d97706;
  transform: translateY(-2px);
}

/* Styles pour la modale de détails de log */
.log-details-modal-content {
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
}

.log-details-container {
  font-family: "Courier New", monospace;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 20px;
  margin: 10px 0;
}

.log-detail-section {
  margin-bottom: 20px;
  padding: 15px;
  background: white;
  border-radius: 6px;
  border-left: 4px solid var(--primary-color);
}

.log-detail-section h4 {
  margin: 0 0 10px 0;
  color: var(--primary-color);
  font-size: 16px;
  font-weight: 600;
}

.log-detail-item {
  display: flex;
  margin-bottom: 8px;
  padding: 5px 0;
  border-bottom: 1px solid #f1f3f4;
}

.log-detail-item:last-child {
  border-bottom: none;
}

.log-detail-label {
  font-weight: 600;
  color: #495057;
  min-width: 150px;
  margin-right: 10px;
}

.log-detail-value {
  color: #212529;
  word-break: break-all;
  flex: 1;
}

.log-detail-json {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 4px;
  padding: 10px;
  font-size: 12px;
  white-space: pre-wrap;
  overflow-x: auto;
  max-height: 200px;
  overflow-y: auto;
}

.log-detail-timestamp {
  color: #6c757d;
  font-size: 14px;
}

.log-detail-ip {
  color: #007bff;
  font-weight: 500;
}

.log-detail-action {
  color: #28a745;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12px;
}

.log-detail-error {
  color: #dc3545;
  font-weight: 600;
}

.log-detail-success {
  color: #28a745;
  font-weight: 600;
}

/* Styles pour les boutons de la modale de détails */
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 15px 20px;
  border-top: 1px solid #e9ecef;
  background: #f8f9fa;
}

.modal-footer button {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.modal-footer .btn-secondary {
  background: #6c757d;
  color: white;
}

.modal-footer .btn-secondary:hover {
  background: #5a6268;
}

.modal-footer .btn-primary {
  background: var(--primary-color);
  color: white;
}

.modal-footer .btn-primary:hover {
  background: #0056b3;
}

/* Styles pour les logs cliquables */
.log-entry {
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.log-entry:hover {
  background-color: #f8f9fa;
}

.log-entry.clickable {
  position: relative;
}

.log-entry.clickable::after {
  content: "👁️";
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.log-entry.clickable:hover::after {
  opacity: 1;
}

/* --- Sub Navbar & Catalogue (Added) --- */
.sub-navbar {
  background: #ffffff;
  border-bottom: 1px solid #e2e6ed;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  position: sticky;
  top: 70px;
  z-index: 80;
}
.sub-navbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  gap: 24px;
  align-items: flex-end;
  padding: 8px 24px;
  flex-wrap: wrap;
}
.sub-select-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 160px;
}
.sub-select-group label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #555;
}
.sub-select-group select {
  padding: 6px 10px;
  border: 1px solid #c8d0da;
  border-radius: 6px;
  background: #f9fafb;
  font-size: 14px;
  transition: 0.15s;
}
.sub-select-group select:focus {
  outline: none;
  border-color: #2563eb;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
.catalogue-btn {
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0.9;
  transition: 0.15s;
}
.catalogue-btn:disabled {
  background: #9da9bb;
  cursor: not-allowed;
  opacity: 0.6;
}
.catalogue-btn:not(:disabled):hover {
  opacity: 1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.sub-actions {
  margin-left: auto;
  display: flex;
  align-items: flex-end;
}

#catalogue-section {
  padding: 28px 32px;
}
.catalogue-container {
  max-width: 1400px;
  margin: 0 auto;
}
.catalogue-header {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.catalogue-header h2 {
  margin: 0;
  font-size: 22px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.catalogue-current {
  font-size: 14px;
  color: #555;
}
.back-btn {
  background: #f3f4f6;
  border: 1px solid #d5dbe3;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.back-btn:hover {
  background: #e5e9ef;
}
.catalogue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.subject-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}
.subject-card h3 {
  margin: 0;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.subject-card .ba-badge {
  background: #2563eb;
  color: #fff;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.subject-card .tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.subject-card .tags-list span {
  background: #f1f5f9;
  color: #334155;
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}
.subject-card footer {
  margin-top: auto;
  font-size: 11px;
  color: #666;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.subject-card .struct-flags {
  display: flex;
  gap: 6px;
}
.struct-flag {
  background: #1e293b;
  color: #fff;
  font-size: 10px;
  padding: 3px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}
.struct-flag.qcm {
  background: #0d9488;
}
.struct-flag.vf {
  background: #9333ea;
}
.empty-catalogue {
  padding: 40px;
  text-align: center;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
  color: #475569;
}
/* Sections Bar (Linux blue theme) */
.sections-bar {
  top: 70px;
  z-index: 90;
  background: #ffffff;
}
.sections-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: overlay;
  opacity: 0.9;
}
.sections-bar-inner {
  position: relative;
  max-width: 1550px;
  margin: 0 auto;
  display: flex;
  gap: 14px;
  padding: 14px 34px;
  overflow-x: auto; /* Active le scroll horizontal */
  overflow-y: hidden; /* Pas de scroll vertical ici */
  flex-wrap: nowrap; /* Empêche le retour à la ligne */
  -webkit-overflow-scrolling: touch; /* Inertie mobile */
  scroll-snap-type: x proximity; /* Alignement doux des boutons */
  scrollbar-color: var(--primary-color) #e5e7eb; /* Firefox: thumb + track */
  scrollbar-gutter: stable; /* Réserve l'espace de la scrollbar même quand elle n'est pas scrollée */
}
/* Centrage automatique seulement si tout tient dans la largeur (pas d'overflow) et écran >= 901px */
@media (min-width: 901px) {
  .sections-bar-inner:not(.has-horizontal-overflow) {
    justify-content: center;
  }
}
.sections-bar-inner.has-horizontal-overflow {
  /* Force l'affichage de la scrollbar native (déjà gérée) + ajoute un indicateur visuel custom */
  position: relative;
}
.sections-bar-inner.has-horizontal-overflow::before,
.sections-bar-inner.has-horizontal-overflow::after {
  content: "";
  position: absolute;
  left: 34px; /* même padding horizontal */
  right: 34px;
  height: 4px;
  bottom: 2px; /* au-dessus de la scrollbar native */
  border-radius: 2px;
  pointer-events: none;
}
.sections-bar-inner.has-horizontal-overflow::before {
  background: #e2e8f0; /* piste neutre */
  opacity: 0.9;
}
.sections-bar-inner.has-horizontal-overflow::after {
  background: linear-gradient(
    90deg,
    var(--primary-color) 0%,
    var(--primary-hover) 100%
  );
  width: calc(var(--sections-scroll-progress, 0) * 100%);
  max-width: calc(100%);
  transition: width 0.15s linear;
}

/* Petits écrans: réduire la zone d'indicateur */
@media (max-width: 600px) {
  .sections-bar-inner.has-horizontal-overflow::before,
  .sections-bar-inner.has-horizontal-overflow::after {
    left: 18px;
    right: 18px;
    bottom: 1px;
  }
}
.sections-bar-inner::-webkit-scrollbar {
  height: 8px; /* Légèrement plus visible */
}
.sections-bar-inner::-webkit-scrollbar-track {
  background: #e5e7eb; /* Track gris clair pour visibilité */
  border-radius: 4px;
}
.sections-bar-inner::-webkit-scrollbar-thumb {
  border-radius: 4px;
  background: var(--primary-color);
}
.sections-bar-inner::-webkit-scrollbar-thumb:hover {
  background: var(--primary-hover);
}
.section-btn {
  background: var(--primary-color);
  color: #fff;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  border: none;
  transition: background-color 0.15s ease, color 0.15s ease;
  scroll-snap-align: start; /* Chaque bouton s'aligne sur le début lors du scroll */
}
.section-btn:hover {
  background: var(--primary-hover);
}
.section-btn:active {
  background: var(--primary-hover);
  filter: brightness(0.92);
}
.section-btn.active {
  background: var(--primary-hover);
  color: #fff;
}
.section-btn:focus-visible {
  outline: 2px solid var(--primary-hover);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  .section-btn {
    transition: none;
  }
}

@media (max-width: 900px) {
  .sections-bar-inner {
    padding: 14px 18px;
    gap: 10px;
    /* S'assure que le comportement horizontal reste actif sur mobile */
    flex-wrap: nowrap;
  }
  /* Sur mobile on force le départ à gauche même si pas d'overflow pour ne pas cacher les premiers boutons */
  .sections-bar-inner:not(.has-horizontal-overflow) {
    justify-content: flex-start;
  }
  .section-btn {
    padding: 10px 18px;
    font-size: 13px;
  }
}

.section-exam-card .exam-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.section-exam-card .exam-tags span {
  background: #e2e8f0;
  color: #334155;
  padding: 3px 6px;
  font-size: 10px;
  border-radius: 4px;
}
.section-exams-empty {
  text-align: center;
  padding: 24px;
  border: 2px dashed #cbd5e1;
  border-radius: 10px;
  font-size: 14px;
  color: #475569;
}

@media (max-width: 900px) {
  #section-home {
    padding: 20px;
  }
}

/* Masquage propre de la scrollbar native (le track custom reste) */
.sections-bar-inner {
  scrollbar-width: none; /* Firefox */
}
.sections-bar-inner::-webkit-scrollbar {
  display: none;
}

/* Stats modal styles */
.stats-modal-content {
  max-width: 1100px;
  width: 95%;
  max-height: 90vh;
}
.stats-modal-content .modal-body {
  max-height: calc(90vh - 100px);
  overflow: auto;
}
.stats-controls {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
  margin-bottom: var(--spacing-md);
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-lg);
}
.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
  box-shadow: var(--shadow-sm);
}
.stat-card h4 {
  margin: 0 0 var(--spacing-sm) 0;
}
.stat-card.wide {
  grid-column: span 2;
}
.table-scroll {
  max-height: 300px;
  overflow: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}
.table-scroll table {
  width: 100%;
  border-collapse: collapse;
}
.table-scroll th,
.table-scroll td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.9rem;
}
.table-scroll th {
  background: var(--bg-primary);
  text-align: left;
  position: sticky;
  top: 0;
}

@media (max-width: 900px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .stat-card.wide {
    grid-column: span 1;
  }
}
