/* ══════════════════════════════════════════════════════════════
   GRADE MASTER — Global Design System CSS
   Fichier : public/assets/css/grade-master.css
   
   Ce fichier contient tous les styles modernisés pour l'application.
   Compatible avec toutes les pages modernisées (Filière, Cahier de texte,
   Note, Evaluation, etc.)
   
   Dépendances :
   - Google Fonts: DM Sans (300,400,500,600) + DM Serif Display
   - FontAwesome (icônes)
   - Bootstrap 5+ (grid, utilities)
   - DataTables (tableaux)
   - Select2 (selects avancés)
══════════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════════════════
   ANTI DARK MODE — Tous navigateurs (Chrome, Samsung, Firefox,
   Safari, Edge, Opera, Brave, UC, Huawei, Xiaomi, Vivaldi…)
══════════════════════════════════════════════════════════════ */

/* 1. Standard W3C — Firefox, Chrome, Edge, Safari, Opera */
:root { color-scheme: only light; }

/* 2. Samsung Browser / WebKit — annule le filtre injecté sur html */
html {
  -webkit-filter: none !important;
  filter: none !important;
  background-color: #f4f6fb !important;
  color: #1a2535 !important;
  /* 3. Windows High Contrast (Edge legacy, IE) */
  -ms-high-contrast: none;
  forced-color-adjust: none;
}

body {
  background-color: #f4f6fb !important;
  color: #1a2535 !important;
}

/* 4. Override complet quand prefers-color-scheme: dark est détecté
      (Firefox Android, Safari iOS, Chrome, Edge, Brave, Opera, Vivaldi…) */
@media (prefers-color-scheme: dark) {

  /* Neutralise tout filtre résiduel (Chrome Force Dark, Huawei, OPPO, Vivo) */
  html, body, #app {
    -webkit-filter: none !important;
    filter: none !important;
    background-color: #f4f6fb !important;
    color: #1a2535 !important;
  }

  /* Header / Navbar */
  .app-header,
  .navbar-header,
  .navbar-nav,
  #header {
    background: linear-gradient(180deg, #c8e9e9, #fff) !important;
    color: #1a2535 !important;
    border-color: #c8e9e9 !important;
  }

  /* Sidebar */
  .app-sidebar,
  .app-sidebar-bg { background-color: #1a2f3f !important; }
  .app-sidebar .menu { background-color: transparent !important; }

  /* Contenu principal */
  .app-content,
  .app-content-padding { background-color: #f4f6fb !important; color: #1a2535 !important; }

  /* Panels / Cards */
  .panel, .panel-default, .panel-body, .panel-heading, .panel-footer,
  .card, .card-body, .card-header, .card-footer,
  .pf-card, .card-ressource, .comments-card,
  .modal-content, .dropdown-menu,
  .table, .table thead, .table tbody, .table tfoot, .table tr, .table td, .table th {
    background-color: #ffffff !important;
    color: #1a2535 !important;
    border-color: #eaecf3 !important;
  }

  /* Formulaires */
  input, input[type="text"], input[type="email"], input[type="password"],
  input[type="number"], input[type="search"], input[type="date"],
  textarea, select, .form-control, .select2-selection {
    background-color: #ffffff !important;
    color: #1a2535 !important;
    border-color: #d0d5dd !important;
  }

  /* Textes */
  a { color: #00acac; }
  .text-muted { color: #8a95a8 !important; }

  /* Badges / Boutons outline */
  .btn-outline-primary, .btn-outline-secondary { color: inherit !important; }
}

/* ══════════════════════════════════════════════════════════════
   1. VARIABLES CSS — Palette de couleurs et constantes
══════════════════════════════════════════════════════════════ */
:root {
  /* Couleurs de base */
  --bg: #f4f6fb;
  --white: #ffffff;
  --border: #eaecf3;

  /* Textes */
  --text-dark: #1a2535;
  --text-mid: #4a5568;
  --text-soft: #8a95a8;

  /* Couleur primaire (Teal) */
  --primary: #00acac;
  --primary-bg: #e6f7f7;
  --primary-dk: #008a8a;
  --primary-light: #00d4d4;
  --primary-pale: #e6f9f9;
  --primary-mid: #b3e9e9;

  /* Couleur secondaire (Gold) */
  --gold: #feb934;
  --gold-bg: #fff4d6;
  --gold-dk: #e0a020;
  --gold-light: #ffd96a;

  /* Couleurs sémantiques */
  --blue: #4f83e0;
  --blue-bg: #edf2fc;
  --blue-border: #c5d9f5;

  --amber: #d08a3a;
  --amber-bg: #fef4e7;

  --red: #e06b6b;
  --red-bg: #fdf0f0;
  --red-border: #fdd;

  --green: #3db9a0;
  --green-bg: #eaf7f5;

  /* Ombres */
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, .05), 0 6px 20px rgba(0, 0, 0, .04);
  --shadow-md: 0 6px 24px rgba(0, 172, 172, .13);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, .15);

  /* Rayons de bordure */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
}

/* ══════════════════════════════════════════════════════════════
   2. BASE — Reset et typographie
══════════════════════════════════════════════════════════════ */
body {
  background: var(--bg);
  font-family: 'DM Sans', sans-serif;
  color: var(--text-dark);
}

/* ══════════════════════════════════════════════════════════════
   3. HEADER PAGE — En-tête de page standard
══════════════════════════════════════════════════════════════ */
.pf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.pf-title {
  font-family: 'SchibstedGrotesk-Medium';
  font-size: 22px;
  color: var(--text-dark);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
}

.pf-title-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--primary-bg);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.pf-sub {
  font-size: 13px;
  color: var(--text-soft);
  margin-top: 3px;
  margin-left: 52px;
}

.pf-header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ══════════════════════════════════════════════════════════════
   4. LAYOUT — Corps de page et grilles
══════════════════════════════════════════════════════════════ */
/* .pf-body {
  padding: 0 28px 40px;
} */

/* Layout grille (sidebar + contenu principal) */
.pf-body.grid-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  align-items: start;
}

/* Layout pleine largeur */
.pf-body.full {
  grid-template-columns: 1fr;
}

/* ══════════════════════════════════════════════════════════════
   5. CARDS — Cartes et panneaux
══════════════════════════════════════════════════════════════ */
.pf-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.pf-card-header {
  padding: 7px 9px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
}

.pf-card-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.pf-card-icon.primary {
  background: var(--primary-bg);
  color: var(--primary);
}

.pf-card-icon.blue {
  background: var(--blue-bg);
  color: var(--blue);
}

.pf-card-icon.gold {
  background: var(--gold-bg);
  color: var(--gold-dk);
}

.pf-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
  flex: 1;
}

.pf-card-body {
  padding: 18px;
}

/* ══════════════════════════════════════════════════════════════
   6. PANELS — Panneaux (style legacy compatible)
══════════════════════════════════════════════════════════════ */
.panel.panel-inverse {
  border-radius: var(--radius-lg) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-sm) !important;
  overflow: hidden;
  background: var(--white);
}

.panel-heading {
  background: var(--bg) !important;
  border-bottom: 1px solid var(--border) !important;
  padding: 12px 18px !important;
}

.panel-title {
  font-family: 'DM Sans', sans-serif !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: var(--text-dark) !important;
}

/* ══════════════════════════════════════════════════════════════
   7. FORMULAIRES — Inputs, selects, labels
══════════════════════════════════════════════════════════════ */
.pf-form-notice {
  font-size: 12px;
  color: var(--text-soft);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 16px;
  text-align: center;
}

.pf-form-group {
  margin-bottom: 14px;
}

.pf-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-mid);
  margin-bottom: 5px;
  display: block;
}

.pf-input,
.pf-select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--text-dark);
  background: var(--bg);
  transition: border .2s, box-shadow .2s;
  box-sizing: border-box;
}

.pf-input:focus,
.pf-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 172, 172, .12);
  background: var(--white);
}

.pf-radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
}

.pf-radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-mid);
  cursor: pointer;
}

.pf-radio-label input {
  accent-color: var(--primary);
}

/* ── Forcer l'état visuel coché des checkbox/radio Bootstrap (.form-check-input),
   quel que soit ce qui peut le neutraliser ailleurs dans la cascade ── */
.form-check-input:checked {
  background-color: var(--primary) !important;
  border-color: var(--primary) !important;
}
.form-check-input:checked[type="checkbox"] {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23FFFFFF' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3l6-6'/%3e%3c/svg%3e") !important;
}
.form-check-input:checked[type="radio"] {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='2' fill='%23FFFFFF'/%3e%3c/svg%3e") !important;
}

/* ══════════════════════════════════════════════════════════════
   8. BOUTONS — Styles de boutons
══════════════════════════════════════════════════════════════ */
.pf-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: opacity .2s, transform .2s;
}

.pf-btn:hover {
  opacity: .85;
  transform: translateY(-1px);
}

.pf-btn.primary {
  background: var(--primary);
  color: #fff;
}

.pf-btn.gold {
  background: var(--gold);
  color: var(--text-dark);
}

.pf-btn.blue {
  background: var(--blue-bg);
  color: var(--blue);
}

.pf-btn.ghost {
  background: var(--bg);
  color: var(--text-mid);
  border: 1px solid var(--border);
}

.pf-btn-row {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* ══════════════════════════════════════════════════════════════
   9. DATATABLES — Tableaux de données
══════════════════════════════════════════════════════════════ */
#data-table-responsive {
  font-family: 'DM Sans', sans-serif !important;
  font-size: 13px !important;
  width: 100% !important;
}

#data-table-responsive thead th {
  background: #f8f9fd !important;
  color: var(--text-soft) !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: .8px !important;
  padding: 12px 14px !important;
  border-top: none !important;
  border-bottom: 2px solid var(--border) !important;
  white-space: nowrap !important;
}

#data-table-responsive tbody td {
  padding: 12px 14px !important;
  border-color: var(--border) !important;
  vertical-align: middle !important;
  color: var(--text-dark) !important;
}

#data-table-responsive tbody tr.odd,
#data-table-responsive tbody tr:nth-child(odd) {
  background: #ffffff !important;
}

#data-table-responsive tbody tr.even,
#data-table-responsive tbody tr:nth-child(even) {
  background: #fafbff !important;
}

#data-table-responsive tbody tr:hover td {
  background: #f0fafa !important;
}

/* Classes utilitaires pour les cellules */
.ct-num {
  font-weight: 700;
  color: var(--text-soft) !important;
  font-size: 12px !important;
}

/* Avatar professeur */
.ct-prof {
  display: flex;
  align-items: center;
  gap: 9px;
}

.ct-avatar {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--primary-bg);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  font-family: 'DM Sans', sans-serif;
  flex-shrink: 0;
}

.ct-prof-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-dark);
}

/* Module / Filière */
.ct-module-name,
.ct-filiere-name,
.ev-libelle,
.ev-module-name {
  font-weight: 600;
  color: var(--text-dark);
  font-size: 13px;
}

.ct-module-sub,
.ct-filiere-sub,
.ev-user,
.ev-module-sub {
  font-size: 11.5px;
  color: var(--text-soft);
  margin-top: 2px;
  line-height: 1.4;
}

.ct-module-abbr {
  display: inline-block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 7px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-soft);
  margin-left: 5px;
  vertical-align: middle;
}

/* Date pill */
.ct-date-pill,
.ev-date-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-mid);
  white-space: nowrap;
}

.ct-date-pill i,
.ev-date-pill i {
  color: var(--primary);
  font-size: 10px;
}

/* Semestre pill */
.ct-semestre-pill,
.ev-semestre-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--blue-bg);
  color: var(--blue);
  border: 1px solid var(--blue-border);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

/* Description tronquée */
.ct-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 12.5px;
  color: var(--text-soft);
  max-width: 240px;
}

/* ══════════════════════════════════════════════════════════════
   10. BADGES — Statuts et états
══════════════════════════════════════════════════════════════ */
.ct-badge,
.ev-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
}

/* États spécifiques */
.ct-badge.actif,
.ev-badge.valide {
  background: var(--green-bg);
  color: var(--green);
}

.ct-badge.annule,
.ev-badge.annule {
  background: var(--red-bg);
  color: var(--red);
}

.ct-badge.attente,
.ev-badge.programme {
  background: var(--amber-bg);
  color: var(--amber);
}

.ev-badge.termine {
  background: var(--blue-bg);
  color: var(--blue);
}

/* ══════════════════════════════════════════════════════════════
   11. BOUTONS ACTIONS — Icônes dans tableaux
══════════════════════════════════════════════════════════════ */
.ct-action-btns,
.ct-actions-cell,
.ev-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ct-btn-icon,
.ct-icon-btn,
.ev-btn-icon {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-soft);
  text-decoration: none;
  cursor: pointer;
  transition: all .2s;
}

.ct-btn-icon:hover,
.ct-icon-btn:hover,
.ev-btn-icon:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}

.ct-btn-icon.info:hover,
.ct-icon-btn.info:hover,
.ev-btn-icon.info:hover {
  background: var(--primary-bg);
  border-color: var(--primary);
  color: var(--primary);
}

.ct-btn-icon.edit:hover,
.ct-icon-btn.edit:hover {
  background: var(--amber-bg);
  border-color: var(--amber);
  color: var(--amber);
}

.ct-btn-icon.danger:hover,
.ct-icon-btn.danger:hover,
.ev-btn-icon.danger:hover {
  background: var(--red-bg);
  border-color: var(--red);
  color: var(--red);
}

.ev-btn-icon.warn:hover {
  background: var(--amber-bg);
  border-color: var(--amber);
  color: var(--amber);
}

/* Bouton détail (version lien) */
.ct-detail-btn,
.ev-detail-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-bg);
  border: 1px solid var(--primary-mid);
  text-decoration: none;
  transition: all .2s;
}

.ct-detail-btn:hover,
.ev-detail-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0, 172, 172, .25);
}

/* ══════════════════════════════════════════════════════════════
   12. DATATABLES CONTROLS — Pagination et filtres
══════════════════════════════════════════════════════════════ */
.dataTables_wrapper {
  font-family: 'DM Sans', sans-serif !important;
  font-size: 13px !important;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  padding: 6px 10px !important;
  font-size: 13px !important;
  font-family: 'DM Sans', sans-serif !important;
  background: var(--bg) !important;
  color: var(--text-dark) !important;
  outline: none !important;
}

.dataTables_wrapper .dataTables_filter input:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(0, 172, 172, .1) !important;
}

.dataTables_wrapper .dataTables_info {
  color: var(--text-soft) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: 7px !important;
  font-size: 12px !important;
  font-family: 'DM Sans', sans-serif !important;
  border: 1px solid var(--border) !important;
  margin: 0 2px !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--primary-bg) !important;
  border-color: var(--border) !important;
  color: var(--primary) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
  color: #c0c8d4 !important;
  background: transparent !important;
}

/* ══════════════════════════════════════════════════════════════
   13. SELECT2 — Overrides pour selects avancés
══════════════════════════════════════════════════════════════ */
.pf-select-annee {
  min-width: 260px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--text-dark);
  background: var(--white);
  transition: border .2s, box-shadow .2s;
  outline: none;
  cursor: pointer;
}

.pf-select-annee:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 172, 172, .12);
}

.select2-container--default .select2-selection--single {
  border: 1px solid var(--border) !important;
  border-radius: 9px !important;
  height: 38px !important;
  background: var(--white) !important;
  font-family: 'DM Sans', sans-serif !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 36px !important;
  padding-left: 12px !important;
  font-size: 13px !important;
  color: var(--text-dark) !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 36px !important;
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(0, 172, 172, .12) !important;
}

.select2-dropdown {
  border: 1px solid var(--border) !important;
  border-radius: 9px !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .1) !important;
  font-family: 'DM Sans', sans-serif !important;
  font-size: 13px !important;
}

.select2-results__option--highlighted {
  background: var(--primary-bg) !important;
  color: var(--primary-dk) !important;
}

.select2-results__option--selected {
  background: var(--primary) !important;
  color: #fff !important;
}

/* ══════════════════════════════════════════════════════════════
   14. ALERTS — Barres d'alerte et recherche
══════════════════════════════════════════════════════════════ */
.alert.alert-secondary {
  background: var(--bg) !important;
  border: none !important;
  border-bottom: 1px solid var(--border) !important;
  border-radius: 0 !important;
  font-size: 13px !important;
  color: var(--text-soft) !important;
  padding: 14px 18px !important;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  flex-wrap: wrap !important;
}

.alert.alert-secondary .btn-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.alert.alert-secondary .btn-success {
  background: var(--primary) !important;
  border: none !important;
  border-radius: 9px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  font-family: 'DM Sans', sans-serif !important;
  padding: 6px 14px !important;
}

.alert.alert-secondary .btn-warning {
  background: var(--gold) !important;
  border: none !important;
  border-radius: 9px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  font-family: 'DM Sans', sans-serif !important;
  padding: 6px 14px !important;
  color: var(--text-dark) !important;
}

.search-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-mid);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 7px;
}

.search-label i {
  color: var(--primary);
}

/* Bouton recherche dans panel-heading */
.btn-recherche {
  background: var(--primary) !important;
  border: none !important;
  border-radius: 8px !important;
  color: #fff !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  padding: 5px 12px !important;
  font-family: 'DM Sans', sans-serif !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
}

/* ══════════════════════════════════════════════════════════════
   15. MODALS — Fenêtres modales
══════════════════════════════════════════════════════════════ */
.modal-content {
  border-radius: var(--radius-lg) !important;
  border: none !important;
  font-family: 'DM Sans', sans-serif !important;
  box-shadow: var(--shadow-lg) !important;
  overflow: hidden;
}

.modal-header {
  border-bottom: 1px solid var(--border) !important;
  padding: 18px 22px !important;
  background: var(--bg) !important;
  position: relative;
}

.modal-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3.5px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
}

.modal-title {
  font-size: 15px !important;
  font-weight: 600 !important;
  color: var(--text-dark) !important;
}

.modal-body {
  padding: 22px !important;
  background: var(--white) !important;
}

.modal-footer {
  border-top: 1px solid var(--border) !important;
  padding: 14px 22px !important;
  background: var(--bg) !important;
}

/* Formulaires dans modals */
.modal-body .form-control,
.modal-body input[type="text"],
.modal-body input[type="date"],
.modal-body input[type="file"],
.modal-body select,
.modal-body textarea {
  border: 1px solid var(--border) !important;
  border-radius: 9px !important;
  font-family: 'DM Sans', sans-serif !important;
  font-size: 13px !important;
  color: var(--text-dark) !important;
  background: var(--bg) !important;
  padding: 9px 12px !important;
}

.modal-body .form-control:focus,
.modal-body input:focus,
.modal-body select:focus,
.modal-body textarea:focus {
  outline: none !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(0, 172, 172, .12) !important;
  background: var(--white) !important;
}

.modal-body label,
.modal-body .form-label,
.modal-body .col-form-label {
  font-size: 12px !important;
  font-weight: 600 !important;
  color: var(--text-mid) !important;
}

.modal-body .btn-primary {
  background: var(--primary) !important;
  border: none !important;
  border-radius: 9px !important;
  font-family: 'DM Sans', sans-serif !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  padding: 9px 20px !important;
  color: #fff !important;
}

.modal-body .btn-danger {
  background: var(--red) !important;
  border: none !important;
  border-radius: 9px !important;
  font-weight: 600 !important;
  padding: 9px 20px !important;
}

.modal-body .btn-default,
.modal-footer .btn-white {
  background: var(--bg) !important;
  border: 1px solid var(--border) !important;
  border-radius: 9px !important;
  color: var(--text-mid) !important;
  font-family: 'DM Sans', sans-serif !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  padding: 9px 20px !important;
}

/* Hints et notices dans modals */
.modal-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 13px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 500;
  margin-bottom: 16px;
}

.modal-hint.primary {
  background: var(--primary-bg);
  color: var(--primary-dk);
  border: 1px solid var(--primary-mid);
}

.modal-hint.gold {
  background: var(--gold-bg);
  color: var(--gold-dk);
  border: 1px solid #fde08a;
}

.modal-hint.danger {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red-border);
}

/* Grille détail modal */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.detail-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 11px 13px;
}

.detail-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-bottom: 3px;
}

.detail-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dark);
  line-height: 1.4;
}

.detail-section {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-soft);
  margin: 14px 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-section::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.detail-resume {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 9px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-dark);
  line-height: 1.6;
}

.detail-annulation {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  border-left: 3px solid var(--red);
  border-radius: 9px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--red);
  line-height: 1.6;
  margin-top: 10px;
}

/* ══════════════════════════════════════════════════════════════
   16. SCROLLBARS — Barres de défilement personnalisées
══════════════════════════════════════════════════════════════ */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--primary-mid);
  border-radius: 10px;
}

.fc .fc-scroller::-webkit-scrollbar {
  width: 5px;
}

.fc .fc-scroller::-webkit-scrollbar-track {
  background: transparent;
}

.fc .fc-scroller::-webkit-scrollbar-thumb {
  background: var(--primary-mid);
  border-radius: 10px;
}

/* ══════════════════════════════════════════════════════════════
   17. RESPONSIVE — Media queries
══════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .pf-body.grid-layout {
    grid-template-columns: 1fr;
  }

  .pf-header {
    padding: 16px 16px 12px;
  }

  .pf-body {
    padding: 0 16px 28px;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 576px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .pf-header {
    padding: 10px 10px 8px;
    gap: 8px;
  }

  .pf-title {
    font-size: 17px !important;
    gap: 8px;
  }

  .pf-title-icon {
    width: 34px;
    height: 34px;
    font-size: 15px;
    border-radius: 9px;
  }

  .pf-sub {
    font-size: 12px;
    margin-left: 42px;
  }
}

/* ══════════════════════════════════════════════════════════════
   18. UTILITIES — Classes utilitaires supplémentaires
══════════════════════════════════════════════════════════════ */
.text-primary {
  color: var(--primary) !important;
}

.text-gold {
  color: var(--gold) !important;
}

.text-blue {
  color: var(--blue) !important;
}

.text-soft {
  color: var(--text-soft) !important;
}

.bg-primary {
  background: var(--primary) !important;
}

.bg-gold {
  background: var(--gold) !important;
}

.bg-surface {
  background: var(--bg) !important;
}

/* ── Padding contenu principal — mobile ──────────────────────── */
@media (max-width: 767.98px) {
  .app-content .app-content-padding {
    padding: 20px 10px !important;
  }

  /* Titres */
  h1,
  .h1 {
    font-size: 1.25rem !important;
  }

  h2,
  .h2 {
    font-size: 1.1rem !important;
  }

  h3,
  .h3 {
    font-size: 1rem !important;
  }

  h4,
  .h4 {
    font-size: 0.95rem !important;
  }

  h5,
  .h5 {
    font-size: 0.9rem !important;
  }

  h6,
  .h6 {
    font-size: 0.85rem !important;
  }

  /* Titres de page (panel-title, page-header) */
  .page-header h1,
  .panel-title,
  .card-title {
    font-size: 1rem !important;
  }
}

/* ── Fix scroll bloqué entre 768px et 991px (tablette) ──────── */
@media (min-width: 768px) and (max-width: 991.98px) {
  .app-content-full-height .app-content {
    height: auto !important;
    min-height: calc(100vh - 50px);
    overflow-y: auto;
  }
}

@media (max-width: 767.98px) {
  #notifDropdown {
    display: none !important;
  }

  /* Logo et nom université alignés à gauche */
  .navbar-header .navbar-brand {
    margin-left: 0 !important;
    margin-right: auto;
  }

  .navbar-item.titreEcole {
    margin: 0 auto 0 12px !important;
    text-align: left !important;
  }
}

/* ══════════════════════════════════════════════════════════════
   COURS PARTAGÉ — show / détail
══════════════════════════════════════════════════════════════ */
.card-ressource {
  background: var(--white);
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .05), 0 6px 20px rgba(0, 0, 0, .04);
  padding: 28px;
  margin-bottom: 24px;
}

.ressource-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.ressource-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.icon-Cours {
  background: var(--primary-bg);
  color: var(--primary);
}

.icon-TP {
  background: var(--blue-bg);
  color: var(--blue);
}

.icon-TD {
  background: var(--amber-bg);
  color: var(--amber);
}

.icon-Examen {
  background: var(--red-bg);
  color: var(--red);
}

.type-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 6px;
}

.type-Cours {
  background: var(--primary-bg);
  color: var(--primary-dk);
}

.type-TP {
  background: var(--blue-bg);
  color: var(--blue);
}

.type-TD {
  background: var(--amber-bg);
  color: var(--amber);
}

.type-Examen {
  background: var(--red-bg);
  color: var(--red);
}

.ressource-meta {
  font-size: 12px;
  color: var(--text-soft);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.ressource-meta i {
  color: var(--primary);
}

.ressource-desc {
  font-size: 14px;
  color: var(--text-mid);
  line-height: 1.7;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.fichier-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--blue-bg);
  color: var(--blue);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid #c8d9f7;
  transition: all .2s;
  margin-top: 16px;
}

.fichier-btn:hover {
  background: var(--blue);
  color: #fff;
}

/* ── Commentaires ── */
.comments-card {
  background: var(--white);
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .05), 0 6px 20px rgba(0, 0, 0, .04);
  overflow: hidden;
}

.comments-title {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}

.comments-list {
  padding: 0 24px;
}

.comment-item {
  display: flex;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.comment-item:last-child {
  border-bottom: none;
}

.comment-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-bg);
  color: var(--primary-dk);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.comment-body {
  flex: 1;
}

.comment-author {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
}

.comment-date {
  font-size: 11px;
  color: var(--text-soft);
  margin-left: 8px;
}

.comment-text {
  font-size: 13px;
  color: var(--text-mid);
  margin-top: 4px;
  line-height: 1.6;
}

.comment-del {
  font-size: 11px;
  color: var(--red);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.comment-del:hover {
  text-decoration: underline;
}

.comment-form {
  padding: 18px 24px;
  border-top: 1px solid var(--border);
  background: #fafbfc;
}

.comment-input {
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 13px;
  padding: 10px 14px;
  width: 100%;
  resize: none;
  min-height: 70px;
  transition: border .2s;
  outline: none;
}

.comment-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 172, 172, .1);
}

.btn-send {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  background: var(--primary);
  color: #fff;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all .2s;
}

.btn-send:hover {
  background: var(--primary-dk);
}

.no-comment {
  padding: 32px;
  text-align: center;
  color: var(--text-soft);
}

.no-comment i {
  font-size: 32px;
  margin-bottom: 8px;
  opacity: .4;
  display: block;
}

/* ── Mobile overrides — cours_partage show ── */
@media (max-width: 576px) {
  .card-ressource {
    padding: 14px 12px;
  }

  .comments-title {
    padding: 12px 14px;
  }

  .comments-list {
    padding: 0 12px;
  }

  .comment-form {
    padding: 12px 14px;
  }

  .ressource-header {
    gap: 10px;
  }
}

/* ══════════════════════════════════════════════════════════════
   FIN DU FICHIER
══════════════════════════════════════════════════════════════ */