/* Clean minimal stylesheet - assistant redesign */

/* Color palette extracted for reuse */
:root {
  --content-max: 1750px; /* max content width for desktop */
  --primary-bg: #f3f5f7; /* Light neutral background */
  --primary-text: #1f3a49; /* Dark blue-gray text */
  --muted-text: #6b7b86; /* Muted text */
  --header-bg: #fff7ef; /* Beige header background */
  --header-border: #e6eaee; /* Subtle header border */
  --button-bg: #BFDFF5; /* Button background */
  --button-hover: #9FD1EE; /* Button hover */
  --beige-light: #fff7ef; /* Light beige */
  --beige-medium: #f1e4d6; /* Medium beige */
  --beige-dark: #2f241c; /* Dark beige */
  --header-text: #111111; /* Header text color */
  --button-light-bg: #f1e4d6; /* Light button background */
  --button-light-text: #2f241c; /* Light button text */
  --button-dark-bg: #2f241c; /* Dark button background */
  --button-dark-text: #f1e4d6; /* Dark button text */
  --accent-dark-blue: #1f3a49; /* Accent dark blue */
  --font-family: "Rubik", sans-serif;; /* Nieuw font voor alle pagina's */
  --stripe: #fffaf3; /* content background (soft beige) */
}

*{box-sizing:border-box}
body{margin:0;font-family:var(--font-family);background:var(--primary-bg);color:var(--primary-text);-webkit-font-smoothing:antialiased}

/* Header stripe full-width; inner content centered */
.header{width:100vw;position:relative;left:50%;transform:translateX(-50%);background:var(--header-bg);border-bottom:1px solid var(--header-border);box-shadow:0 1px 0 rgba(15,30,40,0.03)}
.header-content{width:95vw;max-width:var(--content-max);margin:0 auto;padding:16px 20px;display:grid;grid-template-columns:auto 1fr auto;align-items:center;column-gap:18px}
.header-title{font-weight:700;font-size:18px;color:var(--primary-text);justify-self:start}

/* Search compact - now scales with available center column */
.search-bar{display:flex;justify-content:center;width:560px;max-width:560px;flex:0 0 auto}
.search-bar input{width:100%;padding:10px 14px;border-radius:999px;border:1px solid var(--control-border);background:#fff;color:var(--primary-text);font-size:14px;height:42px;box-shadow:0 1px 2px rgba(10,20,30,0.04)}
.search-bar input::placeholder{color:var(--muted)}

.header-actions{display:flex;gap:10px;align-items:center}
.header-actions .btn{border-radius:8px;padding:8px 12px;font-weight:600}
/* make header buttons subtle beige variants */
.btn.btn-primary{background:var(--beige-light);color:var(--beige-dark);border:1px solid var(--stripe-border)}
.btn.btn-primary:hover{filter:brightness(.98)}

/* Dashboard = slightly darker beige */
.btn.btn-outline-secondary{background:var(--beige-medium);color:var(--beige-dark);border:1px solid rgba(0,0,0,0.04)}
.btn.btn-outline-secondary:hover{filter:brightness(.97)}

/* Admin = dark beige / near black for emphasis */
.btn.btn-outline-danger{background:var(--beige-dark);color:var(--beige-light);border:1px solid rgba(0,0,0,0.06)}
.btn.btn-outline-danger:hover{filter:brightness(.94)}

.btn.danger{background:var(--beige-dark);color:var(--beige-light);border:1px solid rgba(0,0,0,0.06)}
.btn.success{background:var(--beige-medium);color:var(--beige-dark);border:1px solid rgba(0,0,0,0.06)}
.btn.secondary{background:transparent;color:var(--muted);border:1px solid var(--stripe-border)}
/* avatar / user photo */
.avatar, .user-photo, img.user-avatar{width:38px;height:38px;border-radius:50%;object-fit:cover;border:2px solid rgba(255,255,255,0.7);box-shadow:0 2px 6px rgba(10,20,30,0.06)}
.btn.btn-primary{display:inline-flex;align-items:center;gap:8px;padding:8px 16px;border-radius:10px;background:var(--button-bg);color:#14303b;border:1px solid var(--stripe-border);text-decoration:none;font-weight:600}
.btn.btn-primary:hover{background:var(--button-hover)}
.btn.btn-link{background:transparent;border:none;color:var(--muted);text-decoration:underline}

/* legacy outline classes — map to the new beige palette */
.btn.btn-outline-secondary{display:inline-flex;align-items:center;gap:8px;padding:8px 12px;border-radius:8px;background:var(--beige-medium);color:var(--beige-dark);border:1px solid rgba(0,0,0,0.04);text-decoration:none;font-weight:600}
.btn.btn-outline-secondary:hover{filter:brightness(.97)}

.btn.btn-outline-danger{display:inline-flex;align-items:center;gap:8px;padding:8px 12px;border-radius:8px;background:var(--beige-dark);color:var(--beige-light);border:1px solid rgba(0,0,0,0.06);text-decoration:none;font-weight:600}
.btn.btn-outline-danger:hover{filter:brightness(.94)}

/* Page container (content) */
.page-container{max-width:1100px;margin:28px auto;padding:22px;background:var(--stripe);border-radius:10px;box-shadow:0 10px 30px rgba(15,30,40,0.05)}

/* Recipe detail hero (wide rounded header card) */
.recipe-hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: end;
  margin: 28px 0 18px;
  position: relative;
  overflow: visible;
  padding: 0;
}
.recipe-hero .hero-media {
  width: calc(100% + 120px); /* make the header visibly wider than the page container */
  height: 300px;
  overflow: hidden;
  border-radius: 14px;
  position: relative;
  margin-left: -60px;
  box-shadow: 0 8px 30px rgba(10,20,30,0.12);
}
.recipe-hero .hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* fill the container */
  object-position: center center; /* center the photo within the container */
  display: block;
  transition: opacity 7s ease; /* fade duration 7s */
  opacity: 1;
}

/* when swapping images we will toggle .fade-hide to trigger fade */
.recipe-hero .hero-media img.fade-hide { opacity: 0; }
.recipe-hero .hero-overlay {
  position: absolute;
  left: 0; right: 0; bottom: 0; /* overlay spans the hero-media edges */
  height: 50%;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(247,239,230,0.95) 100%);
  z-index: 20;
  border-radius: 0 0 14px 14px; /* match hero rounding */
}

.recipe-hero .hero-content {
  position: absolute;
  bottom: 22px;
  left: 32px;
  z-index: 30; /* above overlay */
  color: #111; /* darker text on light gradient */
  text-shadow: none;
}
.hero-title { font-size: 1.9rem; font-weight:700; margin: 0 0 6px; }
.hero-sub { font-size:0.98rem; opacity:0.95; max-width:720px; }

/* main two-column layout */
.recipe-main .two-col {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 28px;
  align-items: start;
  margin: 18px 0 36px;
}
.col-left { background: var(--muted-bg, #fbfbfb); padding:16px; border-radius:8px; }
.col-left h3, .col-right h3 { margin-top:0; }
.ingredients-list { white-space:pre-wrap; }
.bereiding-content { line-height:1.55; }

/* photo strip */
.photo-strip { display:none; }

.slide-btn { display: none; }

.dots { display:flex; gap:8px; justify-content:center; padding:6px 0 12px 0; }
.dot { width:12px; height:12px; border-radius:50%; background: rgba(0,0,0,0.18); border:0; cursor:pointer; }
.dot.active { background: var(--accent, #c98a15); }

.ingredient-controls { display:flex; gap:10px; align-items:center; }
.ingredient-controls input[type="number"] { padding:6px 8px; }
.ingredient-controls .btn.small { padding:6px 8px; font-size:0.9rem; }
.ingredient-controls .servings-icon { font-size:1.15rem }

/* action row */
.action-row { display:flex; gap:8px; margin-top:8px; }

/* Responsive */
@media (max-width: 880px) {
  .recipe-main .two-col { grid-template-columns: 1fr; }
  .recipe-hero { position: relative; }
  .recipe-hero .hero-content { position: absolute; bottom: 12px; left: 16px; padding: 6px 0 0; text-shadow:none; color:inherit; }
  .recipe-hero .hero-media { height: 200px; margin-left: -18px; width: calc(100% + 36px); border-radius: 10px; }
}
@media (max-width: 880px){
  .header-content{width:100vw;max-width:100vw;padding:10px 14px}
}
/* Explicit recipes section wrapper (useful if you want an extra wrapper in the template) */
.recipes-section{width:95vw;max-width:var(--content-max);margin:0 auto;padding:8px 20px 8px;background:transparent}
.recipes-section .page-container{max-width:100%; margin:8px auto 0; background:transparent; box-shadow:none; border-radius:0}

/* Homepage two-column layout (filters + recipes) */
.home-layout{display:grid;grid-template-columns:280px 1fr;gap:24px;align-items:start}
.filters-mobile-bar{display:none;margin-bottom:10px;justify-content:center}
.filters-panel{background:#ffffff;border:1px solid rgba(0,0,0,0.06);border-radius:12px;padding:14px;position:sticky;top:16px;max-height:70vh;overflow:auto;box-shadow:0 8px 22px rgba(10,20,30,0.04)}
.filters-group{margin-bottom:16px}
.filters-title{font-weight:700;font-size:14px;margin-bottom:8px;color:var(--primary-text)}
.filters-list{display:flex;flex-direction:column;gap:6px}
.filters-list .collapsed-hide{display:none !important}
.filter-item{display:flex;align-items:center;gap:8px;font-size:14px;color:var(--primary-text)}
.filter-item input[type="checkbox"]{width:16px;height:16px;cursor:pointer}
.filter-search{width:100%;padding:8px 10px;border:1px solid var(--header-border);border-radius:8px;margin-bottom:8px}
.recipes-col{min-width:0}

/* Tag pills inside cards: subtle chic */
.recipe-card .recipe-tags span{background:#f6efe6;color:#2f241c}

/* Prominent Filters button */
.btn-filters{
  background-color: var(--button-dark-bg) !important;
  color: var(--button-dark-text) !important;
  border: 1px solid rgba(0,0,0,0.06);
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}
.btn-filters:hover{ filter: brightness(0.94); transform: translateY(-1px); }

/* Keep Random button label on one line */
#randomOpenTrigger{white-space:nowrap}

/* Mobile behavior: filters collapse into a toggleable drawer above recipes */
@media (max-width: 880px){
  .home-layout{display:block}
  .filters-mobile-bar{display:flex}
  .filters-panel{display:none}
  /* Remove page container chrome on mobile */
  .recipes-section{width:100vw;max-width:100vw;padding:0 10px}
  .page-container{background:transparent;box-shadow:none;border-radius:0;padding:0;margin:0}
  /* Remove gap under header on mobile for home */
  .header + .recipes-section{margin-top:0}
  /* Slightly larger Filters button on mobile */
  .btn-filters{padding:12px 22px; font-size:16px}
}

@media(max-width:520px){
  /* Compact random button so the label fits on one line */
  #randomOpenTrigger{padding:6px 10px; font-size:14px}
}

/* Visual gap between header and content for clarity (tighter on home only) */
.header + .recipes-section{margin-top:6px}
.header + .page-container{margin-top:12px}

/* Filters overlay (mobile) */
.filters-overlay{position:fixed;left:0;top:0;width:100vw;height:100dvh;background:rgba(0,0,0,0.45);display:none;align-items:center;justify-content:center;z-index:2000;overscroll-behavior:contain;padding-top:max(12px, env(safe-area-inset-top));padding-bottom:max(12px, env(safe-area-inset-bottom))}
.filters-overlay.show{display:flex}
.filters-sheet{background:#ffffff;border-radius:12px;box-shadow:0 12px 40px rgba(0,0,0,0.25);width:min(92vw,520px);max-height:100%;overflow:hidden;border:1px solid rgba(0,0,0,0.06);display:flex;flex-direction:column}
.filters-sheet-header{display:flex;align-items:center;justify-content:space-between;padding:12px 14px;border-bottom:1px solid var(--header-border);flex:0 0 auto}
.filters-sheet-title{font-weight:700}
.filters-sheet-body{padding:12px 14px;flex:1 1 auto;overflow:auto;-webkit-overflow-scrolling:touch}
.filters-actions{position:sticky;bottom:0;background:#fff;display:flex;gap:10px;justify-content:flex-end;padding:12px 14px;border-top:1px solid var(--header-border);flex:0 0 auto}

/* Prevent background scroll when overlays are open */
body.no-scroll, html.no-scroll{overflow:hidden;touch-action:none;height:100dvh}

/* Grid */
.recipe-list{display:grid;grid-template-columns:repeat(3,1fr);gap:22px}
@media(max-width:1000px){.recipe-list{grid-template-columns:repeat(2,1fr)}}
@media(max-width:520px){.recipe-list{grid-template-columns:repeat(2,1fr);gap:14px}}
@media(max-width:380px){.recipe-list{grid-template-columns:1fr}}

/* Ensure grid handles spacing; remove child margins for perfect alignment with filters panel */
.recipe-list .recipe-card{margin:0}

/* Card */
.recipe-card{display:flex;flex-direction:column;text-decoration:none;color:inherit;background:#fff7ef;border:none;border-radius:14px;overflow:hidden;min-height:300px;transition:transform .14s ease,box-shadow .14s ease;background-clip:padding-box}
.recipe-card:hover{transform:translateY(-4px);box-shadow:0 10px 22px rgba(15,30,40,0.05)}
.recipe-img{width:100%;height:180px;object-fit:cover;background:#f6f9fb}
.recipe-body{padding:14px 16px;display:flex;flex-direction:column;gap:8px;flex:1}
.recipe-name{font-weight:700;font-size:16px;color:var(--primary-text)}
.recipe-category{font-size:13px;color:var(--muted)}
.recipe-tags{display:flex;gap:8px;flex-wrap:wrap}
.recipe-tag{font-size:11px;padding:3px 8px;background:transparent;border-radius:999px;border:none;color:var(--muted)}
.recipe-desc{font-size:14px;color:#444;opacity:0.95;margin-top:auto}

/* Recipe card adjustments */
.recipe-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  overflow: hidden;
  margin: 0;
  background: white;
  border: none; /* removed stroke as requested */
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.recipe-card:hover {
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.recipe-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.recipe-card .recipe-body {
  padding: 16px;
}

.recipe-card .recipe-name {
  font-size: 1.2em;
  font-weight: bold;
}

.recipe-card .recipe-category {
  font-size: 0.9em;
  color: #555;
}

.recipe-card .recipe-tags {
  font-size: 0.9em;
  color: #777;
  margin-top: 4px;
}

.recipe-card .recipe-tags span {
  background: #f1f1f1;
  padding: 3px 8px;
  border-radius: 6px;
  margin-right: 6px;
  border: none; /* no stroke */
  box-sizing: border-box;
  display: inline-block;
  color: #000;
  font-size: 11px;
}

.recipe-card .recipe-description {
  font-size: 0.95em;
  color: #333;
  margin-top: 8px;
}

/* Category filter buttons (home page) */
.recipes-section > div button{border-radius:8px;padding:8px 12px;font-weight:600;background:transparent;border:1px solid var(--stripe-border);color:var(--muted)}
.recipes-section > div button.active-filter{background:var(--beige-600);color:var(--beige-900);border-color:rgba(0,0,0,0.06)}

/* Category filters */
.category-filters .btn-secondary {
  background-color: #007bff;
  color: white;
  border-color: #007bff;
}

.category-filters .btn-outline-secondary {
  background-color: white;
  color: #007bff;
  border-color: #007bff;
}

/* Responsive tweaks */
/* small transitions */
.header-title, .search-bar input, .btn{transition:all .12s}


@media(max-width:760px){
 	/* stack header vertically on smaller screens */
 	.header-content{display:grid;grid-template-columns:1fr auto;grid-template-rows:auto auto;gap:8px;align-items:center; padding:12px 14px}
 	.header-title{grid-column:1;grid-row:1}
 	.header-actions{grid-column:2;grid-row:1;justify-self:end;align-self:center}
  	.search-bar{grid-column:1 / -1;grid-row:2;width:100% !important;max-width:100% !important}
  /* Hide Admin Dashboard button on smaller screens (still reachable via Dashboard -> Master) */
  .header-actions .btn-outline-danger{display:none}
  /* explicitly hide logout link if present */
  .header-actions .btn-link{display:none}
}

@media(max-width:520px){.header-title{font-size:16px}.search-bar{max-width:100%}.search-bar input{padding:8px 10px}}

/* Mobile-specific recipe card/layout fixes: make cards use grid gap and remove extra margins */
@media(max-width:520px){
  /* show two cards per row on typical mobile widths for denser layout */
  .recipe-list{grid-template-columns:repeat(2,1fr); gap:14px}
  .recipe-card{margin:0}
  .page-container{padding:12px}
  .recipes-section{padding:0 6px}
}

/* Category active state styling used by JS (safe visual indicator) */
.category-filters button.active-filter{ background: var(--beige-medium); color: var(--beige-dark); border-color: rgba(0,0,0,0.04) }

/* Moved color-related styles from new.ejs to styles.css for reuse */
.card-header {
  background-color: #fff7ef !important;
  color: #111111 !important;
  font-family: inherit; /* Zorgt ervoor dat het font overeenkomt met de rest van de pagina */
  padding: 16px; /* Consistente spacing zoals in card-body */
}

.btn-primary {
  background-color: var(--button-dark-bg);
  color: var(--button-dark-text);
}

.btn-primary:hover {
  filter: brightness(0.94);
}

.btn-secondary {
  background-color: var(--button-light-bg);
  color: var(--button-light-text);
}

.btn-secondary:hover {
  filter: brightness(0.98);
}

.custom-upload {
  background-color: var(--beige-medium);
  color: var(--primary-text);
}

.custom-upload:hover {
  background-color: var(--beige-dark);
  color: #ffffff;
}

/* Backwards-compatible dark 'Terug' button */
.btn-terug {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  background-color: var(--button-dark-bg) !important; /* donker */
  color: #ffffff !important; /* wit tekst */
  border: 1px solid rgba(0,0,0,0.06);
  text-decoration: none;
  font-weight: 600;
}
.btn-terug:hover {
  filter: brightness(0.94);
}

/* Buttons: Opslaan (donker), Annuleren (licht), Kies Foto's (donker) */
.btn-save {
  background-color: var(--button-dark-bg) !important;
  color: var(--button-dark-text) !important;
  border: 1px solid rgba(0,0,0,0.06);
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 600;
  transition: filter .12s ease, transform .08s ease;
}
.btn-save:hover {
  filter: brightness(0.94);
  transform: translateY(-1px);
}

.btn-cancel {
  background-color: var(--button-light-bg) !important;
  color: var(--button-light-text) !important;
  border: 1px solid rgba(0,0,0,0.04);
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 600;
  transition: filter .12s ease, transform .08s ease;
}
.btn-cancel:hover {
  filter: brightness(0.98);
  transform: translateY(-1px);
}

/* Kies foto's: lichtere knop */
.custom-upload.btn, .custom-upload {
  background-color: var(--button-light-bg) !important; /* licht */
  color: var(--button-light-text) !important; /* donkere tekst */
  border: 1px solid rgba(0,0,0,0.04);
  padding: 8px 12px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  transition: filter .12s ease, transform .08s ease;
}
.custom-upload.btn:hover {
  filter: brightness(0.98);
  transform: translateY(-1px);
}

/* Dashboard header: force left / center / right alignment on small screens
   Use a high-specificity selector and !important to avoid Bootstrap utilities
   fighting our layout. This targets the exact wrapper used in the template. */
@media (max-width: 768px) {
  .dashboard-header > .dashboard-top {
    display: grid !important;
    grid-template-columns: auto 1fr auto !important;
    align-items: center !important;
    gap: .5rem !important;
    width: 100% !important;
  }
  .dashboard-header > .dashboard-top > .text-center.flex-fill { justify-self: center !important; text-align: center !important; padding: 0 8px; }
  .dashboard-header > .dashboard-top > .d-flex.align-items-center:first-child { justify-self: start !important; }
  .dashboard-header > .dashboard-top > .d-flex.align-items-center:last-child { justify-self: end !important; }
  .dashboard-header > .dashboard-top a.btn { white-space: nowrap; }
}

/* Recipe detail specific styles */
.recipe-detail .recipe-top{display:grid;grid-template-columns:1fr 380px;gap:20px;align-items:start}
.recipe-detail .gallery{display:flex;flex-direction:column;gap:12px}
.recipe-detail .main-photo{background:#fff;border-radius:10px;overflow:hidden;border:1px solid rgba(0,0,0,0.04)}
.recipe-detail .main-photo img{width:100%;height:420px;object-fit:cover;display:block}
.recipe-detail .thumbs{display:flex;gap:8px;flex-wrap:wrap}
.recipe-detail .thumb{background:transparent;border:1px solid rgba(0,0,0,0.04);padding:4px;border-radius:8px;cursor:pointer}
.recipe-detail .thumb img{width:84px;height:64px;object-fit:cover;border-radius:6px;display:block}
.recipe-detail .recipe-meta{padding:8px}
.recipe-detail .recipe-title{font-size:28px;margin-bottom:6px}
.recipe-detail .meta-row{display:flex;gap:8px;align-items:center;margin-bottom:8px}
.recipe-detail .short-desc{color:var(--muted-text);margin-bottom:12px}
.recipe-detail .action-row{display:flex;gap:10px}
.recipe-detail .recipe-body-grid{display:grid;grid-template-columns:1fr 1fr;gap:24px;margin-top:20px}
.recipe-detail .ingredients, .recipe-detail .bereiding{background:#fff;border-radius:10px;padding:16px;border:1px solid rgba(0,0,0,0.04)}
.recipe-detail .ingredients h3, .recipe-detail .bereiding h3{margin-top:0}
.recipe-detail .bereidings-content p{margin:0 0 0.75rem}

/* Lightbox */
.lightbox{position:fixed;left:0;top:0;width:100%;height:100%;display:none;align-items:center;justify-content:center;background:rgba(0,0,0,0.8);z-index:9999}
.lightbox.show{display:flex}
.lightbox-img{max-width:92%;max-height:86%;box-shadow:0 10px 30px rgba(0,0,0,0.5);border-radius:8px}
.lightbox-close{position:absolute;top:18px;right:18px;background:transparent;border:none;color:#fff;font-size:22px;padding:8px;cursor:pointer}

@media(max-width:980px){
  .recipe-detail .recipe-top{grid-template-columns:1fr;}
  .recipe-detail .main-photo img{height:320px}
  .recipe-detail .recipe-body-grid{grid-template-columns:1fr}
}


/* Mobile: place the title on its own top row, buttons on a second row (left / center / right) */
@media (max-width: 520px) {
  .dashboard-header .dashboard-top {
    /* keep three columns but two rows: title spans full width on row 1 */
    display: grid !important;
    grid-template-columns: auto 1fr auto !important;
    grid-template-rows: auto auto !important;
    gap: .5rem !important;
  }
  .dashboard-header .dashboard-top > .text-center.flex-fill {
    grid-column: 1 / -1 !important;
    grid-row: 1 !important;
    text-align: center !important;
    padding: 0 !important;
  }
  /* left button group */
  .dashboard-header .dashboard-top > .d-flex.align-items-center:first-child {
    grid-column: 1 !important;
    grid-row: 2 !important;
    justify-self: start !important;
  }
  /* right button group */
  .dashboard-header .dashboard-top > .d-flex.align-items-center:last-child {
    grid-column: 3 !important;
    grid-row: 2 !important;
    justify-self: end !important;
  }
  /* add a centered container for the middle button (Master) if present by forcing it to center column */
  .dashboard-header .dashboard-top > .d-flex.align-items-center:first-child + .text-center.flex-fill + .d-flex.align-items-center {
    grid-column: 2 !important;
    grid-row: 2 !important;
    justify-self: center !important;
  }
}

/* Broader mobile rule to enforce stacking and search position up to 768px */
@media (max-width: 768px) {
  .dashboard-header { display: grid; grid-template-columns: 1fr; grid-auto-rows: auto; gap: .5rem; }
  .dashboard-header .dashboard-top {
    display: grid !important;
    /* use symmetric outer columns so center truly centers and left/right align to edges */
    grid-template-columns: 1fr auto 1fr !important;
    grid-template-rows: auto auto !important;
    gap: .5rem !important;
    align-items: center !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .dashboard-header .dashboard-top > .text-center.flex-fill {
    grid-column: 1 / -1 !important;
    grid-row: 1 !important;
    text-align: center !important;
  }
  .dashboard-header .dashboard-top > .d-flex.align-items-center:first-child {
    grid-column: 1 !important; grid-row: 2 !important; justify-self: start !important;
  }
  .dashboard-header .dashboard-top > .d-flex.align-items-center:last-child {
    grid-column: 3 !important; grid-row: 2 !important; justify-self: end !important;
  }
  /* ensure the standalone search container is placed under the header grid */
  .dashboard-header > .d-flex.justify-content-center { grid-column: 1 / -1 !important; grid-row: 3 !important; justify-self: center !important; width:100% }
  /* nudge .btn-save to be flush right inside its column */
  .dashboard-header .dashboard-top > .d-flex.align-items-center:last-child .btn-save { margin-left: 0 !important; }
}

/* Final mobile spacing overrides to keep Filters tight under the header */
@media (max-width: 880px) {
  .header + .recipes-section { margin-top: 0 !important; }
}

