/* ============================================
   EDUCATIF MIKN - style.css COMPLET
   ============================================ */

/* ---- Variables ---- */
:root {
  --orange: #f97316;
  --orange-dark: #ea580c;
  --primary: #f97316;
  --bg-body: #f1f5f9;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-sidebar: #020617;
  --text-main: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.09);
  --radius: 14px;
}

[data-theme="dark"] {
  --bg-body: #0f172a;
  --bg-main: #1e293b;
  --bg-card: #1e293b;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #334155;
}

/* ---- Reset ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text-main);
  background: var(--bg-body);
  font-size: 15px;
  line-height: 1.5;
}

button {
  font-family: inherit;
  cursor: pointer;
}

a {
  text-decoration: none;
}

input,
select,
textarea {
  font-family: inherit;
}

/* ============================================
   BOUTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 999px;
  background: var(--orange);
  color: #fff;
  padding: 9px 20px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  transition: background .15s;
  white-space: nowrap;
}

.btn:hover {
  background: var(--orange-dark);
}

.btn-secondary {
  background: var(--border);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: #d1d5db;
}

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ============================================
   INPUTS
   ============================================ */
.input {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 9px 12px;
  font-size: 14px;
  background: var(--bg-card);
  color: var(--text-main);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 2px rgba(249, 115, 22, .18);
}

textarea.input {
  resize: vertical;
}

/* ============================================
   BADGES
   ============================================ */
.badge-blue {
  display: inline-block;
  background: #dbeafe;
  color: #1e40af;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
}

/* ============================================
   TOAST
   ============================================ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow);
  z-index: 9999;
  min-width: 220px;
  transform: translateY(120%);
  opacity: 0;
  transition: transform .25s, opacity .25s;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast strong {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
}

.toast p {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

/* ============================================
   PAGE CONNEXION
   ============================================ */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-body);
  padding: 20px;
  gap: 0;
}

.login-card {
  background: var(--bg-card);
  border-radius: 24px;
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.login-logo-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--orange);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 900;
  color: #fff;
}

.login-logo-text {
  font-size: 18px;
  font-weight: 800;
}

.login-card h1 {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 6px;
}

.login-card .subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 24px;
}

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

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.role-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.role-tabs [data-role] {
  flex: 1;
  min-width: 80px;
  padding: 8px 4px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  transition: all .12s;
}

.role-tabs [data-role].active {
  background: var(--orange);
  color: #fff;
  border-color: var(--orange);
}

.login-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.login-actions .btn {
  flex: 1;
}

.login-footer {
  margin-top: 18px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

/* ============================================
   HEADER
   ============================================ */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 12px;
}

.header-title h1 {
  font-size: 20px;
  font-weight: 800;
}

.header-title p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.header-user {
  font-size: 13px;
  color: var(--text-muted);
}

/* ============================================
   LAYOUT
   ============================================ */
.layout {
  display: flex;
  min-height: calc(100vh - 61px);
}

/* ---- Sidebar ---- */
.sidebar {
  width: 250px;
  background: var(--bg-sidebar);
  color: #e5e7eb;
  padding: 20px 14px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  margin-bottom: 8px;
}

.logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--orange);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: #fff;
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-title {
  font-weight: 700;
  font-size: 14px;
  color: #f1f5f9;
}

.sidebar-subtitle {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
}

.nav-section {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #475569;
  margin: 18px 0 6px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border-radius: 10px;
  color: #94a3b8;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background .12s, color .12s;
  position: relative;
}

.nav-item:hover {
  background: rgba(148, 163, 184, .12);
  color: #e2e8f0;
}

.nav-item.active {
  background: var(--orange);
  color: #fff;
  font-weight: 600;
}

.nav-icon {
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: #ef4444;
  color: #fff;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
}

/* ---- Main content ---- */
.main-content {
  flex: 1;
  padding: 28px 32px 48px;
  background: var(--bg-main);
  overflow-x: hidden;
}

/* ============================================
   VUES
   ============================================ */
.view {
  display: none;
}

.view.active {
  display: block;
}

/* ============================================
   CARTES STATS
   ============================================ */
.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
}

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

.card-icon-yellow {
  background: #fef3c7;
}

.card-icon-blue {
  background: #dbeafe;
}

.card-icon-green {
  background: #d1fae5;
}

.card-value {
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}

.card-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ============================================
   DASHBOARD GRID
   ============================================ */
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 20px;
  margin-top: 20px;
}

/* ============================================
   PANELS
   ============================================ */
.panel {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.panel:last-child {
  margin-bottom: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.panel-header h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}

.panel-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.panel-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 0;
  font-size: 14px;
}

/* ============================================
   QUICK ACTIONS
   ============================================ */
.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 12px;
}

/* ============================================
   TOGGLE SWITCH (iOS style)
   ============================================ */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: .3s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .toggle-slider {
  background-color: #475569;
}

.toggle-switch input:checked+.toggle-slider {
  background-color: #34c759;
}

[data-theme="dark"] .toggle-switch input:checked+.toggle-slider {
  background-color: #30d158;
}

.toggle-switch input:focus-visible+.toggle-slider {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

.toggle-switch input:checked+.toggle-slider:before {
  transform: translateX(20px);
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-main);
  color: var(--text-main);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  width: 100%;
  transition: background .12s, border-color .12s;
}

.action-btn:hover {
  background: var(--bg-body);
  border-color: var(--orange);
  color: var(--orange);
}

[data-theme="dark"] .action-btn {
  background: #0f172a;
  border-color: #334155;
  color: #f1f5f9;
}

[data-theme="dark"] .action-btn:hover {
  background: #1e293b;
  border-color: var(--orange);
  color: var(--orange);
}

.action-icon {
  font-size: 20px;
}

.action-hint {
  display: flex;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  padding: 2px 4px;
}

/* ============================================
   TABLEAU
   ============================================ */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th {
  text-align: left;
  padding: 8px 0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

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

.table-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 28px 0 !important;
}

/* ============================================
   LIST ITEMS
   ============================================ */
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

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

/* ============================================
   PLAN DE CLASSE
   ============================================ */
.plan-grid-empty {
  padding: 60px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* ============================================
   MODALS
   ============================================ */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

[data-theme="dark"] .modal {
  background: rgba(0, 0, 0, .75);
}

.modal.show {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border-radius: 20px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, .2);
  margin: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 0;
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  line-height: 1;
}

.modal-close:hover {
  background: var(--border);
}

.modal-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 24px 20px;
}

/* Modal annonce directeur : liste des classes */
.dir-annonce-classes-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 140px;
  overflow-y: auto;
}
.dir-annonce-class-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s, border-color 0.15s;
}
.dir-annonce-class-item:hover {
  background: var(--bg-main);
  border-color: var(--text-muted);
}
.dir-annonce-class-item input {
  margin: 0;
  accent-color: var(--orange, #f97316);
}
.modal-annonce-directeur .modal-header {
  padding: 20px 24px 12px;
}
.modal-annonce-directeur .modal-body {
  max-height: 65vh;
  overflow-y: auto;
}

/* Confirmation publication annonce directeur */
.dir-annonce-success-block {
  padding: 32px 24px;
  text-align: center;
}
.dir-annonce-success-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0d9488, #14b8a6);
  color: #fff;
  font-size: 28px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: dir-annonce-success-pop 0.4s ease-out;
}
.dir-annonce-success-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}
@keyframes dir-annonce-success-pop {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

/* Messagerie : nom vs rôle (couleurs distinctes, pas de chevauchement) */
.msg-conv-card {
  width: 100%;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-main);
  cursor: pointer;
  margin-bottom: 8px;
  transition: background 0.15s, border-color 0.15s;
}
.msg-conv-card:hover {
  background: var(--bg-card);
  border-color: var(--primary);
}
.msg-conv-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.msg-conv-role {
  font-size: 12px;
  color: #0d9488;
  font-weight: 500;
}
.msg-conv-role.prof-role { color: #6366f1; }
.msg-conv-role.director-role { color: #0d9488; }
.msg-conv-snippet {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-thread-header-name { font-weight: 700; font-size: 16px; color: var(--text-main); }
.msg-thread-header-role { font-size: 13px; color: #0d9488; margin-top: 2px; }
.msg-thread-header-role.prof-role { color: #6366f1; }
.msg-thread-header-role.director-role { color: #0d9488; }
.msg-list-col { width: 260px; max-width: 260px; min-width: 260px; flex-shrink: 0; border-right: 1px solid var(--border); padding-right: 14px; display: flex; flex-direction: column; gap: 8px; overflow: hidden; }
.msg-thread-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
/* Carte sélectionnée : surbrillance (bordure + fond léger), texte reste lisible (couleur du thème) */
.msg-conv-card.msg-conv-selected {
  border: 2px solid var(--primary) !important;
  background: var(--bg-card) !important;
  box-shadow: 0 0 0 1px var(--primary);
  color: inherit !important;
}
.msg-conv-card.msg-conv-selected .msg-conv-name { color: var(--text-main) !important; }
.msg-conv-card.msg-conv-selected .msg-conv-role { color: #6366f1 !important; }
.msg-conv-card.msg-conv-selected .msg-conv-snippet { color: var(--text-muted) !important; }

/* Zone des bulles : toute la largeur, aucun vide à droite de l'envoyeur */
.msg-thread-bubbles {
  width: 100%;
  padding: 16px 0 24px 12px;
  min-height: 120px;
  background: var(--bg-body);
  border-radius: 12px;
  box-sizing: border-box;
}
/* Messages reçus (gauche) : occupent une large part pour limiter le vide à droite */
.msg-bubble-wrap { max-width: 90%; }
.msg-bubble-wrap.msg-bubble-wrap-them {
  width: 88%;
  min-width: 220px;
  max-width: 90%;
}
.msg-bubble-wrap.msg-bubble-wrap-them .msg-bubble { width: 100%; box-sizing: border-box; }
/* Mes messages (droite) : collés à droite, pas d'espace vide */
.msg-bubble-wrap.msg-bubble-wrap-mine { width: auto; max-width: 90%; margin-left: auto; }
.msg-bubble {
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  max-width: 100%;
}
.msg-bubble-mine {
  background: linear-gradient(135deg, #0d9488, #14b8a6);
  color: #fff;
  border-radius: 18px 18px 4px 18px;
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.25);
}
.msg-bubble-them {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: 18px 18px 18px 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.msg-bubble-content { word-break: break-word; }
.msg-bubble-time {
  font-size: 11px;
  opacity: 0.9;
  margin-top: 4px;
}
.msg-bubble-mine .msg-bubble-time { color: rgba(255,255,255,0.95); }
.msg-bubble-them .msg-bubble-time { color: var(--text-muted); }

/* ============================================
   QUIZ BUILDER
   ============================================ */
.template-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.template-tab {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all .12s;
}

.template-tab.active,
.template-tab:hover {
  background: var(--orange);
  color: #fff;
  border-color: var(--orange);
}

.quiz-builder {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.quiz-question-block {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  background: var(--bg-main);
}

[data-theme="dark"] .quiz-question-block {
  background: #0f172a;
  border-color: #334155;
}

.question-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 10px;
}

.quiz-option-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quiz-option-row input[type="radio"] {
  accent-color: var(--orange);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.expiry-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fef3c7;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: #92400e;
}

[data-theme="dark"] .expiry-row {
  background: #1c1400;
  color: #fbbf24;
}

.expiry-row label {
  font-weight: 600;
  white-space: nowrap;
}

.expiry-row input {
  flex: 1;
  width: auto;
}

/* ============================================
   RESPONSIVE MOBILE
   ============================================ */
@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
  }

  .main-content {
    padding: 16px;
  }

  .header {
    padding: 12px 16px;
    flex-wrap: wrap;
  }

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

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

  .modal-content {
    max-width: 100%;
    border-radius: 16px;
  }
}

/* === PLAN DE SALLE === */
.seat-grid {
  display: grid;
  gap: 10px;
}

.seat-cell {
  position: relative;
  min-height: 70px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px dashed var(--border);
  transition: all 0.2s;
  font-size: 12px;
  text-align: center;
  padding: 4px;
}

.seat-cell.occupied {
  background: var(--primary);
  color: white;
  border: 2px solid var(--primary);
}

.seat-cell.empty:hover {
  border-color: var(--primary);
  background: var(--bg-hover);
}

.seat-unplaced {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  cursor: grab;
  background: var(--bg-card);
  user-select: none;
}

.plan-badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.plan-free {
  background: #dcfce7;
  color: #15803d;
}

.plan-pro {
  background: #fef3c7;
  color: #b45309;
}

.plan-school {
  background: #ede9fe;
  color: #7c3aed;
}

.quiz-question-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.question-label {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* ============================================
   PATCH ÉLÈVE — Educatif MIKN
   Coller à la fin du style.css existant
============================================ */

/* ---- Boutons ---- */
.btn-primary {
  background: var(--orange);
  color: #fff;
}

.btn-primary:hover {
  background: var(--orange-dark);
}

.btn:disabled,
.btn-primary:disabled,
.btn-secondary:disabled {
  opacity: .65;
  cursor: not-allowed;
}

.btn-sm {
  padding: 6px 14px !important;
  font-size: 13px !important;
}

/* ---- Toast variantes ---- */
.toast.toast-success {
  border-color: rgba(22, 163, 74, .4);
  box-shadow: 0 4px 24px rgba(22, 163, 74, .12), var(--shadow);
}

.toast.toast-error {
  border-color: rgba(220, 38, 38, .4);
  box-shadow: 0 4px 24px rgba(220, 38, 38, .10), var(--shadow);
}

/* ---- Table wrap responsive ---- */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.table-wrap .table {
  min-width: 700px;
}

/* ---- Séparateur ---- */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 4px 0;
}

/* ---- Badges génériques (utilisés dans eleve.html) ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-info {
  background: #dbeafe;
  color: #1e40af;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.badge-success {
  background: #d1fae5;
  color: #065f46;
}

.badge-error {
  background: #fee2e2;
  color: #991b1b;
}

.badge-purple {
  background: #ede9fe;
  color: #5b21b6;
}

/* ---- Tags ---- */
.tag {
  display: inline-block;
  background: var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
}

.tag-type {
  background: #ede9fe;
  color: #7c3aed;
}

/* ---- Barre de progression note ---- */
.progress-bar-wrap {
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
}

.progress-bar {
  height: 100%;
  border-radius: 999px;
  transition: width .3s;
}

/* ---- Moyenne bannière ---- */
.moyenne-banner {
  background: linear-gradient(135deg, var(--orange), #ea580c);
  color: #fff;
  border-radius: var(--radius);
  padding: 24px 28px;
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  box-shadow: 0 8px 24px rgba(249, 115, 22, .28);
  transition: background .4s;
}

.moyenne-value {
  font-size: 3rem;
  font-weight: 900;
  line-height: 1;
}

.moyenne-label {
  font-size: 14px;
  opacity: .85;
  margin-top: 4px;
}

.moyenne-sub {
  font-size: 13px;
  opacity: .7;
}

/* ---- Matières grid ---- */
.matieres-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.matiere-badge {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 12px 14px;
  border-left: 4px solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.matiere-badge span {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.matiere-badge strong {
  font-size: 20px;
  font-weight: 800;
}

/* ---- Note rows (dashboard) ---- */
.note-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.note-row:last-child {
  border-bottom: none;
}

.note-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.note-title {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-score {
  font-size: 16px;
  flex-shrink: 0;
}

/* ---- Activity rows (dashboard) ---- */
.activity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.activity-row:last-child {
  border-bottom: none;
}

/* ---- Activity cards ---- */
.activity-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  border-left: 4px solid var(--border);
  transition: border-color .15s;
}

.activity-card:hover {
  border-left-color: var(--orange);
}

.activity-card.status-submitted {
  border-left-color: #16a34a;
}

.activity-card.status-graded {
  border-left-color: #7c3aed;
}

.activity-card.status-late {
  border-left-color: #dc2626;
}

.activity-card.status-in_progress {
  border-left-color: #f97316;
}

.activity-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.activity-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 4px;
}

.activity-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin: 8px 0;
  line-height: 1.5;
}

.activity-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.due-date {
  font-size: 13px;
  color: var(--text-muted);
}

.due-date.overdue {
  color: #dc2626;
  font-weight: 600;
}

.teacher-comment {
  font-size: 13px;
  color: #1d4ed8;
  background: #dbeafe;
  padding: 6px 10px;
  border-radius: 8px;
  margin-top: 8px;
  width: 100%;
}

/* ---- Filter tabs ---- */
.filter-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-tab {
  padding: 6px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .12s;
}

.filter-tab.active,
.filter-tab:hover {
  background: var(--orange);
  color: #fff;
  border-color: var(--orange);
}

/* ---- Quiz cards ---- */
.quiz-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.quiz-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.quiz-meta {
  display: flex;
  gap: 14px;
  font-size: 13px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

/* ---- Quiz player ---- */
.quiz-timer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fef3c7;
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 14px;
  font-weight: 700;
  color: #92400e;
  transition: background .2s, color .2s;
}

.quiz-timer.danger {
  background: #fee2e2;
  color: #991b1b;
}

.quiz-progress-bar-wrap {
  background: var(--border);
  border-radius: 999px;
  height: 4px;
  margin: 12px 24px 0;
  overflow: hidden;
}

.quiz-question {
  background: var(--bg-main);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
}

[data-theme="dark"] .quiz-question {
  background: #0f172a;
}

.quiz-question-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.quiz-q-num {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: .06em;
}

.quiz-q-text {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 14px;
  line-height: 1.5;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: all .12s;
  font-size: 14px;
}

.quiz-option:hover {
  border-color: var(--orange);
  background: #fff7ed;
}

.quiz-option.selected {
  border-color: var(--orange);
  background: #fff7ed;
  font-weight: 600;
}

[data-theme="dark"] .quiz-option:hover,
[data-theme="dark"] .quiz-option.selected {
  background: #1c0f00;
  border-color: var(--orange);
}

.quiz-option input[type="radio"] {
  accent-color: var(--orange);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ---- Résultat quiz ---- */
.quiz-result-score {
  text-align: center;
  padding: 20px 0;
}

.quiz-result-detail {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quiz-result-row {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
}

.quiz-result-row.correct {
  background: #d1fae5;
  color: #065f46;
}

.quiz-result-row.wrong {
  background: #fee2e2;
  color: #991b1b;
}

.quiz-result-row.open {
  background: #fef3c7;
  color: #92400e;
}

.quiz-result-row small {
  display: block;
  margin-top: 3px;
  font-style: italic;
}

.quiz-result-row strong {
  margin-right: 4px;
}

/* ---- Messages ---- */
.msg-thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 200px;
  max-height: 420px;
  overflow-y: auto;
  padding: 4px 0;
}

.msg-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
}

.msg-bubble.sent {
  align-self: flex-end;
  background: var(--orange);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.msg-bubble.received {
  align-self: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

[data-theme="dark"] .msg-bubble.received {
  background: #0f172a;
  border-color: #334155;
  color: #f1f5f9;
}

.msg-meta {
  font-size: 11px;
  opacity: .65;
  margin-top: 4px;
}

.msg-input-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

/* ---- Upload fichier ---- */
.file-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1.5px dashed var(--border);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  transition: border-color .12s, color .12s;
}

.file-label:hover {
  border-color: var(--orange);
  color: var(--orange);
}

[data-theme="dark"] .file-label {
  border-color: #334155;
}

[data-theme="dark"] .file-label:hover {
  border-color: var(--orange);
  color: var(--orange);
}

.file-label input {
  display: none;
}

.submission-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

/* ---- Empty state ---- */
.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 0;
  font-size: 14px;
}

/* ---- Responsive élève ---- */
@media (max-width: 768px) {
  .moyenne-banner {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }

  .moyenne-value {
    font-size: 2.2rem;
  }

  .matieres-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .table-wrap .table {
    min-width: 600px;
  }

  .quiz-progress-bar-wrap {
    margin: 12px 16px 0;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .cards {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
  .sidebar, .header, .panel-header button, .btn, .nav-item, .no-print, .template-tab {
    display: none !important;
  }
  .main-content {
    margin: 0 !important;
    padding: 0 !important;
  }
  .layout {
    grid-template-columns: 1fr !important;
  }
  body, .panel, .view, .fiche-tab-content {
    background: white !important;
    border: none !important;
    color: black !important;
    box-shadow: none !important;
  }
  .panel {
    margin: 0 !important;
    padding: 0 !important;
  }
}