:root { --border:#e6e6e6; --muted:#666; --bg:#fafafa; }

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: #111;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
}

h1 { margin: 0 0 10px 0; font-size: 22px; }

/* ---------------------------
   Controls layout (TIDIED UP)
   ---------------------------
   Goal:
   - Row 1: search + search button + category + origin + sort aligned
   - Row 2: selected actions aligned
*/
.controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: center;
}

/* Inputs/selects/buttons (keep your original look) */
.controls input,
.controls select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  min-width: 0; /* IMPORTANT: allow grid to size properly */
}

.controls button {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #111;
  color: #fff;
  cursor: pointer;
}

.controls button.secondary {
  background: #fff;
  color: #111;
}
.controls button.secondary.active {
  border-color: #111;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.05);
}
.controls button.secondary.danger {
  border-color: #ffd2d2;
  background: #fff5f5;
  color: #7a0000;
}

/* Make search input stretch nicely */
#searchInput {
  width: 100%;
  min-width: 240px;
}

/* Keeps selects from becoming tiny */
#categorySelect,
#originSelect,
#sortSelect {
  min-width: 190px;
}

/* Selected bar becomes its own clean row */
.selectedBar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-left: 0;
  justify-content: flex-start;
}

/* Push the pill to the right within the selected bar row (desktop) */
.selectedCountPill {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: #111;
  font-size: 13px;
  white-space: nowrap;
  margin-left: auto;
}

/* Desktop layout: put everything on row 1, selectedBar on row 2 */
@media (min-width: 900px) {
  .controls {
    grid-template-columns: 1fr auto auto auto auto;
    align-items: center;
  }

  /* Ensure the selected bar is always on its own row */
  .selectedBar {
    grid-column: 1 / -1;
  }

  /* Make everything line up in height */
  .controls input,
  .controls select,
  .controls button {
    height: 40px;
  }

  /* Keep the search button visually compact (not stretched) */
  #refreshBtn {
    width: auto;
    white-space: nowrap;
  }
}

/* Mobile: stack and keep pill not forced to the far right */
@media (max-width: 899px) {
  .selectedCountPill {
    margin-left: 0;
  }
}

.status {
  margin: 10px 0;
  color: var(--muted);
}

.list { display: grid; gap: 10px; }

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.row {
  display: grid;
  grid-template-columns: 44px 80px 1fr 44px;
  gap: 12px;
  align-items: center;
  padding: 12px;
}

.selector {
  display: flex;
  justify-content: center;
}
.selector input { width: 18px; height: 18px; }

.thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.thumb.placeholder {
  background: #f1f1f1;
  border: 1px dashed var(--border);
}

.summary { cursor: pointer; outline: none; }
.title { font-weight: 700; font-size: 16px; }
.desc { color: var(--muted); margin-top: 4px; }
.meta { color: #333; margin-top: 6px; font-size: 13px; }
.tags { color: var(--muted); margin-top: 6px; font-size: 12px; }

.toggleBtn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.details {
  border-top: 1px solid var(--border);
  padding: 14px 16px 18px 16px;
}

.loading { color: var(--muted); }
.error { color: #b00020; }
.hint { color: var(--muted); }

.detailGrid { display: grid; gap: 12px; }
.detailTitle { font-weight: 800; font-size: 18px; }
.detailDesc { margin-top: 6px; color: var(--muted); }

.block {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}
.blockTitle { font-weight: 700; margin-bottom: 8px; }

.bullets { margin: 0; padding-left: 18px; }
.steps { margin: 0; padding-left: 18px; }
.kv { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.kv li { display: flex; justify-content: space-between; gap: 12px; }
.links { display: flex; gap: 12px; flex-wrap: wrap; }
.links a { color: #0b57d0; text-decoration: none; }
.links a:hover { text-decoration: underline; }

/* Panel */
.panel {
  margin: 12px 0 16px 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}
.panelHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 12px 12px;
  border-bottom: 1px solid var(--border);
}
.panelTitle {
  font-weight: 800;
}
.panelBody {
  padding: 12px;
  display: grid;
  gap: 12px;
}

.copyBox {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}
.panelActions {
  margin-top: 8px;
}
.panelActions button {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #111;
  color: #fff;
  cursor: pointer;
}

.itemLine .unitLine { margin-top: 2px; }
.itemLine .itemName { font-weight: 600; display: block; margin-bottom: 2px; }

.shoppingList li { padding: 6px 0; }

.sl-main {
  display: flex;
  gap: 10px;
  align-items: baseline;
}

.sl-qty {
  min-width: 90px; /* aligns quantities */
  display: inline-block;
}

.sl-item {
  flex: 1;
}

.sl-sub {
  margin-left: 100px;
  margin-top: 4px;
}

.sl-subline {
  display: flex;
  gap: 10px;
  align-items: baseline;
}

.calTag {
  font-weight: 600;
  color: var(--muted);
  margin-left: 6px;
  font-size: 13px;
}

/* Compactere regels voor boodschappenlijst */
.panel .bullets li {
  padding: 2px 0;
  line-height: 1.25;
}

/* ---------------------------
   NEW: Print button in recipe details
   --------------------------- */
.detailHeaderTop {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.detailActions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.printBtn {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #111;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}

.printBtn:hover {
  filter: brightness(1.05);
}
