/* ============================================
   Atelier MK — feuille de style (mobile + PC)
   ============================================ */
:root {
  --brand: #e8552a;
  --brand-dark: #b83d18;
  --brand-light: #fbe7df;
  --accent: #f5a623;
  --bg: #fbf8f4;
  --surface: #ffffff;
  --text: #2a2018;
  --text-muted: #8a7d70;
  --border: rgba(42,32,24,0.10);
  --radius: 18px;
  --shadow-sm: 0 1px 3px rgba(42,32,24,0.06);
  --shadow-md: 0 6px 22px rgba(42,32,24,0.10);
  --shadow-lg: 0 16px 48px rgba(42,32,24,0.16);
  --max: 1100px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  padding-bottom: 80px; /* place pour la bottom-nav mobile */
}
a { color: var(--brand); text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3 { letter-spacing: -0.4px; line-height: 1.2; }

/* ---- Barre du haut ---- */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.9);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: var(--max); margin: 0 auto;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 20px;
}
.brand {
  font-size: 21px; font-weight: 900; color: var(--brand);
  letter-spacing: -0.5px; margin-right: auto;
}
.top-links { display: flex; align-items: center; gap: 18px; }
.top-links a { color: var(--text); font-weight: 600; font-size: 14px; }
.top-links a:hover { color: var(--brand); }
.top-links .admin-link { color: var(--brand-dark); font-weight: 800; }
.btn-mini {
  background: var(--brand); color: #fff !important;
  padding: 8px 16px; border-radius: 999px; font-size: 13px;
}
.icon-btn { color: var(--text); display: inline-flex; }
/* Sur mobile, on cache les liens du haut (la bottom-nav prend le relais) */
@media (max-width: 720px) {
  .top-links a:not(.btn-mini):not(.admin-link) { display: none; }
}

/* ---- Conteneur ---- */
.wrap { max-width: var(--max); margin: 0 auto; padding: 20px; }
.section-title { font-size: 22px; font-weight: 800; margin: 24px 0 14px; }

/* ---- Hero accueil ---- */
.hero {
  position: relative; border-radius: 24px; overflow: hidden;
  margin: 20px; min-height: 280px;
  display: flex; align-items: flex-end;
  background-size: cover; background-position: center;
  max-width: var(--max);
}
@media (min-width: 1140px) { .hero { margin: 24px auto; } }
.hero::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 30%, rgba(0,0,0,0.7));
}
.hero-content { position: relative; z-index: 2; padding: 28px; color: #fff; }
.hero-content h1 { font-size: 30px; font-weight: 900; margin: 0 0 6px; }
.hero-content p { margin: 0 0 16px; opacity: 0.92; font-size: 15px; }
.hero-search {
  display: flex; gap: 8px; background: #fff; border-radius: 999px;
  padding: 6px 6px 6px 18px; max-width: 460px; box-shadow: var(--shadow-md);
}
.hero-search input { flex: 1; border: none; outline: none; font-size: 15px; background: none; }
.hero-search button {
  background: var(--brand); color: #fff; border: none; border-radius: 999px;
  padding: 10px 18px; font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 6px;
}

/* ---- Grille de recettes ---- */
.recipe-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.recipe-card {
  background: var(--surface); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm); transition: transform 0.18s cubic-bezier(.34,1.4,.64,1), box-shadow 0.2s;
  color: var(--text); display: block;
}
.recipe-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.recipe-card:active { transform: scale(0.98); }
.recipe-card-img { aspect-ratio: 4/3; background-size: cover; background-position: center; background-color: var(--brand-light); }
.recipe-card-body { padding: 14px 16px 16px; }
.recipe-card-cat {
  display: inline-block; font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--brand); background: var(--brand-light);
  padding: 3px 9px; border-radius: 999px; margin-bottom: 8px;
}
.recipe-card-title { font-size: 16px; font-weight: 800; margin: 0 0 6px; line-height: 1.25; }
.recipe-card-meta { display: flex; gap: 14px; font-size: 12px; color: var(--text-muted); }
.recipe-card-meta span { display: inline-flex; align-items: center; gap: 4px; }

/* ---- Filtres / chips ---- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.chip {
  padding: 8px 16px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--border); font-size: 13px; font-weight: 600;
  color: var(--text); cursor: pointer;
}
.chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---- Détail recette ---- */
.recipe-hero {
  width: 100%; max-height: 380px; object-fit: cover;
  border-radius: 0 0 24px 24px;
}
.macros-bar {
  display: flex; justify-content: space-around; background: var(--surface);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-md);
  margin: -30px 20px 20px; position: relative; z-index: 2; max-width: 600px;
}
.macro { text-align: center; }
.macro strong { display: block; font-size: 18px; font-weight: 800; }
.macro span { font-size: 11px; color: var(--text-muted); }
.ingredients-list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 6px; }
.ingredients-list .ing-row { display: flex; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
.ingredients-list .ing-row:last-child { border-bottom: none; }
.steps-list { counter-reset: step; padding: 0; list-style: none; }
.steps-list li {
  position: relative; padding: 0 0 18px 48px; counter-increment: step;
}
.steps-list li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 32px; height: 32px; background: var(--brand); color: #fff;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px;
}

/* ---- Boutons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--brand); color: #fff; border: none; border-radius: 14px;
  padding: 14px 22px; font-weight: 700; font-size: 15px; cursor: pointer;
  font-family: inherit; transition: transform 0.15s, box-shadow 0.2s;
}
.btn:hover { box-shadow: var(--shadow-md); }
.btn:active { transform: scale(0.97); }
.btn-block { width: 100%; }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-accent { background: var(--accent); }

/* ---- Cartes génériques ---- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px; }

/* ---- Formulaires ---- */
input, textarea, select {
  font-family: inherit; font-size: 16px; width: 100%;
  padding: 13px 15px; border: 1.5px solid var(--border); border-radius: 14px;
  background: var(--surface); color: var(--text); outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(232,85,42,0.12); }
label { font-size: 13px; font-weight: 700; display: block; margin: 14px 0 6px; }

/* ---- Auth ---- */
.auth-wrap { max-width: 400px; margin: 40px auto; padding: 20px; }
.auth-card { background: var(--surface); border-radius: 24px; box-shadow: var(--shadow-lg); padding: 32px 26px; }
.auth-logo { text-align: center; font-size: 28px; font-weight: 900; color: var(--brand); margin-bottom: 4px; }
.auth-sub { text-align: center; color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }

/* ---- Frigo ---- */
.fridge-tag {
  display: inline-flex; align-items: center; gap: 8px; background: var(--brand-light);
  color: var(--brand-dark); padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 14px;
  margin: 0 8px 8px 0;
}
.fridge-tag button { background: none; border: none; color: var(--brand-dark); cursor: pointer; display: flex; padding: 0; }

/* ---- Bottom nav (mobile) ---- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 90;
  display: flex; justify-content: space-around;
  background: rgba(255,255,255,0.92);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--border);
  padding: 8px 0 calc(env(safe-area-inset-bottom, 0px) + 8px);
}
.bn-item { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--text-muted); font-size: 10px; font-weight: 600; flex: 1; }
.bn-item.active { color: var(--brand); }
.bn-ico { display: flex; }
/* Sur PC, on masque la bottom-nav (les liens du haut suffisent) */
@media (min-width: 721px) {
  .bottom-nav { display: none; }
  body { padding-bottom: 0; }
}

/* ---- Empty states ---- */
.empty { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-emoji { font-size: 44px; margin-bottom: 12px; }

/* ---- Blog ---- */
.post-card { display: flex; gap: 16px; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); margin-bottom: 16px; }
.post-card-img { width: 130px; flex-shrink: 0; background-size: cover; background-position: center; background-color: var(--brand-light); }
.post-card-body { padding: 16px; }
.post-card-body h3 { margin: 0 0 6px; font-size: 17px; }
.post-card-body p { margin: 0; color: var(--text-muted); font-size: 14px; }
.post-article { max-width: 720px; margin: 0 auto; }
.post-article img { border-radius: var(--radius); margin: 16px 0; }
.post-article p { font-size: 16px; line-height: 1.7; }

/* ---- Scan ---- */
.scan-zone {
  border: 2px dashed var(--brand); border-radius: 24px; padding: 40px 20px;
  text-align: center; background: var(--brand-light); cursor: pointer;
}
.scan-result { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 20px; margin-top: 20px; }

/* ---- Filtres avancés (page recettes) ---- */
.filters { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 14px 16px; margin-bottom: 8px; }
.filter-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.filter-row:last-child { border-bottom: none; }
.filter-label { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); min-width: 90px; flex-shrink: 0; }
.filter-row .chips { margin-bottom: 0; flex: 1; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
.filter-row .chip { white-space: nowrap; }
@media (max-width: 600px) {
  .filter-row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .filter-label { min-width: 0; }
}

/* Badge difficulté sur les cartes */
.diff-badge {
  display: inline-block; margin: 10px; font-size: 11px; font-weight: 800;
  padding: 4px 10px; border-radius: 999px; color: #fff; backdrop-filter: blur(6px);
}
.diff-facile { background: rgba(29,158,117,0.92); }
.diff-moyen { background: rgba(245,166,35,0.92); }
.diff-difficile { background: rgba(200,57,43,0.92); }
.recipe-card-img { position: relative; }

/* ---- Étoiles de notation ---- */
.stars-input { display: inline-flex; gap: 4px; }
.star-btn { background: none; border: none; cursor: pointer; padding: 2px; line-height: 0; transition: transform 0.1s; }
.star-btn:hover { transform: scale(1.15); }
.stars svg, .star-btn svg { display: block; }

/* ---- Cards de catégorie rapides (accueil) ---- */
.cat-cards {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  margin-bottom: 8px;
}
.cat-card {
  border-radius: var(--radius); padding: 16px; color: #fff;
  display: flex; flex-direction: column; justify-content: space-between; gap: 10px; min-height: 112px;
  box-shadow: var(--shadow-sm); transition: transform 0.18s cubic-bezier(.34,1.4,.64,1), box-shadow 0.2s;
  position: relative; overflow: hidden; text-decoration: none;
}
.cat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.cat-card:active { transform: scale(0.97); }
.cat-card-ico { display: block; color: #fff; opacity: 0.95; }
.cat-card-ico svg { display: block; }
.cat-card-text { display: flex; flex-direction: column; gap: 1px; }
.cat-card-title { display: block; font-size: 16px; font-weight: 800; color: #fff; line-height: 1.2; }
.cat-card-sub { display: block; font-size: 12px; opacity: 0.92; color: #fff; line-height: 1.3; }
@media (max-width: 480px) {
  .cat-cards { grid-template-columns: repeat(2, 1fr); }
}

/* ---- Nutri-Score ---- */
.nutriscore { display: inline-flex; align-items: center; gap: 0; }
.nutriscore .ns-letter {
  width: 22px; height: 28px; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; transition: transform 0.15s;
}
.nutriscore .ns-letter:first-child { border-radius: 6px 0 0 6px; }
.nutriscore .ns-letter:last-child { border-radius: 0 6px 6px 0; }
/* Version compacte sur les cartes : juste la lettre active */
.nutriscore-mini {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 6px; color: #fff; font-weight: 800; font-size: 12px;
}

/* ---- Blog enrichi ---- */
.blog-hero {
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 0;
  background: var(--surface); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-md); margin-bottom: 24px; color: var(--text);
  transition: transform 0.18s, box-shadow 0.2s;
}
.blog-hero:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.blog-hero-img { min-height: 240px; background-size: cover; background-position: center; position: relative; }
.blog-hero-body { padding: 26px; display: flex; flex-direction: column; justify-content: center; }
.blog-hero-body h2 { font-size: 24px; margin: 8px 0 10px; }
.blog-hero-body p { color: var(--text-muted); margin: 0 0 14px; font-size: 15px; }
.blog-tag {
  display: inline-block; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--brand); background: var(--brand-light); padding: 4px 10px; border-radius: 999px; align-self: flex-start;
}
.blog-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.blog-card {
  background: var(--surface); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm); color: var(--text); transition: transform 0.18s, box-shadow 0.2s;
}
.blog-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.blog-card-img { aspect-ratio: 16/10; background-size: cover; background-position: center; position: relative; }
.blog-card-body { padding: 16px; }
.blog-card-body h3 { margin: 0 0 8px; font-size: 17px; line-height: 1.3; }
.blog-card-body p { margin: 0 0 10px; color: var(--text-muted); font-size: 13px; line-height: 1.5; }
.blog-new {
  position: absolute; top: 12px; left: 12px; background: var(--brand); color: #fff;
  font-size: 11px; font-weight: 800; padding: 4px 10px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.4px; box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
@media (max-width: 640px) {
  .blog-hero { grid-template-columns: 1fr; }
  .blog-hero-img { min-height: 180px; }
}

/* ---- Fil d'Ariane (SEO + UX) ---- */
.breadcrumb { font-size: 13px; color: var(--text-muted); padding: 12px 0 4px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb .bc-sep { opacity: 0.5; }

/* ---- Vidéo + galerie recette ---- */
.recipe-video { position: relative; aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden; margin: 18px 0; box-shadow: var(--shadow-sm); }
.recipe-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.recipe-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin: 18px 0; }
.recipe-gallery img { aspect-ratio: 1; object-fit: cover; border-radius: 12px; width: 100%; transition: transform 0.15s; }
.recipe-gallery a:hover img { transform: scale(1.04); }

/* ---- Empty state icône SVG ---- */
.empty-ico { display: flex; justify-content: center; margin-bottom: 14px; color: var(--brand); opacity: 0.65; }
.empty-ico svg { display: block; }

/* ---- Macros sur les cartes de recette ---- */
.recipe-macros { display: flex; gap: 6px; margin-top: 10px; }
.macro-pill {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0;
  padding: 6px 4px; border-radius: 10px; font-size: 13px; font-weight: 800; line-height: 1.1;
}
.macro-pill small { font-size: 9px; font-weight: 600; opacity: 0.7; text-transform: uppercase; letter-spacing: 0.3px; margin-top: 2px; }
.macro-p { background: #eaf6ef; color: #0d6b4a; }
.macro-c { background: #fdf2e3; color: #b8740a; }
.macro-f { background: #fdeaf0; color: #b03060; }
