/* ═══════════════════════════════════════════
   Back-office — ENTREPRISE ADHEPEAU
   Charte : couleurs définies dans client.config.json
   ═══════════════════════════════════════════ */

:root {
  --primaire: #131842;
  --secondaire: #D4A843;
  --fond: #F5F0E8;
  --fond-clair: #FDFBF7;
  --texte: #1A241E;
  --texte-clair: #4A5D50;
  --surface: #FFFFFF;
  --bordure: #E0D8CC;
  --danger: #C0392B;
  --succes: #27AE60;
  --info: #2980B9;
  --rayon: 8px;
  --ombre: 0 2px 8px rgba(13,71,34,.08);
  --police-titre: 'Playfair Display', Georgia, serif;
  --police-corps: 'Plus Jakarta Sans', 'Inter', Arial, sans-serif;
}

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

body {
  font-family: var(--police-corps);
  background: var(--fond);
  color: var(--texte);
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--primaire); text-decoration: none; }
a:hover { color: var(--secondaire); }

/* ─── Login ─── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primaire) 0%, #0a3519 100%);
}

.login-card {
  background: var(--surface);
  padding: 3rem 2.5rem;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.15);
  width: 100%;
  max-width: 420px;
}

.login-card h1 {
  font-family: var(--police-titre);
  color: var(--primaire);
  font-size: 1.5rem;
  margin-bottom: .5rem;
  text-align: center;
}

.login-card .sous-titre {
  text-align: center;
  color: var(--texte-clair);
  margin-bottom: 2rem;
  font-size: .9rem;
}

/* ─── Layout admin ─── */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: var(--primaire);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
  text-align: center;
}

.sidebar-logo h2 {
  font-family: var(--police-titre);
  font-size: 1.1rem;
  color: var(--secondaire);
}

.sidebar-logo small {
  font-size: .75rem;
  opacity: .7;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
  list-style: none;
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .85rem 1.5rem;
  color: rgba(255,255,255,.8);
  font-size: .9rem;
  transition: background .2s, color .2s;
}

.sidebar-nav li a:hover,
.sidebar-nav li a.actif {
  background: rgba(255,255,255,.1);
  color: var(--secondaire);
}

.sidebar-nav li a .icone {
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: .8rem;
  opacity: .6;
}

.main-content {
  flex: 1;
  margin-left: 260px;
  padding: 2rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.topbar h1 {
  font-family: var(--police-titre);
  font-size: 1.4rem;
  color: var(--primaire);
}

.topbar-actions {
  display: flex;
  gap: .75rem;
  align-items: center;
}

/* ─── Cards stats ─── */
.stats-grille {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--rayon);
  padding: 1.5rem;
  box-shadow: var(--ombre);
  border-left: 4px solid var(--secondaire);
}

.stat-card .valeur {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primaire);
}

.stat-card .label {
  font-size: .85rem;
  color: var(--texte-clair);
  margin-top: .25rem;
}

/* ─── Tableau ─── */
.table-wrapper {
  background: var(--surface);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  overflow-x: auto;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--bordure);
}

.table-header h2 {
  font-size: 1.1rem;
  color: var(--primaire);
}

table {
  width: 100%;
  border-collapse: collapse;
}

table th {
  text-align: left;
  padding: .85rem 1rem;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--texte-clair);
  border-bottom: 2px solid var(--bordure);
  white-space: nowrap;
}

table td {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--bordure);
  font-size: .9rem;
  vertical-align: middle;
}

table tr:last-child td {
  border-bottom: none;
}

table tr:hover {
  background: rgba(212,175,55,.04);
}

/* ─── Boutons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .6rem 1.2rem;
  border: none;
  border-radius: var(--rayon);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .2s, transform .1s;
  font-family: var(--police-corps);
}

.btn:hover { opacity: .9; }
.btn:active { transform: scale(.97); }

.btn-primaire {
  background: var(--primaire);
  color: #fff;
}

.btn-secondaire {
  background: transparent;
  color: var(--primaire);
  border: 1.5px solid var(--secondaire);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-petit {
  padding: .35rem .75rem;
  font-size: .8rem;
}

/* ─── Badges statut ─── */
.badge {
  display: inline-block;
  padding: .2rem .65rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-nouveau { background: #E8F5E9; color: #2E7D32; }
.badge-en-cours { background: #FFF3E0; color: #E65100; }
.badge-traite { background: #E3F2FD; color: #1565C0; }
.badge-archive { background: #F5F5F5; color: #757575; }

/* ─── Formulaires ─── */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: .4rem;
  color: var(--texte);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: .7rem .9rem;
  border: 1.5px solid var(--bordure);
  border-radius: var(--rayon);
  font-size: .9rem;
  font-family: var(--police-corps);
  transition: border-color .2s;
  background: var(--fond-clair);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--secondaire);
}

.form-group textarea {
  min-height: 120px;
  resize: vertical;
}

/* ─── Modal ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: var(--surface);
  border-radius: 12px;
  padding: 2rem;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0,0,0,.2);
}

.modal h2 {
  font-family: var(--police-titre);
  color: var(--primaire);
  margin-bottom: 1.5rem;
}

.modal-actions {
  display: flex;
  gap: .75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* ─── Toast ─── */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: .85rem 1.5rem;
  border-radius: var(--rayon);
  color: #fff;
  font-size: .9rem;
  font-weight: 500;
  z-index: 2000;
  animation: toastIn .3s ease;
}

.toast-succes { background: var(--succes); }
.toast-erreur { background: var(--danger); }

@keyframes toastIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ─── Empty state ─── */
.etat-vide {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--texte-clair);
}

.etat-vide .icone {
  font-size: 3rem;
  margin-bottom: 1rem;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .sidebar { width: 100%; height: auto; position: relative; }
  .main-content { margin-left: 0; }
  .admin-layout { flex-direction: column; }
  .stats-grille { grid-template-columns: 1fr 1fr; }
}
