/* ============================================================
   Design system - variables et primitives globales
   ============================================================ */
:root {
  /* Couleurs identité — surchargées par le thème actif (voir includes/themes.php) */
  --color-bg:           #ffffff;
  --color-surface:      #f6f6f7;
  --color-surface-alt:  #ececef;
  --color-border:       #e1e3e5;
  --color-text:         #202223;
  --color-text-muted:   #6d7175;
  --color-primary:      #1a1a1a;
  --color-primary-hover:#303030;
  --color-on-primary:   #ffffff;
  --color-accent:       #008060;
  --color-accent-hover: #006e52;
  --color-on-accent:    #ffffff;
  /* Couleurs sémantiques (jamais surchargées par les thèmes) */
  --color-error:        #d72c0d;
  --color-warn:         #ffb547;

  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.12);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
}

html { height: 100%; }
body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.5;
  font-size: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden; /* protection : empêche tout overflow accidentel de pousser
                         un scrollbar horizontal sur la page entière */
}
/* Sticky footer simple : main grandit dans le body-flex pour pousser le footer
   en bas du viewport. main reste un block (pas de flex inner — ça cassait
   l'alignement du .container.max-width sur l'admin et créait un overflow
   horizontal subtil). */
body > main { flex: 1 0 auto; min-width: 0; }
body > footer { flex-shrink: 0; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}
@media (min-width: 768px) {
  .container { padding: 0 24px; }
}

/* Boutons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s, transform .05s;
  text-align: center;
  line-height: 1.2;
  user-select: none;
}
.btn:active { transform: scale(.98); }

.btn-primary {
  background: var(--color-primary);
  color: var(--color-on-primary, #fff);
}
.btn-primary:hover { background: var(--color-primary-hover); }

.btn-accent {
  background: var(--color-accent);
  color: var(--color-on-accent, #fff);
}
.btn-accent:hover { background: var(--color-accent-hover); }

.btn-outline {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn-outline:hover { background: var(--color-surface-alt, var(--color-surface)); }

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

.btn-block { width: 100%; }
.btn-lg { padding: 16px 24px; font-size: 16px; }

/* Inputs */
.input, .select, .textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 15px;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: 0;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 18%, transparent);
}
.textarea { resize: vertical; min-height: 96px; }

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
}
.field .hint {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* Badges & alerts */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 14px;
}
.alert-success { background: #e3f1de; color: #006e52; }
.alert-error   { background: #fde8e3; color: #b91c1c; }
.alert-info    { background: #e0f0ff; color: #1a73e8; }

/* Helpers */
.text-muted { color: var(--color-text-muted); }
.text-error { color: var(--color-error); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.hidden { display: none !important; }
