* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: Arial, Helvetica, sans-serif;
}

body {
  background-color: #ffffff;
  color: #1e293b;
  line-height: 1.6;
}

.exercise-card img,
.accordion-content img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
    margin: 15px auto;
}
/* Style propre pour les énoncés et les listes de questions */
.exo-corps {
    font-size: 16px;
    line-height: 1.8;
    color: #1e293b;
    margin-bottom: 20px;
    word-wrap: break-word;
}

.exo-corps p {
    margin-bottom: 12px;
}

.exo-corps ol, .accordion-content ol {
    margin: 12px 0 16px 26px !important;
    padding-left: 10px !important;
    list-style-type: decimal !important;
}

.exo-corps ul, .accordion-content ul {
    margin: 12px 0 16px 26px !important;
    padding-left: 10px !important;
    list-style-type: disc !important;
}

.exo-corps li, .accordion-content li {
    margin-bottom: 8px;
    padding-left: 6px;
    line-height: 1.7;
    display: list-item !important; /* Force l'affichage d'un élément de liste par ligne */
}
/* 1. Header & Barre de navigation */
.navbar {
  background-color: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 16px 8%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}
.math-box, .katex-display {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 0;
}

.navbar .logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 22px;
  font-weight: bold;
  color: #0f172a;
  text-decoration: none;
}

.logo-text {
  font-weight: 800;
  font-size: 24px;
  color: #0f172a;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 25px;
  align-items: center;
}

.nav-links a {
  color: #64748b;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
}

.nav-links a:hover {
  color: #10b981;
}

.active-bac-link {
  color: #10b981 !important;
  font-weight: bold;
}

.prepa-link {
  color: #059669 !important;
  font-weight: bold;
}

.dropdown {
  position: relative;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: #ffffff;
  min-width: 220px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  list-style: none;
  padding: 8px 0;
  border: 1px solid #e2e8f0;
}

.dropdown-menu li a {
  color: #334155;
  padding: 10px 18px;
  display: block;
  font-size: 14px;
}

.dropdown-menu li a:hover {
  background-color: #ecfdf5;
  color: #10b981;
}

.dropdown-menu li.disabled-level a {
  color: #94a3b8;
}

.dropdown:hover .dropdown-menu {
  display: block;
}

/* 2. Hero Section */
.hero {
  padding: 50px 8% 40px;
  background-color: #ffffff;
}

.hero-container {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
}

.hero-content {
  flex: 1.2;
}

.hero-content h1 {
  font-size: 34px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.25;
  margin-bottom: 14px;
}

.hero-content p {
  color: #64748b;
  font-size: 15px;
  margin-bottom: 25px;
  max-width: 500px;
}

.search-form {
  display: flex;
  align-items: center;
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 50px;
  padding: 5px 6px 5px 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
  max-width: 480px;
}

.search-form input {
  flex: 1;
  border: 0;
  outline: none;
  font-size: 14px;
  color: #1e293b;
  background: transparent;
}

.search-form button {
  background-color: #10b981;
  border: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #ffffff;
}

.search-form button:hover {
  background-color: #059669;
}

.hero-visual {
  flex: 0.9;
  display: flex;
  justify-content: center;
  align-items: center;
}

.hero-img {
  width: 100%;
  max-width: 380px;
  height: auto;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.05));
}

@media (max-width: 768px) {
  .hero-visual {
    display: none;
  }
}

.hero-visual svg {
  width: 100%;
  max-width: 360px;
  height: auto;
}

/* 3. Conteneurs & Titres */
.container {
  max-width: 1100px;
  margin: 0 auto 50px;
  padding: 0 20px;
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  margin: 35px 0 18px;
  color: #0f172a;
}

/* 4. Grille des Niveaux Scolaires */
.grid-levels {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.level-card {
  flex: 1;
  min-width: 220px;
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 22px 14px;
  text-align: center;
  text-decoration: none;
  color: #0f172a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-height: 170px;
}

.level-card:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
}

.level-card.card-bac {
  border: 2px solid #10b981;
  background-color: #ecfdf5;
}

/* --- Dimensionnement et alignement des icônes images --- */
.level-icon-wrapper {
  width: 100%;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.level-icon-wrapper img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  display: block;
}

.quick-header img {
  width: 50px;
  height: 50px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.level-card h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.level-card p {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 12px;
}

.btn-decouvrir {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  border: 1px solid #e2e8f0;
  padding: 4px 14px;
  border-radius: 20px;
  background-color: #ffffff;
}

.card-bac .btn-decouvrir {
  background-color: #10b981;
  color: #ffffff;
  border-color: #10b981;
}

/* 5. Blocs « Accès Rapide » */
.grid-quick-access {
  display: flex;
  gap: 18px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.quick-banner {
  flex: 1;
  min-width: 260px;
  border-radius: 12px;
  padding: 22px;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 145px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.banner-green {
  background-color: #059669;
}

.banner-teal {
  background-color: #0d9488;
}

.banner-blue {
  background-color: #0284c7;
}

.quick-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.quick-header h3 {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  color: #ffffff;
}

.quick-header svg {
  opacity: 0.9;
}

.btn-revision {
  align-self: flex-start;
  background-color: #ffffff;
  color: #0f172a;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 20px;
  margin-top: 14px;
}

/* 6. Composants Cours, Exercices & Devoirs */
.single-column {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.card {
  background-color: #ffffff;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  padding: 30px;
  box-shadow: 0 4px 15px rgba(15, 23, 42, 0.04);
}

.card-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.badge-ex {
  font-weight: 700;
  color: #059669;
  font-size: 17px;
}

.badge-diff {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
}

.badge-diff.moyen {
  background-color: #e0f2fe;
  color: #0369a1;
}

.math-block {
  background-color: #f8fafc;
  padding: 14px;
  border-radius: 8px;
  margin: 12px 0;
  font-size: 18px;
  border-left: 3px solid #10b981;
}

.accordion-btn {
  width: 100%;
  text-align: left;
  padding: 14px 18px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid transparent;
  margin-top: 12px;
}

.btn-indice {
  background-color: #fef9c3;
  color: #854d0e;
  border-color: #fef08a;
}

.btn-correction {
  background-color: #dcfce7;
  color: #166534;
  border-color: #bbf7d0;
}

.accordion-content {
  display: none;
  padding: 18px;
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-top: 8px;
}

/* 7. Footer */
.site-footer {
  background-color: #0f172a;
  color: #94a3b8;
  padding: 45px 5% 25px;
  margin-top: 60px;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 30px;
  max-width: 1100px;
  margin: 0 auto 35px;
}

.footer-grid h4 {
  color: #ffffff;
  margin-bottom: 14px;
  font-size: 16px;
}

.footer-grid ul {
  list-style: none;
}

.footer-grid ul li {
  margin-bottom: 8px;
}

.footer-grid ul li a {
  color: #94a3b8;
  text-decoration: none;
  font-size: 14px;
}

.footer-grid ul li a:hover {
  color: #ffffff;
}

.footer-bottom-bar {
  border-top: 1px solid #1e293b;
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1100px;
  margin: 0 auto;
  font-size: 13px;
}

.badge-tunisia {
  background-color: #ffffff;
  padding: 5px 12px;
  border-radius: 6px;
  color: #334155;
  font-size: 12px;
  font-weight: 500;
}

/* 8. Responsive */
@media (max-width: 768px) {
  .hero-container {
    flex-direction: column;
    text-align: center;
  }
  .hero-visual {
    display: none;
  }
  .search-form {
    margin: 0 auto;
  }
  .grid-levels {
    flex-direction: column;
  }
  .grid-quick-access {
    flex-direction: column;
  }
  .footer-bottom-bar {
    flex-direction: column;
    gap: 12px;
  }
}
/* Boutons stylés pour les chapitres */
.chapter-btn-group {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.btn-stylish {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none !important;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.04);
}

/* 1. Bouton Cours & Résumé (Sobre, fond blanc cassé, bordure fine) */
.btn-stylish-cours {
    background-color: #f8fafc;
    color: #334155 !important;
    border: 1px solid #cbd5e1;
}

.btn-stylish-cours:hover {
    background-color: #ffffff;
    color: #0f172a !important;
    border-color: #94a3b8;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
}

/* 2. Bouton Exercices (Accent vert Naja7ni) */
.btn-stylish-exercices {
    background-color: #10b981;
    color: #ffffff !important;
    border: 1px solid #10b981;
}

.btn-stylish-exercices:hover {
    background-color: #059669;
    border-color: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.28);
}

.btn-stylish:active {
    transform: translateY(0);
}
/* Limiter la taille des images insérées dans les cours et exercices */
.exercise-enonce img,
.exercise-card img,
.single-column img,
.accordion-content img {
    max-width: 100% !important;
    width: auto !important;
    max-height: 280px !important; /* Ajuste la hauteur pour un schéma bien proportionné */
    height: auto !important;
    display: block !important;
    margin: 18px auto !important;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}