/* ============================================================
   MonJournalMigraine - Tests technologiques
   Feuille de style commune. Style sobre, sans animation,
   responsive mobile-first.
   ============================================================ */

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --border: #e5e5e5;
  --border-strong: #cccccc;
  --text: #1a1a1a;
  --text-secondary: #555555;
  --text-muted: #888888;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --ok: #15803d;
  --warn: #b45309;
  --danger: #b91c1c;
  --radius: 4px;
  --gap: 16px;
  --maxw: 760px;
  --tap: 44px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

body {
  padding: 24px 16px 64px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

.container {
  max-width: var(--maxw);
  margin: 0 auto;
}

img, svg { max-width: 100%; height: auto; }

/* Typographie */
h1 { font-size: 1.6rem; font-weight: 600; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; font-weight: 600; margin: 28px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
h3 { font-size: 1rem; font-weight: 600; margin: 20px 0 8px; }
p { margin: 8px 0; }
.lead { color: var(--text-secondary); margin: 4px 0 24px; }
small, .meta { color: var(--text-muted); font-size: 0.85rem; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  background: #f3f3f3;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  word-break: break-word;
}

/* En-tete */
.page-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.back-link {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 4px 0;
}
.back-link:hover { color: var(--accent); }

/* Cartes */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.card h3 { margin-top: 0; }

/* Liste des tests */
.test-list { list-style: none; padding: 0; margin: 0; }
.test-list li { margin-bottom: 12px; }
.test-list a {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  color: var(--text);
  text-decoration: none;
  -webkit-tap-highlight-color: rgba(0,0,0,0.05);
}
.test-list a:hover { border-color: var(--border-strong); background: #fcfcfc; }
.test-list .num {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-right: 8px;
}
.test-list .title { font-weight: 600; }
.test-list .desc {
  display: block;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 4px;
}

/* Boutons */
button, .btn {
  display: inline-block;
  font: inherit;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 10px 14px;
  cursor: pointer;
  min-height: var(--tap);
  text-decoration: none;
  -webkit-tap-highlight-color: rgba(0,0,0,0.05);
  touch-action: manipulation;
}
button:hover, .btn:hover { background: #f5f5f5; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button.primary, .btn.primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}
button.primary:hover, .btn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
button.danger { color: var(--danger); border-color: #e6c0c0; }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

/* Formulaires */
label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
input, select, textarea {
  width: 100%;
  font: inherit;
  font-size: 16px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  min-height: var(--tap);
}
textarea { resize: vertical; min-height: 96px; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-color: var(--accent);
}
.field { margin-bottom: 12px; }
.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

/* Tableaux */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin: 12px 0;
}
th, td {
  border-bottom: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
}
th {
  font-weight: 600;
  background: #f5f5f5;
  color: var(--text-secondary);
}
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
}
.badge.ok { color: var(--ok); border-color: #b8dcc4; background: #ecf7f0; }
.badge.warn { color: var(--warn); border-color: #e6d3a8; background: #fbf5e8; }
.badge.err { color: var(--danger); border-color: #e6c0c0; background: #f9ecec; }

/* Logs */
.log {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  background: #1f2328;
  color: #e6e6e6;
  border-radius: var(--radius);
  padding: 12px;
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Metriques */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
.metric .label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.metric .value {
  font-size: 1.4rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
}

/* Note d'info */
.note {
  background: #f5f7fb;
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  border-radius: 3px;
  margin: 12px 0;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

/* Listes simples */
ul.simple, ol.simple { padding-left: 20px; margin: 8px 0; }
ul.simple li, ol.simple li { margin: 4px 0; }

/* Pied de page */
.footer {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
  body { padding: 18px 12px 48px; }
  h1 { font-size: 1.4rem; }
  h2 { font-size: 1.05rem; }
}

@media (max-width: 600px) {
  .field-row { grid-template-columns: 1fr; gap: 8px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  table { font-size: 0.85rem; }
  th, td { padding: 6px 8px; }
}

@media (max-width: 480px) {
  body { padding: 14px 10px 40px; }
  h1 { font-size: 1.25rem; }
  h2 { font-size: 1rem; }
  .card { padding: 12px; }
  .metric { padding: 10px; }
  .metric .value { font-size: 1.2rem; }
  .btn-row { gap: 6px; }
  .btn-row > button, .btn-row > .btn {
    flex: 1 1 140px;
    min-width: 0;
  }
}

@media (max-width: 360px) {
  body { font-size: 15px; }
  h1 { font-size: 1.15rem; }
  .metrics { grid-template-columns: 1fr; }
}
