/* ============================================
   IEP - Interactions Élèves Professeurs
   Feuille de style principale
   ============================================ */

/* --- Variables CSS (Thème global) --- */
:root {
  --primary:       #2563EB;
  --primary-dark:  #1D4ED8;
  --primary-light: #EFF6FF;
  --secondary:     #10B981;
  --accent:        #F59E0B;
  --danger:        #EF4444;
  --purple:        #8B5CF6;

  --white:    #FFFFFF;
  --gray-50:  #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;

  --sidebar-width:  260px;
  --topbar-height:  64px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --font-main:    'Nunito', 'Segoe UI', sans-serif;
  --font-display: 'Poppins', 'Segoe UI', sans-serif;

  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-main);
  background: var(--gray-100);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { cursor: pointer; font-family: var(--font-main); }
input, textarea, select { font-family: var(--font-main); }
img { max-width: 100%; }

.course-actions {
  display: flex;
  gap: 8px;
}
.btn-smn {font-size: 12px !important;  box-shadow: 0 2px 8px rgba(37,99,235,0.3); }

.custom-modal{
    border: none;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
}

.warning-icon{
    width: 90px;
    height: 90px;
    margin: auto;
    border-radius: 50%;
    background: rgba(220,53,69,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.warning-icon i{
    font-size: 40px;
    color: #dc3545;
}

.custom-modal h3{
    font-weight: 700;
    color: #2c3e50;
}

.custom-modal p{
    font-size: 15px;
    line-height: 1.6;
}

.btn-custom{
    min-width: 140px;
    border-radius: 10px;
    padding: 10px 20px;
    font-weight: 600;
    transition: 0.3s;
}

.btn-custom:hover{
    transform: translateY(-2px);
}

/* ============================================
   PAGE DE CONNEXION
   ============================================ */
.login-page {
  display: flex;
  min-height: 100vh;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563EB 50%, #0ea5e9 100%);
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  top: -150px; right: -150px;
  animation: float 6s ease-in-out infinite;
}
.login-page::after {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  bottom: -100px; left: -80px;
  animation: float 8s ease-in-out infinite reverse;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-20px); }
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
  animation: slideUp 0.5s ease-out;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

.login-logo { text-align: center; margin-bottom: 32px; }
.logo-icon {
  width: 72px; height: 72px;
  background: linear-gradient(135deg, var(--primary), #0ea5e9);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 8px 24px rgba(37,99,235,0.35);
}
.logo-icon span {
  color: white;
  font-size: 24px;
  font-weight: 900;
  font-family: var(--font-display);
  letter-spacing: -1px;
}
.login-logo h1 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--gray-900);
}
.login-logo p { color: var(--gray-500); font-size: 0.85rem; margin-top: 4px; }

/* Sélecteur profil — CSS tabs via :has() */
.profile-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 24px;
}
/* Les boutons sont des <label> associés à des <input radio> cachés */
.profile-selector input[type="radio"] { display: none; }
.profile-label {
  padding: 14px 12px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-md);
  background: var(--gray-50);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-600);
  text-align: center;
}
.profile-label .profile-icon { font-size: 1.5rem; }
.profile-label:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}
.profile-selector input[type="radio"]:checked + .profile-label {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37,99,235,0.15);
}

/* Formulaire */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}
.input-wrapper { position: relative; }
.input-icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  pointer-events: none;
}
.form-input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  transition: var(--transition);
  background: var(--gray-50);
  color: var(--gray-800);
}
.form-input:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 4px rgba(37,99,235,0.1);
}
.forgot-link {
  display: block;
  text-align: right;
  font-size: 0.8rem;
  color: var(--primary);
  font-weight: 600;
  margin-top: 6px;
}
.forgot-link:hover { color: var(--primary-dark); }
.btn-login {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  margin-top: 20px;
  transition: var(--transition);
  box-shadow: 0 4px 14px rgba(37,99,235,0.4);
}
.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37,99,235,0.5);
}

/* Erreur login */
.login-error {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: #991B1B;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 16px;
  display: none;
}
.login-error.visible { display: block; }

/* ============================================
   LAYOUT PRINCIPAL (sidebar + topbar)
   ============================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* --- Barre latérale --- */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--gray-900);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-logo {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--primary), #0ea5e9);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-weight: 900;
  font-size: 0.9rem;
  font-family: var(--font-display);
  flex-shrink: 0;
}
.sidebar-brand {
  color: white;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.2;
}
.sidebar-brand small {
  display: block;
  color: var(--gray-400);
  font-size: 0.7rem;
  font-weight: 400;
}

.sidebar-profile {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.profile-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #0ea5e9);
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.15);
}
.profile-info .name { color: white; font-weight: 600; font-size: 0.9rem; }
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  background: rgba(37,99,235,0.25);
  color: #93C5FD;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-top: 4px;
}

/* Navigation sidebar */
.sidebar-nav { padding: 16px 12px; flex: 1; }
.nav-section-title {
  color: var(--gray-500);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 8px 8px 4px;
  margin-top: 8px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--gray-400);
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 2px;
  transition: var(--transition);
  cursor: pointer;
  text-decoration: none;
  margin-left: -25px;
}
.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: white;
}
.nav-item.active {
  background: rgba(37,99,235,0.2);
  color: #93C5FD;
  font-weight: 600;
}
.nav-item .nav-icon { font-size: 1rem; width: 20px; text-align: center; }
.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.btn-logout {
  width: 100%;
  padding: 10px 16px;
  background: rgba(239,68,68,0.15);
  color: #FCA5A5;
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-logout:hover {
  background: rgba(239,68,68,0.25);
  color: #FEE2E2;
}

/* Overlay mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

/* --- Contenu principal --- */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-height);
  background: white;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}
.topbar-left { display: flex; align-items: center; gap: 16px; flex: 1; }
.page-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gray-800);
}
.topbar-search {
  position: relative;
  flex: 0 0 280px;
}
.topbar-search .search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  color: var(--gray-400);
}
.topbar-search input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1.5px solid var(--gray-200);
  border-radius: 20px;
  font-size: 0.85rem;
  background: var(--gray-50);
  transition: var(--transition);
}
.topbar-search input:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
}
.topbar-right { display: flex; align-items: center; gap: 4px; }
.icon-btn {
  width: 36px; height: 36px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-500);
  transition: var(--transition);
  position: relative;
}
.icon-btn:hover { background: var(--gray-100); color: var(--gray-700); }
.notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 7px; height: 7px;
  background: var(--danger);
  border-radius: 50%;
  border: 1.5px solid white;
}
.hamburger {
  display: none;
  border: none;
  background: none;
  font-size: 1.3rem;
  color: var(--gray-600);
  cursor: pointer;
  padding: 4px;
}

/* Zone de page */
.page-content { padding: 24px; flex: 1; }

/* ============================================
   COMPOSANTS COMMUNS
   ============================================ */
/* Cards */
.card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-800);
}

/* Boutons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  transition: var(--transition);
  cursor: pointer;
  text-decoration: none;
}
.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-light); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
}
.badge-blue   { background: #DBEAFE; color: #1D4ED8; }
.badge-green  { background: #D1FAE5; color: #065F46; }
.badge-amber  { background: #FEF3C7; color: #92400E; }
.badge-red    { background: #FEE2E2; color: #991B1B; }
.badge-purple { background: #EDE9FE; color: #5B21B6; }

/* Barre de progression */
.progress-bar {
  height: 8px;
  background: var(--gray-100);
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--primary), #0ea5e9);
  transition: width 0.6s ease;
}

/* Séparateur de section */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gray-800);
}

/* ============================================
   PAGE DASHBOARD
   ============================================ */
.welcome-banner {
  background: linear-gradient(135deg, var(--primary) 0%, #0ea5e9 100%);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  color: white;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.welcome-banner::after {
  content: '🎓';
  position: absolute;
  right: 32px; top: 50%;
  transform: translateY(-50%);
  font-size: 4rem;
  opacity: 0.2;
}
.welcome-banner h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.welcome-banner p { opacity: 0.85; font-size: 0.9rem; }
.welcome-meta {
  display: flex;
  gap: 20px;
  margin-top: 12px;
}
.meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  opacity: 0.9;
}

/* Grille stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: white;
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 14px;
}
.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.stat-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1;
}
.stat-label { font-size: 0.78rem; color: var(--gray-500); margin-top: 2px; }

/* Grille dashboard principale */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}
.col-full { grid-column: 1 / -1; }

/* Liste d'items dans le dashboard */
.item-list { display: flex; flex-direction: column; gap: 10px; }
.item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-100);
  transition: var(--transition);
}
.item-row:hover { background: var(--primary-light); border-color: #BFDBFE; }
.item-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.item-info { flex: 1; min-width: 0; }
.item-title {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-sub { font-size: 0.78rem; color: var(--gray-500); margin-top: 1px; }

/* Notifs */
.notif-list { display: flex; flex-direction: column; gap: 8px; }
.notif-item {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--gray-50);
  border-left: 3px solid var(--gray-200);
}
.notif-item.new { background: #EFF6FF; border-left-color: var(--primary); }
.notif-dot2 {
  width: 8px; height: 8px;
  background: var(--primary);
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
}
.notif-text { font-size: 0.82rem; color: var(--gray-700); }
.notif-time { font-size: 0.72rem; color: var(--gray-400); margin-top: 2px; }

/* ============================================
   PAGE COURS
   ============================================ */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
/* Filtres via CSS :target ou classe active transmise par PHP */
.filter-btn {
  padding: 7px 16px;
  border: 1.5px solid var(--gray-200);
  border-radius: 20px;
  background: white;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  display: inline-block;
}
.filter-btn:hover,
.filter-btn.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.course-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  display: block;
  color: inherit;
}
.course-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: #BFDBFE;
}
.course-matiere-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 12px;
}
.course-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 8px;
  line-height: 1.35;
}
.course-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--gray-100);
}
.course-prof { font-size: 0.78rem; color: var(--gray-500); }
.course-date { font-size: 0.75rem; color: var(--gray-400); }

/* Barre de recherche cours */
.search-cours {
  position: relative;
  margin-bottom: 20px;
}
.search-cours .search-icon {
  position: absolute;
  left: 16px; top: 50%;
  transform: translateY(-50%);
}
.search-cours input {
  width: 100%;
  max-width: 400px;
  padding: 10px 16px 10px 44px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  background: white;
  transition: var(--transition);
}
.search-cours input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* ============================================
   PAGE EXERCICES
   ============================================ */
.exercises-list { display: flex; flex-direction: column; gap: 12px; }
.exercise-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
}
.exercise-card:hover { box-shadow: var(--shadow-md); }
.exercise-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.exercise-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--gray-800);
  margin-bottom: 4px;
}
.exercise-meta {
  display: flex;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--gray-500);
  margin-bottom: 8px;
}
.deadline-soon { color: var(--danger); font-weight: 700; }
.exercise-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ============================================
   PAGE CHAT
   ============================================ */
.chat-container {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 0;
  height: calc(100vh - var(--topbar-height) - 48px);
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.chat-sidebar {
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  background: var(--gray-50);
}
.chat-search {
  padding: 16px;
  border-bottom: 1px solid var(--gray-200);
}
.chat-search input {
  width: 100%;
  padding: 8px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: 20px;
  font-size: 0.85rem;
  background: white;
}
.chat-list { overflow-y: auto; flex: 1; }
.chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-200);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  color: inherit;
}
.chat-item:hover { background: white; }
.chat-item.active { background: var(--primary-light); }
.chat-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
  position: relative;
}
.online-dot {
  position: absolute;
  bottom: 1px; right: 1px;
  width: 10px; height: 10px;
  background: var(--secondary);
  border-radius: 50%;
  border: 2px solid white;
}
.chat-preview { flex: 1; min-width: 0; }
.chat-name { font-weight: 700; font-size: 0.88rem; color: var(--gray-800); }
.chat-last { font-size: 0.78rem; color: var(--gray-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-meta { text-align: right; flex-shrink: 0; }
.chat-time { font-size: 0.72rem; color: var(--gray-400); margin-bottom: 4px; }
.chat-unread {
  background: var(--primary);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin-left: auto;
}

/* Zone messages */
.chat-main { display: flex; flex-direction: column; }
.chat-topbar {
  padding: 14px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 12px;
  background: white;
}
.chat-topbar .chat-name { font-size: 1rem; font-weight: 700; color: var(--gray-800); }
.chat-status { font-size: 0.78rem; color: var(--secondary); }
.messages-area {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--gray-50);
}
.msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 70%;
}
.msg.received { align-self: flex-start; }
.msg.sent { align-self: flex-end; flex-direction: row-reverse; }
.msg-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.5;
}
.msg.received .msg-bubble {
  background: white;
  border: 1px solid var(--gray-200);
  border-bottom-left-radius: 4px;
  color: var(--gray-800);
}
.msg.sent .msg-bubble {
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
}
.msg-time { font-size: 0.68rem; color: var(--gray-400); flex-shrink: 0; margin-bottom: 4px; }
.chat-input-area {
  padding: 16px 20px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  gap: 10px;
  background: white;
}
.chat-input-area input {
  flex: 1;
  padding: 10px 16px;
  border: 1.5px solid var(--gray-200);
  border-radius: 24px;
  font-size: 0.9rem;
  background: var(--gray-50);
  transition: var(--transition);
}
.chat-input-area input:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
}
.btn-send {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}
.btn-send:hover { background: var(--primary-dark); transform: scale(1.05); }

/* ============================================
   PAGE IA (QCM)
   ============================================ */
.ia-config {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.ia-config select, .ia-config input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  background: white;
  color: var(--gray-800);
}
.ia-config select:focus, .ia-config input:focus {
  outline: none;
  border-color: var(--primary);
}

.qcm-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 28px;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  max-width: 700px;
  margin: 0 auto;
}
.qcm-progress-text {
  font-size: 0.82rem;
  color: var(--gray-500);
  margin-bottom: 8px;
}
.qcm-question {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gray-800);
  margin: 20px 0;
  line-height: 1.5;
}
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}
.option-btn {
  padding: 14px 16px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-md);
  background: var(--gray-50);
  text-align: left;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--gray-700);
  cursor: pointer;
  transition: var(--transition);
}
.option-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}
.option-btn.correct {
  border-color: var(--secondary);
  background: #D1FAE5;
  color: #065F46;
}
.option-btn.wrong {
  border-color: var(--danger);
  background: #FEE2E2;
  color: var(--danger);
}
.option-btn:disabled { cursor: default; }

.result-card {
  text-align: center;
  padding: 32px;
}
.score-circle {
  width: 110px; height: 110px;
  border-radius: 50%;
  margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: white;
}
.score-circle.excellent { background: linear-gradient(135deg, var(--secondary), #34d399); }
.score-circle.good      { background: linear-gradient(135deg, var(--primary), #0ea5e9); }
.score-circle.poor      { background: linear-gradient(135deg, var(--accent), #f97316); }
.result-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.result-text { color: var(--gray-500); font-size: 0.9rem; }

/* ============================================
   PAGE NOTES
   ============================================ */
.notes-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}
.grades-table {
  width: 100%;
  border-collapse: collapse;
}
.grades-table th {
  background: var(--gray-50);
  padding: 12px 16px;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--gray-200);
}
.grades-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 0.88rem;
  color: var(--gray-700);
}
.grades-table tr:hover td { background: var(--gray-50); }
.grade-value {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
}
.grade-good { color: var(--secondary); }
.grade-ok   { color: var(--accent); }
.grade-bad  { color: var(--danger); }

/* Résumé notes */
.avg-circle {
  width: 100px; height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #0ea5e9);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
  box-shadow: 0 6px 20px rgba(37,99,235,0.3);
}
.avg-circle span {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  color: white;
}
.avg-label {
  text-align: center;
  font-size: 0.82rem;
  color: var(--gray-500);
  margin-bottom: 20px;
}

/* Mini graphique barres */
.mini-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 100px;
}
.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  height: 100%;
  justify-content: flex-end;
}
.bar {
  width: 100%;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--primary), #0ea5e9);
}
.bar-label { font-size: 0.62rem; color: var(--gray-400); font-weight: 600; }
.bar-val { font-size: 0.65rem; font-weight: 700; color: var(--gray-600); }

/* ============================================
   PAGE PLANNING
   ============================================ */
.planning-header {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.planning-header select {
  padding: 9px 14px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  background: white;
  color: var(--gray-700);
}
.planning-header select:focus { outline: none; border-color: var(--primary); }

.planning-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
}
.day-col {
  background: white;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.day-col.today { border-color: var(--primary); }
.day-head {
  padding: 10px;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--gray-600);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}
.day-col.today .day-head {
  background: var(--primary);
  color: white;
}
.day-sessions { padding: 8px; display: flex; flex-direction: column; gap: 5px; }
.session-pill {
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.3;
}

/* ============================================
   PAGE MOTIVATION
   ============================================ */
.motivation-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}
.quote-card {
  background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
  color: white;
  padding: 32px;
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}
.quote-card::before {
  content: '"';
  position: absolute;
  top: -20px; left: 16px;
  font-size: 9rem;
  color: rgba(255,255,255,0.1);
  font-family: Georgia, serif;
  line-height: 1;
}
.quote-text {
  font-size: 1.05rem;
  line-height: 1.7;
  font-style: italic;
  position: relative;
}
.quote-author {
  display: block;
  margin-top: 14px;
  font-size: 0.82rem;
  opacity: 0.75;
  position: relative;
}

/* Badges */
.badges-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.badge-card {
  text-align: center;
  padding: 16px 12px;
  background: var(--gray-50);
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  transition: var(--transition);
}
.badge-card.earned {
  background: #FFFBEB;
  border-color: #FDE68A;
}
.badge-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.badge-icon { font-size: 2rem; margin-bottom: 6px; }
.badge-name { font-size: 0.75rem; font-weight: 700; color: var(--gray-700); }
.badge-locked { opacity: 0.4; filter: grayscale(1); }

/* Classement */
.rank-list { display: flex; flex-direction: column; gap: 10px; }
.rank-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--gray-50);
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
}
.rank-row.me {
  background: var(--primary-light);
  border-color: #BFDBFE;
}
.rank-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.rank-1    { background: #FEF3C7; color: #D97706; }
.rank-2    { background: #F3F4F6; color: #4B5563; }
.rank-3    { background: #FEE2E2; color: #B45309; }
.rank-other{ background: var(--gray-200); color: var(--gray-600); }
.rank-name { flex: 1; font-weight: 600; font-size: 0.88rem; }
.rank-score {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--primary);
  font-size: 0.88rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .notes-layout { grid-template-columns: 1fr; }
  .planning-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 900px) {
  :root { --sidebar-width: 0px; }
  .sidebar {
    transform: translateX(-260px);
    width: 260px;
    z-index: 101;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.visible { display: block; }
  .main-content { margin-left: 0; }
  .hamburger { display: flex; }
  .topbar-search { display: none; }
  .chat-container { grid-template-columns: 1fr; }
  .chat-sidebar { display: none; }
  .planning-grid { grid-template-columns: repeat(3, 1fr); }
  .options-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .page-content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .planning-grid { grid-template-columns: repeat(2, 1fr); }
  .motivation-layout { grid-template-columns: 1fr; }
  .courses-grid { grid-template-columns: 1fr; }
  .exercise-card { grid-template-columns: auto 1fr; }
  .exercise-actions { grid-column: 1 / -1; }
  .welcome-meta { flex-direction: column; gap: 8px; }
  .badges-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ============================================
   UTILITAIRES
   ============================================ */
.text-center { text-align: center; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-8 { gap: 8px; }
.flex  { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.hidden { display: none; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* Animation page load */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.page-content { animation: fadeIn 0.3s ease-out; }





/* ------ CSS PARAM ----*/
/* ── Navigation par onglets latéraux ── */
    .settings-layout {
      display: flex;
      gap: 28px;
      align-items: flex-start;
    }
    .settings-nav {
      width: 230px;
      flex-shrink: 0;
      background: var(--blanc);
      border: 1px solid var(--gris-bord);
      border-radius: var(--rayon);
      box-shadow: var(--ombre);
      overflow: hidden;
      position: sticky;
      top: 90px;
    }
    .settings-nav-head {
      padding: 18px 20px 12px;
      font-size: 0.68rem;
      text-transform: uppercase;
      letter-spacing: 1.2px;
      font-weight: 700;
      color: var(--gris);
      border-bottom: 1px solid var(--gris-bord);
    }
    .snav-item {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 12px 20px;
      font-size: 0.88rem;
      font-weight: 500;
      color: var(--gris);
      cursor: pointer;
      transition: all 0.18s;
      border-left: 3px solid transparent;
    }
    .snav-item:hover { background: var(--gris-light); color: var(--bleu); }
    .snav-item.active {
      background: var(--turq-light);
      color: var(--turquoise);
      font-weight: 700;
      border-left-color: var(--turquoise);
    }
    .snav-icon { font-size: 1.05rem; width: 22px; text-align: center; }

    /* ── Contenu des sections ── */
    .settings-content { flex: 1; min-width: 0; }
    .settings-section { display: none; }
    .settings-section.active { display: block; }

    .section-title {
      font-family: 'Nunito', sans-serif;
      font-weight: 800;
      font-size: 1.15rem;
      color: var(--bleu);
      margin-bottom: 4px;
    }
    .section-desc {
      font-size: 0.82rem;
      color: var(--gris);
      margin-bottom: 24px;
    }

    /* ── Avatar upload ── */
    .avatar-zone {
      display: flex;
      align-items: center;
      gap: 20px;
      padding: 20px;
      background: var(--gris-light);
      border-radius: 12px;
      margin-bottom: 24px;
    }
    .avatar-big {
      width: 80px; height: 80px; border-radius: 50%;
      background: linear-gradient(135deg, var(--turquoise), var(--bleu-clair));
      display: flex; align-items: center; justify-content: center;
      font-family: 'Nunito', sans-serif; font-weight: 900;
      font-size: 1.8rem; color: var(--blanc);
      flex-shrink: 0; position: relative; cursor: pointer;
    }
    .avatar-edit-overlay {
      position: absolute; inset: 0; border-radius: 50%;
      background: rgba(0,0,0,0.4);
      display: flex; align-items: center; justify-content: center;
      opacity: 0; transition: opacity 0.2s; font-size: 1.2rem;
    }
    .avatar-big:hover .avatar-edit-overlay { opacity: 1; }
    .avatar-info { flex: 1; }
    .avatar-name {
      font-family: 'Nunito', sans-serif; font-weight: 800;
      font-size: 1.1rem; color: var(--bleu);
    }
    .avatar-role { font-size: 0.8rem; color: var(--gris); margin: 3px 0 10px; }

    /* ── Toggle switch ── */
    .toggle-row {
      display: flex; align-items: center;
      justify-content: space-between;
      padding: 16px 0;
      border-bottom: 1px solid var(--gris-bord);
    }
    .toggle-row:last-child { border-bottom: none; }
    .toggle-info { flex: 1; padding-right: 20px; }
    .toggle-label {
      font-size: 0.9rem; font-weight: 600; color: var(--bleu);
      margin-bottom: 3px;
    }
    .toggle-desc { font-size: 0.78rem; color: var(--gris); line-height: 1.5; }
    .switch {
      position: relative; width: 46px; height: 26px; flex-shrink: 0;
    }
    .switch input { opacity: 0; width: 0; height: 0; }
    .slider {
      position: absolute; inset: 0;
      background: var(--gris-bord); border-radius: 26px;
      cursor: pointer; transition: background 0.25s;
    }
    .slider::before {
      content: '';
      position: absolute;
      width: 20px; height: 20px;
      left: 3px; top: 3px;
      background: var(--blanc);
      border-radius: 50%;
      transition: transform 0.25s;
      box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    }
    .switch input:checked + .slider { background: var(--turquoise); }
    .switch input:checked + .slider::before { transform: translateX(20px); }

    /* ── Disponibilité badge ── */
    .dispo-badge {
      display: inline-flex; align-items: center; gap: 6px;
      padding: 6px 14px; border-radius: 20px;
      font-size: 0.8rem; font-weight: 700;
      transition: all 0.3s;
    }
    .dispo-badge.online  { background: rgba(34,197,94,0.12); color: var(--vert); }
    .dispo-badge.offline { /*background: var(--gris-light); color: var(--gris);*/ background: rgba(197,34,94,0.12); color: var(--danger); }
    .dispo-dot {
      width: 8px; height: 8px; border-radius: 50%;
      background: currentColor;
    }
    .dispo-badge.online .dispo-dot { animation: pulse-dot 2s infinite; }
    @keyframes pulse-dot {
      0%, 100% { opacity: 1; transform: scale(1); }
      50%       { opacity: 0.5; transform: scale(0.8); }
    }

    /* ── Sécurité — Force du mdp ── */
    .pwd-strength {
      margin-top: 8px; height: 5px;
      border-radius: 10px; background: var(--gris-bord);
      overflow: hidden;
    }
    .pwd-strength-bar {
      height: 100%; border-radius: 10px;
      transition: width 0.3s, background 0.3s;
      width: 0%;
    }
    .pwd-strength-label {
      font-size: 0.72rem; margin-top: 4px; font-weight: 600;
    }

    /* ── Notifications — icône couleur ── */
    .notif-item {
      display: flex; align-items: center; gap: 14px;
      padding: 14px 0; border-bottom: 1px solid var(--gris-bord);
    }
    .notif-item:last-child { border-bottom: none; }
    .notif-icon {
      width: 40px; height: 40px; border-radius: 10px;
      display: flex; align-items: center; justify-content: center;
      font-size: 1.1rem; flex-shrink: 0;
    }

    /* ── Danger zone ── */
    .danger-zone {
      border: 1.5px solid rgba(239,68,68,0.3);
      border-radius: var(--rayon);
      padding: 20px 24px;
      margin-top: 8px;
    }
    .danger-title {
      font-family: 'Nunito', sans-serif;
      font-weight: 800; color: var(--rouge);
      font-size: 0.95rem; margin-bottom: 4px;
    }
    .danger-desc { font-size: 0.82rem; color: var(--gris); margin-bottom: 14px; }

    /* ── Input with eye icon ── */
    .input-eye { position: relative; }
    .input-eye input { padding-right: 44px; }
    .eye-btn {
      position: absolute; right: 12px; top: 50%;
      transform: translateY(-50%);
      background: none; border: none;
      cursor: pointer; font-size: 1rem;
      color: var(--gris); padding: 4px;
    }

    /* ── Thème couleur ── */
    .theme-swatches {
      display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px;
    }
    .swatch {
      width: 36px; height: 36px; border-radius: 50%;
      cursor: pointer; border: 3px solid transparent;
      transition: transform 0.2s, border-color 0.2s;
    }
    .swatch:hover { transform: scale(1.15); }
    .swatch.active { border-color: var(--bleu); transform: scale(1.15); }

    /* ── Sauvegarde flottante ── */
    .save-bar {
      position: fixed; bottom: 24px; left: 50%;
      transform: translateX(-50%) translateY(80px);
      background: var(--bleu); color: var(--blanc);
      padding: 14px 28px; border-radius: 14px;
      display: flex; align-items: center; gap: 14px;
      box-shadow: var(--ombre-lg);
      font-size: 0.9rem; font-weight: 500;
      z-index: 300; transition: transform 0.3s ease;
      white-space: nowrap;
    }
    .save-bar.visible { transform: translateX(-50%) translateY(0); }

    /* ── Stats compte ── */
    .account-stats {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 12px; margin-top: 12px;
    }
    .acc-stat {
      background: var(--gris-light);
      border-radius: 10px;
      padding: 14px;
      text-align: center;
    }
    .acc-stat-num {
      font-family: 'Nunito', sans-serif;
      font-weight: 900; font-size: 1.5rem; color: var(--bleu);
    }
    .acc-stat-lbl { font-size: 0.74rem; color: var(--gris); margin-top: 2px; }

    @media (max-width: 768px) {
      .settings-layout { flex-direction: column; }
      .settings-nav { width: 100%; position: static; }
      .account-stats { grid-template-columns: repeat(3, 1fr); }
    }
