/* ============================================================
   CyberSens – Design System
   Thème cybersécurité : dark navy + bleu électrique
   ============================================================ */

:root {
  --sidebar-width: 260px;
  --topbar-height: 60px;
  --color-primary:    #1565c0;
  --color-primary-dark: #0d47a1;
  --color-sidebar:    #0d1b2a;
  --color-sidebar-hover: #1a2f46;
  --color-bg:         #f0f2f5;
  --color-card:       #ffffff;
  --color-border:     #e2e8f0;
  --color-text:       #1e293b;
  --color-muted:      #64748b;
  --color-success:    #2e7d32;
  --color-warning:    #e65100;
  --color-danger:     #c62828;
  --color-info:       #0277bd;
  --radius:           12px;
  --radius-sm:        8px;
  --shadow:           0 2px 12px rgba(0,0,0,.08);
  --shadow-md:        0 4px 24px rgba(0,0,0,.12);
  --font:             'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
}

/* ---- SIDEBAR ---- */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--color-sidebar);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -.3px;
}

.sidebar-brand i { color: #60a5fa; font-size: 22px; }

.sidebar-nav {
  list-style: none;
  padding: 12px 0;
  margin: 0;
  flex: 1;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  border-radius: 0;
  transition: all .2s;
  font-size: 14px;
  position: relative;
}

.sidebar-nav a:hover { background: var(--color-sidebar-hover); color: #fff; }
.sidebar-nav a.active {
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
}
.sidebar-nav a.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: #60a5fa;
}
.sidebar-nav i { font-size: 16px; width: 20px; flex-shrink: 0; }

.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.sidebar-user-info { flex: 1; overflow: hidden; }
.sidebar-user-info strong { display: block; color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-info small  { color: rgba(255,255,255,.5); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

.btn-logout {
  color: rgba(255,255,255,.5);
  text-decoration: none;
  font-size: 18px;
  transition: color .2s;
  flex-shrink: 0;
}
.btn-logout:hover { color: #f87171; }

.btn-close-sidebar { background: none; border: none; color: rgba(255,255,255,.6); font-size: 18px; cursor: pointer; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 999; }

/* ---- MAIN WRAPPER ---- */
.main-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- TOPBAR ---- */
.topbar {
  height: var(--topbar-height);
  background: var(--color-card);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}

.btn-menu { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--color-text); padding: 4px; display: none; }
.topbar-title { font-weight: 600; font-size: 15px; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.topbar-icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 8px;
  color: var(--color-muted);
  text-decoration: none;
  transition: all .2s;
}
.topbar-icon-btn:hover { background: var(--color-bg); color: var(--color-text); }
.topbar-icon-btn i { font-size: 18px; }
.notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #ef4444;
  border: 2px solid #fff;
}

/* ---- PAGE CONTENT ---- */
.page-content {
  padding: 28px;
  flex: 1;
}

.page-header { margin-bottom: 24px; }
.page-title { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
.page-subtitle { color: var(--color-muted); margin: 0; font-size: 14px; }
.section-title { font-weight: 600; font-size: 16px; margin-bottom: 16px; padding-bottom: 8px; border-bottom: 2px solid var(--color-border); }

/* ---- CARDS ---- */
.card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  background: none;
  font-weight: 600;
}
.card-body { padding: 20px; }
.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--color-border);
  background: #fafafa;
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ---- STAT CARDS ---- */
.stat-card {
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  color: #fff;
  box-shadow: var(--shadow-md);
}
.stat-card--blue   { background: linear-gradient(135deg, #1565c0, #1976d2); }
.stat-card--green  { background: linear-gradient(135deg, #2e7d32, #388e3c); }
.stat-card--purple { background: linear-gradient(135deg, #6a1b9a, #8e24aa); }
.stat-card--orange { background: linear-gradient(135deg, #e65100, #f57c00); }
.stat-card--red    { background: linear-gradient(135deg, #c62828, #d32f2f); }

.stat-icon { font-size: 32px; opacity: .85; flex-shrink: 0; }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 13px; opacity: .85; margin-top: 2px; }

/* ---- COURSE CARDS ---- */
.course-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: relative;
  transition: transform .2s, box-shadow .2s;
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.course-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.course-card--template { border-left: 4px solid #0277bd; }
.course-card--done { border-left: 4px solid #2e7d32; }
.course-card--locked { opacity: .7; }

.course-card-badge {
  position: absolute;
  top: 12px; right: 12px;
  font-size: 11px;
}
.course-card-header { padding: 16px 16px 8px; }
.course-card-body { padding: 0 16px 12px; flex: 1; }
.course-card-footer { padding: 12px 16px; border-top: 1px solid var(--color-border); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.course-title { font-size: 15px; font-weight: 600; margin: 0 0 6px; line-height: 1.3; }
.course-desc { color: var(--color-muted); font-size: 13px; margin: 0; }
.course-meta { display: flex; gap: 12px; margin-top: 10px; }
.course-meta span { color: var(--color-muted); font-size: 12px; }
.course-deadline { margin-top: 8px; }

/* ---- FORMS ---- */
.form-control, .form-select {
  border-radius: var(--radius-sm);
  border-color: var(--color-border);
  font-size: 14px;
  transition: border-color .2s, box-shadow .2s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(21,101,192,.12);
}
.form-label { font-weight: 500; font-size: 13px; margin-bottom: 6px; }
.section-label { font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--color-muted); margin: 20px 0 10px; }

.input-icon { position: relative; }
.input-icon i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--color-muted); font-size: 16px; pointer-events: none; }
.input-icon .form-control { padding-left: 38px; }

/* ---- BUTTONS ---- */
.btn { border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; transition: all .2s; }
.btn-primary { background: var(--color-primary); border-color: var(--color-primary); }
.btn-primary:hover { background: var(--color-primary-dark); border-color: var(--color-primary-dark); }
.btn-xs { padding: 2px 8px; font-size: 12px; border-radius: 6px; }

/* ---- TABLES ---- */
.table { font-size: 14px; }
.table th { font-weight: 600; color: var(--color-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .3px; border-top: none; }
.table td { vertical-align: middle; }

/* ---- FILTER BAR ---- */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-btn {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--color-border);
  text-decoration: none;
  color: var(--color-text);
  font-size: 13px;
  font-weight: 500;
  transition: all .2s;
  background: var(--color-card);
}
.filter-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }
.filter-btn.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }

/* ---- EMPTY STATE ---- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--color-muted);
}
.empty-state i { font-size: 48px; opacity: .3; margin-bottom: 12px; }
.empty-state p { margin: 0 0 16px; font-size: 15px; }

/* ---- ACTIVITY LIST ---- */
.activity-list { list-style: none; padding: 0; margin: 0; }
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--color-border);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.activity-dot--pending  { background: #f59e0b; }
.activity-dot--approved { background: #10b981; }
.activity-dot--rejected { background: #ef4444; }
.activity-body { flex: 1; font-size: 13px; }

/* ---- INFO LIST ---- */
.info-list { margin: 0; }
.info-list dt { font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; color: var(--color-muted); margin-top: 10px; }
.info-list dd { margin: 0; font-size: 14px; }

/* ---- AVATARS ---- */
.avatar-sm {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.avatar-xs {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #e2e8f0;
  color: var(--color-text);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  flex-shrink: 0;
}

/* ---- COURSE BUILDER ---- */
.builder-module {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.builder-module-header {
  padding: 14px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.builder-module-body { padding: 8px; }
.builder-empty { padding: 16px; text-align: center; color: var(--color-muted); font-size: 13px; }

.builder-lesson {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  transition: background .15s;
}
.builder-lesson:hover { background: #f0f4ff; }
.builder-lesson-icon { flex-shrink: 0; }
.builder-lesson-title { font-size: 14px; }
.builder-lesson-actions { display: flex; gap: 4px; opacity: 0; transition: opacity .2s; }
.builder-lesson:hover .builder-lesson-actions { opacity: 1; }

/* ---- EXERCISES ---- */
.exercise-card { border-left: 4px solid var(--color-primary); }
.exercise-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}
.exercise-context {
  background: #f0f7ff;
  border: 1px solid #bbd6f5;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 12px;
}
.exercise-question { font-size: 15px; margin-bottom: 10px; }
.exercise-options { list-style: none; padding: 0; margin: 0; }
.exercise-options li { padding: 6px 0; font-size: 14px; border-bottom: 1px solid #f0f0f0; }
.exercise-options li:last-child { border-bottom: none; }
.exercise-options li.correct { color: var(--color-success); font-weight: 600; }
.exercise-options li.wrong   { color: var(--color-danger); text-decoration: line-through; }
.exercise-explanation {
  margin-top: 10px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
}

/* ---- EXERCISE PLAY ---- */
.exercise-card-play {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  transition: border-color .2s;
}
.exercise-card-play:focus-within { border-color: var(--color-primary); }
.exercise-question-play { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.exercise-options-play { display: flex; flex-direction: column; gap: 10px; }

.option-play-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s;
}
.option-play-row:hover { background: #f0f7ff; border-color: var(--color-primary); }
.option-input { flex-shrink: 0; }
.option-play-text { font-size: 14px; }

.option-btn-label { cursor: pointer; }
.option-btn-label input { display: none; }
.option-btn {
  display: inline-flex;
  align-items: center;
  padding: 14px 28px;
  border: 2px solid var(--color-border);
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  transition: all .2s;
}
.option-btn-label input:checked + .option-btn {
  border-color: var(--color-primary);
  background: #e8f0fe;
  color: var(--color-primary);
}

.scenario-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--color-muted);
  margin-bottom: 6px;
}

/* ---- RESULT BANNER ---- */
.result-banner {
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.result-banner--success { background: linear-gradient(135deg, #2e7d32, #43a047); color: #fff; }
.result-banner--warning { background: linear-gradient(135deg, #e65100, #f57c00); color: #fff; }
.result-score { text-align: center; }
.result-score-value { font-size: 48px; font-weight: 800; line-height: 1; }
.result-score-label { font-size: 13px; opacity: .8; }
.result-body h4 { margin: 0 0 4px; }
.result-body p  { margin: 0; opacity: .9; }
.exercise-result-card { }
.exercise-result--correct { border-left: 4px solid #2e7d32; }
.exercise-result--wrong   { border-left: 4px solid #c62828; }

/* ---- LESSON VIEW ---- */
.lesson-content { border: none; }
.lesson-body-content {
  font-size: 15px;
  line-height: 1.8;
  color: var(--color-text);
}
.lesson-body-content h1, .lesson-body-content h2 { margin-top: 1.5em; }
.lesson-body-content p { margin-bottom: 1em; }
.lesson-body-content ul, .lesson-body-content ol { padding-left: 1.5em; margin-bottom: 1em; }
.lesson-body-content pre {
  background: #1e293b; color: #e2e8f0;
  padding: 16px; border-radius: 8px;
  overflow-x: auto; font-size: 13px;
}
.lesson-body-content blockquote {
  border-left: 4px solid var(--color-primary);
  padding: 8px 16px;
  background: #f0f7ff;
  border-radius: 0 8px 8px 0;
  margin: 1em 0;
}
.lesson-body-content img { max-width: 100%; border-radius: 8px; }
.lesson-body-content .warning-box {
  background: #fff3cd; border: 1px solid #ffc107;
  border-radius: 8px; padding: 12px 16px; margin: 1em 0;
}
.lesson-body-content .info-box {
  background: #e3f2fd; border: 1px solid #90caf9;
  border-radius: 8px; padding: 12px 16px; margin: 1em 0;
}
.lesson-body-content .danger-box {
  background: #ffebee; border: 1px solid #ef9a9a;
  border-radius: 8px; padding: 12px 16px; margin: 1em 0;
}

/* ---- COURSE SHOW (employee) ---- */
.course-accordion .accordion-item { border: 1px solid var(--color-border); border-radius: var(--radius) !important; overflow: hidden; }
.course-accordion .accordion-button { font-size: 14px; font-weight: 600; background: #f8fafc; }
.course-accordion .accordion-button:not(.collapsed) { background: #eef2ff; color: var(--color-primary); box-shadow: none; }
.module-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--color-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}

.lesson-list { list-style: none; padding: 0; margin: 0; }
.lesson-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  transition: background .15s;
}
.lesson-item:last-child { border-bottom: none; }
.lesson-item:hover { background: #f8fafc; }
.lesson-done .lesson-title { color: var(--color-muted); }
.lesson-icon { flex-shrink: 0; font-size: 18px; }
.lesson-title { font-size: 14px; font-weight: 500; }
.lesson-action { flex-shrink: 0; }

/* ---- CIRCULAR PROGRESS ---- */
.course-progress-ring { width: 70px; flex-shrink: 0; }
.circular-chart { width: 70px; height: 70px; }
.circle-bg { fill: none; stroke: #e2e8f0; stroke-width: 3.8; }
.circle {
  fill: none;
  stroke: var(--color-primary);
  stroke-width: 3.8;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  transition: stroke-dasharray .6s;
}
.percentage { fill: var(--color-text); font-size: 8px; font-weight: 700; text-anchor: middle; }

/* ---- PREREQ LIST ---- */
.prereq-list { border: 1px solid var(--color-border); border-radius: 8px; padding: 12px; }
.prereq-list .form-check + .form-check { margin-top: 8px; border-top: 1px solid #f0f0f0; padding-top: 8px; }

/* ---- HELP LIST ---- */
.help-list { list-style: none; padding: 0; margin: 0; }
.help-list li { padding: 6px 0; font-size: 13px; border-bottom: 1px solid #f0f0f0; }
.help-list li:last-child { border-bottom: none; }

/* ---- NOTIFICATIONS ---- */
.notif-list { list-style: none; padding: 0; margin: 0; }
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--color-border);
  transition: background .15s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: #f8fafc; }
.notif-unread { background: #eff6ff; }
.notif-icon { font-size: 20px; color: var(--color-primary); flex-shrink: 0; margin-top: 2px; }
.notif-body { flex: 1; font-size: 14px; }
.notif-body strong { font-size: 14px; }
.notif-body p { color: var(--color-muted); font-size: 13px; margin: 2px 0 4px; }
.notif-time { flex-shrink: 0; }

/* ---- AUTH LAYOUT ---- */
.auth-body { background: linear-gradient(135deg, #0d1b2a 0%, #1565c0 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-wrapper { width: 100%; max-width: 480px; }
.auth-card { background: #fff; border-radius: 16px; padding: 40px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.auth-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; }
.auth-logo i { font-size: 28px; color: var(--color-primary); }
.auth-logo span { font-size: 22px; font-weight: 800; color: var(--color-sidebar); }
.auth-title { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
.auth-subtitle { color: var(--color-muted); margin: 0 0 24px; font-size: 14px; }
.auth-footer { text-align: center; color: rgba(255,255,255,.5); font-size: 12px; margin-top: 20px; }
.form-link { color: var(--color-primary); text-decoration: none; font-weight: 500; }
.form-link:hover { text-decoration: underline; }

/* ---- ALERTS ---- */
.alert { border-radius: var(--radius-sm); font-size: 14px; }
.alert-dismissible .btn-close { padding: 0.6rem; }

/* ---- BADGES ---- */
.badge { font-weight: 600; letter-spacing: .2px; }
.bg-success-subtle { background-color: #d1fae5 !important; }
.bg-warning-subtle { background-color: #fef3c7 !important; }
.bg-danger-subtle  { background-color: #fee2e2 !important; }
.bg-info-subtle    { background-color: #dbeafe !important; }
.bg-primary-subtle { background-color: #eff6ff !important; }
.text-success { color: var(--color-success) !important; }
.text-warning { color: var(--color-warning) !important; }
.text-danger  { color: var(--color-danger)  !important; }
.text-info    { color: var(--color-info)    !important; }
.text-primary { color: var(--color-primary) !important; }

/* ---- OPTION ROWS (exercise builder) ---- */
.option-row .input-group { align-items: center; }
.option-row .input-group-text { background: #f8fafc; }

/* ---- LESSON EDITOR ---- */
.lesson-editor { font-family: 'Courier New', monospace; font-size: 13px; }

/* ---- RESPONSIVE ---- */
@media (max-width: 1199.98px) {
  .sidebar { transform: translateX(calc(-1 * var(--sidebar-width))); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .main-wrapper { margin-left: 0; }
  .btn-menu { display: flex; }
}

@media (max-width: 767.98px) {
  .page-content { padding: 16px; }
  .stat-card { padding: 16px; }
  .stat-value { font-size: 22px; }
  .auth-card { padding: 24px; }
}
