/* ── Banque de Recettes — design system Airtable (DESIGN.md) ───────────── */
:root {
  --ink: #181d26;
  --body: #333840;
  --muted: #41454d;
  --hairline: #dddddd;
  --border-strong: #9297a0;
  --canvas: #ffffff;
  --surface-soft: #f8fafc;
  --primary: #181d26;
  --primary-active: #0d1218;
  --on-primary: #ffffff;
  --link: #1b61c9;
  --coral: #aa2d00;
  --forest: #0a2e0e;
  --cream: #f5e9d4;
  --peach: #fcab79;
  --mint: #a8d8c4;
  --yellow: #f4d35e;
  --mustard: #d9a441;
  --radius-card: 14px;
  --radius-input: 8px;
  --shadow-modal: 0 24px 64px rgba(24, 29, 38, 0.18);
  font-family: "Haas Grotesk", system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--canvas);
  color: var(--body);
  font-size: 16px;
  line-height: 1.5;
}

.hidden { display: none !important; }
h1, h2, h3 { color: var(--ink); margin: 0; }

/* ── Boutons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 48px;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  min-height: 48px;
  padding: 12px 24px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
}
.btn-primary:hover { background: var(--primary-active); }
.btn-secondary {
  background: var(--canvas);
  color: var(--ink);
  border-color: var(--hairline);
}
.btn-secondary:hover { border-color: var(--border-strong); }
.btn-sm { min-height: 36px; padding: 6px 16px; font-size: 14px; }
.btn-block { width: 100%; }

/* ── Champs ─────────────────────────────────────────────────────────────── */
.field { display: block; margin-bottom: 16px; }
.field span {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 6px;
}
.input, .field input, .field textarea {
  width: 100%;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-input);
  background: var(--canvas);
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
  padding: 10px 14px;
  min-height: 44px;
}
.field textarea { resize: vertical; line-height: 1.6; }
.input:focus, .field input:focus, .field textarea:focus {
  outline: none;
  border-color: #458fff;
  box-shadow: 0 0 0 3px rgba(69, 143, 255, 0.25);
}

/* ── Connexion ──────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  padding: 32px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
}
.login-title { font-size: 28px; font-weight: 500; letter-spacing: -0.3px; }
.login-sub { color: var(--muted); margin: 8px 0 24px; }
.login-error {
  color: var(--coral);
  font-size: 14px;
  margin: 0 0 16px;
}

/* ── Barre supérieure ───────────────────────────────────────────────────── */
.topbar {
  border-bottom: 1px solid var(--hairline);
  background: var(--canvas);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { font-size: 18px; font-weight: 500; color: var(--ink); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--forest);
  background: var(--mint);
  border-radius: 48px;
  padding: 6px 14px;
}

/* ── Conteneur & barre d'outils ─────────────────────────────────────────── */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 24px 96px;
}
.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.search-input { flex: 1 1 280px; }
.sort-select { flex: 0 0 auto; width: 180px; }

/* ── Grille de cartes recettes ──────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
@media (max-width: 1024px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .grid { grid-template-columns: 1fr; } }

.card {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease;
}
.card:hover { border-color: var(--border-strong); }
.card-banner {
  height: 8px;
  background: var(--surface-soft);
}
.card-body { padding: 24px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.card-title { font-size: 20px; font-weight: 500; color: var(--ink); }
.card-meta { font-size: 13px; color: var(--muted); }
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
}

.empty { color: var(--muted); text-align: center; padding: 64px 0; }

/* ── Étoiles ────────────────────────────────────────────────────────────── */
.stars { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.star {
  font-style: normal;
  font-size: 18px;
  color: var(--hairline);
  line-height: 1;
}
.star.on { color: var(--mustard); }
.stars-label { font-size: 13px; color: var(--muted); margin-left: 6px; }

.star-widget { display: inline-flex; gap: 4px; }
.star-btn {
  background: none;
  border: none;
  padding: 0 2px;
  cursor: pointer;
  font-style: normal;
  font-size: 26px;
  color: var(--border-strong);
  line-height: 1;
}
.star-btn.on { color: var(--yellow); }
.star-btn:focus-visible { outline: 2px solid #458fff; outline-offset: 2px; border-radius: 4px; }

/* ── Modales ────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(24, 29, 38, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 16px;
  overflow-y: auto;
  z-index: 50;
}
.modal {
  position: relative;
  background: var(--canvas);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 480px;
  padding: 32px;
}
.modal-lg { max-width: 720px; }
.modal-heading { font-size: 22px; font-weight: 500; margin-bottom: 16px; }
.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}
.modal-close:hover { color: var(--ink); }
.edit-hint {
  background: var(--cream);
  color: var(--ink);
  border-radius: var(--radius-input);
  padding: 12px 16px;
  font-size: 14px;
  margin: 0 0 16px;
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
}

/* ── Détail d'une recette ───────────────────────────────────────────────── */
.detail-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.detail-title { font-size: 26px; font-weight: 500; }
.detail-global { font-size: 14px; color: var(--muted); }
.version {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  padding: 24px;
  margin-top: 24px;
}
.version-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.version-kind {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-radius: 48px;
  padding: 4px 12px;
}
.kind-originale { background: var(--mint); color: var(--forest); }
.kind-variante  { background: var(--peach); color: var(--coral); }
.version-author { font-size: 13px; color: var(--muted); }
.version-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

.recipe-section h3 {
  font-size: 15px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin: 20px 0 8px;
}
.recipe-section ul { margin: 0; padding-left: 20px; }
.recipe-section ol { margin: 0; padding-left: 20px; }
.recipe-section li { margin-bottom: 6px; }
