/*
Theme Name: AlgorithmeFacile
Theme URI: https://algorithmefacile.tn/
Author: AlgorithmeFacile
Description: Thème WordPress léger et responsive pour la plateforme éducative AlgorithmeFacile.
Version: 1.0.0
Requires at least: 6.4
Requires PHP: 7.4
Text Domain: algorithmefacile
*/
/* =====================================================
   AlgorithmeFacile V2 - Feuilles de Styles Globales (Optimisé)
===================================================== */

:root {
    --primary: #0284c7;
    --primary-hover: #0369a1;
    --bg-main: #f8fafc;
    --bg-header: #0f172a;
    --bg-sidebar: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-hover: #1e293b;
    --text-color: #334155;
    --text-heading: #0f172a;
    --border-color: #e2e8f0;
    --card-bg: #ffffff;
    --code-bg: #0b0f19;
    --code-text: #38bdf8;
    --table-header-bg: #f8fafc;
    --table-stripe-bg: #f8fafc;
    --success: #16a34a;
    --warning: #eab308;
    
    /* Variable ajoutée : Couleur dynamique pour les titres de section du menu */
    --bg-section-header: rgba(255, 255, 255, 0.08); 
  }
  
  /* Thème Sombre */
  [data-theme="dark"] {
    --bg-main: #090d16;
    --bg-header: #020617;
    --bg-sidebar: #020617;
    --sidebar-text: #94a3b8;
    --sidebar-hover: #1e293b;
    --text-color: #cbd5e1;
    --text-heading: #f8fafc;
    --border-color: #1e293b;
    --card-bg: #0f172a;
    --code-bg: #020617;
    --code-text: #38bdf8;
    --table-header-bg: #1e293b;
    --table-stripe-bg: #131c2e;
    
    /* S'assombrit subtilement en mode sombre */
    --bg-section-header: rgba(255, 255, 255, 0.02); 
  }
  
  * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  }
  
  body {
    background-color: var(--bg-main);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease, color 0.3s ease;
  }
  
  /* -----------------------------------------------------
    1. En-tête (Header) & Menus Déroulants
  ----------------------------------------------------- */
  .main-header {
    background: var(--bg-header);
    color: #fff;
    padding: 1rem 2rem;
    border-bottom: 3px solid var(--primary);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
  }
  
  .logo-container h1,
  .logo-container .site-title {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.02em;
  }
  
  .subtitle {
    font-size: 0.82rem;
    color: #94a3b8;
    margin-top: 2px;
  }
  
  /* Navigation Déroulante du Header */
  .header-nav {
    display: flex;
    align-items: center;
  }
  
  .header-nav-list {
    display: flex;
    list-style: none;
    gap: 10px;
    margin: 0;
    padding: 0;
  }
  
  .header-nav-item {
    position: relative;
  }
  
  .header-nav-link {
    color: #f8fafc;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s, color 0.2s;
  }
  
  .header-nav-link:hover {
    background-color: var(--sidebar-hover);
    color: var(--primary);
  }
  
  .header-nav-link .arrow {
    font-size: 0.75rem;
  }
  
  /* Sous-menu Dropdown Header */
  .dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2);
    list-style: none;
    padding: 6px 0;
    min-width: 220px;
    display: none;
    z-index: 1000;
  }
  
  .dropdown-menu li a {
    display: block;
    padding: 9px 16px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.88rem;
    transition: background 0.15s, color 0.15s;
  }
  
  .dropdown-menu li a:hover {
    background-color: var(--primary);
    color: #ffffff;
  }
  
  .header-nav-item:hover .dropdown-menu {
    display: block;
  }
  
  .header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
  }
  
  .btn-theme {
    background: transparent;
    color: #fff;
    border: 1px solid #334155;
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
  }
  
  .btn-theme:hover {
    background-color: var(--primary);
    border-color: var(--primary);
  }
  
  .btn-mobile-menu {
    display: none;
    background: transparent;
    color: #fff;
    border: 1px solid #334155;
    font-size: 1.3rem;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
  }
  
  /* -----------------------------------------------------
    2. Disposition Principale (App Layout)
  ----------------------------------------------------- */
  .app-layout {
    display: flex;
    flex: 1;
    min-height: calc(100vh - 130px);
  }
  
  /* -----------------------------------------------------
    3. Menu Latéral (Sidebar)
  ----------------------------------------------------- */
  .sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    color: #fff;
    flex-shrink: 0;
    padding: 1.5rem 0;
    border-right: 1px solid var(--border-color);
    transition: all 0.3s ease;
  }
  
  #sidebar-menu ul, 
  .nav-list, 
  .submenu {
    list-style: none;
    padding: 0;
    margin: 0;
  }
  
  .nav-item {
    margin-bottom: 2px;
  }
  
  .nav-link, 
  .submenu-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    width: 100%;
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
  }
  
  .nav-link:hover, 
  .submenu-toggle:hover {
    background-color: var(--sidebar-hover);
    color: #f8fafc;
  }
  
  .nav-link.active {
    background-color: var(--primary);
    color: #ffffff !important;
    font-weight: 600;
  }
  
  .chevron {
    margin-left: auto;
    font-size: 0.65rem;
    transition: transform 0.3s ease;
  }
  
  .has-submenu.open .chevron {
    transform: rotate(180deg);
  }
  
  /* Sous-menu */
  .submenu {
    display: none;
    background-color: rgba(0, 0, 0, 0.15);
  }
  
  .has-submenu.open .submenu {
    display: block;
  }
  
  .submenu .nav-link {
    padding-left: 48px;
    font-size: 0.86rem;
  }
  
  /* =====================================================
     TITRES DE SECTIONS DU MENU (Cliquables et Dynamiques)
  ===================================================== */
  .nav-section-group {
    margin-bottom: 5px;
  }
  
  /* Cache les éléments par défaut (quand fermé) */
  .nav-section-group .section-items {
    display: none;
    list-style: none;
    padding: 0;
    margin: 0;
  }
  
  /* Affiche les éléments quand la classe 'open' est présente */
  .nav-section-group.open .section-items {
    display: block;
    animation: fadeInDown 0.3s ease-in-out;
  }
  
  @keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
  }
  
  .menu-section-header.clickable {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    margin: 15px 10px 5px 10px;
    background: var(--bg-section-header); /* Utilisation de la variable dynamique ici ! */
    border-radius: 6px;
    color: var(--sidebar-text);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer; 
    user-select: none;
    transition: all 0.3s ease; 
    border: 1px solid transparent;
  }
  
  /* Effets dynamiques magnifiques au survol */
  .menu-section-header.clickable:hover {
    background: rgba(2, 132, 199, 0.15); 
    border-color: rgba(2, 132, 199, 0.4);
    color: #ffffff; 
    transform: translateX(4px); 
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  }
  
  .menu-section-header.clickable .icon {
    margin-right: 10px;
    color: var(--primary);
    font-size: 1.1rem;
    transition: transform 0.3s ease;
  }
  
  .menu-section-header.clickable:hover .icon {
    transform: scale(1.2);
  }
  
  .menu-section-header.clickable .text {
    white-space: nowrap;
  }
  
  .menu-section-header.clickable .header-line {
    flex-grow: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
    margin: 0 12px;
    transition: background 0.3s ease;
  }
  
  .menu-section-header.clickable:hover .header-line {
    background: var(--primary); 
  }
  
  .chevron-section {
    font-size: 0.65rem;
    transition: transform 0.3s ease;
    color: inherit;
  }
  
  .nav-section-group.open .chevron-section {
    transform: rotate(180deg);
  }
  
  /* -----------------------------------------------------
    4. Zone de Contenu Principal (Main Content)
  ----------------------------------------------------- */
  .main-content {
    flex: 1;
    padding: 2.5rem;
    overflow-y: auto;
    max-width: 1200px;
  }
  
  /* Panneaux / Cartes modernes */
  .panel {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 2rem 2.5rem;
    margin-bottom: 1.75rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -2px rgba(0, 0, 0, 0.02);
  }
  
  .panel h1 {
    color: var(--text-heading);
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
  }
  
  .panel h2 {
    color: var(--text-heading);
    font-size: 1.3rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 0.85rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--border-color);
  }
  
  .panel h3 {
    color: var(--text-heading);
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.6rem;
  }
  
  .panel p {
    line-height: 1.7;
    margin-bottom: 1rem;
    color: var(--text-color);
  }
  
  .panel ul, .panel ol {
    padding-left: 1.5rem;
    margin-top: 0.5rem;
    margin-bottom: 1.25rem;
  }
  
  .panel li {
    line-height: 1.6;
    margin-bottom: 0.5rem;
    color: var(--text-color);
  }
  
  .panel hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1.5rem 0;
  }
  
  /* Grilles de disposition */
  .workspace-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
  }
  
  .code-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
  }
  
  /* -----------------------------------------------------
    5. Boutons, Formulaires & Contrôles
  ----------------------------------------------------- */
  .btn {
    padding: 9px 18px;
    border-radius: 8px;
    border: none;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
  }
  
  .btn-primary {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 2px 4px rgba(2, 132, 199, 0.2);
  }
  
  .btn-primary:hover {
    background-color: var(--primary-hover);
  }
  
  .btn-secondary {
    background-color: var(--table-header-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
  }
  
  .btn-secondary:hover {
    background-color: var(--border-color);
  }
  
  /* -----------------------------------------------------
    6. Code, Algorithmes & Tableaux Modernes
  ----------------------------------------------------- */
  pre, code {
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
  }
  
  pre {
    background-color: var(--code-bg);
    color: var(--code-text);
    padding: 1.25rem;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 0.88rem;
    line-height: 1.5;
    border: 1px solid var(--border-color);
    margin: 1rem 0;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
  }
  
  /* Amélioration visuelle inline code */
  p code, li code, td code {
    background-color: var(--table-header-bg);
    color: var(--primary);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    font-size: 0.85em;
  }
  
  /* Tableaux professionnels redessinés */
  table, .tableau {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 1.25rem 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    font-size: 0.92rem;
  }
  
  table th, table td, .tableau th, .tableau td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
  }
  
  table th:last-child, table td:last-child, 
  .tableau th:last-child, .tableau td:last-child {
    border-right: none;
  }
  
  table tr:last-child td, .tableau tr:last-child td {
    border-bottom: none;
  }
  
  table th, .tableau th {
    background-color: var(--table-header-bg);
    color: var(--text-heading);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.78rem;
    letter-spacing: 0.05em;
  }
  
  table tr:nth-child(even) td, .tableau tr:nth-child(even) td {
    background-color: var(--table-stripe-bg);
  }
  
  /* -----------------------------------------------------
    7. Pied de Page (Footer)
  ----------------------------------------------------- */
  .main-footer {
    background-color: var(--bg-header);
    color: #64748b;
    text-align: center;
    padding: 1.25rem;
    font-size: 0.85rem;
    border-top: 1px solid var(--border-color);
  }
  
  /* -----------------------------------------------------
    8. Zone de Recherche (Search Box)
  ----------------------------------------------------- */
  .search-box {
    position: relative;
    width: 260px;
  }
  
  .search-box input {
    width: 100%;
    padding: 8px 14px;
    border-radius: 20px;
    border: 1px solid #334155;
    background-color: var(--card-bg);
    color: var(--text-color);
    font-size: 0.88rem;
    outline: none;
    transition: all 0.2s;
  }
  
  .search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
  }
  
  .search-results-dropdown {
    position: absolute;
    top: 115%;
    left: 0;
    right: 0;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2);
  }
  
  .search-results-dropdown div {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.88rem;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.15s;
  }
  
  .search-results-dropdown div:last-child {
    border-bottom: none;
  }
  
  .search-results-dropdown div:hover {
    background-color: var(--primary);
    color: #ffffff;
  }
  
  /* -----------------------------------------------------
    9. Section Contact
  ----------------------------------------------------- */
  .contact-section {
    background-color: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 2.5rem;
    transition: background-color 0.3s;
  }
  
  .contact-container {
    max-width: 800px;
    margin: 0 auto;
  }
  
  .contact-section h2 {
    color: var(--text-heading);
    margin-bottom: 0.5rem;
    font-size: 1.4rem;
  }
  
  .contact-desc {
    color: var(--sidebar-text);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
  }
  
  .contact-form .form-group {
    margin-bottom: 1.25rem;
  }
  
  .contact-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-color);
  }
  
  .contact-form input, 
  .contact-form textarea {
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-main);
    color: var(--text-color);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s;
  }
  
  .contact-form input:focus, 
  .contact-form textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
  }
  
  /* -----------------------------------------------------
    10. Responsive Design
  ----------------------------------------------------- */
  @media (max-width: 992px) {
    .header-nav {
      order: 4;
      width: 100%;
      margin-top: 10px;
    }
  
    .header-nav-list {
      flex-direction: column;
      gap: 5px;
      width: 100%;
    }
  
    .dropdown-menu {
      position: static;
      box-shadow: none;
      border: none;
      padding-left: 20px;
      background: transparent;
    }
  
    .workspace-grid,
    .main-content {
       display: flex !important;
       flex-direction: column !important;
    }
  }
  
  @media (max-width: 768px) {
    .main-header {
       padding: 0.8rem 1rem;
    }
  
    .logo-container h1,
    .logo-container .site-title {
       font-size: 1.2rem;
    }
  
    .search-box {
       order: 3;
       width: 100%;
    }
  
    .btn-mobile-menu {
       display: block;
    }
  
    .app-layout {
       flex-direction: column;
    }
  
    .sidebar {
       width: 100%;
       display: none;
       border-right: none;
       border-bottom: 1px solid var(--border-color);
    }
  
    .sidebar.mobile-open {
       display: block;
    }
  
    .main-content {
       padding: 1.25rem;
    }
  }
  
  /* -----------------------------------------------------
    11. Pages d'Aide Pédagogique & Cartes
  ----------------------------------------------------- */
  .aide-container, .cc-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
  }
  
  .aide-card, .cc-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 22px 26px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }
  
  .aide-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px -3px rgba(0, 0, 0, 0.05);
  }
  
  .aide-card.blue { border-left: 5px solid #0284c7; }
  .aide-card.green { border-left: 5px solid #16a34a; }
  .aide-card.orange { border-left: 5px solid #eab308; }
  .aide-card.purple { border-left: 5px solid #9333ea; }
  .cc-card { border-left: 5px solid var(--primary); }
  
  .aide-card-title, .cc-card h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-heading);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
  }
  
  .aide-list, .cc-card ul {
    list-style-type: disc;
    padding-left: 20px;
    margin: 0;
  }
  
  .aide-list > li, .cc-card li {
    margin-bottom: 10px;
    line-height: 1.6;
    color: var(--text-color);
  }
  
  .badge-remarque {
    display: inline-block;
    background-color: #fef9c3;
    color: #854d0e;
    border: 1px solid #fde047;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-top: 8px;
  }
  
  [data-theme="dark"] .badge-remarque {
    background-color: #422006;
    color: #fef08a;
    border-color: #713f12;
  }
  
  /* Boîte de formule de calcul de moyenne */
  .code-box {
    background-color: var(--table-header-bg);
    border: 2px dashed var(--primary);
    color: var(--primary);
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 1.05rem;
    font-weight: 600;
    padding: 16px 20px;
    border-radius: 8px;
    text-align: center;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    letter-spacing: 0.5px;
  }
  
  [data-theme="dark"] .code-box {
    background-color: #020617;
    color: #38bdf8;
    border-color: #38bdf8;
  }
  
  /* =====================================================
     Styles pour le nouveau Logo AlgorithmeFacile
  ===================================================== */
  .logo-img {
    max-width: 260px; 
    height: auto;
    display: block;
    transition: transform 0.2s ease;
  }
  
  .logo-img:hover {
    transform: scale(1.02); 
  }
  
  @media (max-width: 768px) {
    .logo-img {
      max-width: 180px; 
    }
  }
  
  /* =====================================================
     Ajustement : Suppression du panneau droit d'exécution
  ===================================================== */
  aside.right-panel {
    display: none !important;
  }
  
  .app-layout {
    grid-template-columns: 260px 1fr !important;
  }
  
  /* Les pages d'examens pratiques (Bac Éco / Bac Lettres) enveloppent
     leur contenu dans <main class="content-container"> à côté de
     <nav class="sidebar">. .app-layout étant en flexbox, ce <main>
     doit explicitement occuper l'espace restant, sinon il se retrouve
     compressé à la largeur de son contenu (colonne étroite + grand vide). */
  .app-layout > .content-container {
    flex: 1;
    min-width: 0;
    padding: 2.5rem;
    max-width: 1200px;
    overflow-y: auto;
  }
  
  @media (max-width: 768px) {
    .app-layout > .content-container {
      padding: 1.5rem 1.25rem;
    }
  }
  
  @media (max-width: 768px) {
    .app-layout {
      grid-template-columns: 1fr !important;
    }
  }
  
  /* =====================================================
     AlgorithmeFacile — couche responsive globale 2026
  ===================================================== */
  html { scroll-behavior: smooth; }
  *, *::before, *::after { box-sizing: border-box; }
  img, svg, video, iframe { max-width: 100%; }
  input, select, textarea, button { max-width: 100%; font: inherit; }
  .content-container, .nav-container, .footer-container { width: min(1200px, calc(100% - 32px)); margin-inline: auto; }
  .content-container { overflow-wrap: anywhere; }
  .panel, .aide-card, .simulation-section, .educational-content, .seo-context, .seo-intro, .seo-related-links { min-width: 0; }
  .af-bac-table, .tableau { width: 100%; }
  
  /* =====================================================
     Tableaux "résultat de requête" façon Microsoft Access
     (feuille de données / datasheet view)
  ===================================================== */
  .access-result {
    margin-top: 4px;
  }
  .access-result .access-caption {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    background: #2c5e8a;
    padding: 4px 10px;
    border-radius: 6px 6px 0 0;
  }
  .access-table-wrap {
    overflow-x: auto;
    border: 1px solid #94a3b8;
    border-radius: 0 6px 6px 6px;
  }
  table.access-table {
    border-collapse: collapse;
    width: 100%;
    min-width: 480px;
    font-family: "Segoe UI", Calibri, Arial, sans-serif;
    font-size: 0.85rem;
    background: #fff;
    color: #111;
  }
  table.access-table th {
    background: #d6e4f0;
    color: #1e293b;
    font-weight: 700;
    text-align: left;
    padding: 6px 10px;
    border: 1px solid #94a3b8;
    white-space: nowrap;
  }
  table.access-table td {
    padding: 5px 10px;
    border: 1px solid #c3ccd6;
    white-space: nowrap;
  }
  table.access-table tbody tr:nth-child(even) {
    background: #f0f5fa;
  }
  table.access-table tbody tr:hover {
    background: #dbe9f7;
  }
  .access-param {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fffbe6;
    border: 1px solid #eab308;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.85rem;
    margin-bottom: 8px;
    color: #713f12;
  }
  .access-note {
    font-size: 0.78rem;
    opacity: 0.75;
    margin-top: 6px;
    font-style: italic;
  }
  
  /* Grille de conception Access (mode QBE) — affichée avant le résultat */
  .access-grid-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #78350f;
    background: #fef3c7;
    padding: 4px 10px;
    border-radius: 6px 6px 0 0;
    border: 1px solid #d97706;
    border-bottom: none;
  }
  .access-grid-wrap {
    overflow-x: auto;
    border: 1px solid #d97706;
    border-radius: 0 6px 6px 6px;
    margin-bottom: 14px;
  }
  table.access-grid {
    border-collapse: collapse;
    width: 100%;
    min-width: 420px;
    font-family: "Segoe UI", Calibri, Arial, sans-serif;
    font-size: 0.85rem;
    background: #fffdf7;
    color: #111;
  }
  table.access-grid td {
    padding: 5px 10px;
    border: 1px solid #e2c98a;
    white-space: nowrap;
  }
  table.access-grid tr td:first-child {
    background: #fef3c7;
    font-weight: 700;
    color: #78350f;
    text-align: right;
  }
  
  .af-bac-table th, .af-bac-table td, .tableau th, .tableau td { vertical-align: middle; }
  .table-scroll, .table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  button, .btn, a.btn { min-height: 42px; }
  
  @media (max-width: 768px) {
    .content-container, .nav-container, .footer-container { width: min(100% - 20px, 720px); }
    .header-main { position: relative; }
    .nav-container { gap: 10px; }
    .nav-links { gap: 8px; flex-wrap: wrap; }
    .nav-links a { padding: 8px 10px; }
    .intro-section { padding: 18px 14px !important; }
    .intro-section h1 { font-size: clamp(1.35rem, 6vw, 2rem); line-height: 1.2; }
    .subtitle { line-height: 1.45; }
    .panel, .aide-card, .educational-content, .seo-context, .seo-intro, .seo-related-links { padding: 14px !important; }
    .af-bac-table { min-width: 760px; }
    .af-bac-table th, .af-bac-table td { padding: 8px 6px !important; font-size: .82rem; }
    .tableau { min-width: 680px; }
    #algo-app > .panel { width: 100%; }
    #algo-app table { max-width: none; }
    #algo-app input, #algo-app select, #algo-app textarea { width: 100% !important; max-width: 100%; }
    #algo-app [style*="display:flex"] { min-width: 0; }
    #algo-app [style*="width: 250px"], #algo-app [style*="width: 200px"] { width: 100% !important; }
    .aide-container, .aide-grid, .mindmap-grid { grid-template-columns: 1fr !important; }
    .mindmap-wrapper { overflow-x: auto !important; }
    .footer-container { flex-direction: column; align-items: stretch !important; text-align: center; }
    .footer-nav ul { justify-content: center; }
    .recent-grid { grid-template-columns: 1fr !important; }
    .recent-controls { display: flex !important; justify-content: space-between; gap: 8px; }
    .recent-controls button { flex: 1; }
  }
  
  @media (max-width: 480px) {
    .content-container, .nav-container, .footer-container { width: calc(100% - 14px); }
    .logo { font-size: 1rem; }
    .nav-links a { font-size: .86rem; }
    .af-bac-table { min-width: 700px; }
    .panel h2, .aide-card h3 { line-height: 1.3; }
  }
  
  .recent-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; }
  .recent-card { background:rgba(255,255,255,.05); padding:10px; border-radius:8px; border:1px solid rgba(255,255,255,.1); min-width:0; }
  .recent-card a { color:#f8fafc; text-decoration:none; }
  .recent-card a:hover { text-decoration:underline; }
  .recent-controls { margin-top:12px; display:flex; justify-content:flex-end; gap:8px; }
  .recent-controls button { border:1px solid rgba(255,255,255,.2); background:rgba(255,255,255,.08); color:#fff; border-radius:8px; padding:7px 12px; cursor:pointer; }
  .recent-controls button:disabled { opacity:.35; cursor:not-allowed; }
  
  @media (max-width: 768px) {
    .content-container { width: min(100% - 16px, 720px); }
    .panel, .educational-content, .seo-context, .seo-intro, .seo-related-links { border-radius: 10px; }
    .aide-container { display: grid !important; grid-template-columns: 1fr !important; gap: 12px !important; }
    .aide-card { padding: 16px !important; }
    .aide-card-title { font-size: 1rem !important; }
    .simulation-section { overflow: visible; }
    .af-bac-table { min-width: 760px !important; }
    .table-responsive, .table-scroll, [style*="overflow-x: auto"] { overflow-x: auto !important; max-width: 100%; }
    .btn, a.btn { width: 100%; justify-content: center; text-align: center; }
  }
  
  @media (max-width: 480px) {
    .content-container { width: calc(100% - 12px); }
    .intro-section h1 { font-size: 1.35rem !important; }
    .panel h2 { font-size: 1.12rem; }
    .aide-list > li, .cc-card li { font-size: .94rem; line-height: 1.55; }
    .code-box { font-size: .9rem; padding: 12px 10px; overflow-wrap: anywhere; }
  }
  
  .btn-subject-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--primary);
    text-decoration: none;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    font-weight: 600;
  }
  .btn-subject-link:hover,
  .btn-subject-link:focus-visible {
    text-decoration: underline;
    transform: translateY(-1px);
  }
  @media (max-width: 768px) {
    .btn-subject-link { width: 100%; box-sizing: border-box; }
  }
  
  /* =====================================================
     Sujets Bac Lettres — tableau Excel + formules + étapes
  ===================================================== */
  .excel-caption {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #14532d;
    background: #dcfce7;
    padding: 4px 10px;
    border-radius: 6px 6px 0 0;
    border: 1px solid #16a34a;
    border-bottom: none;
  }
  .excel-table-wrap {
    overflow-x: auto;
    border: 1px solid #16a34a;
    border-radius: 0 6px 6px 6px;
    margin-bottom: 14px;
  }
  table.excel-table {
    border-collapse: collapse;
    width: 100%;
    min-width: 420px;
    font-family: Calibri, "Segoe UI", Arial, sans-serif;
    font-size: 0.85rem;
    background: #fff;
    color: #111;
  }
  table.excel-table th {
    background: #16a34a;
    color: #fff;
    font-weight: 700;
    text-align: center;
    padding: 6px 10px;
    border: 1px solid #14532d;
    white-space: nowrap;
  }
  table.excel-table td {
    padding: 5px 10px;
    border: 1px solid #bbf7d0;
    text-align: center;
    white-space: nowrap;
  }
  table.excel-table tbody tr:nth-child(even) {
    background: #f0fdf4;
  }
  table.excel-table td.excel-label {
    text-align: left;
    font-weight: 600;
    background: #f0fdf4;
  }
  
  .formula-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f0fdf4;
    border: 1px solid #16a34a;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 8px;
  }
  .formula-box .formula-cell {
    font-size: 0.75rem;
    font-weight: 700;
    color: #14532d;
    background: #bbf7d0;
    padding: 3px 8px;
    border-radius: 5px;
    white-space: nowrap;
  }
  .formula-box code {
    font-family: "Cascadia Code", Consolas, monospace;
    font-size: 0.92rem;
    color: #14532d;
    font-weight: 600;
  }
  
  .steps-list {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: step-counter;
  }
  .steps-list li {
    counter-increment: step-counter;
    position: relative;
    padding: 8px 0 8px 38px;
    margin-bottom: 4px;
    line-height: 1.55;
  }
  .steps-list li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 6px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .steps-list li:not(:last-child)::after {
    content: "";
    position: absolute;
    left: 13px;
    top: 32px;
    bottom: -4px;
    width: 2px;
    background: var(--border-color);
  }
  /* CSS pour le repli de la barre latérale (anciennement dans index.html) */
#appSidebar {
  transition: width 0.3s ease, min-width 0.3s ease;
  overflow-x: hidden;
}
#appSidebar.collapsed {
  width: 50px !important;
  min-width: 50px !important;
}
#appSidebar.collapsed #sidebar-menu {
  display: none;
}
#appSidebar.collapsed #btnToggleSidebar {
  transform: rotate(180deg);
}
       
       
       /* Masquage radical du bloc d'en-tête de cours */
.single .entry-header,
.single-cours .entry-header,
.single-exercice .entry-header,
.page-header,
.entry-header {
    display: none !important;
}
       
       /* Masquer le bloc d'introduction SEO et d'en-tête sur les cours */
#seo-intro,
.seo-intro,
.seo-context,
.entry-header {
    display: none !important;
}
       
       /* Masquer à la fois l'en-tête et le bloc de bas de page SEO sur les cours */
#seo-intro,
.seo-intro,
.seo-context,
.seo-related-links,
.entry-header {
    display: none !important;
}
/* Masquer tout bloc contenant l'indication AdSense en bas de page */
body.single .main-content p:has-text("AdSense"),
body.single .main-content h2:has-text("Principes de l'algorithme") {
    display: none !important;
}
       /* Masquer définitivement tous les blocs SEO et explicatifs du bas de page */
.seo-context,
.educational-content,
.seo-related-links {
    display: none !important;
}
       /* Masquer le paragraphe explicatif résiduel de validation AdSense */
.main-content > p {
    display: none !important;
}
       
       /* Restaurer l'affichage des titres sur la page des résultats de recherche */
body.search-results .entry-header,
body.search-results .entry-title {
    display: block !important;
    margin-bottom: 10px;
}

body.search-results .entry-title a {
    color: var(--primary, #0284c7);
    text-decoration: none;
    font-size: 1.4rem;
    font-weight: bold;
}

body.search-results .entry-title a:hover {
    text-decoration: underline;
}