/* ===================================================================
 * Material Theme — surcouche de modernisation du site
 *
 * Ce fichier est chargé APRÈS toutes les feuilles de style existantes
 * (Bootstrap, thème Remark/Nova, plugins) afin de moderniser
 * l'apparence de l'ensemble du site sans casser la structure HTML/JS
 * existante : palette Material 3, typographie plus lisible, élévation,
 * coins arrondis, formulaires, tableaux, responsive.
 * =================================================================== */

/* -------------------------------------------------------------------
 * 1. Design tokens
 * ------------------------------------------------------------------- */
:root {
  /* Couleurs de marque (Material Indigo, déjà utilisées dans le thème) */
  --md-primary-50: #e8eaf6;
  --md-primary-100: #c5cae9;
  --md-primary-200: #9fa8da;
  --md-primary-300: #7986cb;
  --md-primary-400: #5c6bc0;
  --md-primary: #3f51b5;
  --md-primary-600: #3949ab;
  --md-primary-700: #303f9f;
  --md-primary-800: #283593;
  --md-primary-900: #1a237e;
  --md-on-primary: #ffffff;

  --md-secondary: #00bcd4;
  --md-secondary-600: #00acc1;

  --md-success: #4caf50;
  --md-warning: #ff9800;
  --md-danger: #f44336;
  --md-info: #00bcd4;

  /* Surfaces (mode clair) */
  --md-bg: #f4f5f9;
  --md-surface: #ffffff;
  --md-surface-alt: #f7f8fc;
  --md-border: #e6e8f0;
  --md-on-surface: #1c1c22;
  --md-on-surface-muted: #62636c;

  /* Élévation Material (ombres) */
  --md-elevation-1: 0 1px 2px 0 rgba(30, 30, 45, 0.06), 0 1px 3px 1px rgba(30, 30, 45, 0.08);
  --md-elevation-2: 0 1px 2px 0 rgba(30, 30, 45, 0.08), 0 3px 8px 1px rgba(30, 30, 45, 0.1);
  --md-elevation-3: 0 4px 10px 0 rgba(30, 30, 45, 0.1), 0 6px 18px 2px rgba(30, 30, 45, 0.12);
  --md-elevation-4: 0 8px 20px 0 rgba(30, 30, 45, 0.14), 0 10px 28px 3px rgba(30, 30, 45, 0.14);

  /* Forme */
  --md-radius-sm: 6px;
  --md-radius: 10px;
  --md-radius-lg: 16px;
  --md-radius-pill: 999px;

  /* Typo */
  --md-font: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

  /* Transitions */
  --md-ease: cubic-bezier(0.4, 0, 0.2, 1);
}

body.page-dark,
body.site-dark {
  --md-bg: #16161c;
  --md-surface: #1e1e26;
  --md-surface-alt: #24242e;
  --md-border: #34343f;
  --md-on-surface: #eceef4;
  --md-on-surface-muted: #a5a6b3;
}

/* -------------------------------------------------------------------
 * 2. Base & typographie
 * ------------------------------------------------------------------- */
html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--md-font);
  background-color: var(--md-bg);
  color: var(--md-on-surface);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s var(--md-ease), color 0.25s var(--md-ease);
}

body,
.page-content {
  line-height: 1.65;
}

p {
  margin-bottom: 1em;
  max-width: 74ch;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--md-on-surface);
  line-height: 1.25;
  margin-bottom: 0.6em;
}

a {
  color: var(--md-primary-600);
  transition: color 0.15s var(--md-ease);
}

a:hover,
a:focus {
  color: var(--md-primary-800);
}

body.page-dark a:not(.btn),
body.site-dark a:not(.btn) {
  color: #8c9eff;
}

body.page-dark a:not(.btn):hover,
body.site-dark a:not(.btn):hover {
  color: #b3c1ff;
}

::selection {
  background: var(--md-primary-200);
  color: var(--md-primary-900);
}

/* Scrollbar moderne (WebKit) */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: rgba(63, 81, 181, 0.35);
  border-radius: var(--md-radius-pill);
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background-color: rgba(63, 81, 181, 0.55);
}

/* Focus visible accessible */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--md-primary-400);
  outline-offset: 2px;
}

/* -------------------------------------------------------------------
 * 3. Layout général / conteneurs
 * ------------------------------------------------------------------- */
.page-content,
.container-fluid {
  max-width: 100%;
}

.page {
  background-color: var(--md-bg);
}

@media (min-width: 1200px) {
  .page-content {
    padding-left: 30px;
    padding-right: 30px;
  }
}

img {
  max-width: 100%;
  height: auto;
}

/* -------------------------------------------------------------------
 * 4. Navigation principale
 * ------------------------------------------------------------------- */
.site-navbar {
  box-shadow: var(--md-elevation-2);
}

/* Bandeau supérieur : fond et texte unifiés, adaptés au mode clair/sombre.
   On force à la fois le fond ET les couleurs de texte/icônes ensemble
   (y compris les barres du hamburger, qui utilisent background-color et
   non color) pour ne jamais se retrouver avec un contraste cassé. */
.site-navbar,
.site-navbar .navbar-header,
.site-navbar .navbar-container {
  background-color: var(--md-surface) !important;
}

.site-navbar .navbar-header,
.site-navbar .navbar-header .navbar-toggler,
.site-navbar .navbar-header .navbar-brand,
.site-navbar .navbar-header .navbar-brand-text,
.site-navbar .navbar-container .nav-link,
.site-navbar .navbar-container .navbar-toggler {
  color: var(--md-on-surface) !important;
}

.site-navbar .hamburger::before,
.site-navbar .hamburger::after,
.site-navbar .hamburger .hamburger-bar {
  background-color: var(--md-on-surface) !important;
}

.site-menubar .site-menu-item > a:hover {
  color: var(--md-primary);
}

.dropdown-menu {
  border: none;
  border-radius: var(--md-radius);
  box-shadow: var(--md-elevation-3);
  padding: 8px;
  background-color: var(--md-surface);
}

.dropdown-menu > li > a {
  border-radius: var(--md-radius-sm);
  padding: 10px 14px;
}

.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus {
  background-color: var(--md-primary-50);
  color: var(--md-primary-800);
}

body.page-dark .dropdown-menu > li > a:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.site-menubar {
  background-color: var(--md-surface) !important;
  box-shadow: var(--md-elevation-1);
}

.site-menu-item.active > a {
  background-color: var(--md-primary-50) !important;
  border-radius: 0 var(--md-radius-pill) var(--md-radius-pill) 0;
}

body.page-dark .site-menu-item.active > a {
  background-color: rgba(63, 81, 181, 0.25) !important;
}

/* Masque le bloc "Le saviez-vous ?" quand le menu de gauche est rétracté */
body.site-menubar-fold .site-menubar-tip {
  display: none;
}

/* -------------------------------------------------------------------
 * 5. Boutons — style Material (rempli / contour / texte)
 * ------------------------------------------------------------------- */
.btn {
  font-weight: 500;
  border-radius: var(--md-radius-sm);
  letter-spacing: 0.01em;
  text-transform: none;
  padding: 10px 20px;
  transition: box-shadow 0.2s var(--md-ease), transform 0.15s var(--md-ease), background-color 0.2s var(--md-ease);
  border-width: 1px;
}

.btn:active {
  transform: translateY(1px);
}

.btn-lg {
  border-radius: var(--md-radius);
}

.btn-sm {
  border-radius: var(--md-radius-sm);
}

.btn-primary {
  background-color: var(--md-primary);
  border-color: var(--md-primary);
  box-shadow: var(--md-elevation-1);
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--md-primary-700);
  border-color: var(--md-primary-700);
  box-shadow: var(--md-elevation-2);
}

.btn-default {
  background-color: var(--md-surface);
  border-color: var(--md-border);
  color: var(--md-on-surface);
}

.btn-default:hover {
  background-color: var(--md-surface-alt);
}

.btn-flat,
.btn-link {
  box-shadow: none !important;
  background: transparent;
}

.btn-raised {
  box-shadow: var(--md-elevation-2);
}

.btn-raised:hover {
  box-shadow: var(--md-elevation-3);
}

.btn-floating {
  box-shadow: var(--md-elevation-3);
}

/* -------------------------------------------------------------------
 * 6. Cartes / panneaux
 * ------------------------------------------------------------------- */
.panel,
.card,
.widget {
  background-color: var(--md-surface);
  border: 1px solid var(--md-border);
  border-radius: var(--md-radius);
  box-shadow: var(--md-elevation-1);
  transition: box-shadow 0.2s var(--md-ease);
}

.panel:hover,
.card:hover {
  box-shadow: var(--md-elevation-2);
}

.panel-heading,
.card-header {
  background-color: transparent;
  border-bottom: 1px solid var(--md-border);
  border-top-left-radius: var(--md-radius);
  border-top-right-radius: var(--md-radius);
  padding: 16px 20px;
  font-weight: 500;
}

.panel-body,
.card-body {
  padding: 20px;
}

.panel-footer,
.card-footer {
  background-color: var(--md-surface-alt);
  border-top: 1px solid var(--md-border);
  border-bottom-left-radius: var(--md-radius);
  border-bottom-right-radius: var(--md-radius);
}

/* -------------------------------------------------------------------
 * 7. Formulaires
 * ------------------------------------------------------------------- */
.form-control {
  border: 1px solid var(--md-border);
  border-radius: var(--md-radius-sm);
  background-color: var(--md-surface);
  color: var(--md-on-surface);
  padding: 10px 14px;
  height: auto;
  box-shadow: none;
  transition: border-color 0.15s var(--md-ease), box-shadow 0.15s var(--md-ease);
}

.form-control:focus {
  border-color: var(--md-primary);
  box-shadow: 0 0 0 3px rgba(63, 81, 181, 0.15);
}

label {
  font-weight: 500;
  color: var(--md-on-surface-muted);
}

.input-group-addon {
  border-radius: var(--md-radius-sm);
  border-color: var(--md-border);
  background-color: var(--md-surface-alt);
}

/* -------------------------------------------------------------------
 * 8. Tableaux
 * ------------------------------------------------------------------- */
.table {
  color: var(--md-on-surface);
}

.table > thead > tr > th {
  border-bottom-width: 1px;
  border-color: var(--md-border);
  font-weight: 500;
  color: var(--md-on-surface-muted);
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.table > tbody > tr > td,
.table > tbody > tr > th {
  border-color: var(--md-border);
  vertical-align: middle;
}

.table-striped > tbody > tr:nth-of-type(odd) {
  background-color: var(--md-surface-alt);
}

.table-hover > tbody > tr:hover {
  background-color: var(--md-primary-50);
}

body.page-dark .table-hover > tbody > tr:hover {
  background-color: rgba(63, 81, 181, 0.15);
}

/* Rend les tableaux larges défilables au lieu de casser le layout mobile */
.table-responsive {
  border: none;
}

/* -------------------------------------------------------------------
 * 9. Alertes, badges, étiquettes
 * ------------------------------------------------------------------- */
.alert {
  border: none;
  border-radius: var(--md-radius-sm);
  border-left: 4px solid transparent;
  box-shadow: var(--md-elevation-1);
}

.alert-success { border-left-color: var(--md-success); }
.alert-warning { border-left-color: var(--md-warning); }
.alert-danger  { border-left-color: var(--md-danger); }
.alert-info    { border-left-color: var(--md-info); }

.badge,
.label {
  border-radius: var(--md-radius-pill);
  font-weight: 500;
  padding: 0.3em 0.75em;
}

/* -------------------------------------------------------------------
 * 10. Pagination & onglets
 * ------------------------------------------------------------------- */
.pagination > li > a,
.pagination > li > span {
  border-radius: var(--md-radius-sm);
  margin: 0 3px;
  border-color: var(--md-border);
  color: var(--md-on-surface);
}

.pagination > .active > a {
  background-color: var(--md-primary);
  border-color: var(--md-primary);
}

.nav-tabs > li.active > a {
  color: var(--md-primary);
  border-bottom: 2px solid var(--md-primary);
}

/* -------------------------------------------------------------------
 * 11. Pied de page
 * ------------------------------------------------------------------- */
.site-footer {
  background-color: var(--md-surface);
  border-top: 1px solid var(--md-border);
  color: var(--md-on-surface-muted);
}

.site-footer a {
  color: var(--md-on-surface-muted);
}

.site-footer a:hover {
  color: var(--md-primary);
}

/* -------------------------------------------------------------------
 * 12. Modales
 * ------------------------------------------------------------------- */
.modal-content {
  border: none;
  border-radius: var(--md-radius-lg);
  box-shadow: var(--md-elevation-4);
}

.modal-header {
  border-bottom: 1px solid var(--md-border);
}

.modal-footer {
  border-top: 1px solid var(--md-border);
}

/* -------------------------------------------------------------------
 * 13. Responsive — confort de lecture mobile
 * ------------------------------------------------------------------- */
@media (max-width: 767px) {
  body {
    font-size: 15px;
  }

  h1, .h1 { font-size: 1.9rem; }
  h2, .h2 { font-size: 1.5rem; }
  h3, .h3 { font-size: 1.25rem; }

  .panel-body,
  .card-body {
    padding: 16px;
  }

  .btn {
    padding: 10px 16px;
  }

  .table-responsive {
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 480px) {
  .panel-heading,
  .card-header {
    padding: 14px 16px;
  }
}

/* -------------------------------------------------------------------
 * 14. Grilles de cartes (formations, articles, catégories...)
 * ------------------------------------------------------------------- */
.projects-wrap .blocks,
.documents-wrap .blocks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
  list-style: none;
  margin: 24px 0 0;
  padding: 0;
}

.projects-wrap .blocks > li,
.documents-wrap .blocks > li {
  display: flex;
}

.projects-wrap .blocks .panel,
.documents-wrap .blocks .panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin-bottom: 0;
  padding: 0;
  overflow: hidden;
}

.projects-wrap .blocks .panel .overlay {
  margin: 0;
}

.projects-wrap .blocks .panel img.overlay-figure,
.documents-wrap .blocks .panel img.overlay-figure {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
}

.projects-wrap .blocks .panel .panel-body,
.documents-wrap .blocks .panel .panel-body {
  padding: 16px;
}

/* Cartes "document" (catégories et articles) */
.document-card-title {
  text-decoration: none;
  color: var(--md-on-surface);
}

.document-card-title h4 {
  margin: 0 0 6px;
  font-size: 1rem;
  color: var(--md-primary-700);
}

body.page-dark .document-card-title h4 {
  color: var(--md-primary-200);
}

.document-card .panel-body p {
  color: var(--md-on-surface-muted);
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.document-card-meta {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--md-border);
  font-size: 0.8rem;
  color: var(--md-on-surface-muted);
}

.course-title {
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--md-on-surface);
}

.course-tags {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--md-radius-pill);
  background-color: var(--md-primary-50);
  color: var(--md-primary-800);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

body.page-dark .chip {
  background-color: rgba(63, 81, 181, 0.25);
  color: #c5cae9;
}

@media (max-width: 480px) {
  .projects-wrap .blocks {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* -------------------------------------------------------------------
 * 15. Bloc "à propos" / présentation
 * ------------------------------------------------------------------- */
.intro-block {
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}

.intro-lead {
  font-size: 1.1rem;
  color: var(--md-on-surface);
}

.intro-text {
  margin-top: 20px;
  color: var(--md-on-surface-muted);
}

/* -------------------------------------------------------------------
 * 16. Grille d'équipe (formateurs, intervenants...)
 * ------------------------------------------------------------------- */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.team-card-wrap {
  display: flex;
}

.team-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 16px;
}

.team-card-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--md-primary-50);
  margin-bottom: 16px;
  flex-shrink: 0;
}

body.page-dark .team-card-avatar {
  background-color: rgba(63, 81, 181, 0.2);
}

.team-card-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.team-card-avatar .icon {
  font-size: 2.75rem;
  margin: 0;
}

.team-card-name {
  margin: 0 0 8px;
  word-break: break-word;
}

.team-card-desc {
  color: var(--md-on-surface-muted);
  font-size: 0.9rem;
  word-break: break-word;
  margin-bottom: 16px;
}

.team-card-links {
  margin-top: auto;
  display: flex;
  gap: 8px;
}

.team-grid-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 24px;
}

/* -------------------------------------------------------------------
 * 17. Filtres de page-header (glossaire, FAQ...)
 * ------------------------------------------------------------------- */
.page-header-select {
  background-color: rgba(0, 0, 0, 0.08);
  border: none;
  color: inherit;
}

/* -------------------------------------------------------------------
 * 18. Glossaire
 * ------------------------------------------------------------------- */
.letter-btn {
  position: relative;
  overflow: visible;
  min-width: 36px;
}

.letter-btn-empty {
  opacity: 0.5;
}

.letter-btn-count {
  position: absolute;
  top: -8px;
  right: -8px;
  font-size: 0.65rem;
  padding: 3px 6px;
  box-shadow: var(--md-elevation-1);
  z-index: 1;
}

.glossary-icon {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: var(--md-radius-sm);
}

.glossary-term-trans {
  font-size: 0.7em;
}

.read-more-btn {
  font-size: 0.9rem;
}

/* -------------------------------------------------------------------
 * 19. Parcours pédagogiques
 * ------------------------------------------------------------------- */
.learning-path-card {
  display: block;
  background-color: var(--md-surface);
  border: 1px solid var(--md-border);
  border-left: 5px solid var(--path-color, var(--md-primary));
  border-radius: var(--md-radius);
  box-shadow: var(--md-elevation-1);
  padding: 24px;
  margin-bottom: 24px;
}

.path-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.path-icon {
  color: var(--path-color, var(--md-primary));
}

.path-desc {
  color: var(--md-on-surface-muted);
  margin-bottom: 20px;
}

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

.path-step {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--md-border);
}

.path-step:first-child {
  border-top: none;
}

.path-steps .step-icon {
  float: none;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--path-color, var(--md-primary));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 500;
  margin-right: 0;
}

.path-steps .step-content {
  flex: 1;
}

.path-steps .step-desc {
  color: var(--md-on-surface-muted);
  font-size: 0.85rem;
}

.path-start-btn {
  border-color: var(--path-color, var(--md-primary));
  color: var(--path-color, var(--md-primary));
}
