/*
  ===================================================================
  FICHIER CSS GLOBAL HARMONISÉ
  Utilisé pour tous les cours (Maths/Physique/Chimie)
  Le fond par défaut est maintenant #fff2beff comme demandé.
  ===================================================================
*/

:root {
  /* Couleurs primaires de l'application (Orange, Jaune) */
  --primary-orange: #ff7b00;
  --secondary-yellow: #ffe066;
  
  /* Couleurs de texte */
  --text-primary: #222;
  --text-secondary: #555;
  
  /* Ombres */
  --shadow-light: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-medium: 0 8px 25px rgba(0, 0, 0, 0.15);
  
  /* Fond par défaut des boîtes de contenu */
  --card-background: linear-gradient(145deg, hsl(46, 100%, 89%), #fff8cf);
  
  /* Styles pour les boîtes de contenu spécifiques */
  --color-example-bg: linear-gradient(145deg, #e8f5e9, #c8e6c9); /* Vert pâle */
  --color-example-border: #4CAF50;
  --color-example-title: #1b5e20;
  
  --color-definition-bg: linear-gradient(145deg, #e0f7fa, #b2ebf2); /* Bleu/Cyan pâle */
  --color-definition-border: #00acc1;
  
  --color-proposition-bg: linear-gradient(145deg, #ffebee, #ffcdd2); /* Rouge pâle */
  --color-proposition-border: #e53935;
  
  --color-remarque-bg: #fff9e6; /* Jaune pâle */
  --color-remarque-border: var(--secondary-yellow);
}

*, *::before, *::after {
  box-sizing: border-box;
}

/* ----------------------------------- */
/* Styles du Corps et du Conteneur Principal */
/* ----------------------------------- */
body {
  font-family: 'Poppins', sans-serif;
  /* Utilisation de la couleur solide #fff2beff comme background par défaut pour tous les cours */
  background: #fff2beff; 
  color: var(--text-primary);
  text-align: center;
  margin: 0;
  padding: 0;
  line-height: 1.8;
}

.cours-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.hero-section {
  text-align: center;
  padding: 40px 20px;
  margin-bottom: 40px;
}

.hero-content h1 {
  font-size: 3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 15px;
  background: linear-gradient(135deg, var(--primary-orange), #ff9500);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.content-wrapper {
  background: white;
  border-radius: 20px;
  padding: 50px;
  box-shadow: var(--shadow-light);
  margin-bottom: 40px;
  text-align: left;
  position: relative; 
}

/* ----------------------------------- */
/* Bouton de Téléchargement PDF */
/* ----------------------------------- */
.btn-pdf-download {
  display: none !important;
  position: absolute;
  top: 30px;
  right: 30px;
  /* display: inline-flex; */
  align-items: center;
  gap: 8px;
  background: #f8f8f8;
  color: var(--primary-orange);
  border: 1px solid var(--primary-orange);
  padding: 8px 15px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.btn-pdf-download:hover {
  background: var(--primary-orange);
  color: white;
  box-shadow: 0 4px 10px rgba(255, 123, 0, 0.2);
}

.btn-pdf-download svg {
  stroke: currentColor;
  width: 18px;
  height: 18px;
}

/* ----------------------------------- */
/* Titres et Table des Matières */
/* ----------------------------------- */
.course-header {
  border: 3px double var(--primary-orange);
  padding: 20px;
  text-align: center;
  margin-bottom: 40px;
  border-radius: 10px;
  background: linear-gradient(145deg, #fff9e6, #ffffff);
}

.course-header h2 {
  font-size: 1.8rem;
  margin: 0;
  color: var(--text-primary);
}

.table-of-contents {
  background: var(--card-background);
  padding: 25px;
  border-radius: 15px;
  margin: 30px 0;
  border-left: 4px solid var(--primary-orange);
}

.table-of-contents h3 {
  margin-top: 0;
  color: var(--primary-orange);
  font-size: 1.3rem;
}

.table-of-contents ul {
  list-style: none;
  padding-left: 0;
}

.table-of-contents li {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 123, 0, 0.1);
}

.table-of-contents a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.3s;
  font-weight: 500;
}

.table-of-contents a:hover {
  color: var(--primary-orange);
}

.section-title {
  font-size: 2rem;
  color: var(--primary-orange);
  margin-top: 50px;
  margin-bottom: 25px;
  padding-bottom: 10px;
  border-bottom: 3px solid var(--primary-orange);
}

.subsection-title {
  font-size: 1.5rem;
  color: var(--text-primary);
  margin-top: 35px;
  margin-bottom: 20px;
}

h4.subsubsection-title {
  font-size: 1.3rem;
  color: var(--text-secondary);
  margin-top: 30px;
  margin-bottom: 15px;
  font-weight: 600;
}

/* ----------------------------------- */
/* Boîtes de Contenu Spécifiques */
/* ----------------------------------- */

/* Définitions (bleu/cyan) */
.definition-box {
  background: var(--color-definition-bg);
  border-left: 5px solid var(--color-definition-border);
  padding: 20px;
  margin: 25px 0;
  border-radius: 10px;
}

/* Propositions/Théorèmes (rouge) */
.proposition-box {
  background: var(--color-proposition-bg);
  border-left: 5px solid var(--color-proposition-border);
  padding: 20px;
  margin: 25px 0;
  border-radius: 10px;
}

/* Exemples (vert) */
.example-box {
  background: var(--color-example-bg);
  border-left: 5px solid var(--color-example-border);
  padding: 20px;
  margin: 25px 0;
  border-radius: 10px;
}

.definition-box h4,
.proposition-box h4,
.example-box h4 {
  margin-top: 0;
  font-size: 1.2rem;
  font-weight: 600;
}
.example-box h4 {
  color: var(--color-example-title); 
}

/* Preuves */
.proof-box {
  background: #fefefe;
  border-left: 4px solid #999;
  padding: 5px 15px 15px 25px;
  margin: 20px 0;
  border-radius: 0 8px 8px 0;
  font-size: 0.95rem;
  box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.proof-box p {
  margin-top: 10px;
  margin-bottom: 10px;
}

.proof-box p:first-child {
  margin-top: 0;
}

/* Remarques (jaune) */
.remarque {
  background: var(--color-remarque-bg);
  border-left: 4px solid var(--color-remarque-border);
  padding: 15px;
  margin: 20px 0;
  border-radius: 5px;
  font-style: italic;
}

.remarque strong {
  color: var(--primary-orange);
  font-style: normal;
}

/* Boîtes de formules */
.formula-box {
  background: #fffcf5; 
  padding: 20px 20px 20px 25px; 
  margin: 20px 0;
  text-align: center; 
  overflow-x: auto;
  border-left: 4px solid var(--primary-orange); 
  border-radius: 0 8px 8px 0;
  box-shadow: 0 2px 5px rgba(0,0,0,0.02); 
}

/* ----------------------------------- */
/* Images et Tableaux */
/* ----------------------------------- */
.image-container {
  text-align: center;
  margin: 30px 0;
  max-width: 600px;
  margin-left: auto;   
  margin-right: auto;  
}

.image-container img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: var(--shadow-light);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 25px 0;
  background: white;
  box-shadow: var(--shadow-light);
  border-radius: 10px;
  overflow: hidden;
}

table th {
  background: var(--primary-orange);
  color: white;
  padding: 15px;
  text-align: center;
  font-weight: 600;
}

table td {
  padding: 12px;
  text-align: center;
  border: 1px solid #e0e0e0;
}

table tr:nth-child(even) {
  background: #fafafa;
}

/* ----------------------------------- */
/* Boutons de Navigation */
/* ----------------------------------- */
.btn-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--primary-orange), #ff9500);
  color: white;
  padding: 12px 24px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: 0 4px 15px rgba(255, 123, 0, 0.3);
  transition: all 0.3s ease;
  margin: 0;
}

.btn-nav:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 123, 0, 0.4);
}

.navigation-buttons {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap; 
  gap: 20px; 
  margin-top: 50px;
}

/* ----------------------------------- */
/* Media Queries (Mobile) */
/* ----------------------------------- */
@media (max-width: 768px) {
  .hero-content h1 {
    font-size: 2.2rem;
  }

  .content-wrapper {
    padding: 25px;
  }
  
  /* Règle mobile pour le bouton PDF (passe en position relative et pleine largeur) */
  .btn-pdf-download {
    position: relative; 
    top: auto;
    right: auto;
    display: block; 
    text-align: center;
    margin-bottom: 20px; 
  }

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

  .subsection-title {
    font-size: 1.2rem;
  }
  
  h4.subsubsection-title {
    font-size: 1.1rem;
  }

  /* Règle mobile pour les boutons de navigation */
  .navigation-buttons {
    flex-direction: row; 
    gap: 10px; 
    margin-top: 30px;
  }

  .btn-nav {
    width: auto; 
    max-width: none;
    padding: 10px 15px; 
    font-size: 0.9rem; 
  }

  /* Handle MathJax formula overflow on mobile */
  .formula-box {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Only apply overflow to block display equations, not inline math */
  mjx-container[display="true"] {
    overflow-x: auto !important;
    max-width: 100% !important;
  }
}

/* AJOUTS POUR HARMONISATION AVEC MATHS */

/* Styles pour les preuves déroulantes (Correction, Preuve, etc.) */
.proof-box details summary {
  cursor: pointer;
  font-weight: bold;
  font-style: italic;
  color: #333;
  outline: none;
  list-style: none; /* Masque la flèche par défaut */
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Masquer la flèche par défaut sur Webkit */
.proof-box details summary::-webkit-details-marker {
  display: none;
}

/* Ajout d'une flèche personnalisée */
.proof-box details summary::before {
  content: '▶';
  font-size: 0.8em;
  transition: transform 0.2s ease;
  display: inline-block;
}

/* Rotation de la flèche quand ouvert */
.proof-box details[open] summary::before {
  transform: rotate(90deg);
}

.proof-box details[open] summary {
  margin-bottom: 10px;
}

.proof-box details summary:hover {
  color: var(--primary-orange);
}

/* Styles pour les liens dans le contenu du cours */
.content-wrapper a:not(.btn-pdf-download):not(.btn-nav):not(.table-of-contents a) {
  color: var(--primary-orange);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
  border-bottom: 1px solid transparent;
}

.content-wrapper a:not(.btn-pdf-download):not(.btn-nav):not(.table-of-contents a):hover {
  color: #e65100; /* Orange un peu plus foncé au survol */
  border-bottom: 1px solid var(--primary-orange);
}