/* ===== RESET & VARIABLES ===== */
:root {
  --cream:            #FDF6EC;
  --warm-white:       #FFFDF9;
  --terracotta:       #C4622D;
  --terracotta-dark:  #9B4920;
  --terracotta-light: #F0C4A8;
  --sage:             #5C7A5C;
  --charcoal:         #2C2825;
  --muted:            #7A6E65;
  --border:           #E8DDD0;
  --shadow:           0 2px 20px rgba(44,40,37,.08);
  --radius:           14px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--cream);
  color: var(--charcoal);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* ===== NAVBAR ===== */
.navbar {
  background: var(--warm-white);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 2rem;
  position: sticky;
  top: 0;
  z-index: 200;
}

.logo {
  font-family: 'Playfair Display', serif;
  font-size: 1.35rem;
  white-space: nowrap;
  color: var(--charcoal);
}
.logo span { color: var(--terracotta); font-style: italic; }

.nav-links {
  display: flex;
  list-style: none;
  gap: 0.25rem;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
  display: block;
  padding: 0.4rem 0.85rem;
  border-radius: 30px;
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
  transition: all .2s;
}
.nav-links a:hover,
.nav-links a.active { color: var(--terracotta); background: var(--cream); }

.nav-right { display: flex; align-items: center; gap: 0.6rem; white-space: nowrap; }
.nav-user   { font-size: 0.85rem; color: var(--muted); }

.nav-toggle { display: none; border: none; background: none; font-size: 1.4rem; cursor: pointer; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-block;
  padding: 0.5rem 1.2rem;
  border-radius: 30px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
  border: 1px solid transparent;
  line-height: 1.4;
}
.btn-outline { background: transparent; border-color: var(--border); color: var(--charcoal); }
.btn-outline:hover { border-color: var(--terracotta); color: var(--terracotta); }
.btn-solid   { background: var(--terracotta); color: #fff; border-color: var(--terracotta); }
.btn-solid:hover { background: var(--terracotta-dark); border-color: var(--terracotta-dark); }
.btn-danger  { background: #e24b4a; color: #fff; border-color: #e24b4a; }
.btn-danger:hover { background: #c13534; }
.btn-lg { padding: 0.85rem 2rem; font-size: 1rem; }

/* ===== FLASH ===== */
.flash {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.85rem 2rem;
  font-size: 0.9rem;
  border-bottom: 1px solid transparent;
}
.flash button { background: none; border: none; cursor: pointer; font-size: 1rem; opacity: .6; }
.flash-success { background: #e6f4ea; color: #2d7a3a; border-color: #b8dfc0; }
.flash-error   { background: #fceaea; color: #a32d2d; border-color: #f5b8b8; }
.flash-info    { background: #e6f1fb; color: #185fa5; border-color: #b5d4f4; }

/* ===== HERO ===== */
.hero {
  background: var(--charcoal);
  color: #fff;
  padding: 5rem 2rem 4.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 65% 40%, rgba(196,98,45,.3) 0%, transparent 55%),
              radial-gradient(ellipse at 20% 80%, rgba(92,122,92,.2) 0%, transparent 50%);
}
.hero-content { position: relative; z-index: 1; max-width: 680px; margin: 0 auto; }
.hero-eyebrow { font-size: .75rem; letter-spacing: .18em; text-transform: uppercase; color: var(--terracotta-light); margin-bottom: 1rem; }
.hero h1 { font-family: 'Playfair Display', serif; font-size: clamp(2rem, 5vw, 3.5rem); line-height: 1.1; margin-bottom: 1.1rem; }
.hero h1 em { color: var(--terracotta-light); font-style: italic; }
.hero p { color: rgba(255,255,255,.62); font-size: 1rem; font-weight: 300; margin-bottom: 2.2rem; }

.hero-search { display: flex; max-width: 480px; margin: 0 auto; }
.hero-search input {
  flex: 1; padding: .85rem 1.2rem;
  border: none; border-radius: 30px 0 0 30px;
  background: rgba(255,255,255,.13); color: #fff;
  font-family: 'DM Sans', sans-serif; font-size: .95rem; outline: none;
}
.hero-search input::placeholder { color: rgba(255,255,255,.4); }
.hero-search button {
  padding: .85rem 1.5rem;
  background: var(--terracotta); color: #fff;
  border: none; border-radius: 0 30px 30px 0;
  font-family: 'DM Sans', sans-serif; font-size: .9rem; font-weight: 500; cursor: pointer;
  transition: background .2s;
}
.hero-search button:hover { background: var(--terracotta-dark); }

/* ===== CATEGORIES BAR ===== */
.categories-bar {
  background: var(--warm-white);
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 0;
  padding: 0 1.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.categories-bar::-webkit-scrollbar { display: none; }
.cat-pill {
  display: flex; align-items: center; gap: .4rem;
  padding: .8rem 1.1rem;
  border: none; border-bottom: 2px solid transparent; background: transparent;
  font-family: 'DM Sans', sans-serif; font-size: .85rem; color: var(--muted);
  white-space: nowrap; cursor: pointer; text-decoration: none;
  transition: all .2s;
}
.cat-pill:hover  { color: var(--terracotta); }
.cat-pill.active { color: var(--terracotta); border-bottom-color: var(--terracotta); font-weight: 500; }

/* ===== MAIN CONTAINER ===== */
main { flex: 1; }
.container { max-width: 1200px; margin: 0 auto; padding: 2.5rem 1.5rem; }

/* ===== SECTION HEADER ===== */
.section-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 1.5rem; }
.section-header h2 { font-family: 'Playfair Display', serif; font-size: 1.6rem; }
.section-header a  { font-size: .85rem; color: var(--terracotta); }
.section-header a:hover { text-decoration: underline; }

/* ===== RECIPE GRID ===== */
.recipe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }
.recipe-grid.cols-4 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

/* ===== RECIPE CARD ===== */
.recipe-card {
  background: var(--warm-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
  box-shadow: var(--shadow);
}
.recipe-card:hover { transform: translateY(-4px); box-shadow: 0 10px 32px rgba(44,40,37,.14); }

.card-image {
  width: 100%; height: 200px;
  display: flex; align-items: center; justify-content: center;
  font-size: 4rem; position: relative;
  background: #f5ece0;
  overflow: hidden;
}
.card-image img { width: 100%; height: 100%; object-fit: cover; }
.card-badge {
  position: absolute; top: .75rem; left: .75rem;
  background: var(--terracotta); color: #fff;
  padding: .22rem .65rem; border-radius: 20px;
  font-size: .7rem; font-weight: 500;
}
.card-badge.draft { background: #888; }

.card-body    { padding: 1.1rem 1.25rem 1.3rem; }
.card-cat     { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--terracotta); font-weight: 500; margin-bottom: .35rem; }
.card-title   { font-family: 'Playfair Display', serif; font-size: 1.05rem; line-height: 1.3; margin-bottom: .45rem; }
.card-resume  { font-size: .82rem; color: var(--muted); line-height: 1.6; margin-bottom: .85rem;
                display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta    { display: flex; justify-content: space-between; align-items: center; }
.card-author  { display: flex; align-items: center; gap: .45rem; }
.avatar       { width: 26px; height: 26px; border-radius: 50%; background: var(--sage);
                display: flex; align-items: center; justify-content: center;
                font-size: .62rem; font-weight: 600; color: #fff; flex-shrink: 0; }
.author-name  { font-size: .78rem; color: var(--muted); }
.card-date    { font-size: .75rem; color: var(--muted); }

/* ===== RECIPE DETAIL ===== */
.detail-wrap  { max-width: 940px; margin: 0 auto; padding: 2rem 1.5rem; }
.back-link    { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--muted); margin-bottom: 1.5rem; }
.back-link:hover { color: var(--terracotta); }

.detail-head  { margin-bottom: 1.75rem; }
.detail-cat   { font-size: .72rem; letter-spacing: .13em; text-transform: uppercase; color: var(--terracotta); font-weight: 500; margin-bottom: .6rem; }
.detail-title { font-family: 'Playfair Display', serif; font-size: clamp(1.8rem, 4vw, 2.8rem); line-height: 1.15; margin-bottom: .9rem; }
.detail-intro { font-size: 1rem; color: var(--muted); line-height: 1.75; }

.detail-hero  {
  width: 100%; height: 380px; border-radius: var(--radius);
  overflow: hidden; display: flex; align-items: center; justify-content: center;
  font-size: 7rem; background: #f5ece0; margin: 2rem 0;
}
.detail-hero img { width: 100%; height: 100%; object-fit: cover; }

.detail-meta  { display: flex; flex-wrap: wrap; gap: 2rem; padding: 1.4rem 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin-bottom: 2.5rem; }
.meta-item .meta-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); text-align:center;}
.meta-item .meta-val   { font-family: 'Playfair Display', serif; font-size: 1.2rem; text-align:center; }

.detail-body  { display: grid; grid-template-columns: 260px 1fr; gap: 3rem; }

.ing-card     { background: var(--warm-white); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; position: sticky; top: 80px; }
.ing-card h3  { font-family: 'Playfair Display', serif; font-size: 1.1rem; margin-bottom: 1.2rem; }
.ing-item     { display: flex; justify-content: space-between; align-items: baseline; padding: .55rem 0; border-bottom: 1px solid var(--border); font-size: .88rem; }
.ing-item:last-child { border-bottom: none; }
.ing-name     { color: var(--charcoal); }
.ing-qty      { color: var(--terracotta); font-weight: 500; }

.steps h3     { font-family: 'Playfair Display', serif; font-size: 1.2rem; margin-bottom: 1.5rem; }
.step         { display: flex; gap: 1.2rem; margin-bottom: 1.5rem; }
.step-num     { width: 32px; height: 32px; border-radius: 50%; background: var(--terracotta); color: #fff;
                display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 600; flex-shrink: 0; margin-top: 3px; }
.step-text    { font-size: .95rem; line-height: 1.8; padding-top: 4px; }

.keywords     { margin-top: 2rem; padding: 1.2rem 1.5rem; background: var(--warm-white); border: 1px solid var(--border); border-radius: var(--radius); }
.kw-label     { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: .6rem; }
.kw-tag       { display: inline-block; background: var(--terracotta-light); color: var(--terracotta-dark);
                padding: .22rem .7rem; border-radius: 20px; font-size: .75rem; margin: .2rem; }

.gallery      { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .75rem; margin-top: 2rem; }
.gallery img  { border-radius: 10px; height: 130px; width: 100%; object-fit: cover; }

/* ===== SEARCH RESULTS ===== */
.search-bar   { display: flex; gap: 0; max-width: 600px; margin-bottom: 2rem; }
.search-bar input {
  flex: 1; padding: .75rem 1rem;
  border: 1px solid var(--border); border-right: none; border-radius: 8px 0 0 8px;
  font-family: 'DM Sans', sans-serif; font-size: .95rem; background: var(--warm-white); outline: none;
}
.search-bar input:focus { border-color: var(--terracotta); }
.search-bar button {
  padding: .75rem 1.3rem; background: var(--terracotta); color: #fff;
  border: 1px solid var(--terracotta); border-radius: 0 8px 8px 0;
  font-family: 'DM Sans', sans-serif; font-size: .9rem; cursor: pointer;
}

/* ===== AUTH FORMS ===== */
.auth-wrap    { min-height: calc(100vh - 64px); display: flex; align-items: center; justify-content: center; padding: 2rem; }
.auth-card    { background: var(--warm-white); border: 1px solid var(--border); border-radius: 20px; padding: 2.5rem; width: 100%; max-width: 430px; }
.auth-card h1 { font-family: 'Playfair Display', serif; font-size: 1.8rem; margin-bottom: .4rem; }
.auth-card .sub { color: var(--muted); font-size: .9rem; margin-bottom: 2rem; }
.auth-footer  { font-size: .82rem; color: var(--muted); margin-top: 1.5rem; text-align: center; }
.auth-footer a { color: var(--terracotta); }

/* ===== FORMS ===== */
.form-group   { margin-bottom: 1.1rem; }
.form-group label { display: block; font-size: .78rem; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--charcoal); margin-bottom: .35rem; }
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%; padding: .7rem .95rem;
  border: 1px solid var(--border); border-radius: 8px;
  font-family: 'DM Sans', sans-serif; font-size: .9rem;
  background: var(--cream); color: var(--charcoal); outline: none;
  transition: border-color .2s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { border-color: var(--terracotta); }
.form-group textarea { resize: vertical; min-height: 130px; line-height: 1.6; }
.form-hint    { font-size: .75rem; color: var(--muted); margin-top: .25rem; }
.form-row     { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-actions { display: flex; gap: .75rem; justify-content: flex-end; margin-top: 1.5rem; }

/* ===== ADMIN ===== */
.admin-layout { display: flex; min-height: calc(100vh - 64px); }
.admin-sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--charcoal); padding: 1.5rem 1rem;
  display: flex; flex-direction: column; gap: .2rem;
}
.admin-sidebar h3 { font-family: 'Playfair Display', serif; color: rgba(255,255,255,.5); font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; margin: .8rem .75rem .4rem; }
.sidebar-link {
  display: flex; align-items: center; gap: .65rem; padding: .65rem .75rem;
  border-radius: 8px; color: rgba(255,255,255,.6); font-size: .85rem; transition: all .2s;
}
.sidebar-link:hover { background: rgba(255,255,255,.1); color: #fff; }
.sidebar-link.active { background: var(--terracotta); color: #fff; }
.admin-main  { flex: 1; padding: 2rem; background: var(--cream); overflow-y: auto; }
.admin-head  { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.admin-head h1 { font-family: 'Playfair Display', serif; font-size: 1.5rem; }

.stats-grid  { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card   { background: var(--warm-white); border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem; }
.stat-label  { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: .4rem; }
.stat-val    { font-family: 'Playfair Display', serif; font-size: 2rem; color: var(--charcoal); }
.stat-sub    { font-size: .75rem; color: var(--sage); margin-top: .2rem; }

.data-table  { width: 100%; border-collapse: collapse; background: var(--warm-white); border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }
.data-table th { padding: .8rem 1rem; text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); border-bottom: 1px solid var(--border); font-weight: 500; white-space: nowrap; }
.data-table td { padding: .85rem 1rem; font-size: .875rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #faf7f2; }

.badge       { display: inline-block; padding: .2rem .65rem; border-radius: 20px; font-size: .7rem; font-weight: 500; }
.badge-green { background: #e6f4ea; color: #2d7a3a; }
.badge-amber { background: #fef3e2; color: #9b6c00; }
.badge-blue  { background: #e6f1fb; color: #185fa5; }
.badge-red   { background: #fceaea; color: #a32d2d; }

.action-group { display: flex; gap: .3rem; flex-wrap: wrap; }
.action-btn  { border: 1px solid var(--border); background: none; padding: .28rem .65rem; border-radius: 6px;
               font-size: .75rem; cursor: pointer; font-family: 'DM Sans', sans-serif; transition: all .2s; white-space: nowrap; }
.action-btn:hover        { border-color: var(--terracotta); color: var(--terracotta); }
.action-btn.danger:hover { border-color: #e24b4a; color: #e24b4a; }

/* ===== FILE UPLOAD ===== */
.upload-area {
  border: 2px dashed var(--border); border-radius: 10px;
  padding: 2rem; text-align: center; cursor: pointer;
  transition: border-color .2s; background: var(--cream);
}
.upload-area:hover { border-color: var(--terracotta); }
.upload-area p { color: var(--muted); font-size: .9rem; margin-top: .5rem; }

/* ===== PAGINATION ===== */
.pagination  { display: flex; gap: .4rem; justify-content: center; margin-top: 2.5rem; }
.page-btn    {
  padding: .5rem .85rem; border: 1px solid var(--border); border-radius: 8px;
  font-family: 'DM Sans', sans-serif; font-size: .85rem; background: var(--warm-white);
  cursor: pointer; transition: all .2s; text-decoration: none; color: var(--charcoal);
}
.page-btn:hover  { border-color: var(--terracotta); color: var(--terracotta); }
.page-btn.active { background: var(--terracotta); border-color: var(--terracotta); color: #fff; }
.page-btn[disabled] { opacity: .4; pointer-events: none; }

/* ===== EMPTY STATE ===== */
.empty        { text-align: center; padding: 4rem 2rem; }
.empty-icon   { font-size: 3.5rem; margin-bottom: 1rem; }
.empty h3     { font-family: 'Playfair Display', serif; font-size: 1.3rem; margin-bottom: .4rem; }
.empty p      { color: var(--muted); font-size: .9rem; }

/* ===== INGREDIENT ROWS (admin form) ===== */
.ing-row      { display: flex; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.ing-row input { flex: 1; }
.ing-row .qty  { max-width: 130px; }
.ing-row .pos  { max-width: 60px; }
.ing-remove    { border: none; background: none; cursor: pointer; color: #e24b4a; font-size: 1.1rem; padding: .2rem .4rem; }
.add-ing-btn   {
  border: 1px dashed var(--border); background: transparent; padding: .55rem 1rem;
  border-radius: 8px; cursor: pointer; font-size: .85rem; color: var(--muted);
  font-family: 'DM Sans', sans-serif; margin-top: .5rem; transition: all .2s;
}
.add-ing-btn:hover { border-color: var(--terracotta); color: var(--terracotta); }

/* ===== FOOTER ===== */
.site-footer   { background: var(--charcoal); color: rgba(255,255,255,.7); margin-top: auto; }
.footer-inner  { max-width: 1200px; margin: 0 auto; padding: 3rem 1.5rem 2rem; display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 3rem; }
.footer-brand p { font-size: .85rem; line-height: 1.7; margin-top: .75rem; color: rgba(255,255,255,.5); }
.footer-links h4 { font-family: 'Playfair Display', serif; color: #fff; margin-bottom: .9rem; font-size: 1rem; }
.footer-links ul { list-style: none; }
.footer-links li { margin-bottom: .4rem; }
.footer-links a  { font-size: .85rem; color: rgba(255,255,255,.55); transition: color .2s; }
.footer-links a:hover { color: var(--terracotta-light); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); text-align: center; padding: 1.2rem 1.5rem; font-size: .8rem; color: rgba(255,255,255,.35); }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .detail-body { grid-template-columns: 1fr; }
  .ing-card    { position: static; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .admin-layout { flex-direction: column; }
  .admin-sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; padding: .75rem; gap: .25rem; }
  .admin-sidebar h3 { display: none; }
}
@media (max-width: 680px) {
  .nav-links   { display: none; }
  .nav-toggle  { display: block; }
  .nav-links.open { display: flex; flex-direction: column; position: fixed; top: 64px; left: 0; right: 0; background: var(--warm-white); padding: 1rem; border-bottom: 1px solid var(--border); z-index: 100; }
  .hero h1     { font-size: 2rem; }
  .form-row    { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; gap: 2rem; }
  .stats-grid  { grid-template-columns: 1fr 1fr; }
}

/* ===== COMMENTAIRES & NOTES ===== */
.comments-section { border-top: 2px solid var(--border); padding-top: 2.5rem; }

.star-rating      { display: flex; gap: .1rem; }
.star-btn         { transition: color .15s, transform .15s; }
.star-btn:hover   { transform: scale(1.2); }

/* Protéger le formulaire de création si role insuffisant */
.restricted-form  {
  opacity: .5; pointer-events: none;
  filter: grayscale(1);
}
