/* public/assets/css/main.css - Design System & Styles Globaux */
:root {
  --font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Couleurs primaires et d'accent */
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --primary-border: #c7d2fe;
  
  --success: #10b981;
  --success-dark: #047857;
  --success-light: #ecfdf5;
  
  --danger: #ef4444;
  --danger-dark: #b91c1c;
  --danger-light: #fef2f2;
  
  --warning: #f59e0b;
  --warning-light: #fffbeb;

  /* Neutres */
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  --border-color: #e2e8f0;
  --border-focus: #818cf8;

  /* Ombres & Arrondis */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.05);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.05);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-hover);
}

/* Header & Navigation */
.navbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: var(--shadow-sm);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-main);
  text-decoration: none;
  transition: opacity var(--transition-fast);
}

.nav-brand:hover {
  opacity: 0.92;
}

.brand-logo-img {
  height: 36px;
  width: auto;
  max-width: 165px;
  object-fit: contain;
  display: block;
}

.brand-divider {
  display: inline-block;
  width: 1.5px;
  height: 24px;
  background-color: var(--border-color);
  opacity: 0.8;
}

.brand-text {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.nav-brand .brand-logo {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--primary), #818cf8);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.nav-desktop-wrap {
  display: flex;
  align-items: center;
  flex: 1;
  justify-content: center;
  margin: 0 1rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
  text-decoration: none;
  border: 1px solid transparent;
  user-select: none;
}

.nav-link:hover {
  color: var(--primary);
  background: rgba(79, 70, 229, 0.08);
}

.nav-link.active {
  color: var(--primary);
  background: var(--primary-light);
  font-weight: 600;
  border-color: rgba(79, 70, 229, 0.2);
}

/* Dropdown Menu Administration */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
}

.dropdown-caret {
  font-size: 0.72rem;
  transition: transform var(--transition-fast);
  display: inline-block;
  margin-left: 0.15rem;
  opacity: 0.75;
}

.nav-dropdown.open .dropdown-caret,
.nav-dropdown:hover .dropdown-caret {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.04);
  padding: 0.5rem;
  min-width: 260px;
  z-index: 100;
  display: none;
  flex-direction: column;
  gap: 0.25rem;
  animation: dropdownFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.nav-dropdown-menu::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 8px;
}

.nav-dropdown.open .nav-dropdown-menu,
.nav-dropdown:hover .nav-dropdown-menu {
  display: flex;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-main);
  transition: all var(--transition-fast);
}

.dropdown-link:hover {
  background: #f8fafc;
  color: var(--primary);
  transform: translateX(3px);
}

.dropdown-link.active {
  background: var(--primary-light);
  color: var(--primary);
}

.dropdown-link-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
  line-height: 1;
}

.dropdown-link-content {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.dropdown-link-content strong {
  font-size: 0.88rem;
  font-weight: 600;
  color: inherit;
}

.dropdown-link-content small {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.dropdown-link:hover .dropdown-link-content small {
  color: var(--primary-hover);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

/* Bouton et Menu Déroulant Notifications Système */
.notifications-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.nav-notification-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

.nav-notification-btn:hover {
  background: var(--bg-hover, #f1f5f9);
  color: var(--primary);
}

.notification-badge-pulse {
  position: absolute;
  top: 1px;
  right: 1px;
  background: #ef4444;
  color: white;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.05rem 0.35rem;
  min-width: 17px;
  height: 17px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px white;
  animation: pulse-alert 2s infinite;
}

@keyframes pulse-alert {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); box-shadow: 0 0 8px rgba(239, 68, 68, 0.6); }
}

.notifications-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.15), 0 4px 10px rgba(0, 0, 0, 0.05);
  width: 330px;
  max-width: 90vw;
  z-index: 100;
  display: none;
  flex-direction: column;
  animation: dropdownFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  overflow: hidden;
}

.notifications-dropdown.open .notifications-menu {
  display: flex;
}

.notifications-header {
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.notifications-list {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.notification-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  text-decoration: none;
  color: var(--text-main);
  transition: background 0.15s ease;
}

.notification-item:hover {
  background: #f8fafc;
}

.notification-item.unread {
  background: #faf5ff;
}

.notification-item-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 2px;
}

.notification-item-content {
  flex: 1;
  min-width: 0;
}

.notification-item-msg {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-main);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notification-item-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  display: block;
}

.notifications-footer {
  padding: 0.65rem 0.85rem;
  background: #f8fafc;
  border-top: 1px solid var(--border-color);
  text-align: center;
}

/* Menu Déroulant Profil dans la barre de navigation */
.profile-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.profile-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.04);
  padding: 0.6rem;
  min-width: 270px;
  z-index: 100;
  display: none;
  flex-direction: column;
  gap: 0.25rem;
  animation: dropdownFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.profile-dropdown-menu::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 8px;
}

.profile-dropdown.open .profile-dropdown-menu,
.profile-dropdown:hover .profile-dropdown-menu {
  display: flex;
}

.profile-dropdown-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0.5rem 0.65rem 0.5rem;
}

.profile-dropdown-avatar {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.profile-dropdown-initials {
  width: 42px;
  height: 42px;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.profile-dropdown-user-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.profile-dropdown-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-dropdown-role-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary);
  background: var(--primary-light);
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
  display: inline-block;
  width: fit-content;
}

.profile-dropdown-email {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-divider {
  height: 1px;
  background: #f1f5f9;
  margin: 0.25rem 0;
}

/* Bouton Profil / Avatar dans la barre de navigation */
.user-avatar-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  text-decoration: none;
  transition: all var(--transition-fast);
  position: relative;
  outline: none;
}

.user-avatar-btn:hover {
  transform: translateY(-1px);
}

.user-avatar-btn:hover .user-avatar,
.user-avatar-btn:hover .user-avatar-initials {
  box-shadow: 0 0 0 2px var(--primary);
}

.user-avatar-btn.user-avatar-btn-active .user-avatar,
.user-avatar-btn.user-avatar-btn-active .user-avatar-initials {
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.45);
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  display: block;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

/* Rond avec initiales si l'utilisateur n'a pas de photo */
.user-avatar-initials {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), #818cf8);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: 0.04em;
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
  user-select: none;
  transition: all var(--transition-fast);
}

.mobile-user-avatar-initials {
  width: 44px;
  height: 44px;
  font-size: 1.05rem;
}

/* Bouton Déconnexion avec icône SVG */
.nav-logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: #f8fafc;
  border: 1px solid var(--border-color);
  color: #64748b;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nav-logout-btn:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.nav-logout-btn:active {
  transform: translateY(0);
}

/* Bouton Hamburger Mobile */
.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  padding: 0;
  transition: all var(--transition-fast);
  z-index: 50;
}

.hamburger-btn:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

.hamburger-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.hamburger-line {
  display: block;
  width: 20px;
  height: 2px;
  background-color: var(--text-main);
  border-radius: 2px;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
  transform-origin: center;
}

.hamburger-btn.active .hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger-btn.active .hamburger-line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.hamburger-btn.active .hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ==========================================================================
   Tiroir Mobile (Slide-over Drawer)
   ========================================================================== */
.mobile-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(350px, 86vw);
  height: 100vh;
  height: 100dvh;
  background: #ffffff;
  z-index: 999;
  box-shadow: -10px 0 35px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mobile-drawer.open {
  transform: translateX(0);
}

.mobile-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  background: #f8fafc;
  flex-shrink: 0;
}

.mobile-drawer-close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: white;
  font-size: 1.5rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.mobile-drawer-close:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}

.mobile-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  -webkit-overflow-scrolling: touch;
}

.mobile-user-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: all var(--transition-fast);
}

.mobile-user-card:hover {
  background: #f1f5f9;
  border-color: var(--primary);
  transform: translateY(-1px);
}

.mobile-user-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 2px solid white;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.mobile-user-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.mobile-user-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-user-role-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary);
  background: var(--primary-light);
  padding: 0.12rem 0.5rem;
  border-radius: var(--radius-full);
  display: inline-block;
  width: fit-content;
}

.mobile-user-email {
  font-size: 0.76rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-user-arrow {
  font-size: 1.15rem;
  color: var(--text-muted);
  margin-left: 0.25rem;
}

.mobile-year-card {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
}

.mobile-year-form {
  margin: 0;
}

.mobile-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid #edf2f7;
}

.mobile-nav-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.mobile-nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-main);
  font-weight: 500;
  font-size: 0.92rem;
  transition: all var(--transition-fast);
}

.mobile-nav-link:hover {
  background: #f1f5f9;
  color: var(--primary);
  padding-left: 1rem;
}

.mobile-nav-link.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.mobile-nav-icon {
  font-size: 1.15rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.mobile-drawer-footer {
  padding: 1rem;
  border-top: 1px solid var(--border-color);
  background: #f8fafc;
  flex-shrink: 0;
}

/* Empêche le défilement de la page quand le drawer mobile est ouvert */
body.mobile-menu-open {
  overflow: hidden !important;
}

/* Responsive Media Queries pour la barre de navigation */
@media (max-width: 1024px) {
  .nav-desktop-wrap {
    display: none !important;
  }
  .desktop-only {
    display: none !important;
  }
  .hamburger-btn {
    display: flex !important;
  }
  .navbar {
    padding: 0.65rem 1.25rem;
  }
  .year-selector-dropdown {
    max-width: 150px;
    text-overflow: ellipsis;
  }
}

@media (max-width: 540px) {
  .academic-year-selector-wrap {
    display: none !important;
  }
  .navbar {
    padding: 0.6rem 0.85rem;
  }
  .brand-logo-img {
    height: 30px;
    max-width: 135px;
  }
  .nav-brand .brand-text {
    font-size: 0.95rem;
  }
}

@media (max-width: 440px) {
  .brand-divider {
    display: none;
  }
  .nav-brand .brand-text {
    display: none;
  }
}

/* Conteneur principal */
.main-container {
  flex: 1;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

/* Boutons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.25);
}
.btn-primary:hover {
  background-color: var(--primary-hover);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(79, 70, 229, 0.35);
}

.btn-secondary {
  background-color: var(--bg-surface);
  color: var(--text-main);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
}

.btn-danger {
  background-color: var(--danger);
  color: white;
}
.btn-danger:hover {
  background-color: var(--danger-dark);
}

.btn-success {
  background-color: var(--success);
  color: white;
}
.btn-success:hover {
  background-color: var(--success-dark);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 0.85rem 1.75rem;
  font-size: 1rem;
  border-radius: var(--radius-md);
}

/* Cartes & Dashboard */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  transition: box-shadow var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-icon.blue { background: #e0f2fe; color: #0284c7; }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }
.stat-icon.emerald { background: #d1fae5; color: #059669; }
.stat-icon.rose { background: #ffe4e6; color: #e11d48; }

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-main);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

thead th {
  background: #f8fafc;
  padding: 0.85rem 1rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: background var(--transition-fast);
}

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

tbody tr:hover {
  background: #f8fafc;
}

tbody td {
  padding: 1rem;
  font-size: 0.9rem;
  vertical-align: middle;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge-success {
  background: var(--success-light);
  color: var(--success-dark);
}

.badge-danger {
  background: var(--danger-light);
  color: var(--danger-dark);
}

.badge-primary {
  background: var(--primary-light);
  color: var(--primary);
}

.badge-gray {
  background: #f1f5f9;
  color: #475569;
}

/* Formulaires */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.9rem;
  font-family: inherit;
  font-size: 0.95rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-main);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

/* Wrapper mot de passe avec bouton d'affichage œil */
.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-input-wrapper input {
  padding-right: 2.75rem;
}

.password-toggle-btn {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  padding: 0.35rem;
  cursor: pointer;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background var(--transition-fast);
  z-index: 5;
}

.password-toggle-btn:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.password-toggle-btn:focus {
  outline: none;
  color: var(--primary);
}

.password-toggle-btn .eye-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  display: block;
}

.password-toggle-btn svg,
.password-toggle-btn svg * {
  pointer-events: none;
}

/* Supprime le bouton œil natif sous Microsoft Edge (Windows) */
input::-ms-reveal,
input::-ms-clear {
  display: none;
}

/* Alertes & Flash */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.92rem;
  font-weight: 500;
}

.alert-success {
  background: var(--success-light);
  color: var(--success-dark);
  border: 1px solid #a7f3d0;
}

.alert-danger {
  background: var(--danger-light);
  color: var(--danger-dark);
  border: 1px solid #fecaca;
}

.alert-warning {
  background: var(--warning-light);
  color: #92400e;
  border: 1px solid #fde68a;
}

.alert-info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

/* Upload Avatar Previewer */
.avatar-upload-preview {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1rem;
}

.avatar-preview-box {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-full);
  border: 2px dashed var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #f8fafc;
}

.avatar-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Footer */
.footer {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  padding: 1.5rem 2rem;
  background: var(--bg-surface);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Modales & Boîtes d'importation */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  padding: 1.5rem;
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 620px;
  max-height: calc(100dvh - 2rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(15px) scale(0.98);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid var(--border-color);
}

.modal-backdrop.open .modal-dialog {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(to right, #f8fafc, #ffffff);
  flex-shrink: 0;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}

.modal-close:hover {
  color: var(--danger);
  background: var(--danger-light);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.5rem;
  background: #f8fafc;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-shrink: 0;
}

.import-template-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: linear-gradient(135deg, #eff6ff, #e0e7ff);
  border: 1px solid #bfdbfe;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
}

.import-template-banner .banner-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.import-template-banner .banner-icon {
  font-size: 1.75rem;
}

.import-dropzone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.75rem 1.25rem;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 1rem;
}

.import-dropzone:hover, .import-dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.9;
  }
}

/* ==========================================================================
   Page Profil Utilisateur
   ========================================================================== */
.profile-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 2rem;
  align-items: start;
}

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

.profile-card-header {
  text-align: center;
  padding: 1rem 0 1.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.25rem;
}

.profile-avatar-large {
  width: 96px;
  height: 96px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 4px solid white;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
  margin: 0 auto 0.75rem;
  display: block;
  background: #f1f5f9;
}

.profile-user-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.profile-user-email {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  word-break: break-all;
}

.profile-meta-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  font-size: 0.88rem;
}

.profile-meta-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed var(--border-color);
}

.profile-meta-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.profile-meta-label {
  color: var(--text-muted);
  font-weight: 500;
}

.profile-meta-value {
  font-weight: 600;
  color: var(--text-main);
}

.form-section-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #f1f5f9;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 600px) {
  .form-grid-2 {
    grid-template-columns: 1fr;
  }
}

.password-note-box {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Bouton de génération de mot de passe sécurisé */
.btn-generate-password {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  line-height: 1.3;
}

.btn-generate-password:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.15);
}

.btn-generate-password:active {
  transform: translateY(0);
}

.btn-generate-password.btn-generate-success {
  background: #ecfdf5;
  border-color: #10b981;
  color: #059669;
}

/* ==========================================================================
   Sélecteur d'Année Scolaire & Bandeau Historique
   ========================================================================== */
.academic-year-selector-wrap {
  display: flex;
  align-items: center;
}

.year-selector-form {
  display: inline-flex;
  align-items: center;
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 0.2rem 0.55rem 0.2rem 0.65rem;
  transition: all var(--transition-fast);
  margin: 0;
}

.year-selector-form:hover, .year-selector-form:focus-within {
  background: white;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.12);
}

.year-selector-icon {
  font-size: 0.95rem;
  margin-right: 0.35rem;
  cursor: pointer;
  user-select: none;
}

.year-selector-dropdown {
  background: transparent;
  border: none;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  outline: none;
  padding: 0.15rem 0.25rem;
  font-family: inherit;
}

.year-selector-dropdown:focus {
  outline: none;
}

/* Bandeau d'alerte Année Scolaire Historique */
.archive-year-banner {
  background: linear-gradient(90deg, #fffbeb 0%, #fef3c7 100%);
  border-bottom: 2px solid #f59e0b;
  padding: 0.65rem 1.5rem;
  font-size: 0.88rem;
  color: #92400e;
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.08);
}

.archive-year-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.archive-year-badge {
  background: #f59e0b;
  color: white;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.archive-year-reset-btn {
  margin-left: auto;
  background: white;
  border: 1px solid #d97706;
  color: #b45309;
  font-weight: 600;
  font-size: 0.8rem;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.archive-year-reset-btn:hover {
  background: #d97706;
  color: white;
}

/* ==========================================================================
   Barre de Filtres et Recherche Instantanée Étudiants
   ========================================================================== */
.student-filter-toolbar {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.student-filter-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.student-search-box {
  position: relative;
  flex: 1;
  min-width: 260px;
}

.student-search-box .search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.95rem;
  pointer-events: none;
}

.student-search-input {
  width: 100%;
  padding-left: 2.5rem !important;
  padding-right: 2.2rem !important;
  height: 40px;
  border-radius: var(--radius-md) !important;
  border: 1.5px solid var(--border-color) !important;
  font-size: 0.9rem !important;
  transition: all var(--transition-fast);
}

.student-search-input:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15) !important;
}

.search-clear-btn {
  position: absolute;
  right: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  background: #e2e8f0;
  border: none;
  border-radius: var(--radius-full);
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.75rem;
  color: #475569;
  transition: all var(--transition-fast);
}

.search-clear-btn:hover {
  background: #cbd5e1;
  color: #0f172a;
}

.search-feedback-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.2rem;
}

.filter-select {
  height: 40px;
  padding: 0.35rem 0.75rem;
  font-size: 0.88rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  background: white;
  min-width: 170px;
  cursor: pointer;
}

.filter-select:focus {
  border-color: var(--primary);
  outline: none;
}

.filter-badge-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  background: white;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.filter-badge-btn:hover, .filter-badge-btn.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.highlight-match {
  background: #fef08a;
  color: #854d0e;
  padding: 0 2px;
  border-radius: 2px;
  font-weight: 600;
}

/* ========================================================
   COMPOSANT DEUX LISTES (DUAL LISTBOX / TRANSFER LIST)
   Pour l'affectation des étudiants aux groupes
   ======================================================== */
.dual-list-container {
  display: grid;
  grid-template-columns: 1fr 64px 1fr;
  gap: 1.25rem;
  align-items: center;
  margin-top: 1rem;
}

@media (max-width: 960px) {
  .dual-list-container {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

.dual-list-panel {
  background: white;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

.dual-list-panel:focus-within {
  border-color: #a5b4fc;
}

.dual-list-header {
  padding: 0.85rem 1.15rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.dual-list-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
}

.dual-list-count {
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
}

.dual-list-count.count-available {
  background: #eef2ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
}

.dual-list-count.count-group {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.dual-list-toolbar {
  padding: 0.65rem 0.85rem;
  background: #fafafa;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.dual-list-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.dual-list-search-wrap .search-icon {
  position: absolute;
  left: 0.75rem;
  font-size: 0.85rem;
  pointer-events: none;
  opacity: 0.6;
}

.dual-list-search-input {
  width: 100%;
  padding: 0.5rem 2rem 0.5rem 2.2rem;
  font-size: 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: white;
  transition: all var(--transition-fast);
}

.dual-list-search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.15);
}

.dual-list-items {
  height: 460px;
  overflow-y: auto;
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  background: #ffffff;
}

.dual-list-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid #e2e8f0;
  background: white;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.dual-list-item:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  transform: translateX(1px);
}

.dual-list-item.selected {
  background: #eef2ff !important;
  border-color: #6366f1 !important;
  box-shadow: 0 0 0 1px #6366f1;
}

.dual-list-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border-color);
}

.dual-list-details {
  flex: 1;
  min-width: 0;
}

.dual-list-name {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.dual-list-meta {
  font-size: 0.74rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.1rem;
}

.dual-list-tags {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  margin-top: 0.2rem;
}

.dual-list-tag {
  font-size: 0.68rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  white-space: nowrap;
}

.dual-list-btn-action {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.dual-list-btn-add {
  background: #e0e7ff;
  color: #4338ca;
}

.dual-list-btn-add:hover {
  background: #4f46e5;
  color: white;
  transform: scale(1.1);
}

.dual-list-btn-remove {
  background: #fee2e2;
  color: #b91c1c;
}

.dual-list-btn-remove:hover {
  background: #ef4444;
  color: white;
  transform: scale(1.1);
}

/* Contrôles centraux (Flèches de transfert) */
.dual-list-controls {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  justify-content: center;
  align-items: center;
}

@media (max-width: 960px) {
  .dual-list-controls {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem 0;
  }
}

.dual-list-ctrl-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  background: white;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.dual-list-ctrl-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: scale(1.05);
}

.dual-list-empty-msg {
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.dual-list-empty-icon {
  font-size: 2.2rem;
  opacity: 0.5;
}

.dual-list-summary-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* ==========================================================================
   Espace Enseignant (Responsive Mobile & Desktop)
   ========================================================================== */
.teacher-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.25rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.teacher-greeting {
  flex: 1;
  min-width: 260px;
}

.teacher-view-switcher {
  display: inline-flex;
  gap: 4px;
  background: #e2e8f0;
  padding: 4px;
  border-radius: var(--radius-md);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.view-switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.view-switch-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.5);
}

.view-switch-btn.active {
  background: white;
  color: var(--primary);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.view-switch-btn .count-pill {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
  background: #f1f5f9;
  color: var(--text-main);
}

.view-switch-btn.active .count-pill {
  background: #eef2ff;
  color: var(--primary);
}

/* Grille des cours de l'enseignant */
.teacher-courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.teacher-course-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.teacher-course-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.teacher-course-card.is-today {
  border-color: #10b981;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.18);
}

.course-card-badges {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.badge-today {
  animation: pulse 2s infinite;
}

.course-card-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.65rem;
  color: var(--text-main);
  line-height: 1.3;
}

.course-schedule-pill {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.course-schedule-pill.schedule-today {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}

.schedule-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.schedule-time {
  color: var(--text-muted);
}

.course-card-desc {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 1.5rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.course-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
  gap: 0.75rem;
}

.course-teacher-info {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.btn-action-appel {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
  font-weight: 600;
}

/* Optimisation mobile pour l'espace enseignant */
@media (max-width: 640px) {
  .teacher-page-header {
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 1.25rem;
    gap: 0.85rem;
  }

  .teacher-page-header .page-title {
    font-size: 1.4rem;
    margin-bottom: 0.25rem;
  }

  .teacher-page-header .page-subtitle {
    font-size: 0.82rem;
  }

  .teacher-view-switcher {
    width: 100%;
    display: flex;
  }

  .view-switch-btn {
    flex: 1;
    justify-content: center;
    padding: 0.5rem 0.4rem;
    font-size: 0.8rem;
  }

  .teacher-courses-grid {
    grid-template-columns: 1fr;
    gap: 0.9rem;
  }

  .teacher-course-card {
    padding: 1.15rem 1rem;
  }

  .course-card-title {
    font-size: 1.15rem;
  }

  .course-schedule-pill {
    padding: 0.5rem 0.65rem;
    font-size: 0.82rem;
  }

  .course-card-desc {
    margin-bottom: 1rem;
    font-size: 0.84rem;
    -webkit-line-clamp: 2;
  }

  .course-card-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
    padding-top: 0.85rem;
  }

  .btn-action-appel {
    width: 100%;
    justify-content: center;
    padding: 0.65rem 1rem;
    font-size: 0.92rem;
  }
}

/* ==========================================================================
   Grilles d'Administration Responsives Universelles
   ========================================================================== */
.admin-layout-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 2rem;
  align-items: start;
}

.admin-layout-grid.wide {
  grid-template-columns: 400px 1fr;
}

.admin-layout-grid.medium {
  grid-template-columns: 380px 1fr;
}

.admin-layout-grid.equal {
  grid-template-columns: 1fr 1fr;
}

.datetime-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 0.75rem;
}

/* Barres de filtres et d'outils formulaires */
.form-filter-bar {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

.form-filter-bar > * {
  min-width: 0;
}

/* Tableaux avec défilement tactile fluide */
.table-responsive {
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

/* ==========================================================================
   Règles Responsives Tablette & Écrans Moyens (<= 1024px)
   ========================================================================== */
@media (max-width: 1024px) {
  .admin-layout-grid,
  .admin-layout-grid.wide,
  .admin-layout-grid.medium,
  .admin-layout-grid.equal {
    grid-template-columns: 1fr !important;
    gap: 1.5rem;
  }
}

/* ==========================================================================
   Règles Responsives Mobiles & Petits Écrans (<= 640px)
   ========================================================================== */
@media (max-width: 640px) {
  .main-container {
    padding: 1.25rem 0.85rem;
  }

  .page-header {
    margin-bottom: 1.25rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
  }

  .page-header > div:last-child {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 100%;
  }

  .page-header > div:last-child .btn,
  .page-header > div:last-child a.btn,
  .page-header > div:last-child button.btn {
    flex: 1;
    min-width: 130px;
    justify-content: center;
    text-align: center;
  }

  .page-title {
    font-size: 1.4rem;
    line-height: 1.25;
  }

  .page-subtitle {
    font-size: 0.84rem;
    line-height: 1.4;
  }

  .card {
    padding: 1.15rem 0.95rem;
    border-radius: var(--radius-md);
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
  }

  .card-header > div:last-child {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
  }

  .stat-card {
    padding: 1rem;
  }

  .datetime-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  /* Formulaires et filtres sur mobile */
  .form-filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .form-filter-bar > div {
    min-width: 100% !important;
    width: 100% !important;
  }

  .form-filter-bar .btn,
  .form-filter-bar button[type="submit"] {
    width: 100%;
    justify-content: center;
  }

  .student-filter-toolbar {
    padding: 0.85rem;
  }

  .student-filter-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }

  .student-search-box {
    min-width: 100% !important;
    width: 100% !important;
  }

  .filter-select {
    width: 100% !important;
    min-width: 100% !important;
  }

  /* Modales optimisées pour petits écrans */
  .modal-backdrop {
    padding: 0.75rem;
  }

  .modal-dialog {
    max-height: calc(100dvh - 1.5rem);
    border-radius: var(--radius-md);
  }

  .modal-header {
    padding: 1rem 1.15rem;
  }

  .modal-body {
    padding: 1.15rem 1rem;
  }

  .modal-footer {
    padding: 0.85rem 1rem;
    flex-wrap: wrap;
  }

  .modal-footer .btn {
    flex: 1;
    min-width: 120px;
    justify-content: center;
  }

  /* Tableaux */
  table th, table td {
    padding: 0.65rem 0.65rem;
    font-size: 0.82rem;
  }

  /* Page de connexion */
  .login-card {
    padding: 1.75rem 1.25rem !important;
  }

  /* Footer */
  .footer {
    padding: 1.25rem 1rem;
    font-size: 0.8rem;
  }
}

/* ==========================================================================
   Mise en valeur du formulaire en Mode Édition / Modification
   ========================================================================== */
.card-editing-active {
  border: 2px solid #f59e0b !important;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.22), 0 10px 25px -5px rgba(245, 158, 11, 0.15) !important;
  position: relative;
  transition: all var(--transition-base);
  animation: editCardPulse 2.4s ease-in-out infinite alternate;
}

@keyframes editCardPulse {
  0% {
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2), 0 4px 14px rgba(0, 0, 0, 0.06);
  }
  100% {
    box-shadow: 0 0 0 6px rgba(245, 158, 11, 0.38), 0 8px 22px rgba(245, 158, 11, 0.18);
  }
}
