/* ============================================================
   APPMETIER PLATFORM — Design Tokens
   Charte cream/ink éditoriale
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Couleurs principales */
  --ink:         #1a1814;
  --ink-light:   #4a4640;
  --ink-muted:   #8a8480;
  --cream:       #faf8f4;
  --cream-dark:  #f0ede7;
  --cream-deep:  #e6e1d8;
  --accent:      #c8432b;
  --accent-h:    #a83521;
  --accent-warm: #e8a44a;
  --rule:        #d8d4ce;
  --white:       #ffffff;

  /* UI */
  --ui-bg:   #ffffff;
  --ui-bg2:  #f7f5f1;
  --ui-bg3:  #edeae4;
  --ui-brd:  #d8d4ce;
  --ui-brd2: #c4bfb8;
  --ui-text: #1a1814;
  --ui-text2: #6a6460;
  --ui-text3: #9a9490;

  /* Sémantiques */
  --green:    #2d6a4f;
  --green-lt: #e8f5ee;
  --red:      #c8432b;
  --red-lt:   #fdecea;
  --orange:   #c8830a;

  /* Typographie */
  --font-serif: 'Libre Baskerville', Georgia, serif;
  --font-sans:  'DM Sans', system-ui, sans-serif;
  --font-mono:  'JetBrains Mono', 'Courier New', monospace;

  /* Rayons */
  --radius-sm: 5px;
  --radius:    8px;
  --radius-lg: 10px;
  --radius-xl: 20px;

  /* Transitions */
  --transition: all 0.15s ease;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--cream);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; }
a   { color: inherit; text-decoration: none; }

/* ============================================================
   ACCESSIBILITÉ
   ============================================================ */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--ui-brd2); }

/* ============================================================
   BOUTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
  transition: var(--transition);
  white-space: nowrap;
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  padding: 10px 22px;
  border-radius: var(--radius-xl);
}
.btn-primary:hover { background: var(--accent-h); }

.btn-outline {
  background: transparent;
  color: var(--ink-light);
  border: 1px solid var(--rule);
  padding: 9px 18px;
  border-radius: var(--radius-xl);
}
.btn-outline:hover { border-color: var(--ui-brd2); color: var(--ink); }

.btn-ghost {
  background: transparent;
  color: var(--ink-muted);
  padding: 8px;
  border-radius: var(--radius-sm);
}
.btn-ghost:hover { background: var(--cream-dark); color: var(--ink); }

.btn-sm { padding: 6px 14px; font-size: 11px; }
.btn-full { width: 100%; justify-content: center; }

/* ============================================================
   FORMULAIRES
   ============================================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group label {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
}
.form-control {
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--ink);
  background: var(--white);
  width: 100%;
  transition: border-color .15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--accent);
}
.form-control[aria-invalid="true"] {
  border-color: var(--red);
}
.form-control::placeholder { color: var(--ui-text3); }
.form-control[readonly] {
  background: var(--cream-dark);
  color: var(--ink-muted);
}

/* ============================================================
   TOASTS
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--ink);
  color: var(--cream);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 400;
  border-left: 3px solid var(--accent);
  animation: toastIn .3s ease;
  pointer-events: auto;
  max-width: 320px;
  box-shadow: 0 4px 20px rgba(26,24,20,.25);
}
.toast.success { border-left-color: var(--green); }
.toast.error   { border-left-color: var(--red); }
.toast.out     { animation: toastOut .3s ease forwards; }

@keyframes toastIn  { from { opacity:0; transform:translateX(16px); } to { opacity:1; transform:translateX(0); } }
@keyframes toastOut { from { opacity:1; transform:translateX(0); }    to { opacity:0; transform:translateX(16px); } }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26,24,20,.55);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(3px);
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--rule);
  animation: modalIn .25s ease;
}
@keyframes modalIn {
  from { opacity:0; transform:translateY(12px); }
  to   { opacity:1; transform:translateY(0); }
}
.modal-title {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--rule);
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}

/* ============================================================
   UTILITAIRES
   ============================================================ */
.divider { height: 1px; background: var(--rule); margin: 16px 0; }
.text-accent  { color: var(--accent); }
.text-muted   { color: var(--ink-muted); }
.text-green   { color: var(--green); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

/* Badge statut */
.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.status-dot::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  display: block;
  flex-shrink: 0;
}
.status-dot.active  { color: var(--green); }
.status-dot.active::before { background: var(--green); }
.status-dot.inactive { color: var(--ink-muted); }
.status-dot.inactive::before { background: var(--ink-muted); }

/* Eyebrow */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
}
.eyebrow::before {
  content: '';
  display: block;
  width: 18px; height: 1.5px;
  background: var(--accent);
  flex-shrink: 0;
}

/* Spinner */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .65s linear infinite;
  flex-shrink: 0;
}
.spinner-ink {
  border-color: rgba(26,24,20,.15);
  border-top-color: var(--ink);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   RESPONSIVE UTILS
   ============================================================ */
@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
}
@media (min-width: 769px) {
  .hide-desktop { display: none !important; }
}
