/* PrintBuilder – Styles globaux */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; color: #1e293b; }

/* ── Boutons ─────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border: none; border-radius: 8px; font-size: .85rem; font-weight: 600; cursor: pointer; text-decoration: none; transition: all .15s; }
.btn-primary   { background: #4f46e5; color: #fff; }
.btn-primary:hover { background: #4338ca; }
.btn-secondary { background: #f1f5f9; color: #475569; }
.btn-secondary:hover { background: #e2e8f0; }
.btn-danger    { background: #fee2e2; color: #dc2626; }
.btn-danger:hover { background: #fecaca; }
.btn-sm { padding: 5px 10px; font-size: .78rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Admin layout ────────────────────────────────────────── */
.admin-layout { display: flex; min-height: 100vh; background: #f8fafc; }

.sidebar {
  width: 220px; flex-shrink: 0;
  background: #1e293b; color: #cbd5e1;
  display: flex; flex-direction: column;
  padding: 0; position: fixed; left: 0; top: 0; bottom: 0; z-index: 100;
}
.sidebar-brand {
  padding: 20px 18px; font-size: 1rem; font-weight: 700;
  color: #a6e3a1; border-bottom: 1px solid #334155;
}
.sidebar nav { flex: 1; padding: 12px 0; }
.nav-link {
  display: block; padding: 10px 18px; color: #94a3b8;
  text-decoration: none; font-size: .88rem; transition: all .15s;
  border-left: 3px solid transparent;
}
.nav-link:hover { background: #334155; color: #e2e8f0; }
.nav-link.active { background: #334155; color: #fff; border-left-color: #4f46e5; }
.sidebar-footer { padding: 16px 18px; border-top: 1px solid #334155; font-size: .78rem; color: #64748b; }
.sidebar-footer a { color: #94a3b8; text-decoration: none; display: block; margin-top: 4px; }
.sidebar-footer a:hover { color: #fff; }

.main-content { margin-left: 220px; flex: 1; padding: 32px; }

/* ── Panneaux ────────────────────────────────────────────── */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.panel-header h2 { font-size: 1.2rem; color: #0f172a; margin: 0; }

/* ── Grille de gabarits ──────────────────────────────────── */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.template-card {
  background: #fff; border-radius: 10px; padding: 16px;
  border: 1.5px solid #e2e8f0; transition: border-color .15s, box-shadow .15s;
}
.template-card:hover { border-color: #a5b4fc; box-shadow: 0 4px 12px rgba(79,70,229,.1); }
.tc-name { font-size: .95rem; font-weight: 700; color: #0f172a; margin-bottom: 4px; }
.tc-desc { font-size: .82rem; color: #64748b; margin-bottom: 8px; }
.tc-meta { font-size: .75rem; color: #94a3b8; margin-bottom: 12px; }
.tc-actions { display: flex; gap: 8px; }

/* ── Tableaux ────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 10px 14px; background: #f8fafc; text-align: left; font-size: .8rem; color: #64748b; border-bottom: 2px solid #e2e8f0; }
.data-table td { padding: 10px 14px; border-bottom: 1px solid #f1f5f9; font-size: .88rem; }
.data-table tr:hover td { background: #f8fafc; }

/* ── Badges ──────────────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .75rem; font-weight: 600; }
.badge-admin { background: #ede9fe; color: #6d28d9; }
.badge-user  { background: #dbeafe; color: #1d4ed8; }

/* ── Formulaire ──────────────────────────────────────────── */
.form-card { background: #fff; border-radius: 10px; padding: 24px; border: 1.5px solid #e2e8f0; max-width: 560px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: .85rem; font-weight: 600; color: #374151; margin-bottom: 5px; }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: 9px 12px; border: 1.5px solid #e2e8f0;
  border-radius: 8px; font-size: .9rem; color: #1e293b; background: #fff;
}
.form-group input:focus,
.form-group select:focus { outline: none; border-color: #4f46e5; }
.form-group small { display: block; margin-top: 4px; font-size: .78rem; color: #94a3b8; }

/* ── Modal ───────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal.hidden { display: none; }
.modal-box { background: #fff; border-radius: 12px; padding: 28px; width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal-box h3 { margin: 0 0 20px; font-size: 1.1rem; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }

/* ── Utilitaires ─────────────────────────────────────────── */
.hidden  { display: none !important; }
.loading { color: #94a3b8; font-style: italic; font-size: .88rem; }
.empty   { color: #94a3b8; font-size: .88rem; }
.error   { color: #dc2626; font-size: .88rem; }
.status-msg { font-size: .85rem; margin-left: 10px; }
.status-msg.ok  { color: #16a34a; }
.status-msg.err { color: #dc2626; }

/* ── Responsive minimal ──────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { width: 100%; position: static; }
  .main-content { margin-left: 0; padding: 16px; }
}
