/* StaffMTL — Design system */
/* Mobile-first · Dark mode · WCAG AA */

:root {
  --bg: #F8F7F4;
  --surface: #FFFFFF;
  --surface-2: #F0EEE9;
  --text: #1A1714;
  --text-muted: #6B6460;
  --accent: #E85D04;
  --accent-hover: #C94E03;
  --accent-text: #FFFFFF;
  --border: #E2DED8;
  --success: #16A34A;
  --error: #DC2626;
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111111;
    --surface: #1C1C1C;
    --surface-2: #242424;
    --text: #F0EDE8;
    --text-muted: #9A9490;
    --border: #2E2E2C;
    --shadow: 0 1px 3px rgba(0,0,0,0.4);
  }
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Layout */
.container { max-width: 600px; margin: 0 auto; padding: 0 16px; }
.page { min-height: 100dvh; display: flex; flex-direction: column; }

/* Header */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; max-width: 900px; margin: 0 auto;
}
.logo { font-size: 1.125rem; font-weight: 700; color: var(--text); text-decoration: none; }
.logo span { color: var(--accent); }
.nav-link {
  font-size: 0.875rem; color: var(--text-muted); text-decoration: none;
  padding: 6px 12px; border-radius: var(--radius); transition: background 0.15s;
}
.nav-link:hover { background: var(--surface-2); }
.nav-link.active { color: var(--text); font-weight: 500; }

/* Main content */
main { flex: 1; padding: 24px 16px; }
.main-inner { max-width: 600px; margin: 0 auto; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

/* Typography */
h1 { font-size: 1.5rem; font-weight: 700; line-height: 1.3; margin-bottom: 8px; }
h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: 16px; }
h3 { font-size: 1rem; font-weight: 600; margin-bottom: 8px; }
p { color: var(--text-muted); margin-bottom: 16px; }

/* Forms */
.field { margin-bottom: 20px; }
label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 6px; }
input, textarea, select {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.15);
}
textarea { resize: vertical; min-height: 120px; }
.field-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }
.char-count { font-size: 0.8rem; color: var(--text-muted); text-align: right; margin-top: 4px; }
.char-count.warn { color: var(--error); }

/* Radio cards */
.radio-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.radio-card { position: relative; cursor: pointer; }
.radio-card input { position: absolute; opacity: 0; width: 0; height: 0; }
.radio-card-inner {
  display: block; padding: 16px; border: 2px solid var(--border);
  border-radius: var(--radius); text-align: center; transition: all 0.15s; user-select: none;
}
.radio-card input:checked + .radio-card-inner {
  border-color: var(--accent);
  background: rgba(232, 93, 4, 0.06);
}
.radio-card-icon { font-size: 1.5rem; display: block; margin-bottom: 4px; }
.radio-card-label { font-size: 0.875rem; font-weight: 600; color: var(--text); }
.radio-card-price { font-size: 0.8rem; color: var(--text-muted); }

/* Duration selector */
.duration-btns { display: flex; gap: 8px; }
.duration-btn {
  flex: 1; padding: 10px; border: 2px solid var(--border);
  border-radius: var(--radius); background: var(--surface); color: var(--text);
  font-size: 0.875rem; font-weight: 500; cursor: pointer; transition: all 0.15s;
}
.duration-btn:hover { border-color: var(--accent); }
.duration-btn.active { border-color: var(--accent); background: rgba(232, 93, 4, 0.06); }

/* Price preview */
.price-preview {
  background: var(--surface-2); border-radius: var(--radius);
  padding: 16px; margin-bottom: 20px; text-align: center;
}
.price-preview .price { font-size: 1.75rem; font-weight: 700; color: var(--accent); }
.price-preview .price-label { font-size: 0.8rem; color: var(--text-muted); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 20px; border-radius: var(--radius);
  font-size: 1rem; font-weight: 600; font-family: var(--font);
  cursor: pointer; border: none; transition: all 0.15s; text-decoration: none;
  gap: 8px;
}
.btn-primary { background: var(--accent); color: var(--accent-text); width: 100%; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
  background: transparent; color: var(--text);
  border: 1.5px solid var(--border); width: 100%;
}
.btn-secondary:hover { background: var(--surface-2); }
.btn-sm { padding: 8px 14px; font-size: 0.875rem; width: auto; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 99px;
  font-size: 0.75rem; font-weight: 500;
}
.badge-published { background: #DCFCE7; color: #15803D; }
.badge-pending { background: #FEF9C3; color: #854D0E; }
.badge-failed { background: #FEE2E2; color: #991B1B; }
.badge-paid { background: #DBEAFE; color: #1D4ED8; }
@media (prefers-color-scheme: dark) {
  .badge-published { background: #14532D; color: #86EFAC; }
  .badge-pending { background: #422006; color: #FDE047; }
  .badge-failed { background: #450A0A; color: #FCA5A5; }
  .badge-paid { background: #1E3A5F; color: #93C5FD; }
}

/* Status messages */
.alert {
  padding: 12px 16px; border-radius: var(--radius);
  margin-bottom: 16px; font-size: 0.875rem;
}
.alert-error { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.alert-success { background: #DCFCE7; color: #15803D; border: 1px solid #BBF7D0; }
@media (prefers-color-scheme: dark) {
  .alert-error { background: #450A0A; color: #FCA5A5; border-color: #7F1D1D; }
  .alert-success { background: #14532D; color: #86EFAC; border-color: #166534; }
}

/* Post list */
.post-item { padding: 16px 0; border-bottom: 1px solid var(--border); }
.post-item:last-child { border-bottom: none; }
.post-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
.post-business { font-weight: 600; font-size: 0.9375rem; }
.post-meta { font-size: 0.8rem; color: var(--text-muted); }
.post-metrics { display: flex; gap: 16px; margin-top: 8px; font-size: 0.8rem; color: var(--text-muted); }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

/* Auth tabs */
.auth-tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.auth-tab {
  flex: 1; padding: 12px; text-align: center;
  font-size: 0.9375rem; font-weight: 500; cursor: pointer;
  border: none; background: none; color: var(--text-muted); border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: all 0.15s;
}
.auth-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Loading */
.loading { display: flex; align-items: center; justify-content: center; padding: 48px; color: var(--text-muted); }
.spinner {
  width: 20px; height: 20px; border: 2px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.6s linear infinite; margin-right: 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty state */
.empty { text-align: center; padding: 48px 16px; color: var(--text-muted); }
.empty-icon { font-size: 2.5rem; margin-bottom: 12px; }

/* Success page */
.success-icon { text-align: center; font-size: 3rem; margin-bottom: 16px; }

/* Admin table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th { text-align: left; padding: 8px 12px; border-bottom: 2px solid var(--border); color: var(--text-muted); font-weight: 500; }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }

/* Responsive */
@media (min-width: 640px) {
  main { padding: 32px 24px; }
  h1 { font-size: 1.875rem; }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

/* Focus visible pour WCAG */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

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