/* ================================================================
   LMS T3EC/TIEC — Feuille de style principale
   Mobile-first, responsive, PWA-ready
   ================================================================ */

:root {
  --blue:        #1a3d6e;
  --blue-mid:    #2557a7;
  --blue-light:  #e8f0fc;
  --teal:        #0d7c66;
  --teal-light:  #e0f4f0;
  --amber:       #b45309;
  --amber-light: #fef3c7;
  --purple:      #5b21b6;
  --purple-light:#ede9fe;
  --coral:       #c2410c;
  --coral-light: #fff1ec;
  --green:       #166534;
  --green-light: #dcfce7;
  --red:         #991b1b;
  --red-light:   #fee2e2;
  --gray:        #1e293b;
  --gray-mid:    #64748b;
  --gray-light:  #f8fafc;
  --border:      #e2e8f0;
  --white:       #ffffff;
  --sidebar-w:   240px;
  --topbar-h:    56px;
  --radius:      10px;
  --shadow:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--gray);
  background: #f0f4f8;
  line-height: 1.6;
}

a { color: var(--blue-mid); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── SIDEBAR ──────────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--blue);
  color: white;
  display: flex; flex-direction: column;
  z-index: 200;
  transition: transform .25s ease;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 20px 18px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.brand-icon { font-size: 28px; flex-shrink: 0; }
.brand-title { font-size: 16px; font-weight: 700; }
.brand-sub { font-size: 11px; opacity: .6; }

.sidebar-user {
  padding: 14px 18px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; opacity: .65; }

.sidebar-nav { flex: 1; padding: 10px 0; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px;
  color: rgba(255,255,255,.75);
  font-size: 13.5px;
  transition: background .15s, color .15s;
  cursor: pointer;
  text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: white; text-decoration: none; }
.nav-item.active { background: rgba(255,255,255,.15); color: white; font-weight: 600; }

.nav-icon { font-size: 16px; flex-shrink: 0; width: 22px; text-align: center; }
.nav-label { flex: 1; }

.sidebar-footer {
  padding: 10px 0;
  border-top: 1px solid rgba(255,255,255,.1);
}

/* ── TOPBAR ───────────────────────────────────────────── */
.topbar {
  position: fixed; top: 0;
  left: var(--sidebar-w); right: 0;
  height: var(--topbar-h);
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
  z-index: 100;
  box-shadow: var(--shadow);
}
.hamburger {
  display: none;
  flex-direction: column; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 4px;
}
.hamburger span {
  display: block; width: 22px; height: 2px;
  background: var(--gray); border-radius: 2px;
}
.page-title { font-size: 16px; font-weight: 600; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-name { font-size: 13px; color: var(--gray-mid); }
.notif-badge {
  background: var(--coral); color: white;
  font-size: 11px; font-weight: 700;
  padding: 3px 8px; border-radius: 20px;
}

/* ── MAIN CONTENT ─────────────────────────────────────── */
.main-wrapper {
  margin-left: var(--sidebar-w);
  padding-top: var(--topbar-h);
  min-height: 100vh;
}
.main-content { padding: 28px 28px 60px; max-width: 1200px; }

/* ── CARDS ────────────────────────────────────────────── */
.card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 16px; font-weight: 600; }
.card-body { padding: 22px; }
.card-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--gray-light);
  font-size: 13px;
  color: var(--gray-mid);
}

/* ── STAT CARDS ───────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.stat-label { font-size: 12px; color: var(--gray-mid); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 300; line-height: 1; }
.stat-sub { font-size: 12px; color: var(--gray-mid); margin-top: 4px; }
.stat-blue  .stat-value { color: var(--blue-mid); }
.stat-teal  .stat-value { color: var(--teal); }
.stat-amber .stat-value { color: var(--amber); }
.stat-purple.stat-value { color: var(--purple); }
.stat-green .stat-value { color: var(--green); }

/* ── GRID LAYOUTS ─────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ── TABLES ───────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.data-table {
  width: 100%; border-collapse: collapse; font-size: 13.5px;
}
.data-table th {
  background: var(--blue); color: white;
  padding: 10px 14px; text-align: left;
  font-weight: 500; font-size: 12px;
  letter-spacing: .3px; white-space: nowrap;
}
.data-table th:first-child { border-radius: 8px 0 0 0; }
.data-table th:last-child  { border-radius: 0 8px 0 0; }
.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--gray-light); }

/* ── FORMS ────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
label.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--gray); }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=url], select, textarea {
  width: 100%;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 14px;
  font-family: inherit;
  color: var(--gray);
  background: white;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--blue-mid);
  box-shadow: 0 0 0 3px rgba(37,87,167,.1);
}
textarea { resize: vertical; min-height: 90px; }
.form-hint { font-size: 12px; color: var(--gray-mid); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row.cols-3 { grid-template-columns: repeat(3, 1fr); }

/* ── BUTTONS ──────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: 7px;
  font-size: 13.5px; font-weight: 600; font-family: inherit;
  cursor: pointer; border: none; transition: opacity .15s, transform .1s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { opacity: .88; text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn-primary   { background: var(--blue-mid);  color: white; }
.btn-teal      { background: var(--teal);       color: white; }
.btn-purple    { background: var(--purple);     color: white; }
.btn-amber     { background: var(--amber);      color: white; }
.btn-danger    { background: #dc2626;           color: white; }
.btn-ghost     { background: white; color: var(--gray); border: 1px solid var(--border); }
.btn-sm        { padding: 6px 12px; font-size: 12.5px; }
.btn-lg        { padding: 13px 28px; font-size: 15px; }

/* ── BADGES ───────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 3px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600;
}
.badge-blue   { background: var(--blue-light);   color: var(--blue-mid); }
.badge-teal   { background: var(--teal-light);   color: var(--teal); }
.badge-purple { background: var(--purple-light); color: var(--purple); }
.badge-amber  { background: var(--amber-light);  color: var(--amber); }
.badge-green  { background: var(--green-light);  color: var(--green); }
.badge-red    { background: var(--red-light);    color: var(--red); }
.badge-gray   { background: var(--gray-light);   color: var(--gray-mid); }

/* ── ALERTS ───────────────────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: 8px; margin-bottom: 16px;
  font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start;
}
.alert-success { background: var(--green-light); color: var(--green); border: 1px solid #bbf7d0; }
.alert-error   { background: var(--red-light);   color: var(--red);   border: 1px solid #fecaca; }
.alert-info    { background: var(--blue-light);  color: var(--blue-mid); border: 1px solid #bfdbfe; }
.alert-warning { background: var(--amber-light); color: var(--amber);  border: 1px solid #fde68a; }

/* ── PROGRESS BAR ─────────────────────────────────────── */
.progress-bar {
  background: var(--border); border-radius: 20px;
  height: 8px; overflow: hidden; min-width: 80px;
}
.progress-bar div { height: 100%; border-radius: 20px; transition: width .3s; }

/* ── MODULE CARDS ─────────────────────────────────────── */
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.module-card {
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.module-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.module-card-header {
  padding: 14px 18px;
  display: flex; justify-content: space-between; align-items: center;
}
.module-code {
  font-size: 11px; font-weight: 700; font-family: monospace;
  background: rgba(0,0,0,.08); padding: 2px 7px; border-radius: 4px;
}
.module-card-body { padding: 12px 18px 16px; }
.module-title { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.module-meta { font-size: 12px; color: var(--gray-mid); }

/* ── EVALUATION ───────────────────────────────────────── */
.eval-question {
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.eval-question-text { font-size: 15px; font-weight: 500; margin-bottom: 14px; }
.eval-option {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 7px;
  border: 1px solid var(--border); margin-bottom: 8px;
  cursor: pointer; transition: background .12s, border-color .12s;
  font-size: 14px;
}
.eval-option:hover { background: var(--gray-light); border-color: var(--blue-mid); }
.eval-option input[type=radio], .eval-option input[type=checkbox] {
  width: auto; flex-shrink: 0;
}
.eval-option.correct   { background: var(--green-light); border-color: #86efac; }
.eval-option.incorrect { background: var(--red-light);   border-color: #fca5a5; }
.eval-option.selected  { background: var(--blue-light);  border-color: var(--blue-mid); }

/* ── PROGRESSION ──────────────────────────────────────── */
.prog-bloc { margin-bottom: 28px; }
.prog-bloc-title {
  font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .8px; color: var(--gray-mid); margin-bottom: 12px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.prog-item {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.prog-item:last-child { border-bottom: none; }
.prog-item-code { font-family: monospace; font-size: 12px; font-weight: 700; width: 40px; flex-shrink: 0; color: var(--gray-mid); }
.prog-item-title { flex: 1; }
.prog-item-pct { width: 36px; text-align: right; font-size: 12px; font-weight: 600; color: var(--gray-mid); }

/* ── MESSAGES ─────────────────────────────────────────── */
.msg-list { display: flex; flex-direction: column; gap: 0; }
.msg-item {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; gap: 14px; cursor: pointer;
  transition: background .12s;
}
.msg-item:hover { background: var(--gray-light); }
.msg-item.unread { background: var(--blue-light); }
.msg-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--blue-mid); color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.msg-body { flex: 1; min-width: 0; }
.msg-from { font-size: 13px; font-weight: 600; }
.msg-subject { font-size: 13px; color: var(--gray-mid); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-date { font-size: 11px; color: var(--gray-mid); white-space: nowrap; }

/* ── SATISFACTION ─────────────────────────────────────── */
.survey-question {
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 14px;
}
.survey-question-text { font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.rating-stars { display: flex; gap: 8px; }
.rating-star {
  width: 40px; height: 40px; border-radius: 50%;
  border: 2px solid var(--border);
  background: white; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .15s;
}
.rating-star:hover, .rating-star.selected { background: var(--amber); border-color: var(--amber); }

/* ── LOGIN PAGE ───────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: var(--blue);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.login-box {
  background: white; border-radius: 16px;
  padding: 40px 36px; width: 100%; max-width: 400px;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-icon { font-size: 40px; }
.login-logo h1 { font-size: 22px; font-weight: 700; color: var(--blue); margin-top: 8px; }
.login-logo p { font-size: 13px; color: var(--gray-mid); margin-top: 4px; }

/* ── MODAL ────────────────────────────────────────────── */
.modal-bg {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 500;
  align-items: center; justify-content: center; padding: 20px;
}
.modal-bg.open { display: flex; }
.modal {
  background: white; border-radius: 14px;
  padding: 28px; width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--gray-mid); }

/* ── MISC ─────────────────────────────────────────────── */
.section-title { font-size: 20px; font-weight: 700; color: var(--blue); margin-bottom: 18px; }
.text-muted { color: var(--gray-mid); }
.text-sm { font-size: 12.5px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.pagination { display: flex; gap: 6px; margin-top: 18px; }
.page-link {
  padding: 6px 12px; border-radius: 6px;
  border: 1px solid var(--border); font-size: 13px; color: var(--gray);
  background: white;
}
.page-link.active { background: var(--blue-mid); color: white; border-color: var(--blue-mid); }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 150; }

/* ── RESPONSIVE MOBILE ────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  .sidebar {
    width: 240px;
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }

  .main-wrapper { margin-left: 0; }

  .topbar { left: 0; padding: 0 16px; }
  .hamburger { display: flex; }
  .topbar-name { display: none; }

  .main-content { padding: 18px 16px 60px; }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row, .form-row.cols-3 { grid-template-columns: 1fr; }
  .module-grid { grid-template-columns: 1fr; }

  .login-box { padding: 30px 22px; }
  .modal { padding: 22px 18px; }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
