@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #f0f4f1;
  --panel: #ffffff;
  --text: #0f1f14;
  --muted: #5a7065;
  --line: #d6e4da;
  --primary: #007F4D;
  --primary-dark: #005c37;
  --primary-light: #e6f5ee;
  --accent: #00c27a;
  --soft: #eaf5ef;
  --success: #007F4D;
  --warning: #9a5b00;
  --danger: #b42318;
  --brand-dark: #08130d;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.10), 0 4px 8px rgba(0,0,0,.04);
  --radius: 10px;
  --radius-lg: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }

/* ─── HEADER ─── */
header {
  background: var(--brand-dark);
  border-bottom: 1px solid #1a3d28;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1200px;
  margin: 0 auto;
  height: 64px;
}

.brand { display: flex; align-items: center; gap: 14px; }

.logo-frame {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  padding: 6px 10px;
}

.brand-logo { width: 160px; height: auto; display: block; }

.brand h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: .01em;
}

.brand p {
  margin: 1px 0 0;
  color: rgba(255,255,255,.5);
  font-size: 12px;
}

.userbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.userbar-email {
  color: rgba(255,255,255,.7);
  font-size: 13px;
  font-weight: 500;
}

/* ─── PILLS / TAGS ─── */
.role-pill, .tag {
  display: inline-flex;
  align-items: center;
  background: rgba(0,194,122,.15);
  color: #3de8a0;
  border: 1px solid rgba(0,194,122,.25);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* Deconnexion button in header */
header .ghost {
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.85);
  border: 1px solid rgba(255,255,255,.15);
  font-size: 13px;
  padding: 7px 14px;
}

header .ghost:hover {
  background: rgba(255,255,255,.15);
  color: #ffffff;
}

/* ─── LAYOUT ─── */
.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  max-width: 1200px;
  margin: 0 auto;
  min-height: calc(100vh - 64px);
}

aside {
  padding: 20px 12px;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

main { padding: 28px 26px; }

/* ─── SIDEBAR NAV ─── */
.nav-button {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 10px 13px;
  border-radius: var(--radius);
  cursor: pointer;
  margin-bottom: 3px;
  font-weight: 500;
  font-size: 14px;
  transition: background .15s, color .15s;
}

.nav-button:hover {
  background: var(--soft);
  color: var(--primary-dark);
}

.nav-button.active {
  background: var(--primary-light);
  border-color: rgba(0,127,77,.2);
  color: var(--primary-dark);
  font-weight: 700;
}

/* ─── LOGIN PAGE ─── */
.login {
  max-width: 460px;
  margin: 8vh auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-md);
}

.login h2, .panel h2 { margin-top: 0; font-weight: 800; }

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 16px 0;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 4px;
}

.auth-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: background .15s, color .15s;
}

.auth-tab.active {
  background: var(--panel);
  color: var(--primary-dark);
  box-shadow: var(--shadow-sm);
}

/* ─── FORM FIELDS ─── */
.field { display: grid; gap: 6px; margin: 14px 0; }

.field span {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

input, select, textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 13px;
  background: #ffffff;
  color: var(--text);
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,127,77,.1);
}

textarea { min-height: 96px; resize: vertical; }

/* ─── BUTTONS ─── */
.primary, .secondary, .ghost {
  border: 0;
  border-radius: var(--radius);
  padding: 10px 18px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  transition: background .15s, transform .1s, box-shadow .15s;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(0,127,77,.25);
}

.primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(0,127,77,.3);
  transform: translateY(-1px);
}

.secondary {
  background: var(--soft);
  color: var(--primary-dark);
  border: 1px solid rgba(0,127,77,.15);
}

.secondary:hover { background: #d4eddf; }

.ghost {
  background: transparent;
  color: var(--muted);
  border: 1.5px solid var(--line);
}

.ghost:hover { background: var(--bg); color: var(--text); }

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

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

/* ─── PANELS & CARDS ─── */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.panel h2 { font-size: 20px; font-weight: 800; margin: 0 0 4px; }

.card {
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s, border-color .2s;
  display: flex;
  flex-direction: column;
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: rgba(0,127,77,.3);
}

.card h3 {
  margin: 0 0 8px;
  font-size: 19px;
  font-weight: 800;
  color: var(--text);
}

.card p {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 12px;
}

/* ─── MUTED TEXT ─── */
.muted { color: var(--muted); font-size: 14px; }

/* ─── METRICS ─── */
.metric {
  font-size: 32px;
  font-weight: 800;
  margin: 6px 0 0;
  color: var(--primary);
}

/* ─── DIRECTOR DEMO ─── */
.director-demo-board { display: none; margin-bottom: 18px; }
.director-demo-board.show { display: block; }

.director-hero {
  background: linear-gradient(135deg, #08130d, #12345f);
  color: #ffffff;
  border: 0;
  box-shadow: var(--shadow-md);
}

.director-hero .muted { color: #d8e6f5; }

.director-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.director-actions a { text-decoration: none; display: inline-flex; align-items: center; }

.director-mini-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.director-mini-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.director-mini-card strong {
  display: block;
  font-size: 28px;
  font-weight: 800;
  margin-top: 4px;
  color: var(--primary);
}

.director-path { display: grid; gap: 10px; }

.director-path-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

.director-step {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--soft);
  color: var(--primary-dark);
  font-weight: 800;
  font-size: 14px;
}

/* ─── PROGRESS BAR ─── */
.progress {
  height: 8px;
  border-radius: 999px;
  background: #e2ede7;
  overflow: hidden;
  margin: 12px 0;
}

.progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 999px;
}

/* ─── COURSE ACTIONS ─── */
.course-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.course-actions a { text-decoration: none; display: inline-flex; align-items: center; }

/* ─── MODULE / LEARNER ROWS ─── */
.module-row, .learner-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.module-row:first-child, .learner-row:first-child { border-top: 0; }

/* ─── STATUS ─── */
.status-ok   { color: var(--success); font-weight: 700; }
.status-wait { color: var(--warning); font-weight: 700; }
.status-risk { color: var(--danger);  font-weight: 700; }

/* ─── MESSAGES ─── */
.hidden { display: none; }

.form-error {
  color: var(--danger);
  font-weight: 600;
  font-size: 13px;
  margin-top: 10px;
  background: #fff5f5;
  border: 1px solid #fcd0ce;
  border-radius: 8px;
  padding: 9px 13px;
}

.form-success {
  color: var(--success);
  font-weight: 600;
  font-size: 13px;
  margin-top: 10px;
  background: var(--soft);
  border: 1px solid rgba(0,127,77,.2);
  border-radius: 8px;
  padding: 9px 13px;
}

.form-success a { color: var(--success); word-break: break-all; }

/* ─── DEMO DIRECTOR CARD ─── */
.demo-director-card {
  border: 1px solid rgba(0,127,77,.2);
  background: var(--soft);
  border-radius: var(--radius);
  padding: 18px;
  margin: 16px 0;
}

.demo-director-card h3 { margin: 0 0 8px; font-size: 17px; font-weight: 700; }

.demo-director-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0;
}

.demo-director-grid span { display: block; color: var(--muted); font-size: 12px; }
.demo-director-grid strong { word-break: break-all; font-size: 14px; }

.demo-director-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* ─── RESPONSIVE ─── */
@media (max-width: 900px) {
  .layout, .grid, .grid.two {
    grid-template-columns: 1fr;
  }

  aside {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  main { padding: 18px; }

  .director-mini-grid { grid-template-columns: 1fr 1fr; }
  .demo-director-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .director-mini-grid, .director-path-item {
    grid-template-columns: 1fr;
  }
}
