/* =====================================================================
   ATOM - Feuille de style
   Design moderne, sobre et professionnel (sans emojis, icones SVG)
   ===================================================================== */

:root {
  --bg:            #f1f5f9;
  --surface:       #ffffff;
  --surface-2:     #f8fafc;
  --border:        #e2e8f0;
  --border-strong: #cbd5e1;

  --text:          #0f172a;
  --text-soft:     #475569;
  --text-muted:    #94a3b8;

  --primary:       #4f46e5;
  --primary-dark:  #4338ca;
  --primary-soft:  #eef2ff;

  --sidebar:       #0f172a;
  --sidebar-soft:  #1e293b;
  --sidebar-text:  #cbd5e1;
  --sidebar-muted: #64748b;

  --success:       #059669;
  --success-soft:  #ecfdf5;
  --warning:       #d97706;
  --warning-soft:  #fffbeb;
  --danger:        #dc2626;
  --danger-soft:   #fef2f2;
  --info:          #0284c7;
  --info-soft:     #f0f9ff;

  --radius:        12px;
  --radius-sm:     8px;
  --shadow:        0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md:     0 4px 16px rgba(15, 23, 42, .08);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

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

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- Mise en page generale ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 256px;
  background: var(--sidebar);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 30;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 22px;
  border-bottom: 1px solid var(--sidebar-soft);
}
.sidebar__logo {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 17px; letter-spacing: .5px;
}
.sidebar__title { font-size: 15px; font-weight: 600; color: #fff; line-height: 1.2; }
.sidebar__subtitle { font-size: 11px; color: var(--sidebar-muted); letter-spacing: .3px; }

.nav { padding: 16px 12px; flex: 1; overflow-y: auto; }
.nav__label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--sidebar-muted); padding: 12px 12px 8px;
}
.nav__item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--sidebar-text); font-weight: 500;
  transition: background .15s, color .15s;
}
.nav__item:hover { background: var(--sidebar-soft); color: #fff; text-decoration: none; }
.nav__item.active { background: var(--primary); color: #fff; }
.nav__item svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar__footer {
  padding: 16px; border-top: 1px solid var(--sidebar-soft);
  font-size: 13px;
}
.sidebar__user { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.sidebar__avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--sidebar-soft); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 600;
}
.sidebar__user-name { color: #fff; font-weight: 500; }
.sidebar__user-role { color: var(--sidebar-muted); font-size: 12px; }

.content { flex: 1; margin-left: 256px; min-width: 0; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 18px 32px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 20;
}
.topbar__title h1 { font-size: 20px; font-weight: 650; }
.topbar__title p { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.main { padding: 28px 32px 56px; }

/* ---------- Cartes ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card__header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.card__title { font-size: 15px; font-weight: 600; }
.card__body { padding: 22px; }
.card__body--flush { padding: 0; }

/* ---------- Statistiques ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 24px; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.stat__head { display: flex; align-items: center; justify-content: space-between; }
.stat__label { font-size: 13px; color: var(--text-soft); font-weight: 500; }
.stat__icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary);
}
.stat__icon svg { width: 20px; height: 20px; }
.stat__value { font-size: 28px; font-weight: 700; margin-top: 12px; letter-spacing: -.02em; }
.stat__hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat--green .stat__icon { background: var(--success-soft); color: var(--success); }
.stat--amber .stat__icon { background: var(--warning-soft); color: var(--warning); }
.stat--blue  .stat__icon { background: var(--info-soft);    color: var(--info); }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted); font-weight: 600;
  padding: 12px 18px; border-bottom: 1px solid var(--border); background: var(--surface-2);
  white-space: nowrap;
}
table.data td {
  padding: 14px 18px; border-bottom: 1px solid var(--border); vertical-align: middle;
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--surface-2); }
.cell-strong { font-weight: 600; color: var(--text); }
.cell-muted { color: var(--text-muted); }
.cell-right { text-align: right; }
.cell-center { text-align: center; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  white-space: nowrap;
}
.badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--green  { background: var(--success-soft); color: var(--success); }
.badge--amber  { background: var(--warning-soft); color: var(--warning); }
.badge--red    { background: var(--danger-soft);  color: var(--danger); }
.badge--blue   { background: var(--info-soft);    color: var(--info); }
.badge--gray   { background: #f1f5f9; color: var(--text-soft); }
.badge--indigo { background: var(--primary-soft); color: var(--primary); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  text-decoration: none; white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-dark); text-decoration: none; }
.btn--light { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn--light:hover { background: var(--surface-2); text-decoration: none; }
.btn--danger { background: var(--surface); color: var(--danger); border-color: #fecaca; }
.btn--danger:hover { background: var(--danger-soft); text-decoration: none; }
.btn--success { background: var(--success); color: #fff; }
.btn--success:hover { background: #047857; text-decoration: none; }
.btn--sm { padding: 6px 12px; font-size: 13px; }
.btn--block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-group { display: inline-flex; gap: 8px; }

/* ---------- Formulaires ---------- */
.form-grid { display: grid; gap: 18px; }
.form-grid--2 { grid-template-columns: 1fr 1fr; }
.form-grid--3 { grid-template-columns: repeat(3, 1fr); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-soft); }
.field .hint { font-size: 12px; color: var(--text-muted); }
.input, .select, textarea.input {
  width: 100%; padding: 10px 12px; font-family: inherit; font-size: 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, textarea.input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .15);
}
.form-actions { display: flex; gap: 12px; margin-top: 4px; }

/* ---------- Barre de progression ---------- */
.progress { height: 8px; border-radius: 999px; background: var(--border); overflow: hidden; min-width: 90px; }
.progress__bar { height: 100%; background: var(--primary); border-radius: 999px; transition: width .3s; }
.progress__bar--full { background: var(--success); }
.progress__bar--low  { background: var(--warning); }

/* ---------- Alertes / Flash ---------- */
.alert {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; border-radius: var(--radius-sm); margin-bottom: 18px;
  font-size: 14px; border: 1px solid;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert--success { background: var(--success-soft); color: #065f46; border-color: #a7f3d0; }
.alert--error   { background: var(--danger-soft);  color: #991b1b; border-color: #fecaca; }
.alert--info    { background: var(--info-soft);     color: #075985; border-color: #bae6fd; }
.alert--warning { background: var(--warning-soft);  color: #92400e; border-color: #fde68a; }

/* ---------- Etat vide ---------- */
.empty { text-align: center; padding: 56px 24px; color: var(--text-muted); }
.empty svg { width: 44px; height: 44px; margin-bottom: 14px; color: var(--border-strong); }
.empty h3 { font-size: 16px; color: var(--text-soft); margin-bottom: 6px; }

/* ---------- Toolbar de page ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.toolbar__filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.section-gap { margin-top: 24px; }

/* ---------- Page de connexion ---------- */
.auth {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 100% 0%, #1e1b4b 0%, #0f172a 55%, #020617 100%);
  padding: 24px;
}
.auth__card {
  width: 100%; max-width: 410px; background: var(--surface);
  border-radius: 16px; box-shadow: 0 24px 60px rgba(2, 6, 23, .5);
  padding: 40px;
}
.auth__brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.auth__logo {
  width: 46px; height: 46px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 20px;
}
.auth__title { font-size: 18px; font-weight: 700; }
.auth__subtitle { font-size: 13px; color: var(--text-muted); }
.auth h2 { font-size: 22px; margin-bottom: 6px; }
.auth__lead { color: var(--text-soft); margin-bottom: 26px; }

/* ---------- Pointage (grille de presence) ---------- */
.pointage-cell { text-align: center; }
.point-toggle {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--surface); cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center; transition: all .12s;
}
.point-toggle:hover { border-color: var(--primary); }
.point-toggle svg { width: 16px; height: 16px; }
.point-toggle.is-present { background: var(--success); border-color: var(--success); color: #fff; }
.point-toggle.is-absent  { background: var(--surface); color: var(--border-strong); }

/* ---------- Divers ---------- */
.muted { color: var(--text-muted); }
.text-right { text-align: right; }
.mono { font-variant-numeric: tabular-nums; }
.print-only { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .form-grid--3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .content { margin-left: 0; }
  .stats, .form-grid--2, .form-grid--3 { grid-template-columns: 1fr; }
  .menu-toggle { display: inline-flex !important; }
}
.menu-toggle { display: none; }

/* ---------- Impression (liste payee) ---------- */
@media print {
  .sidebar, .topbar, .toolbar, .btn, .no-print { display: none !important; }
  .content { margin-left: 0; }
  .main { padding: 0; }
  body { background: #fff; }
  .card { border: none; box-shadow: none; }
  .print-only { display: block; }
  table.data th { background: #f1f5f9 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
