/* =========================================================================
   ISPA — Design System
   Direction : soft & professionnel. Calme, lumineux, généreux en respiration.
   ========================================================================= */

:root {
  /* Surfaces & encre */
  --bg:        #F5F6FB;
  --surface:   #FFFFFF;
  --surface-2: #FBFBFE;
  --ink:       #1A1C2E;
  --ink-soft:  #45485F;
  --muted:     #7A7E99;
  --line:      #ECEDF5;
  --line-2:    #E2E4EF;

  /* Marque — indigo doux + menthe */
  --primary:      #5B61F0;
  --primary-600:  #4B50DB;
  --primary-soft: #ECEDFE;
  --primary-tint: #F4F4FF;
  --accent:       #10B9A3;
  --accent-soft:  #E1F8F4;

  /* États */
  --success: #16B981; --success-soft:#E6F8F0;
  --warning: #F5A524; --warning-soft:#FDF2DD;
  --danger:  #F2547B; --danger-soft: #FDE9EE;

  /* Accents de rôle */
  --role-admin:   #5B61F0;
  --role-teacher: #10B9A3;
  --role-student: #8B5CF6;

  /* Rayons & ombres */
  --r-sm: 10px; --r: 16px; --r-lg: 22px; --r-xl: 28px; --r-full: 999px;
  --sh-xs: 0 1px 2px rgba(26,28,46,.05);
  --sh-sm: 0 2px 8px rgba(26,28,46,.05);
  --sh:    0 8px 24px rgba(26,28,46,.06);
  --sh-lg: 0 18px 48px rgba(26,28,46,.10);

  --ff-display: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
  --ff-body:    "Inter", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--ff-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
h1,h2,h3,h4 { font-family: var(--ff-display); font-weight: 700; letter-spacing: -.02em; color: var(--ink); }
::selection { background: var(--primary-soft); }

/* Scrollbar discrète */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; border: 3px solid var(--bg); }

/* =========================================================================
   LAYOUT — sidebar + topbar + contenu
   ========================================================================= */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 256px; flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 22px 16px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 22px; }
.brand__mark {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, var(--primary), #8B5CF6);
  display: grid; place-items: center; color: #fff; flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(91,97,240,.35);
}
.brand__name { font-family: var(--ff-display); font-weight: 800; font-size: 18px; letter-spacing: -.03em; }
.brand__name span { color: var(--primary); }

.nav-group { margin-top: 14px; }
.nav-group__label {
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); padding: 0 10px 8px;
}
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px; color: var(--ink-soft);
  font-weight: 500; font-size: 14.5px; margin-bottom: 2px;
  transition: background .16s, color .16s;
}
.nav-link svg { width: 19px; height: 19px; flex-shrink: 0; stroke-width: 1.9; opacity: .85; }
.nav-link:hover { background: var(--surface-2); color: var(--ink); }
.nav-link.is-active {
  background: var(--primary-soft); color: var(--primary-600); font-weight: 600;
}
.nav-link.is-active svg { opacity: 1; }

.sidebar__foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); }
.userchip { display: flex; align-items: center; gap: 11px; padding: 8px; border-radius: 12px; }
.userchip:hover { background: var(--surface-2); }
.avatar {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  background: var(--primary-soft); color: var(--primary-600);
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
  font-family: var(--ff-display);
}
.userchip__name { font-weight: 600; font-size: 13.5px; line-height: 1.2; }
.userchip__role { font-size: 12px; color: var(--muted); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 70px; display: flex; align-items: center; gap: 18px;
  padding: 0 32px; background: rgba(245,246,251,.8);
  backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 20;
  border-bottom: 1px solid var(--line);
}
.topbar__title { font-family: var(--ff-display); font-weight: 700; font-size: 19px; }
.topbar__spacer { flex: 1; }

.search {
  display: flex; align-items: center; gap: 9px; background: var(--surface);
  border: 1px solid var(--line-2); border-radius: var(--r-full);
  padding: 9px 16px; min-width: 260px; color: var(--muted);
}
.search input { border: none; outline: none; background: none; font-size: 14px; width: 100%; color: var(--ink); font-family: inherit; }
.search svg { width: 18px; height: 18px; }

.content { padding: 28px 32px 56px; max-width: 1280px; width: 100%; }

/* =========================================================================
   COMPOSANTS
   ========================================================================= */
.page-head { margin-bottom: 26px; }
.page-head h1 { font-size: 26px; }
.page-head p { color: var(--muted); margin-top: 4px; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--sh-sm);
}
.card--pad { padding: 24px; }
.card__head { display:flex; align-items:center; justify-content:space-between; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.card__head h3 { font-size: 16px; }
.card__body { padding: 22px 24px; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2,1fr); }
.grid-3 { grid-template-columns: repeat(3,1fr); }
.grid-4 { grid-template-columns: repeat(4,1fr); }
.cols-2-1 { grid-template-columns: 2fr 1fr; }

/* KPI cards */
.kpi {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 20px; box-shadow: var(--sh-sm);
  position: relative; overflow: hidden;
}
.kpi__icon {
  width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center;
  margin-bottom: 16px;
}
.kpi__icon svg { width: 22px; height: 22px; stroke-width: 1.9; }
.kpi__icon--indigo { background: var(--primary-soft); color: var(--primary-600); }
.kpi__icon--teal   { background: var(--accent-soft); color: var(--accent); }
.kpi__icon--violet { background:#F1EBFE; color: var(--role-student); }
.kpi__icon--amber  { background: var(--warning-soft); color: #C97E0F; }
.kpi__value { font-family: var(--ff-display); font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.kpi__label { color: var(--muted); font-size: 13.5px; margin-top: 7px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  font-family: var(--ff-body); font-weight: 600; font-size: 14px;
  padding: 11px 18px; border-radius: 12px; border: 1px solid transparent;
  cursor: pointer; transition: transform .08s, box-shadow .16s, background .16s; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; stroke-width: 2; }
.btn--primary { background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(91,97,240,.28); }
.btn--primary:hover { background: var(--primary-600); }
.btn--ghost { background: var(--surface); color: var(--ink-soft); border-color: var(--line-2); }
.btn--ghost:hover { background: var(--surface-2); border-color: var(--muted); }
.btn--soft { background: var(--primary-soft); color: var(--primary-600); }
.btn--soft:hover { background: #E2E3FD; }
.btn--danger { background: var(--danger-soft); color: #D63A63; }
.btn--block { width: 100%; }
.btn--sm { padding: 8px 13px; font-size: 13px; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: var(--r-full);
}
.badge--indigo { background: var(--primary-soft); color: var(--primary-600); }
.badge--teal   { background: var(--accent-soft); color: var(--accent); }
.badge--violet { background:#F1EBFE; color: var(--role-student); }
.badge--success{ background: var(--success-soft); color: var(--success); }
.badge--danger { background: var(--danger-soft); color: #D63A63; }
.badge--muted  { background: var(--surface-2); color: var(--muted); border:1px solid var(--line); }

/* Table */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--surface-2); }
.table .cell-user { display: flex; align-items: center; gap: 11px; }

/* Forms */
.field { margin-bottom: 18px; }
.field label, .field__label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 7px; color: var(--ink-soft); }
.field__input {
  width: 100%; padding: 12px 14px; font-size: 14.5px; font-family: inherit;
  border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface);
  color: var(--ink); transition: border .16s, box-shadow .16s;
}
.field__input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-tint); }
.field__hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.field__error { font-size: 12.5px; color: #D63A63; margin-top: 6px; }
select.field__input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%237A7E99' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch__input { width: 42px; height: 24px; appearance: none; background: var(--line-2); border-radius: 99px; position: relative; cursor: pointer; transition: background .2s; }
.switch__input:checked { background: var(--primary); }
.switch__input::after { content:""; position:absolute; top:3px; left:3px; width:18px; height:18px; background:#fff; border-radius:50%; transition: left .2s; box-shadow: var(--sh-xs); }
.switch__input:checked::after { left: 21px; }

/* Progress */
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress__bar { height: 100%; background: linear-gradient(90deg, var(--primary), #8B5CF6); border-radius: 99px; transition: width .4s; }

/* =========================================================================
   COURSE CARDS — présentation identique, seule la cover diffère
   ========================================================================= */
.course-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--sh-sm);
  transition: transform .18s, box-shadow .18s;
  display: flex;
  flex-direction: column;
  height: 100%;                         /* même hauteur dans la grille */
}
.course-card:hover { transform: translateY(-3px); box-shadow: var(--sh-lg); }

.course-card__cover {
  height: 180px;                        /* même hauteur, avec ou sans image */
  flex-shrink: 0;
  background: var(--grad-aurora);       /* dégradé quand pas d'image */
  display: flex; align-items: center; justify-content: center;
}
.course-card__cover img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.course-card__cover svg {
  width: 48px; height: 48px;
  color: rgba(255, 255, 255, .4);       /* icône discrète sur le dégradé */
  opacity: 1;
}

.course-card__body {
  padding: 18px; flex: 1;
  display: flex; flex-direction: column;
}
.course-card__cat { align-self: flex-start; margin-bottom: 12px; }
.course-card__title {
  font-family: var(--ff-display);
  font-weight: 700; font-size: 17px; line-height: 1.3;
  margin-bottom: 6px;
}
.course-card__desc {
  color: var(--muted); font-size: 14px; line-height: 1.5;
  margin: 0 0 14px; min-height: 42px;   /* hauteur réservée même si vide */
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.course-card__meta {
  display: flex; align-items: center; gap: 8px;
  color: var(--muted); font-size: 13px;
  margin-top: auto;                     /* méta collé en bas */
}
.course-card__enrolled { align-self: flex-start; margin-top: 12px; }

/* Empty state */
.empty { text-align: center; padding: 54px 20px; color: var(--muted); }
.empty svg { width: 46px; height: 46px; margin-bottom: 14px; color: var(--line-2); }
.empty h3 { font-size: 17px; margin-bottom: 6px; color: var(--ink); }

/* Messages / toasts */
.toasts { position: fixed; top: 18px; right: 18px; z-index: 60; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--primary);
  border-radius: 12px; padding: 13px 18px; box-shadow: var(--sh-lg); font-size: 14px;
  min-width: 260px; animation: slidein .3s ease;
}
.toast--success { border-left-color: var(--success); }
.toast--warning { border-left-color: var(--warning); }
.toast--danger  { border-left-color: var(--danger); }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* Utilities */
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.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}
.text-muted { color: var(--muted); } .text-sm { font-size: 13px; } .fw-600 { font-weight: 600; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }

/* Responsive */
@media (max-width: 980px) {
  .grid-4 { grid-template-columns: repeat(2,1fr); }
  .grid-3 { grid-template-columns: repeat(2,1fr); }
  .cols-2-1 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .sidebar { position: fixed; left: -280px; z-index: 50; transition: left .25s; box-shadow: var(--sh-lg); }
  .sidebar.is-open { left: 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .content { padding: 20px; }
  .topbar { padding: 0 16px; }
  .search { min-width: 0; flex: 1; }
  .menu-toggle { display: grid !important; }
}
.menu-toggle { display: none; place-items: center; width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; }

/* ==========================================================================
   COUCHE DE MODERNISATION v2 — rendu rehaussé (mêmes classes)
   ========================================================================== */
* { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

html { scroll-behavior: smooth; }

:root {
  --grad-primary: linear-gradient(135deg, #6469F2 0%, #5B61F0 50%, #7A5CF0 100%);
  --grad-aurora:  linear-gradient(135deg, #5B61F0 0%, #8B5CF6 55%, #10B9A3 120%);
  --ring: 0 0 0 4px rgba(91,97,240,.18);
}

/* --- Transitions globales douces --- */
.btn, .card, .course-card, .kpi, .nav-link, .badge, .table tbody tr,
.field__input, .userchip, .toast { transition: all .18s cubic-bezier(.4,0,.2,1); }

/* --- Boutons : dégradé + relief au survol --- */
.btn { font-weight: 600; letter-spacing: .01em; border-radius: var(--r-sm); }
.btn--primary {
  background: var(--grad-primary);
  box-shadow: 0 6px 16px rgba(91,97,240,.28);
  border: none;
}
.btn--primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(91,97,240,.36); }
.btn--primary:active { transform: translateY(0); box-shadow: 0 4px 12px rgba(91,97,240,.3); }
.btn--soft:hover { transform: translateY(-1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }

/* --- Cartes : bord net + survol pour les cartes interactives --- */
.card { border: 1px solid var(--line); box-shadow: var(--sh); }
.course-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(26,28,46,.12);
  border-color: var(--primary-soft);
}

/* --- KPI : liseré supérieur dégradé + survol --- */
.kpi { position: relative; overflow: hidden; border: 1px solid var(--line); }
.kpi::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--grad-primary); opacity: .9;
}
.kpi:hover { transform: translateY(-3px); box-shadow: var(--sh-lg); }
.kpi__value { font-family: var(--ff-display); letter-spacing: -.02em; }

/* --- Tableaux : entête raffiné + survol de ligne --- */
.table thead th {
  text-transform: uppercase; font-size: 11px; letter-spacing: .07em;
  color: var(--muted); font-weight: 700;
}
.table tbody tr:hover { background: var(--primary-tint); }

/* --- Barre latérale : pastille active en dégradé --- */
.nav-link { border-radius: var(--r-sm); font-weight: 500; }
.nav-link:hover { background: var(--primary-tint); color: var(--primary); }
.nav-link.is-active {
  background: var(--grad-primary); color: #fff;
  box-shadow: 0 6px 16px rgba(91,97,240,.3);
}
.nav-link.is-active svg { color: #fff; }

/* --- Badges : pilule douce --- */
.badge { border-radius: var(--r-full); font-weight: 600; letter-spacing: .01em; }

/* --- Progression : remplissage dégradé animé --- */
.progress { background: var(--line); border-radius: var(--r-full); overflow: hidden; }
.progress__bar {
  background: var(--grad-primary);
  border-radius: var(--r-full);
  transition: width .5s cubic-bezier(.4,0,.2,1);
}

/* --- Champs : focus accessible --- */
.field__input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: var(--ring); background: #fff;
}

/* --- Topbar : effet verre dépoli collant --- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,.82);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar__title { font-family: var(--ff-display); letter-spacing: -.01em; }

/* --- Carte utilisateur (sidebar) --- */
.userchip:hover { background: var(--primary-tint); border-radius: var(--r); }

/* --- Apparition douce du contenu --- */
.content > * { animation: fadeUp .4s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* --- En-tête de page --- */
.page-head h1 { font-family: var(--ff-display); letter-spacing: -.02em; }

/* --- Responsive : confort mobile --- */
@media (max-width: 640px) {
  .content { padding: 16px !important; }
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
  .cols-2-1 { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 22px; }
  .table { font-size: 13px; }
}
@media (max-width: 420px) {
  .grid-3, .grid-4, .grid-2 { grid-template-columns: 1fr; }
}

/* --- Accessibilité : focus visible global --- */
a:focus-visible, button:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }

/* --- Préférence mouvement réduit --- */
@media (prefers-reduced-motion: reduce) {
  *, .content > * { animation: none !important; transition: none !important; }
}

/* Correctif : .cols-2-1 grille autonome (2 colonnes -> 1 sur petit écran) */
.cols-2-1 { display: grid; gap: 24px; grid-template-columns: 2fr 1fr; align-items: start; }
@media (max-width: 980px) { .cols-2-1 { grid-template-columns: 1fr; } }

