/* ============================================================
   EduPlatform CI — Design System Global
   Palette inspirée du drapeau ivoirien : Orange · Blanc · Vert
   ============================================================ */

:root {
  /* ── Couleurs nationales (Côte d'Ivoire) ──────────────────── */
  --primary:       #F77F00;  /* Orange ivoirien */
  --primary-dark:  #D96A00;
  --primary-light: #FFE8CC;
  --secondary:     #009E60;  /* Vert ivoirien */
  --secondary-dark:#00824D;
  --secondary-light:#D4F4E2;
  --accent:        #F77F00;  /* alias orange pour cohérence */

  --danger:        #DC2626;
  --success:       #009E60;  /* aligné sur le vert national */
  --warning:        #D97706;

  --gray-50:  #FAFAF9;
  --gray-100: #F4F3F1;
  --gray-200: #E7E5E2;
  --gray-300: #D3D0CB;
  --gray-400: #9C9890;
  --gray-500: #716D65;
  --gray-600: #4F4C46;
  --gray-700: #38362F;
  --gray-800: #232118;
  --gray-900: #16140D;

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow:    0 4px 12px rgba(0,0,0,.10);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.12);
  --transition: .18s ease;
}

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

body {
  font-family: var(--font-sans);
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  font-size: 15px;
}

/* ── Bandeau tricolore (signature visuelle nationale) ────────── */
.flag-strip {
  height: 4px;
  width: 100%;
  background: linear-gradient(90deg, #F77F00 0%, #F77F00 33.33%, #FFFFFF 33.33%, #FFFFFF 66.66%, #009E60 66.66%, #009E60 100%);
  flex-shrink: 0;
}

/* ── Typography ─────────────────────────────────────── */
h1 { font-size: 1.75rem; font-weight: 700; color: var(--gray-900); }
h2 { font-size: 1.35rem; font-weight: 600; color: var(--gray-800); }
h3 { font-size: 1.1rem;  font-weight: 600; color: var(--gray-700); }

/* ── Layout ─────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--gray-900);
  color: white;
  display: flex;
  flex-direction: column;

  padding: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: .75rem;
}
.sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}
.sidebar-logo h1 {
  font-size: 1rem; font-weight: 700;
  color: white; line-height: 1.2;
}
.sidebar-logo span { font-size: .7rem; color: var(--gray-400); }

.sidebar-nav { flex: 1; padding: 1rem 0; }
.nav-section { padding: .25rem 1.5rem .25rem; font-size: .7rem;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--gray-500); margin-top: .75rem; }
.nav-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem 1.5rem;
  color: var(--gray-300);
  text-decoration: none;
  font-size: .875rem;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
  border-left: 3px solid transparent;
}
.nav-item:hover  { background: rgba(255,255,255,.06); color: white; }
.nav-item.active { background: rgba(247,127,0,.22); color: white;
  border-left-color: var(--primary); }
.nav-item .nav-icon { width: 18px; text-align: center; }

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,.08);
}
.user-info { display: flex; align-items: center; gap: .75rem; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary); color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: .875rem;
  flex-shrink: 0;
}
.user-name  { font-size: .875rem; font-weight: 500; color: white; }
.user-role  { font-size: .75rem; color: var(--gray-400); }

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

.topbar {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 1rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
}
.topbar-title h2 { font-size: 1.1rem; margin: 0; }
.topbar-title p  { font-size: .8rem; color: var(--gray-500); margin: 0; }
.topbar-actions { display: flex; align-items: center; gap: .75rem; }

.page-content { padding: 1.5rem; }

/* ── Cards ──────────────────────────────────────────── */
.card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--gray-100);
}
.card-header h3 { margin: 0; }

/* ── Stats grid ─────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.stat-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex; align-items: center; gap: 1rem;
}
.stat-icon {
  width: 48px; height: 48px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
}
.stat-icon.blue   { background: var(--primary-light); }
.stat-icon.green  { background: var(--secondary-light); }
.stat-icon.amber  { background: #FEF3C7; }
.stat-icon.purple { background: #EDE9FE; }
.stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1; color: var(--gray-900); }
.stat-label { font-size: .8rem; color: var(--gray-500); margin-top: 2px; }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .55rem 1.1rem; border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 500;
  border: none; cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary   { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-success   { background: var(--success); color: white; }
.btn-danger    { background: var(--danger);  color: white; }
.btn-ghost     { background: transparent; color: var(--gray-600); }
.btn-ghost:hover { background: var(--gray-100); }
.btn-sm { padding: .35rem .75rem; font-size: .8rem; }
.btn-lg { padding: .75rem 1.5rem; font-size: 1rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ── Forms ───────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: .875rem; font-weight: 500;
  color: var(--gray-700); margin-bottom: .4rem; }
.form-control {
  width: 100%;
  padding: .55rem .875rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  color: var(--gray-800);
  background: white;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(247,127,0,.15);
}
.form-control.error { border-color: var(--danger); }
.form-hint  { font-size: .78rem; color: var(--gray-500); margin-top: .3rem; }
.form-error { font-size: .78rem; color: var(--danger);   margin-top: .3rem; }
textarea.form-control { resize: vertical; min-height: 100px; }

/* ── Tables ──────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead th {
  background: var(--gray-50);
  padding: .75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--gray-600);
  border-bottom: 2px solid var(--gray-200);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
tbody tr { border-bottom: 1px solid var(--gray-100); transition: background var(--transition); }
tbody tr:hover { background: var(--gray-50); }
tbody td { padding: .75rem 1rem; color: var(--gray-700); vertical-align: middle; }

/* ── Badges ──────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 500;
}
.badge-blue   { background: var(--primary-light); color: var(--primary-dark); }
.badge-green  { background: var(--secondary-light); color: var(--secondary-dark); }
.badge-amber  { background: #FEF3C7; color: #B45309; }
.badge-red    { background: #FEE2E2; color: #B91C1C; }
.badge-purple { background: #EDE9FE; color: #6D28D9; }
.badge-gray   { background: var(--gray-100); color: var(--gray-600); }

/* ── Modal ───────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); z-index: 100;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: white;
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  width: min(600px, 94vw);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp .2s ease;
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem;
}
.modal-header h3 { margin: 0; }
.modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 1.25rem; color: var(--gray-400);
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
}
.modal-close:hover { background: var(--gray-100); }

/* ── Alert / Toast ───────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  display: flex; flex-direction: column; gap: .5rem; z-index: 200;
}
.toast {
  display: flex; align-items: center; gap: .75rem;
  padding: .875rem 1.25rem;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--primary);
  min-width: 280px;
  animation: slideLeft .25s ease;
}
@keyframes slideLeft {
  from { transform: translateX(50px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
.toast.success { border-color: var(--success); }
.toast.error   { border-color: var(--danger);  }
.toast.warning { border-color: var(--warning); }
.toast-msg  { flex: 1; font-size: .875rem; }
.toast-close { cursor: pointer; color: var(--gray-400); font-size: .875rem; }

/* ── AI Badge ────────────────────────────────────────── */
.ai-badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .2rem .6rem;
  background: linear-gradient(135deg, var(--primary-light), var(--secondary-light));
  color: var(--primary-dark);
  border-radius: 20px;
  font-size: .72rem; font-weight: 600;
}

/* ── Score display ───────────────────────────────────── */
.score-pill {
  display: inline-flex; align-items: center;
  padding: .3rem .8rem;
  border-radius: 20px;
  font-weight: 700;
  font-size: .9rem;
}
.score-excellent { background: #DCFCE7; color: #15803D; }
.score-good      { background: #FEF9C3; color: #854D0E; }
.score-average   { background: #FEF3C7; color: #B45309; }
.score-poor      { background: #FEE2E2; color: #B91C1C; }

/* ── Loader ──────────────────────────────────────────── */
.loader {
  display: inline-flex; align-items: center; gap: .5rem;
  color: var(--gray-500); font-size: .875rem;
}
.spinner {
  width: 18px; height: 18px;
  border: 2.5px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.ai-loader {
  background: linear-gradient(135deg, var(--primary-light), var(--secondary-light));
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex; align-items: center; gap: .875rem;
}
.ai-loader-text h4  { font-size: .9rem; margin-bottom: .2rem; }
.ai-loader-text p   { font-size: .8rem; color: var(--gray-500); margin: 0; }

/* ── Progress bar ────────────────────────────────────── */
.progress { height: 8px; background: var(--gray-200); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; transition: width .4s ease; }
.progress-fill.blue   { background: var(--primary); }
.progress-fill.green  { background: var(--success); }
.progress-fill.amber  { background: var(--accent); }
.progress-fill.red    { background: var(--danger); }

/* ── Grid utils ──────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { width: 100%; height: auto; position: relative; }
  .app-shell { flex-direction: column; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ── Scrollbar ───────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 99px; }
