/* ---------- RESET & BASE ---------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html, body {
  max-width: 100%;
  overflow-x: hidden;
  background: #f5f7fb;
  min-height: 100vh;
  height: 100%;
}

/* ---------- LOGIN PAGE ---------- */
.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: #eef2f7;
  padding: 1.5rem;
  width: 100%;
  max-width: 100%;
}

.login-box {
  background: #ffffff;
  padding: 2.5rem 2rem 2rem;
  border-radius: 24px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.06);
  border: 1px solid #e9edf4;
}

.login-box h1 {
  font-size: 1.7rem;
  font-weight: 600;
  color: #1a2639;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0.2rem;
}

.login-box h1 i {
  color: #3b6ea5;
}

.login-box .sub {
  color: #6b7b93;
  font-size: 0.9rem;
  margin-bottom: 1.8rem;
  border-left: 3px solid #3b6ea5;
  padding-left: 12px;
}

.login-box label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #2c3e5a;
  margin: 1.2rem 0 0.4rem 0.2rem;
}

.login-box input {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1.5px solid #dce2ec;
  border-radius: 12px;
  font-size: 0.95rem;
  background: #fafcff;
  transition: 0.15s;
}

.login-box input:focus {
  border-color: #3b6ea5;
  outline: none;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(59, 110, 165, 0.12);
}

.login-btn {
  width: 100%;
  margin-top: 2rem;
  padding: 0.75rem;
  background: #3b6ea5;
  border: none;
  border-radius: 40px;
  font-weight: 600;
  color: white;
  font-size: 1rem;
  cursor: pointer;
  transition: 0.15s;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.login-btn:hover {
  background: #2a5380;
}

.login-btn:active {
  transform: scale(0.97);
}

.login-box .hint {
  margin-top: 1.2rem;
  font-size: 0.75rem;
  color: #8a9bb0;
  text-align: center;
}

.login-box .hint a {
  color: #3b6ea5;
  text-decoration: none;
  font-weight: 600;
}

.login-box .hint a:hover {
  text-decoration: underline;
}

/* ========== ADMIN LAYOUT ========== */
#adminWrap {
  display: none;
  flex-direction: column;
  min-height: 100vh;
  height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

/* ========== HEADER FIXE ========== */
.topbar {
  background: #ffffff;
  padding: 0.6rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e9edf4;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  flex-shrink: 0;
  z-index: 50;
}

.topbar.fixed-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hamburger-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.4rem;
  color: #2c3e5a;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: 0.15s;
}

.hamburger-btn:hover {
  background: #f0f4fa;
}

.topbar .brand {
  font-weight: 700;
  font-size: 1.3rem;
  color: #1a2639;
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar .brand i {
  color: #3b6ea5;
}

.topbar .user {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.9rem;
  color: #2c3e5a;
}

.topbar .user i {
  font-size: 1.2rem;
  color: #5a6f88;
  cursor: pointer;
  transition: 0.15s;
  padding: 6px;
  border-radius: 30px;
}

.topbar .user a {
  color: #5a6f88;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.topbar .user i:hover {
  background: #f0f4fa;
  color: #3b6ea5;
}

/* ========== BODY ========== */
.admin-body {
  display: flex;
  flex: 1;
  flex-direction: row;
  position: relative;
  width: 100%;
  max-width: 100%;
  height: calc(100vh - 60px);
  overflow: hidden;
}

/* ========== OVERLAY ========== */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* ========== SIDEBAR FIXE ========== */
.sidebar {
  background: #ffffff;
  width: 260px;
  border-right: 1px solid #e9edf4;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.25s ease, transform 0.3s ease;
  overflow: hidden;
  z-index: 100;
  height: 100%;
}

.sidebar.fixed-sidebar {
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
}

/* Sidebar réduit (bureau) */
.sidebar.collapsed {
  width: 70px;
}

.sidebar.collapsed .menu-text,
.sidebar.collapsed .submenu-arrow,
.sidebar.collapsed .menu-label,
.sidebar.collapsed .version,
.sidebar.collapsed .submenu {
  display: none;
}

.sidebar.collapsed .menu-link {
  justify-content: center;
  padding: 0.6rem 0;
}

.sidebar.collapsed .menu-link i {
  margin: 0;
  font-size: 1.2rem;
}

/* Bouton fermeture mobile (caché par défaut) */
.sidebar-close-mobile {
  display: none;
  background: none;
  border: none;
  font-size: 1.4rem;
  color: #5a6f88;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: 0.15s;
}

.sidebar-close-mobile:hover {
  background: #f0f4fa;
  color: #1a2639;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 1.2rem 0.8rem 1.2rem;
  border-bottom: 1px solid #f0f4fa;
  flex-shrink: 0;
}

.sidebar-header .menu-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #9aabbf;
  font-weight: 600;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: #9aabbf;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 4px 8px;
  border-radius: 8px;
  transition: 0.15s;
}

.sidebar-toggle:hover {
  background: #f0f4fa;
  color: #3b6ea5;
}

.sidebar.collapsed .sidebar-toggle i {
  transform: rotate(180deg);
}

/* Menu principal - scrollable */
.sidebar-menu {
  list-style: none;
  padding: 0.8rem 0.8rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-menu::-webkit-scrollbar {
  width: 4px;
}

.sidebar-menu::-webkit-scrollbar-track {
  background: #f0f4fa;
}

.sidebar-menu::-webkit-scrollbar-thumb {
  background: #d0d8e4;
  border-radius: 4px;
}

.sidebar-menu::-webkit-scrollbar-thumb:hover {
  background: #b0bccd;
}

.menu-item {
  margin-bottom: 2px;
}

.menu-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.6rem 1rem;
  border-radius: 12px;
  color: #3d4f68;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.15s;
  cursor: pointer;
  position: relative;
}

.menu-link i {
  width: 20px;
  text-align: center;
  font-size: 1rem;
  color: #6a7f99;
  flex-shrink: 0;
}

.menu-link .menu-text {
  flex: 1;
  white-space: nowrap;
}

.menu-link .submenu-arrow {
  font-size: 0.7rem;
  color: #9aabbf;
  transition: transform 0.25s ease;
  margin-left: auto;
}

.menu-link:hover {
  background: #f0f4fa;
  color: #1a2639;
}

.menu-item.active > .menu-link {
  background: #eef4fe;
  color: #1a2639;
  font-weight: 600;
}

.menu-item.active > .menu-link i {
  color: #3b6ea5;
}

/* Sous-menus */
.has-submenu .submenu {
  list-style: none;
  padding: 0;
  margin: 2px 0 4px 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.2s ease;
  opacity: 0;
}

.has-submenu.open .submenu {
  max-height: 400px;
  opacity: 1;
}

.has-submenu.open .submenu-arrow {
  transform: rotate(180deg);
}

.submenu li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.45rem 1rem 0.45rem 3.2rem;
  color: #4d607a;
  text-decoration: none;
  font-size: 0.85rem;
  border-radius: 8px;
  transition: 0.1s;
}

.submenu li a i {
  width: 18px;
  font-size: 0.8rem;
  color: #7a8fa8;
}

.submenu li a:hover {
  background: #f5f8fc;
  color: #1a2639;
}

.submenu li a.active {
  background: #eef4fe;
  color: #3b6ea5;
  font-weight: 600;
}

.submenu li a.active i {
  color: #3b6ea5;
}

/* Pied du sidebar */
.sidebar-footer {
  padding: 1rem 1.2rem;
  border-top: 1px solid #f0f4fa;
  font-size: 0.7rem;
  color: #9aabbf;
  flex-shrink: 0;
}

/* ========== MAIN CONTENT (scrollable) ========== */
.main-content {
  flex: 1;
  padding: 1rem 2rem 2rem;
  background: #f5f7fb;
  width: 100%;
  max-width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100%;
}

.main-content::-webkit-scrollbar {
  width: 6px;
}

.main-content::-webkit-scrollbar-track {
  background: #eef2f7;
}

.main-content::-webkit-scrollbar-thumb {
  background: #d0d8e4;
  border-radius: 4px;
}

.main-content::-webkit-scrollbar-thumb:hover {
  background: #b0bccd;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1.6rem;
  width: 100%;
  max-width: 100%;
}

.page-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #1a2639;
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-header h2 i {
  color: #3b6ea5;
}

.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  padding: 0.4rem 1.2rem;
  border: 1px solid #dce2ec;
  border-radius: 30px;
  background: white;
  font-weight: 500;
  font-size: 0.85rem;
  color: #2c3e5a;
  cursor: pointer;
  transition: 0.1s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  text-decoration: none;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.btn-primary {
  background: #3b6ea5;
  border-color: #3b6ea5;
  color: white;
}

.btn-primary:hover {
  background: #2a5380;
  border-color: #2a5380;
  color: white;
}

.btn-white {
  background: #fff;
  border-color: #dce2ec;
  color: #3b6ea5;
  font-weight: 600;
}

.btn-white:hover {
  background: #f5f7fa;
  border-color: #c8d0da;
  color: #2a5380;
}

.btn-outline {
  background: transparent;
  border-color: #dce2ec;
}

.btn-outline:hover {
  background: #f0f4fa;
}

.btn-danger {
  background: #ca061a;
  border-color: #ca061a;
  color: white;
}

.btn-danger:hover {
  background: #ca061a;
  border-color: #ca061a;
  color: white;
}

.btn-success {
  background: #2e9e5b;
  border-color: #2e9e5b;
  color: white;
}

.btn-success:hover {
  background: #238247;
  border-color: #238247;
  color: white;
}

.btn-info {
  background: #3b6ea5;
  border-color: #3b6ea5;
  color: white;
}

.btn-info:hover {
  background: #2a5380;
  border-color: #2a5380;
  color: white;
}

.btn-warning {
  background: #d97706;
  border-color: #d97706;
  color: white;
}

.btn-warning:hover {
  background: #b45309;
  border-color: #b45309;
  color: white;
}

.btn-default {
  background: #7a8fa8;
  border-color: #7a8fa8;
  color: white;
}

.btn-default:hover {
  background: #5a6f88;
  border-color: #5a6f88;
  color: white;
}

.btn-active {
  background: #ffffff;
  border-color: #2a5380;
  color: #2a5380;
  font-weight: 700;
}

.btn-active:hover {
  background: #eef3fa;
  border-color: #2a5380;
  color: #2a5380;
}

.btn-sm {
  padding: 0.25rem 0.9rem;
  font-size: 0.78rem;
}

/* Uniformite des boutons des barres d'outils (largeurs egales)
   + marge pour eviter le collage quand les boutons passent a la ligne */
.content > div:has(> b ~ a.btn) a.btn,
.content > div:has(> a.btn:first-child) a.btn {
  min-width: 104px;
  justify-content: center;
  vertical-align: middle;
  margin: 4px 6px 4px 0;
}

/* Boutons d'action dans les tableaux : largeur uniforme + marge anti-collage */
td a.btn,
.actions a.btn {
  min-width: 68px;
  justify-content: center;
  vertical-align: middle;
  margin: 3px 3px 3px 0;
}

/* Bouton aligne a droite (ex. « Imprimer les non payes ») */
.btn-toolbar-right {
  float: right;
  margin-left: 10px;
}

/* Garde l'alignement a droite du bouton flottant malgre les marges de la barre d'outils */
.content > div:has(> b ~ a.btn) a.btn.btn-toolbar-right,
.content > div:has(> a.btn:first-child) a.btn.btn-toolbar-right {
  float: right;
  margin: 4px 0 4px 10px;
}

/* Espace entre l'en-tete (titre <b> + boutons) et la table qui le suit */
.content > div:has(> b ~ a.btn) {
  margin-bottom: 16px;
}

/* Titre de page : design elegante (remplace « TITRE - ») */
.page-title {
  display: inline-block;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #1a2639;
  margin-right: 14px;
  vertical-align: middle;
}
.page-title::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 24px;
  margin-left: 14px;
  border-radius: 4px;
  vertical-align: -4px;
  background: linear-gradient(180deg, #3b6ea5 0%, #8bb3d9 100%);
  box-shadow: 0 0 0 3px rgba(59, 110, 165, 0.10);
}

/* Selecteur d'annee academique (annee de travail) */
.annee-select-form {
  display: inline-block;
  margin-left: 14px;
  vertical-align: middle;
}
.annee-select {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: #3b6ea5;
  background: #fff;
  border: 1px solid #d8e0ec;
  border-radius: 20px;
  padding: 0.35rem 1rem;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.annee-select:hover,
.annee-select:focus {
  border-color: #3b6ea5;
  box-shadow: 0 0 0 3px rgba(59, 110, 165, 0.12);
}

/* alerts */
.alert {
  padding: 0.7rem 1.2rem;
  border-radius: 16px;
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: 12px;
  background: white;
  border: 1px solid #e9edf4;
  font-size: 0.9rem;
  color: #1a2639;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  word-wrap: break-word;
}

.alert i {
  font-size: 1.1rem;
  color: #3b6ea5;
  flex-shrink: 0;
}

.alert-success {
  background: #eaf6ee;
  border-color: #cfe8da;
  color: #1c6b3c;
}

.alert-success i {
  color: #2e9e5b;
}

.alert-error {
  background: #fdecee;
  border-color: #f6ced3;
  color: #ca061a;
}

.alert-error i {
  color: #ca061a;
}

.alert-warning i {
  color: #ca061a;
}

/* Compat comptes glyphicon -> Font Awesome */
i.glyphicon {
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-style: normal;
  -webkit-font-smoothing: antialiased;
}

i.glyphicon-ok-sign::before {
  content: "\f058";
}

i.glyphicon-print::before {
  content: "\f02f";
}

/* ========== TABLES ========== */
.table-wrap,
.table-container {
  background: white;
  border-radius: 20px;
  padding: 0.2rem;
  border: 1px solid #e9edf4;
  overflow-x: auto;
  margin-bottom: 1.8rem;
  width: 100%;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 480px;
}

.content > table {
  background: white;
  border-radius: 20px;
  border: 1px solid #e9edf4;
  overflow: hidden;
  margin-bottom: 1.8rem;
}

/* Tableaux façon Bootstrap : conteneur avec scroll horizontal (table-responsive) */
.table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: #ffffff;
  border: 1px solid #e9edf4;
  border-radius: 20px;
  margin-bottom: 1.8rem;
}

.table-responsive table {
  margin: 0;
  border: none;
}

th {
  text-align: left;
  padding: 0.9rem 1rem 0.7rem 1rem;
  color: #2c3e5a;
  font-weight: 600;
  border-bottom: 2px solid #eef2f7;
  background: #fafcff;
}

td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid #f0f4fa;
  color: #1f2a3f;
}

tr:last-child td {
  border-bottom: none;
}

tbody tr:nth-child(even) {
  background: #fafcff;
}

tbody tr {
  transition: background 0.15s ease;
}

tbody tr:hover {
  background: #f0f6fd;
}

.badge {
  background: #eef4fe;
  color: #1a2639;
  padding: 0.2rem 0.9rem;
  border-radius: 30px;
  font-size: 0.7rem;
  font-weight: 600;
  display: inline-block;
  white-space: nowrap;
}

.badge-blue {
  background: #3b6ea5;
  color: white;
}

.badge-red {
  background: #ca061a;
  color: white;
}

.actions i {
  margin: 0 4px;
  color: #7a8fa8;
  cursor: pointer;
  font-size: 0.95rem;
  transition: 0.1s;
}

.actions i:hover {
  color: #3b6ea5;
}

.footer-note {
  margin-top: 0.8rem;
  font-size: 0.75rem;
  color: #9aabbf;
  text-align: center;
  width: 100%;
  padding-bottom: 0.5rem;
}

/* ========== MODALS ========== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(2px);
  justify-content: center;
  align-items: center;
  z-index: 999;
  padding: 1rem;
}

.modal-overlay.show {
  display: flex;
}

.modal-box {
  background: white;
  max-width: 420px;
  width: 100%;
  padding: 2rem 1.8rem 1.6rem;
  border-radius: 28px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
  animation: fadeIn 0.15s ease;
}

.modal-box.modal-medium {
  max-width: 560px;
  padding: 2rem 2rem 1.8rem;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2rem;
}

.modal-header h3 {
  font-size: 1.3rem;
  font-weight: 600;
  color: #1a2639;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.modal-header .modal-close {
  font-size: 1.4rem;
  color: #9aabbf;
  cursor: pointer;
  transition: 0.15s;
  padding: 4px;
  border-radius: 30px;
}

.modal-header .modal-close:hover {
  background: #f0f4fa;
  color: #1a2639;
}

.modal-box h3 {
  font-size: 1.3rem;
  font-weight: 600;
  color: #1a2639;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0.4rem;
}

.modal-box h3 i {
  color: #ca061a;
}

.modal-box p {
  color: #4a5d78;
  font-size: 0.95rem;
  margin: 0.8rem 0 1.6rem;
  line-height: 1.4;
}

/* ========== FORMULAIRES ========== */
.form-group {
  margin-bottom: 1.2rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #2c3e5a;
  margin-bottom: 0.3rem;
}

label {
  display: block;
  font-weight: 600;
  color: #2c3e5a;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 0.65rem 1rem;
  border: 1.5px solid #dce2ec;
  border-radius: 12px;
  font-size: 0.95rem;
  background: #fafcff;
  transition: 0.15s;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #1f2a3f;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="datetime-local"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
  border-color: #3b6ea5;
  outline: none;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(59, 110, 165, 0.12);
}

input[type="checkbox"] {
  width: auto;
}

.checkstudent {
  width: auto;
}

/* Toggle affichage mot de passe */
.password-wrapper {
  position: relative;
}

.password-wrapper input[type="password"],
.password-wrapper input[type="text"] {
  padding-right: 90px;
}

.password-wrapper .toggle-pass {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  cursor: pointer;
  color: #3b6ea5;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  line-height: 1;
  text-decoration: none;
}

.password-wrapper .toggle-pass:hover {
  color: #1a5276;
}

/* ========== CONTENU / CARTES ========== */
.content {
  width: 100%;
  max-width: 100%;
}

.content-full {
  width: 100%;
  max-width: 100%;
}

.card {
  background: #ffffff;
  border-radius: 20px;
  border: 1px solid #e9edf4;
  padding: 1.6rem 1.8rem;
  margin-bottom: 1.8rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.card h2 {
  font-size: 1.3rem;
  font-weight: 600;
  color: #1a2639;
  margin-bottom: 1.2rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid #eef2f7;
}

.connection-form {
  max-width: 520px;
  margin: 0 auto;
  padding: 6vh 1rem 2rem;
}

.connection-form .card {
  max-width: 460px;
  margin: 0 auto;
  text-align: center;
}

.txt-center {
  text-align: center;
}

.studentitem:hover {
  background-color: #eef4fe;
  color: #1a2639;
  cursor: pointer;
}

/* ---------- FICHE ETUDIANT ---------- */
.student-thumb {
  width: 38px;
  height: 50px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e9edf4;
  background: #f0f4fa;
  display: inline-block;
  vertical-align: middle;
}

.student-thumb-empty {
  display: inline-flex;
  width: 38px;
  height: 50px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px dashed #d0d8e4;
  background: #fafcff;
  color: #9aabbf;
  font-size: 0.9rem;
}
.fiche-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.9rem 1.2rem;
}

.fiche-grid-one {
  grid-template-columns: 1fr;
  gap: 0.45rem;
}

.fiche-line {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.fiche-line .fiche-label {
  min-width: 150px;
  text-align: left;
  flex-shrink: 0;
}

.fiche-sep {
  color: #9aabbf;
}

.fiche-line .fiche-value {
  text-align: left;
}

.fiche-cols {
  display: flex;
  gap: 2.5rem;
  align-items: flex-start;
  flex: 1;
  min-width: 0;
}

.fiche-cols .fiche-grid-one {
  flex: 1;
  min-width: 0;
}

.fiche-side {
  flex-shrink: 0;
  min-width: 200px;
  border: 1px solid #e5ebf3;
  border-radius: 8px;
  padding: 0.9rem;
}

.fiche-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.fiche-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #9aabbf;
  font-weight: 600;
}

.fiche-value {
  font-size: 0.95rem;
  color: #1a2639;
  font-weight: 500;
  word-break: break-word;
}

.fiche-id-card {
  display: flex;
  gap: 1.2rem;
  align-items: center;
  flex-wrap: wrap;
}

.fiche-photo {
  width: 110px;
  height: 140px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid #e9edf4;
  background: #f0f4fa;
}

.fiche-photo-placeholder {
  width: 110px;
  height: 140px;
  border-radius: 14px;
  border: 1px dashed #d0d8e4;
  background: #fafcff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9aabbf;
  font-size: 0.8rem;
  text-align: center;
}

.new-photo-img {
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fiche-section h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: #3b6ea5;
  margin-bottom: 0.9rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #eef2f7;
  display: flex;
  align-items: center;
  gap: 8px;
}

.fiche-section h3.small i {
  font-size: 0.9rem;
}

.fiche-section h3 i.glyphicon {
  font-size: 1rem;
}

.fiche-diplome {
  border: 1px solid #eef2f7;
  border-radius: 14px;
  padding: 0.9rem 1rem;
  margin-bottom: 0.7rem;
  background: #fafcff;
}

.fiche-diplome .fiche-diplome-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.fiche-diplome .fiche-diplome-head small {
  color: #9aabbf;
}

.dip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 8px;
  border: 1px solid #eef2f7;
  padding: 10px;
  border-radius: 12px;
  background: #fafcff;
}

.dip-row .form-group {
  flex: 1;
  min-width: 130px;
  margin-bottom: 0;
}

/* ---------- RECADRAGE PHOTO ---------- */
.photo-card .fiche-section {
  height: 300px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.photo-card .fiche-section h3 {
  flex: 0 0 auto;
}

.photo-crop-panel {
  margin-top: 0;
  padding: 1rem;
  border: 1px solid #eef2f7;
  border-radius: 14px;
  background: #fafcff;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.photo-crop-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 0.5rem;
  flex: 0 0 auto;
}

.photo-crop-header small {
  color: #9aabbf;
}

.photo-crop-stage {
  flex: 1 1 auto;
  min-height: 50%;
  width: 100%;
  max-width: 100%;
  margin: 0;
  background: #1a2639;
  border-radius: 12px;
  overflow: hidden;
}

.photo-crop-stage img {
  max-width: 100%;
  display: block;
  margin: 0 auto;
}

.photo-crop-tools {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 5px;
  margin-top: 0.6rem;
  flex: 0 0 auto;
}

.photo-crop-tools .btn {
  padding: 3px 7px;
  font-size: 11px;
  white-space: nowrap;
}

/* ---------- PARCOURS SOUS MENTIONS ---------- */
.parcours-block td {
  background: #f6f9fd;
  padding: 0.35rem 1rem 0.6rem;
}

.parcours-sublist {
  width: 100%;
  border-collapse: collapse;
}

.parcours-sublist tr {
  border: none;
}

.parcours-sublist td {
  border: none;
  background: transparent;
  padding: 0.3rem 0;
  font-size: 0.9rem;
}

.parcours-sublist td i {
  color: #3b6ea5;
}

.parcours-sublist .classe-line td {
  padding-left: 1.7rem;
}

.parcours-sublist .classe-line td i {
  color: #7ea2c8;
}

.parcours-vide {
  color: #9aabbf;
}

/* ========== BADGE EMPRUNTS (sidebar) ========== */
#badge-emprunts {
  vertical-align: middle;
}

/* ---------- RESPONSIVE MOBILE ---------- */
@media (max-width: 820px) {
  .sidebar {
    width: 220px;
  }
  .main-content {
    padding: 1.2rem;
  }
}

@media (max-width: 768px) {
  /* Afficher le bouton hamburger */
  .hamburger-btn {
    display: block;
  }

  .sidebar-close-mobile {
    display: block;
  }

  #adminWrap {
    height: 100vh;
    overflow: hidden;
  }

  .admin-body {
    height: calc(100vh - 56px);
  }

  /* Sidebar coulissant depuis la gauche */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    min-height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 1px solid #e9edf4;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.08);
    z-index: 100;
    overflow-y: auto;
    height: 100vh;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar.collapsed {
    width: 280px;
  }

  .sidebar.collapsed .menu-text,
  .sidebar.collapsed .submenu-arrow,
  .sidebar.collapsed .menu-label,
  .sidebar.collapsed .version,
  .sidebar.collapsed .submenu {
    display: flex;
  }

  .sidebar.collapsed .menu-link {
    justify-content: flex-start;
    padding: 0.6rem 1rem;
  }

  .sidebar.collapsed .menu-link i {
    margin: 0;
    font-size: 1rem;
  }

  /* Cacher le bouton toggle sur mobile */
  .sidebar-toggle {
    display: none;
  }

  .sidebar-header {
    padding: 1rem 1rem 0.8rem 1rem;
  }

  .sidebar-header .menu-label {
    font-size: 0.6rem;
  }

  /* Overlay */
  .sidebar-overlay.active {
    display: block;
  }

  /* Ajuster le main content */
  .main-content {
    padding: 1rem;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    height: calc(100vh - 56px);
  }

  .topbar {
    padding: 0.5rem 1rem;
    width: 100%;
    max-width: 100%;
    position: sticky;
    top: 0;
    z-index: 50;
  }

  .topbar .brand {
    font-size: 1.1rem;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: 100%;
    max-width: 100%;
  }

  .page-header h2 {
    font-size: 1.2rem;
  }

  .btn-group {
    width: 100%;
    justify-content: stretch;
  }

  .btn-group .btn {
    flex: 1;
    justify-content: center;
    font-size: 0.78rem;
    padding: 0.4rem 0.5rem;
    white-space: nowrap;
  }

  .btn-group .btn i {
    margin-right: 4px;
  }

  .modal-box.modal-medium {
    padding: 1.5rem;
    max-width: 95%;
  }

  .modal-box {
    max-width: 95%;
    padding: 1.5rem;
  }

  .table-wrap,
  .table-container,
  .table-responsive {
    border-radius: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Tables directes / dans cartes : scroll horizontal sur mobile */
  .content > table,
  .card table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .content > div:has(> b ~ a.btn) a.btn,
  .content > div:has(> a.btn:first-child) a.btn {
    min-width: 92px;
  }

  td a.btn,
  .actions a.btn {
    min-width: 60px;
  }

  table {
    min-width: 460px;
    font-size: 0.82rem;
  }

  .content > table {
    border-radius: 12px;
  }

  th, td {
    padding: 0.6rem 0.8rem;
  }

  .alert {
    font-size: 0.82rem;
    padding: 0.6rem 1rem;
  }

  .alert i {
    font-size: 1rem;
  }

  .sidebar.fixed-sidebar {
    position: fixed;
    top: 0;
    height: 100vh;
  }
}

@media (max-width: 480px) {
  .login-box {
    padding: 1.8rem 1.2rem;
  }

  .sidebar {
    width: 260px;
  }

  .topbar .user span {
    display: none;
  }

  .topbar .user i {
    font-size: 1.1rem;
  }

  .topbar {
    padding: 0.4rem 0.8rem;
  }

  .table-wrap,
  .table-container {
    border-radius: 12px;
  }

  th,
  td {
    padding: 0.5rem 0.6rem;
    font-size: 0.75rem;
  }

  .actions i {
    font-size: 0.8rem;
    margin: 0 2px;
  }

  .badge {
    font-size: 0.6rem;
    padding: 0.15rem 0.6rem;
  }

  .alert {
    font-size: 0.75rem;
    padding: 0.5rem 0.8rem;
    gap: 8px;
  }

  .alert i {
    font-size: 0.9rem;
  }

  .modal-box {
    padding: 1.2rem 1rem 1rem;
  }

  .modal-box h3 {
    font-size: 1.1rem;
  }

  .form-group input,
  .form-group select {
    font-size: 0.9rem;
    padding: 0.5rem 0.8rem;
  }

  /* Boutons de validation des formulaires pleine largeur sur mobile */
  .card form button[type="submit"] {
    width: 100%;
    justify-content: center;
  }

  .modal-actions .btn {
    min-width: 70px;
    font-size: 0.8rem;
    padding: 0.3rem 0.8rem;
  }

  .page-header h2 {
    font-size: 1.1rem;
  }

  .btn-group .btn {
    font-size: 0.7rem;
    padding: 0.3rem 0.4rem;
  }

  .btn-group .btn i {
    font-size: 0.7rem;
    margin-right: 2px;
  }

  .main-content {
    padding: 0.8rem;
    height: calc(100vh - 50px);
  }

  .topbar {
    padding: 0.4rem 0.8rem;
  }

  .topbar .brand {
    font-size: 1rem;
  }

  .hamburger-btn {
    font-size: 1.2rem;
    padding: 2px 6px;
  }

  .sidebar-header .menu-label {
    font-size: 0.55rem;
  }

  .menu-link {
    font-size: 0.8rem;
    padding: 0.5rem 0.8rem;
  }

  .submenu li a {
    font-size: 0.78rem;
    padding: 0.35rem 0.8rem 0.35rem 2.5rem;
  }

  .modal-overlay {
    padding: 0.5rem;
  }

  #adminWrap {
    height: 100vh;
  }

  .admin-body {
    height: calc(100vh - 50px);
  }

  .card {
    padding: 1.2rem 1rem;
  }

  .connection-form {
    padding-top: 3vh;
  }
}

/* Correction pour les très petits écrans */
@media (max-width: 360px) {
  .btn-group {
    flex-direction: column;
    gap: 5px;
  }

  .btn-group .btn {
    width: 100%;
    justify-content: center;
  }

  .topbar .user {
    gap: 8px;
  }

  .sidebar {
    width: 220px;
  }

  th, td {
    padding: 0.4rem 0.4rem;
    font-size: 0.7rem;
  }

  table {
    min-width: 380px;
  }
}

/* ========== IMPRESSION FICHES (CV PAPIER) ========== */
.print-cv {
  display: none;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 7mm 7mm 12mm;

    @bottom-center {
      content: "Page " counter(page) " / " counter(pages);
      font-family: "Inter", Arial, sans-serif;
      font-size: 8pt;
      color: #8a8f98;
      vertical-align: top;
      padding-top: 3mm;
    }
  }

  html,
  body {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    background: #ffffff !important;
  }

  #adminWrap {
    display: block !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  .topbar,
  .sidebar,
  .sidebar-overlay,
  .sidebar-footer,
  .alert,
  .no-print {
    display: none !important;
  }

  .admin-body {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
  }

  .main-content {
    display: block !important;
    overflow: visible !important;
    height: auto !important;
    background: #ffffff !important;
    padding: 0 !important;
  }

  .content {
    display: none !important;
  }

  .print-cv {
    display: block !important;
  }

  .pcv-sheet {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 7mm 11mm;
    background: #ffffff;
    color: #1c2733;
    font-family: Georgia, "Times New Roman", Times, serif;
    font-size: 10pt;
    line-height: 1;
    box-sizing: border-box;
  }

  .pcv-brand {
    page-break-inside: avoid;
    page-break-after: avoid;
  }

  .pcv-header {
    page-break-inside: avoid;
    page-break-after: avoid;
  }

  .pcv-kv,
  .pcv-line,
  .pcv-entry {
    page-break-inside: avoid;
  }

  .pcv-section h3 + * {
    page-break-before: avoid;
  }

  .pcv-foot {
    page-break-before: avoid;
  }

  .pcv-brand {
    text-align: center;
    padding-bottom: 1.5mm;
    border-bottom: 1.5px solid #b08952;
    margin-bottom: 3mm;
    display: flex;
    align-items: center;
    gap: 6mm;
  }

  .pcv-brand-img {
    height: 20mm;
    flex-shrink: 0;
  }

  .pcv-brand-body {
    flex: 1;
  }

  .pcv-brand-annee {
    font-size: 8.5pt;
    color: #8a8f98;
    margin-top: 0.6mm;
    letter-spacing: 1px;
  }

  .pcv-brand-contact {
    font-size: 7pt;
    color: #8a8f98;
    text-align: left;
    flex-shrink: 0;
  }

  .pcv-brand-contact span {
    display: block;
    white-space: nowrap;
    line-height: 1.5;
  }

  .pcv-brand-left {
    flex-shrink: 0;
    text-align: center;
  }

  .pcv-brand-name {
    font-family: "Inter", Arial, sans-serif;
    font-size: 13pt;
    letter-spacing: 5px;
    color: #234e70;
    text-transform: uppercase;
    font-weight: 700;
  }

  .pcv-matricule-side {
    margin-left: auto;
    text-align: right;
    flex-shrink: 0;
  }

  .pcv-brand .pcv-brand-sub {
    font-family: "Inter", Arial, sans-serif;
    font-size: 7pt;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: #8a8f98;
    margin-top: 0.4mm;
  }

  .pcv-header {
    display: flex;
    gap: 5mm;
    align-items: flex-start;
    margin-bottom: 3mm;
    page-break-inside: avoid;
  }

  .pcv-photo {
    width: 23mm;
    height: 27mm;
    object-fit: cover;
    border: 1.2px solid #234e70;
    padding: 1px;
    background: #ffffff;
    flex-shrink: 0;
  }

  .pcv-photo-initials {
    width: 23mm;
    height: 27mm;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18pt;
    color: #234e70;
    background: #f5f8fb;
    border: 1.2px solid #234e70;
  }

  .pcv-name {
    font-size: 18pt;
    font-weight: 700;
    color: #234e70;
    margin: 0;
    line-height: 1.1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .pcv-firstname {
    font-size: 11pt;
    font-weight: 400;
    color: #3f7fa8;
    margin: 0 0 1.5mm;
    line-height: 1.1;
  }

  .pcv-titre {
    font-size: 9pt;
    color: #234e70;
    letter-spacing: 1px;
    font-style: normal;
    font-weight: 700;
    margin-bottom: 1.5mm;
  }

  .pcv-idline {
    font-family: "Inter", Arial, sans-serif;
    font-size: 8pt;
    color: #3a4651;
  }

  .pcv-lbl {
    font-weight: 700;
    color: #234e70;
  }

  .pcv-section {
    margin-bottom: 6mm;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .pcv-bullet li,
  .pcv-entry {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  table tr,
  table thead {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  table thead {
    display: table-header-group;
  }

  .pcv-prof .pcv-section {
    margin-bottom: 3mm;
  }

  .pcv-ancien .pcv-section {
    margin-bottom: 3mm;
  }

  .pcv-ancien .pcv-section h3 {
    padding-top: 1mm;
  }

  .pcv-prof .pcv-section h3 {
    padding-top: 1mm;
  }

  .pcv-section h3 {
    font-family: "Inter", Arial, sans-serif;
    font-size: 9pt;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #234e70;
    margin: 0 0 2mm;
    padding-bottom: 1.2mm;
    padding-top: 2mm;
    border-bottom: 1px solid #c9b28a;
    page-break-after: avoid;
    break-after: avoid;
  }

  .pcv-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 6mm;
    row-gap: 0.3mm;
  }

  .pcv-one {
    display: block;
  }

  .pcv-kv {
    display: flex;
    align-items: baseline;
    gap: 1mm;
    margin-bottom: 0.4mm;
  }

  .pcv-kv .pcv-lbl {
    min-width: 48mm;
    flex-shrink: 0;
    text-align: left;
  }

  .pcv-etat-cols {
    display: flex;
    gap: 8mm;
    align-items: flex-start;
  }

  .pcv-etat-cols .pcv-one {
    flex: 1;
    min-width: 0;
  }

  .pcv-side-box {
    flex-shrink: 0;
    width: 55mm;
    border: 0.8px solid #c9b28a;
    border-radius: 2mm;
    padding: 2mm 3mm;
  }

  .pcv-side-box .pcv-lbl {
    min-width: 18mm;
  }

  .pcv-kv .pcv-colon {
    flex-shrink: 0;
  }

  .pcv-kv .pcv-val {
    text-align: left;
  }

  .pcv-entry {
    margin-bottom: 1mm;
    page-break-inside: avoid;
  }

  .pcv-entry-title {
    font-weight: 700;
  }

   .pcv-entry-meta {
     font-family: "Inter", Arial, sans-serif;
     font-size: 7.5pt;
     color: #b08952;
     text-transform: uppercase;
     letter-spacing: 1px;
     margin-top: 3px;
   }

  .pcv-entry-sub {
    color: #3a4651;
    font-size: 9pt;
  }

  .pcv-bullet {
    list-style: none;
    margin: 0 0 0 5mm;
    padding: 0;
  }

  .pcv-bullet li {
    position: relative;
    padding-left: 4.5mm;
    margin-bottom: 2mm;
    page-break-inside: avoid;
  }

  .pcv-bullet li::before {
    content: "\2022";
    position: absolute;
    left: 0;
    top: 0;
    color: #b08952;
    font-size: 11pt;
    line-height: 1;
  }

  .pcv-foot {
    margin-top: 3mm;
    padding-top: 1.5mm;
    border-top: 1px solid #c9b28a;
    text-align: center;
    font-family: "Inter", Arial, sans-serif;
    font-size: 7pt;
    color: #8a8f98;
    letter-spacing: 1px;
  }
}