/* =========================
   THEME & GLOBALS
   ========================= */
:root{
  --bg:#0f1115;
  --panel:#151923;
  --panel2:#1b2030;
  --text:#f5f6f8;
  --muted:#a9b0c1;
  --accent:#66e0a3;
  --accent2:#7db7ff;
  --line:#2a3146;
  --track:#22283a;
  --shadow:rgba(0,0,0,.35);

  /* layout heights */
  --topbar-h:56px;     /* header height */
  --subbar-h:36px;     /* chips row height (approx) */
}

*{ box-sizing:border-box; }
html, body{ height:100%; }
body{
  margin:0;
  color:var(--text);
  background:linear-gradient(180deg,#0d1117,#0b0e13 60%,#0a0d12);
  font-family:system-ui,"Segoe UI",Roboto,Arial,sans-serif;
}
a{ color:inherit; text-decoration:none; }

/* =========================
   CONTAINER & NAV
   ========================= */
.container{ max-width:1100px; margin:0 auto; padding:24px; }

.nav{
  position:sticky;
  top:0;
  z-index:40;
  background:rgba(10,12,18,.7);
  backdrop-filter:blur(8px);
  border-bottom:1px solid rgba(255,255,255,.06);
  height:var(--topbar-h);
}
.nav .wrap{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 16px;
}
.brand{
  color:var(--text);
  font-weight:800;
  white-space:nowrap;
}
.link{
  color:var(--muted);
  margin-left:12px;
}
.btn{
  background:linear-gradient(90deg,var(--accent),var(--accent2));
  color:#0b0f17;
  border:0;
  border-radius:10px;
  padding:8px 12px;
  font-weight:700;
  margin-left:12px;
  cursor:pointer;
}
.btn:hover{ filter:brightness(1.06); }

/* Hamburger button (mobile) */
.menu-btn{
  display:none;
  background:#141a26;
  color:var(--text);
  border:1px solid #2b3246;
  border-radius:10px;
  padding:8px 12px;
  font-size:18px;
  line-height:1;
  cursor:pointer;
}

/* Topbar search */
.nav .search{ flex:1; max-width:640px; margin:0 8px; }
.input{
  width:100%;
  padding:12px 14px;
  border-radius:12px;
  border:1px solid #2b3246;
  background:#141a26;
  color:var(--text);
  outline:none;
  font-size:15px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.03);
}

/* =========================
   APP SHELL (sidebar + main)
   ========================= */
.app-grid{
  display:grid;
  grid-template-columns:240px 1fr;
  min-height:calc(100vh - var(--topbar-h));
}
.sidebar{
  background:var(--panel2);
  border-right:1px solid rgba(255,255,255,0.06);
  padding:14px 10px;
  position:sticky;
  top:var(--topbar-h);
  height:calc(100vh - var(--topbar-h));
  overflow:auto;
}
.side-nav{ display:flex; flex-direction:column; gap:6px; }
.nav-item{
  display:flex; align-items:center; gap:10px;
  padding:10px 12px; border-radius:10px; color:var(--text);
}
.nav-item:hover{ background:rgba(255,255,255,0.04); }
.side-sep{ height:1px; background:rgba(255,255,255,0.08); margin:8px 0; }

.main{ width:100%; }

/* =========================
   HERO (optional)
   ========================= */
.hero{
  display:flex; align-items:center; justify-content:center; text-align:center;
  padding:42px 16px;
}
.hero .inner{
  width:100%; max-width:760px;
  background:linear-gradient(180deg,rgba(255,255,255,.02),rgba(255,255,255,.01));
  border:1px solid rgba(255,255,255,.06);
  border-radius:20px; padding:28px; box-shadow:0 10px 40px var(--shadow);
}
.hero h1{ font-size:clamp(28px,5vw,42px); margin:0 0 8px; }
.hero p{ margin:0 0 18px; color:var(--muted); }

/* =========================
   SUBBAR (chips row)
   ========================= */
.subbar{
  display:flex; align-items:center; justify-content:space-between;
  gap:12px; padding:10px 20px 6px 20px;
}
.chips{ display:flex; gap:8px; flex-wrap:wrap; }
.chip{
  background:#141a26; border:1px solid #2b3246; color:var(--text);
  padding:6px 10px; border-radius:8px; cursor:pointer;
}
.btn.ghost{
  background:transparent; color:var(--text);
  border:1px solid #2b3246; border-radius:8px; padding:8px 12px;
}
.page-title{ padding:0 20px; }

/* =========================
   MAIN CONTENT + RIGHT FILTERS
   (permanent, aligned with subbar)
   ========================= */
.content-2col{
  display:grid;
  grid-template-columns: minmax(0,1fr) 320px; /* results | filters */
  gap:16px;
  align-items:start;
  padding:0 20px 20px;   /* align with subbar padding */
}
.filters.side{
  position:sticky;
  top: calc(var(--topbar-h) + var(--subbar-h) + 6px); /* align with top row */
  height:fit-content;
}
.filters-card{
  background:var(--panel);
  border:1px solid rgba(255,255,255,.06);
  border-radius:16px;
  padding:14px;
  display:flex; flex-direction:column; gap:12px;
}
.filters-title{ font-weight:700; }
.filters-note{ font-size:12px; color:var(--muted); margin-top:-6px; }

/* =========================
   LIST VIEW (Mealie-like)
   ========================= */
.list-grid{
  display:grid; gap:12px; padding:8px 0 0 0;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
}
.row-card{
  display:grid; grid-template-columns: 120px 1fr; gap:12px;
  background:var(--panel);
  border:1px solid rgba(255,255,255,.06);
  border-radius:12px; padding:10px;
}
.row-card .thumb{
  display:block; width:120px; height:90px; border-radius:8px;
  background-size:cover; background-position:center;
}
.row-body{ display:flex; flex-direction:column; gap:6px; min-width:0; }
.row-title{ margin:0; font-size:16px; }
.row-title a{ color:var(--text); }
.row-desc{ margin:0; color:var(--muted); font-size:13px; line-height:1.35; }
.badges{ display:flex; gap:6px; flex-wrap:wrap; }
.badge{
  font-size:12px; padding:4px 8px; border-radius:999px;
  background:#161d2b; border:1px solid #29314a; color:#c9d2ea;
}
.row-macros{ display:flex; gap:14px; color:var(--muted); font-size:13px; }
.row-actions{ display:flex; gap:10px; align-items:center; }
.btn.sm{ padding:6px 10px; border-radius:8px; font-size:13px; }

/* =========================
   GENERIC GRID & CARDS (other pages)
   ========================= */
.grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(260px,1fr));
  gap:16px;
  margin-top:20px;
}
.card{
  background:var(--panel);
  border:1px solid rgba(255,255,255,.06);
  border-radius:16px;
  overflow:hidden;
  display:flex; flex-direction:column;
}
.card .img{
  background-size:cover; background-position:center;
  aspect-ratio:16/9;
}
.card .body{ padding:12px; display:flex; flex-direction:column; gap:8px; }
.macros{ display:flex; gap:14px; color:var(--muted); }
.macros strong{ color:var(--text); font-weight:700; margin-right:4px; }

/* =========================
   DUAL-RANGE SLIDER
   ========================= */
/* Structure reference:
<div class="dr" data-mingap="20">
  <div class="dr-head">
    <span class="dr-label">Calories</span>
    <span class="dr-values">0 – 1000</span>
  </div>
  <div class="dr-wrap">
    <div class="dr-track"></div>
    <input class="dr-input low" type="range">
    <input class="dr-input high" type="range">
    <!-- JS injects .dr-hit -->
  </div>
</div>
*/
.dr{ margin:12px 0 18px; }
.dr-head{
  display:flex; justify-content:space-between; align-items:baseline;
  font-size:14px; margin-bottom:6px; color:var(--muted);
}
.dr-label{ font-weight:600; color:var(--text); }
.dr-values{ font-variant-numeric:tabular-nums; }
.dr-wrap{ position:relative; height:36px; }
.dr-track{
  position:absolute; left:0; right:0; top:50%; transform:translateY(-50%);
  height:6px; border-radius:999px; background:var(--track);
  box-shadow:inset 0 0 0 1px var(--line);
}

/* native inputs (kept for a11y) */
.dr-input{
  position:absolute; inset:0; height:36px; margin:0;
  background:transparent; -webkit-appearance:none; appearance:none;
  pointer-events:none; outline:none;
}
.dr-input::-webkit-slider-thumb{
  -webkit-appearance:none; appearance:none;
  width:18px; height:18px; border-radius:50%;
  background:#fff; border:2px solid #10131a;
  box-shadow:0 1px 2px rgba(0,0,0,.25);
  cursor:pointer; position:relative; z-index:2;
}
.dr-input::-moz-range-thumb{
  width:18px; height:18px; border-radius:50%;
  background:#fff; border:2px solid #10131a;
  box-shadow:0 1px 2px rgba(0,0,0,.25);
  cursor:pointer; position:relative; z-index:2;
}
.dr-input::-webkit-slider-runnable-track{ height:36px; background:transparent; }
.dr-input::-moz-range-track{ height:36px; background:transparent; }

/* hit layer JS uses for smooth dragging */
.dr-hit{ position:absolute; inset:0; cursor:pointer; }

/* =========================
   FOOTER
   ========================= */
.footer{
  text-align:center; color:var(--muted);
  padding:28px 0; border-top:1px solid rgba(255,255,255,.06); margin-top:32px;
}

/* =========================
   RESPONSIVE
   ========================= */
@media (max-width:1000px){
  .app-grid{ grid-template-columns:1fr; }
  .sidebar{ display:none; }
  .menu-btn{ display:inline-flex; align-items:center; justify-content:center; }

  .content-2col{ grid-template-columns:1fr; padding:0 12px 16px; }
  .filters.side{ position:static; order:-1; }  /* show filters above list on mobile */

  .list-grid{ grid-template-columns:1fr; }
  .row-card{ grid-template-columns:96px 1fr; }
  .row-card .thumb{ width:96px; height:72px; }
}

@media (min-width:1120px){
  /* roomier list rows if wide */
  .list-grid{ grid-template-columns: repeat(auto-fill, minmax(480px, 1fr)); }
}

/* Make main area full-width like Mealie */
.app-grid .main.container{
  max-width:none; margin:0; padding-left:0; padding-right:0;
}
