/* style.css — Styles globaux SecuPaie */

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

/* ─── Variables ─────────────────────────────────────────────────────────── */
:root {
  --primaire:  #1a2e4a;
  --accent:    #2563eb;
  --succes:    #16a34a;
  --danger:    #dc2626;
  --fond:      #f8fafc;
  --blanc:     #ffffff;
  --bordure:   #e2e8f0;
  --texte:     #1e293b;
  --texte-sec: #64748b;
  --radius:    12px;
  --radius-sm: 6px;
  --ombre:     0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --ombre-md:  0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.04);
}

/* ─── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--fond);
  color: var(--texte);
  line-height: 1.5;
  min-height: 100vh;
}

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

/* ─── Navigation fixe ───────────────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: var(--primaire);
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  height: 60px;
  display: flex;
  align-items: center;
}

.nav__inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -.01em;
  flex-shrink: 0;
}

.nav__brand img, .nav__brand svg {
  width: 28px;
  height: 28px;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: .25rem;
  list-style: none;
  flex: 1;
}

.nav__link {
  color: rgba(255,255,255,.75);
  padding: .4rem .85rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 500;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.nav__link:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.nav__link--active { background: rgba(255,255,255,.18); color: #fff; }

/* Bouton menu mobile */
.nav__toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: .4rem;
  margin-left: auto;
}
.nav__toggle svg { display: block; }

/* ─── Contenu principal ─────────────────────────────────────────────────── */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 80px 1.5rem 2rem;
}

/* ─── En-tête de page ───────────────────────────────────────────────────── */
.page-header {
  margin-bottom: 1.75rem;
}
.page-header__title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primaire);
  letter-spacing: -.02em;
}
.page-header__subtitle {
  color: var(--texte-sec);
  margin-top: .25rem;
  font-size: .95rem;
}

/* ─── Cartes ────────────────────────────────────────────────────────────── */
.card {
  background: var(--blanc);
  border: 1px solid var(--bordure);
  border-radius: var(--radius);
  box-shadow: var(--ombre);
  padding: 1.5rem;
}
.card + .card { margin-top: 1rem; }

.card__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primaire);
  margin-bottom: 1rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--bordure);
}

/* ─── Barre d'outils / actions ──────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.toolbar--end { justify-content: flex-end; }
.toolbar--between { justify-content: space-between; }

/* ─── Sélecteur mois/année ──────────────────────────────────────────────── */
.mois-selector {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.mois-selector label {
  font-size: .875rem;
  font-weight: 500;
  color: var(--texte-sec);
}

/* ─── Formulaire ────────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 1rem;
}
.form-label {
  display: block;
  font-size: .875rem;
  font-weight: 500;
  color: var(--texte);
  margin-bottom: .375rem;
}
.form-input,
.form-select {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid var(--bordure);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: .9rem;
  color: var(--texte);
  background: var(--blanc);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form-input:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-input--erreur {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px rgba(220,38,38,.12) !important;
}
.form-input--sm,
.form-select--sm {
  padding: .35rem .6rem;
  font-size: .85rem;
}
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

/* ─── Tableaux ──────────────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--bordure);
}
table.sp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.sp-table th {
  background: #f1f5f9;
  color: var(--texte-sec);
  font-weight: 600;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: .65rem .9rem;
  text-align: left;
  border-bottom: 1px solid var(--bordure);
  white-space: nowrap;
}
.sp-table td {
  padding: .6rem .9rem;
  border-bottom: 1px solid var(--bordure);
  vertical-align: middle;
}
.sp-table tbody tr:last-child td { border-bottom: none; }
.sp-table tbody tr:nth-child(even) { background: #fafbfd; }
.sp-table tbody tr:hover { background: #f0f6ff; }
.sp-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.sp-table tfoot td {
  font-weight: 700;
  border-top: 2px solid var(--bordure);
  background: #f8fafc;
}

/* ─── Badges ────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .55rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
}
.badge--succes  { background: #dcfce7; color: #15803d; }
.badge--danger  { background: #fee2e2; color: #b91c1c; }
.badge--info    { background: #dbeafe; color: #1d4ed8; }
.badge--warn    { background: #fef9c3; color: #a16207; }
.badge--dim     { background: #f3e8ff; color: #7e22ce; }
.badge--ferie   { background: #ffedd5; color: #c2410c; }

/* ─── Toast notification ────────────────────────────────────────────────── */
.sp-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(6rem);
  padding: .7rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 500;
  color: #fff;
  box-shadow: var(--ombre-md);
  transition: transform .25s ease, opacity .25s ease;
  opacity: 0;
  z-index: 9999;
  white-space: nowrap;
  pointer-events: none;
}
.sp-toast--visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.sp-toast--succes  { background: var(--succes); }
.sp-toast--erreur  { background: var(--danger); }
.sp-toast--info    { background: var(--accent); }

/* ─── État vide ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--texte-sec);
}
.empty-state__icon {
  font-size: 3rem;
  margin-bottom: .75rem;
  opacity: .4;
}
.empty-state__text { font-size: 1rem; }

/* ─── Divider ───────────────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--bordure);
  margin: 1.5rem 0;
}

/* ─── Récap chiffres ────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: .75rem;
}
.stat-card {
  background: var(--fond);
  border: 1px solid var(--bordure);
  border-radius: var(--radius-sm);
  padding: .85rem 1rem;
  text-align: center;
}
.stat-card__value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primaire);
  line-height: 1.1;
}
.stat-card__label {
  font-size: .75rem;
  color: var(--texte-sec);
  margin-top: .25rem;
  font-weight: 500;
}

/* ─── Couleurs jours spéciaux (saisie) ─────────────────────────────────── */
.ligne-dimanche td { background: #faf5ff !important; }
.ligne-ferie td    { background: #fff7ed !important; }

/* ─── Responsive mobile ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav__links {
    display: none;
    position: fixed;
    top: 60px; left: 0; right: 0;
    background: var(--primaire);
    flex-direction: column;
    padding: .5rem 0 1rem;
    gap: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,.2);
  }
  .nav__links.nav__links--open { display: flex; }
  .nav__link { padding: .75rem 1.5rem; border-radius: 0; width: 100%; }
  .nav__toggle { display: block; }

  .main { padding: 72px 1rem 2rem; }
  .page-header__title { font-size: 1.3rem; }
  .toolbar--between { flex-direction: column; align-items: flex-start; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  .sp-table th, .sp-table td { padding: .5rem .6rem; font-size: .8rem; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
