/* ============================================================
   AIS Bachelor — Feuille de style principale
   ============================================================ */

:root {
  --primary:    #1a56db;
  --primary-d:  #1347c2;
  --accent:     #0ea5e9;
  --success:    #16a34a;
  --warning:    #d97706;
  --danger:     #dc2626;
  --bg:         #f8fafc;
  --surface:    #ffffff;
  --border:     #e2e8f0;
  --text:       #1e293b;
  --text-muted: #64748b;
  --radius:     10px;
  --shadow:     0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --nav-h:      64px;
}

/* Reset & base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Navbar ---- */
.navbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 1.5rem;
  padding: 0 2rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
}
.navbar-brand { display: flex; align-items: center; gap: .75rem; min-width: 200px; }
.brand-icon { font-size: 1.6rem; }
.brand-title { display: block; font-weight: 700; font-size: .95rem; color: var(--primary); line-height: 1.2; }
.brand-sub   { display: block; font-size: .72rem; color: var(--text-muted); }
.navbar-menu { display: flex; align-items: center; gap: .25rem; flex: 1; }
.nav-link {
  padding: .45rem .85rem; border-radius: 6px;
  font-size: .82rem; font-weight: 500; color: var(--text-muted);
  white-space: nowrap; transition: background .15s, color .15s;
}
.nav-link:hover, .nav-link.active { background: #eff6ff; color: var(--primary); text-decoration: none; }
.navbar-user { display: flex; align-items: center; gap: .75rem; margin-left: auto; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700;
}
.user-name { display: block; font-size: .82rem; font-weight: 600; line-height: 1.2; }
.user-role  { display: block; font-size: .7rem; color: var(--text-muted); text-transform: capitalize; }
.btn-logout {
  background: none; border: 1px solid var(--border);
  padding: .35rem .6rem; border-radius: 6px;
  font-size: 1rem; cursor: pointer; color: var(--text-muted);
  transition: background .15s, color .15s;
}
.btn-logout:hover { background: #fef2f2; color: var(--danger); border-color: var(--danger); }

/* ---- Layout ---- */
.main-content { padding: 2rem; max-width: 1400px; margin: 0 auto; }
.page-header { margin-bottom: 2rem; }
.page-title { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.page-sub   { color: var(--text-muted); font-size: .9rem; margin-top: .25rem; }

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.card-title { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; }

/* ---- Stats grid ---- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
}
.stat-label { font-size: .78rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--primary); line-height: 1.2; margin: .25rem 0; }
.stat-sub   { font-size: .78rem; color: var(--text-muted); }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
thead th {
  background: #f1f5f9; color: var(--text-muted);
  font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  padding: .75rem 1rem; text-align: left; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td { padding: .75rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }

/* ---- Badges ---- */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .6rem; border-radius: 20px;
  font-size: .72rem; font-weight: 600;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-grey    { background: #f1f5f9; color: #475569; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1.1rem; border-radius: 7px;
  font-size: .83rem; font-weight: 500; cursor: pointer;
  border: none; transition: background .15s, box-shadow .15s;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); }
.btn-secondary { background: #f1f5f9; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #e2e8f0; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-sm { padding: .3rem .75rem; font-size: .78rem; }

/* ---- Forms ---- */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: .83rem; font-weight: 500; margin-bottom: .4rem; }
.form-control {
  width: 100%; padding: .5rem .85rem;
  border: 1px solid var(--border); border-radius: 7px;
  font-size: .88rem; background: var(--surface); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,86,219,.15); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-actions { display: flex; gap: .75rem; margin-top: 1.5rem; }

/* ---- Alerts ---- */
.alert {
  padding: .9rem 1.25rem; border-radius: var(--radius);
  font-size: .87rem; margin-bottom: 1rem;
  display: flex; align-items: center; gap: .6rem;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-danger  { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

/* ---- Progress ---- */
.progress-bar-wrap { background: #e2e8f0; border-radius: 99px; height: 8px; overflow: hidden; }
.progress-bar {
  height: 100%; background: var(--primary); border-radius: 99px;
  transition: width .4s ease;
}

/* ---- Login page ---- */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #1a56db 50%, #0ea5e9 100%);
}
.login-card {
  background: var(--surface); border-radius: 16px; padding: 2.5rem;
  width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo-icon { font-size: 3rem; }
.login-logo-title { font-size: 1.3rem; font-weight: 700; color: var(--primary); margin-top: .5rem; }
.login-logo-sub { font-size: .8rem; color: var(--text-muted); }

/* ---- Dispo grid ---- */
.dispo-grid { display: grid; gap: .3rem; }
.dispo-week-header {
  background: #f1f5f9;
  padding: .6rem 1rem;
  font-weight: 600; font-size: .8rem;
  border-radius: 6px;
  color: var(--primary);
  margin-top: .75rem;
}
.dispo-day-row {
  display: grid; grid-template-columns: 160px 1fr 1fr 1fr 1fr;
  align-items: center; gap: .5rem;
  padding: .4rem .75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.dispo-day-label { font-size: .82rem; font-weight: 500; }
.dispo-radio-group { display: flex; gap: .5rem; }
.dispo-radio-group label {
  display: flex; align-items: center; gap: .3rem;
  font-size: .78rem; cursor: pointer;
  padding: .2rem .6rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  transition: background .1s;
}
.dispo-radio-group input[type=radio] { display: none; }
.dispo-radio-group input[type=radio]:checked + span { font-weight: 700; }
.dispo-radio-group label:has(input:checked) { background: #dbeafe; border-color: var(--primary); color: var(--primary); }
.dispo-none { font-size: .75rem; color: var(--text-muted); font-style: italic; }

/* ---- Competences matrix ---- */
.matrix-wrap { overflow-x: auto; }
.matrix-table th, .matrix-table td { text-align: center; min-width: 50px; }
.matrix-table td:first-child { text-align: left; min-width: 260px; max-width: 300px; font-size: .8rem; }
.matrix-check { font-size: 1rem; color: var(--success); }
.matrix-section-row td { background: #eff6ff; font-weight: 600; font-size: .78rem; color: var(--primary); }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .navbar-menu { display: none; }
  .stats-grid  { grid-template-columns: 1fr 1fr; }
  .form-row    { grid-template-columns: 1fr; }
  .dispo-day-row { grid-template-columns: 120px 1fr 1fr 1fr 1fr; }
}

/* ---- Footer ---- */
.footer {
  border-top: 1px solid var(--border);
  padding: 1rem 2rem;
  font-size: .75rem; color: var(--text-muted);
  display: flex; justify-content: center;
}
.footer-content { display: flex; gap: 2rem; }

/* ---- Utility ---- */
.text-muted  { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.w-100 { width: 100%; }
