/* ============================================================
   Collège Simone Veil — Suivi des professeurs
   Palette : encre (marine profond) + bronze académique
   Typographie : Quicksand (imposée)
   ============================================================ */

:root {
  --ink-900: #1c2a42;
  --ink-800: #24344f;
  --ink-700: #33465f;
  --ink-050: #eef1f6;

  --paper: #f6f5f1;
  --surface: #ffffff;
  --border: #e3ded2;

  --bronze: #a97e42;
  --bronze-dark: #8a6633;
  --bronze-light: #f1e6d3;

  --text-main: #21252b;
  --text-muted: #62697a;

  --success: #3f7d58;
  --success-bg: #e7f1ea;
  --warning: #b9862f;
  --warning-bg: #f7ecd8;
  --danger: #ac4b46;
  --danger-bg: #f6e6e4;

  --radius-s: 4px;
  --radius-m: 8px;
  --shadow-1: 0 1px 2px rgba(28, 42, 66, 0.06);

  --sidebar-w: 248px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--text-main);
  font-family: 'Quicksand', 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

h1, h2, h3, h4 { font-weight: 700; margin: 0 0 0.5em; color: var(--ink-900); }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 0.75em; }
a { color: var(--ink-800); }

/* ---------------- Layout général ---------------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--ink-900);
  color: #dfe4ee;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar .brand {
  padding: 22px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar .brand strong {
  display: block;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
}
.sidebar .brand span {
  display: block;
  font-size: 0.78rem;
  color: #9aa6bd;
  margin-top: 2px;
}

.sidebar nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
}
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-s);
  color: #c7cfdf;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  margin-bottom: 2px;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar nav a.active { background: var(--bronze); color: #fff; }
.sidebar nav a svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar .sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 0.8rem;
  color: #8b96ad;
}
.sidebar .sidebar-footer form { margin: 0; }
.sidebar .sidebar-footer button {
  background: none;
  border: none;
  color: #dfe4ee;
  font-family: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar .sidebar-footer button:hover { color: #fff; }

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar .user-chip {
  font-size: 0.88rem;
  color: var(--text-muted);
}
.topbar .user-chip strong { color: var(--text-main); }

.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  width: 38px; height: 38px;
  align-items: center; justify-content: center;
  cursor: pointer;
}

.content {
  padding: 24px 28px 60px;
}

/* ---------------- Cartes / KPI ---------------- */
.grid-kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--ink-800);
  border-radius: var(--radius-m);
  padding: 16px 18px;
}
.kpi.accent-bronze { border-left-color: var(--bronze); }
.kpi.accent-success { border-left-color: var(--success); }
.kpi.accent-warning { border-left-color: var(--warning); }
.kpi .kpi-value {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--ink-900);
  line-height: 1.2;
}
.kpi .kpi-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  margin-bottom: 24px;
}
.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.panel-header h2 { margin: 0; }
.panel-body { padding: 20px; }

/* ---------------- Tableaux ---------------- */
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
table.data th, table.data td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
table.data th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.82rem;
}
table.data tbody tr:hover { background: var(--ink-050); }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------- Badges de statut ---------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge.done { background: var(--success-bg); color: var(--success); }
.badge.partial { background: var(--warning-bg); color: var(--warning); }
.badge.none { background: var(--danger-bg); color: var(--danger); }
.badge.status-actif { background: var(--success-bg); color: var(--success); }
.badge.status-inactif { background: var(--ink-050); color: var(--text-muted); }

/* ---------------- Boutons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-s);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  line-height: 1;
}
.btn:hover { border-color: var(--ink-700); }
.btn.primary { background: var(--ink-900); border-color: var(--ink-900); color: #fff; }
.btn.primary:hover { background: var(--ink-800); }
.btn.bronze { background: var(--bronze); border-color: var(--bronze); color: #fff; }
.btn.bronze:hover { background: var(--bronze-dark); }
.btn.danger { color: var(--danger); border-color: var(--danger); background: var(--danger-bg); }
.btn.small { padding: 6px 11px; font-size: 0.8rem; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }

/* ---------------- Formulaires ---------------- */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-800);
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  font-family: inherit;
  font-size: 0.92rem;
  background: var(--surface);
  color: var(--text-main);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--bronze);
  outline-offset: 1px;
  border-color: var(--bronze);
}
.field .hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }

/* ---------------- Alertes / notifications ---------------- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-s);
  font-size: 0.88rem;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert.success { background: var(--success-bg); color: var(--success); border-color: #cfe4d6; }
.alert.error { background: var(--danger-bg); color: var(--danger); border-color: #e6cac7; }
.alert.info { background: var(--ink-050); color: var(--ink-800); border-color: #d9dfeb; }

.notif-list { display: flex; flex-direction: column; gap: 8px; }
.notif-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-s);
  border: 1px solid var(--border);
  font-size: 0.86rem;
}
.notif-item .who { font-weight: 600; }

/* ---------------- Login ---------------- */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--ink-900), var(--ink-700));
  padding: 20px;
}
.login-card {
  background: var(--surface);
  border-radius: var(--radius-m);
  padding: 36px 34px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 12px 32px rgba(15, 22, 38, 0.28);
}
.login-card .crest {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--bronze);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  margin-bottom: 16px;
}
.login-card h1 { font-size: 1.25rem; margin-bottom: 4px; }
.login-card .subtitle { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 24px; }

/* ---------------- Fiche professeur ---------------- */
.teacher-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}
.teacher-head .meta { color: var(--text-muted); font-size: 0.9rem; }
.avg-callout {
  background: var(--bronze-light);
  border: 1px solid #e6d3b0;
  border-radius: var(--radius-m);
  padding: 16px 20px;
  text-align: center;
  min-width: 160px;
}
.avg-callout .value { font-size: 1.8rem; font-weight: 700; color: var(--bronze-dark); }
.avg-callout .label { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

.history-block { margin-bottom: 18px; }
.history-block h3 { margin-bottom: 8px; }

/* ---------------- Filtres ---------------- */
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { margin-bottom: 0; min-width: 160px; }

/* ---------------- Modales simples ---------------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(20, 27, 41, 0.55);
  display: none;
  align-items: center; justify-content: center;
  padding: 20px;
  z-index: 50;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-m);
  width: 100%; max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
}
.modal-close {
  float: right;
  background: none; border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* ---------------- Utilitaires ---------------- */
.text-muted { color: var(--text-muted); }
.mt-0 { margin-top: 0; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tag-list { display: flex; gap: 6px; flex-wrap: wrap; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }

/* ---------------- Responsive ---------------- */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 40;
    box-shadow: 4px 0 24px rgba(0,0,0,0.2);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: flex; }
  .content { padding: 18px; }
  .topbar { padding: 14px 18px; }
  .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  table.data { font-size: 0.85rem; }
  table.data th, table.data td { padding: 8px 10px; }
}

/* Respect des préférences de réduction de mouvement */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
