/*
================================================================================
STYLES CSS UNIFIÉS POUR SYSTÈME D'ACCESSIBILITÉ ÉDUCATIF
================================================================================
Version 2.0 - Styles complets pour le système d'accessibilité unifié
Auteur : Emile SNYERS
Date : 2025-06-29
Licence : © Emile SNYERS 2025 - Usage éducatif et associatif uniquement

🎯 Remplace tous les anciens fichiers CSS de thème et d'accessibilité
📱 Design responsive et adaptatif
🔧 Variables CSS dynamiques
🎨 Thèmes éducatifs optimisés
================================================================================
*/

/* ============================================================================
   VARIABLES CSS DE BASE ET SYSTÈME DE MULTIPLICATEUR
============================================================================ */

:root {
  /* === VARIABLES DE TAILLE DE POLICE AVEC MULTIPLICATEUR === */
  --font-size-multiplier: 1; /* Contrôlé par JavaScript */
  
  /* Tailles de police standardisées (affectées par le multiplicateur) */
  --font-size-xs: calc(0.75rem * var(--font-size-multiplier));     /* 12px */
  --font-size-sm: calc(0.875rem * var(--font-size-multiplier));    /* 14px */
  --font-size-base: calc(1rem * var(--font-size-multiplier));      /* 16px */
  --font-size-md: calc(1.125rem * var(--font-size-multiplier));    /* 18px */
  --font-size-lg: calc(1.25rem * var(--font-size-multiplier));     /* 20px */
  --font-size-xl: calc(1.5rem * var(--font-size-multiplier));      /* 24px */
  --font-size-2xl: calc(1.875rem * var(--font-size-multiplier));   /* 30px */
  --font-size-3xl: calc(2.25rem * var(--font-size-multiplier));    /* 36px */
  --font-size-4xl: calc(3rem * var(--font-size-multiplier));       /* 48px */

  /* Tailles FIXES pour les titres (non affectées par le multiplicateur) */
  --title-size-sm: 1.25rem;    /* 20px - Sous-titres */
  --title-size-md: 1.5rem;     /* 24px - Titres H3 */
  --title-size-lg: 1.875rem;   /* 30px - Titres H2 */
  --title-size-xl: 2.25rem;    /* 36px - Titres H1 */
  --title-size-2xl: 3rem;      /* 48px - Titre principal */

  /* === VARIABLES D'ESPACEMENT === */
  --spacing-xs: 0.25rem;   /* 4px */
  --spacing-sm: 0.5rem;    /* 8px */
  --spacing-md: 1rem;      /* 16px */
  --spacing-lg: 1.5rem;    /* 24px */
  --spacing-xl: 2rem;      /* 32px */
  --spacing-2xl: 2.5rem;   /* 40px */
  --spacing-3xl: 3rem;     /* 48px */

  /* === VARIABLES DE DESIGN === */
  --border-radius-sm: 4px;
  --border-radius-md: 8px;
  --border-radius-lg: 12px;
  --border-radius-xl: 16px;
  --border-radius-full: 50%;

  /* === VARIABLES DE LAYOUT === */
  --main-max-width: 1200px;
  --sidebar-width: 280px;
  --header-height: 70px;
  
  /* === TRANSITIONS === */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;

  /* === VARIABLES DE THÈME (seront modifiées dynamiquement) === */
  --theme-background: #faf7f2;
  --theme-text: #2c3e50;
  --theme-text-title: #1a252f;
  --theme-primary: #8b6f3f;
  --theme-secondary: #f4ead0;
  --theme-tertiary: #ffffff;
  --theme-quaternary: #e8dcc0;
  --theme-header: #d4b894;
  --theme-footer: #d4b894;
  --theme-accent: #2e7d32;

  /* === OMBRES === */
  --theme-header-shadow: 0 2px 8px rgba(0,0,0,0.1);
  --theme-section-shadow: 0 2px 4px rgba(0,0,0,0.05);
  --theme-sidebar-shadow: 0 2px 6px rgba(0,0,0,0.1);
  --theme-modal-shadow: 0 20px 60px rgba(0,0,0,0.3);

  /* === COULEURS DE TEXTE SPÉCIFIQUES === */
  --theme-button-primary-text: white;
  --theme-button-secondary-text: var(--theme-text);
  --theme-button-sidebar-text: white;
  --theme-button-footer-text: var(--theme-text);

  /* === POLICE DE THÈME === */
  --theme-font-family: 'Georgia', serif;
}

/* ============================================================================
   STYLES DE BASE ET RESET
============================================================================ */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--theme-background);
  color: var(--theme-text);
  font-family: var(--theme-font-family);
  font-size: var(--font-size-base);
  line-height: 1.6;
  margin: 0;
  padding: 0;
  transition: background-color var(--transition-normal), 
              color var(--transition-normal);
}

/* ============================================================================
   TYPOGRAPHIE INTELLIGENTE
============================================================================ */

/* TITRES - Tailles FIXES (non affectées par l'accessibilité) */
h1, .h1 {
  font-size: var(--title-size-xl) !important;
  color: var(--theme-text-title);
  font-weight: bold;
  line-height: 1.2;
  margin: var(--spacing-lg) 0 var(--spacing-md) 0;
}

h2, .h2 {
  font-size: var(--title-size-lg) !important;
  color: var(--theme-text-title);
  font-weight: bold;
  line-height: 1.3;
  margin: var(--spacing-md) 0 var(--spacing-sm) 0;
}

h3, .h3 {
  font-size: var(--title-size-md) !important;
  color: var(--theme-text-title);
  font-weight: 600;
  line-height: 1.4;
  margin: var(--spacing-md) 0 var(--spacing-sm) 0;
}

h4, .h4 {
  font-size: var(--title-size-sm) !important;
  color: var(--theme-text-title);
  font-weight: 600;
  line-height: 1.4;
  margin: var(--spacing-sm) 0 var(--spacing-xs) 0;
}

h5, h6 {
  font-size: var(--font-size-lg) !important;
  color: var(--theme-text-title);
  font-weight: 600;
  line-height: 1.5;
  margin: var(--spacing-sm) 0 var(--spacing-xs) 0;
}

/* TEXTE PRINCIPAL - Affecté par l'accessibilité */
p, .text-base {
  font-size: var(--font-size-base);
  margin-bottom: var(--spacing-md);
  line-height: 1.7;
}

/* TEXTE SPÉCIALISÉ */
.text-small, small {
  font-size: var(--font-size-sm);
}

.text-large {
  font-size: var(--font-size-lg);
}

.text-caption {
  font-size: var(--font-size-xs);
  opacity: 0.8;
}

/* LIENS */
a {
  color: var(--theme-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--theme-accent);
  text-decoration: underline;
}

/* EMPHASES */
strong, b {
  color: var(--theme-text-title);
  font-weight: bold;
}

em, i {
  font-style: italic;
  color: var(--theme-primary);
}

/* ============================================================================
   LAYOUT PRINCIPAL
============================================================================ */

.main-container {
  max-width: var(--main-max-width);
  margin: 0 auto;
  padding: var(--spacing-md);
}

.content-wrapper {
  background: var(--theme-tertiary);
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-xl);
  margin-bottom: var(--spacing-xl);
  box-shadow: var(--theme-section-shadow);
  transition: all var(--transition-normal);
}

.content-wrapper:hover {
  transform: translateY(-2px);
  box-shadow: var(--theme-header-shadow);
}

/* ============================================================================
   HEADER ET NAVIGATION
============================================================================ */

.site-header {
  background: var(--theme-header);
  color: var(--theme-button-sidebar-text);
  padding: var(--spacing-md) 0;
  box-shadow: var(--theme-header-shadow);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: all var(--transition-normal);
}

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

.site-title {
  font-size: var(--title-size-lg);
  font-weight: bold;
  margin: 0;
  color: var(--theme-button-sidebar-text);
}

.main-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: var(--spacing-lg);
}

.main-nav a {
  color: var(--theme-button-sidebar-text);
  font-size: var(--font-size-base);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--border-radius-md);
  transition: all var(--transition-fast);
}

.main-nav a:hover {
  background: rgba(255, 255, 255, 0.2);
  text-decoration: none;
}

/* ============================================================================
   SIDEBAR ÉDUCATIVE
============================================================================ */

.sidebar {
  width: var(--sidebar-width);
  background: var(--theme-primary);
  color: var(--theme-button-sidebar-text);
  padding: var(--spacing-lg);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--theme-sidebar-shadow);
  position: sticky;
  top: calc(var(--header-height) + var(--spacing-md));
  max-height: calc(100vh - var(--header-height) - var(--spacing-xl));
  overflow-y: auto;
}

.sidebar h3 {
  color: var(--theme-button-sidebar-text) !important;
  border-bottom: 2px solid rgba(255, 255, 255, 0.3);
  padding-bottom: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
}

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

.sidebar li {
  margin-bottom: var(--spacing-sm);
}

.sidebar a {
  color: rgba(255, 255, 255, 0.9);
  font-size: var(--font-size-sm);
  display: block;
  padding: var(--spacing-sm);
  border-radius: var(--border-radius-sm);
  transition: all var(--transition-fast);
}

.sidebar a:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  text-decoration: none;
  transform: translateX(5px);
}

/* ============================================================================
   BOUTONS ET ÉLÉMENTS INTERACTIFS
============================================================================ */

.btn {
  display: inline-block;
  padding: var(--spacing-sm) var(--spacing-md);
  border: none;
  border-radius: var(--border-radius-md);
  font-family: var(--theme-font-family);
  font-size: var(--font-size-base);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.btn-primary {
  background: var(--theme-primary);
  color: var(--theme-button-primary-text);
}

.btn-secondary {
  background: var(--theme-secondary);
  color: var(--theme-button-secondary-text);
}

.btn-accent {
  background: var(--theme-accent);
  color: var(--theme-button-primary-text);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--theme-section-shadow);
}

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

/* ============================================================================
   FORMULAIRES
============================================================================ */

.form-group {
  margin-bottom: var(--spacing-md);
}

.form-label {
  display: block;
  font-weight: 600;
  color: var(--theme-text-title);
  margin-bottom: var(--spacing-xs);
  font-size: var(--font-size-sm);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: var(--spacing-sm);
  border: 2px solid var(--theme-secondary);
  border-radius: var(--border-radius-md);
  background: var(--theme-background);
  color: var(--theme-text);
  font-family: var(--theme-font-family);
  font-size: var(--font-size-base);
  transition: all var(--transition-fast);
}

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

/* ============================================================================
   CARTES ET SECTIONS
============================================================================ */

.card {
  background: var(--theme-tertiary);
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  box-shadow: var(--theme-section-shadow);
  border: 1px solid var(--theme-secondary);
  transition: all var(--transition-normal);
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--theme-header-shadow);
}

.card-header {
  border-bottom: 2px solid var(--theme-secondary);
  padding-bottom: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
}

.card-title {
  margin: 0;
  color: var(--theme-text-title);
}

/* ============================================================================
   TABLEAUX ÉDUCATIFS
============================================================================ */

.table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--spacing-lg) 0;
  background: var(--theme-tertiary);
  border-radius: var(--border-radius-md);
  overflow: hidden;
  box-shadow: var(--theme-section-shadow);
}

.table th {
  background: var(--theme-primary);
  color: var(--theme-button-primary-text);
  padding: var(--spacing-md);
  text-align: left;
  font-weight: 600;
  font-size: var(--font-size-sm);
}

.table td {
  padding: var(--spacing-sm) var(--spacing-md);
  border-bottom: 1px solid var(--theme-secondary);
  font-size: var(--font-size-base);
}

.table tr:nth-child(even) {
  background: var(--theme-quaternary);
}

.table tr:hover {
  background: var(--theme-secondary);
}

/* ============================================================================
   LISTES ÉDUCATIVES
============================================================================ */

.list-styled {
  padding-left: var(--spacing-lg);
}

.list-styled li {
  margin-bottom: var(--spacing-sm);
  font-size: var(--font-size-base);
  line-height: 1.6;
}

.list-unstyled {
  list-style: none;
  padding: 0;
}

/* ============================================================================
   ÉLÉMENTS PÉDAGOGIQUES SPÉCIAUX
============================================================================ */

.highlight-box {
  background: linear-gradient(135deg, var(--theme-secondary), var(--theme-tertiary));
  border-left: 4px solid var(--theme-primary);
  padding: var(--spacing-md);
  margin: var(--spacing-lg) 0;
  border-radius: var(--border-radius-md);
  font-size: var(--font-size-base);
}

.info-box {
  background: var(--theme-tertiary);
  border: 2px solid var(--theme-accent);
  border-radius: var(--border-radius-md);
  padding: var(--spacing-md);
  margin: var(--spacing-md) 0;
}

.warning-box {
  background: #fff3cd;
  border: 2px solid #ffc107;
  color: #856404;
  border-radius: var(--border-radius-md);
  padding: var(--spacing-md);
  margin: var(--spacing-md) 0;
}

.definition {
  background: var(--theme-secondary);
  border-radius: var(--border-radius-md);
  padding: var(--spacing-md);
  margin: var(--spacing-md) 0;
  font-style: italic;
  font-size: var(--font-size-base);
}

/* ============================================================================
   RESPONSIVE DESIGN
============================================================================ */

/* Tablettes */
@media (max-width: 1024px) {
  .main-container {
    padding: var(--spacing-sm);
  }
  
  .sidebar {
    width: 250px;
  }
  
  .content-wrapper {
    padding: var(--spacing-lg);
  }
}

/* Tablettes petites */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: var(--spacing-md);
  }
  
  .main-nav ul {
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--spacing-md);
  }
  
  .sidebar {
    width: 100%;
    position: static;
    margin-bottom: var(--spacing-lg);
  }
  
  .content-wrapper {
    padding: var(--spacing-md);
  }
  
  .card {
    padding: var(--spacing-md);
  }
}

/* Smartphones */
@media (max-width: 480px) {
  .main-container {
    padding: var(--spacing-xs);
  }
  
  .content-wrapper {
    padding: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
  }
  
  .site-title {
    font-size: var(--title-size-md);
  }
  
  .btn {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: var(--font-size-sm);
  }
  
  .table {
    font-size: var(--font-size-sm);
  }
  
  .table th, .table td {
    padding: var(--spacing-xs) var(--spacing-sm);
  }
}

/* ============================================================================
   MODES D'ACCESSIBILITÉ SPÉCIAUX
============================================================================ */

/* Mode sans animations (pour les utilisateurs sensibles au mouvement) */
.no-animations *,
.no-animations *::before,
.no-animations *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}

/* Mode contraste élevé */
.high-contrast-mode {
  filter: contrast(150%) brightness(1.1);
}

.high-contrast-mode .card,
.high-contrast-mode .content-wrapper {
  border: 3px solid var(--theme-primary);
}

.high-contrast-mode .btn {
  border: 2px solid currentColor;
  font-weight: bold;
}

/* ============================================================================
   AMÉLIORATIONS POUR L'IMPRESSION
============================================================================ */

@media print {
  .accessibility-toggle,
  .accessibility-panel,
  .sidebar {
    display: none !important;
  }
  
  .content-wrapper {
    box-shadow: none;
    border: 1px solid #ccc;
  }
  
  a {
    text-decoration: underline;
  }
  
  .btn {
    border: 1px solid #ccc;
    background: white !important;
    color: black !important;
  }
}

/* ============================================================================
   FOCUS ET NAVIGATION AU CLAVIER
============================================================================ */

/* Amélioration de la visibilité du focus pour l'accessibilité */
*:focus {
  outline: 3px solid var(--theme-accent);
  outline-offset: 2px;
}

/* Focus visible uniquement au clavier */
*:focus:not(:focus-visible) {
  outline: none;
}

*:focus-visible {
  outline: 3px solid var(--theme-accent);
  outline-offset: 2px;
}

/* ============================================================================
   ANIMATIONS ET TRANSITIONS OPTIMISÉES
============================================================================ */

/* Transition fluide pour le changement de thème */
* {
  transition: background-color var(--transition-normal),
              color var(--transition-normal),
              border-color var(--transition-normal);
}

/* Réduction des mouvements pour les utilisateurs sensibles */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================================
   CLASSES UTILITAIRES ÉDUCATIVES
============================================================================ */

/* Espacement */
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }

/* Alignement */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-justify { text-align: justify; }

/* Visibilité */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Flexbox utilitaires */
.d-flex { display: flex; }
.flex-column { flex-direction: column; }
.align-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }

/* Largeurs */
.w-100 { width: 100%; }
.w-75 { width: 75%; }
.w-50 { width: 50%; }
.w-25 { width: 25%; }

/* ============================================================================
   LOG ET DÉBOGAGE
============================================================================ */

/* Classe pour identifier les éléments pendant le développement */
.debug {
  border: 2px dashed red;
  background: rgba(255, 0, 0, 0.1);
}

/* ============================================================================
   FIN DU FICHIER CSS UNIFIÉ
============================================================================ */