/* ---------- Basis ---------- */
:root {
  --bg: #faf6f0;
  --card: #ffffff;
  --ink: #2b2420;
  --muted: #7a6e66;
  --line: #e8dfd4;
  --accent: #b5532f;
  --accent-dark: #933f20;
  --accent-soft: #f6e4da;
  --tag: #4f6b4a;
  --tag-soft: #e5ede2;
  --ok: #2f6b3a;
  --ok-soft: #e1f0e3;
  --err: #a12a2a;
  --err-soft: #f8e1e1;
  --radius: 12px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

h1, h2, .brand {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: normal;
  line-height: 1.2;
}
h1 { font-size: 1.7rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.3rem; margin: 2rem 0 .8rem; }

a { color: var(--accent-dark); }

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 16px 96px;
}

.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ---------- Bovenbalk ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--accent);
  color: #fff;
}
.brand {
  color: #fff;
  font-size: 1.35rem;
  text-decoration: none;
}
.topbar nav { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.topbar nav a {
  color: #fff;
  text-decoration: none;
  font-size: .9rem;
  padding: 6px 10px;
  border-radius: 999px;
}
.topbar nav a:hover, .topbar nav a.active { background: rgba(255, 255, 255, .18); }

/* ---------- Knoppen ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.danger { color: var(--err); border-color: #e5bcbc; background: transparent; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .7; cursor: wait; }
.small-btn { min-height: 34px; padding: 4px 12px; font-size: .9rem; margin-left: 8px; }

/* Ronde plusknop rechtsonder (telefoon) */
.fab {
  position: fixed;
  right: 18px;
  bottom: max(18px, env(safe-area-inset-bottom));
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 2rem;
  line-height: 60px;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(80, 30, 10, .3);
}

/* ---------- Meldingen ---------- */
.alert { padding: 12px 14px; border-radius: var(--radius); margin-bottom: 14px; }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.error { background: var(--err-soft); color: var(--err); }

/* ---------- Zoeken & filters ---------- */
.search { display: flex; gap: 8px; margin-bottom: 12px; }
.search input {
  flex: 1;
  min-width: 0;
  min-height: 46px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font: inherit;
  background: var(--card);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.chips.scroll {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.chips.scroll::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: .9rem;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.chip small { color: var(--muted); }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-dark); }
.chip.tag { color: var(--tag); }
.chip.tag.on { background: var(--tag-soft); border-color: var(--tag); }

.tagbox { margin: 4px 0 8px; }
.tagbox summary { cursor: pointer; color: var(--muted); padding: 4px 0; }

.resultbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
  color: var(--muted);
  font-size: .9rem;
}
.sort a { color: var(--muted); text-decoration: none; margin-left: 10px; }
.sort a.on { color: var(--ink); font-weight: 600; }

/* ---------- Receptenoverzicht ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
@media (min-width: 700px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(60, 30, 10, .08);
  transition: transform .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(60, 30, 10, .12); }

.thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--accent-soft);
}
.thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  display: block;
}
.thumb .count {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: .8rem;
}
.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 80px;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: .05em;
  background: var(--accent-soft);
}

.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.card-body strong { font-weight: 600; line-height: 1.3; }

.empty { text-align: center; padding: 48px 16px; color: var(--muted); }

.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 24px 0; color: var(--muted); }

/* ---------- Eén recept ---------- */
.back { margin: 0 0 8px; }
.back a { text-decoration: none; color: var(--muted); }

.recipe { max-width: 820px; margin: 0 auto; }
.recipe .meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.notes {
  background: var(--card);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 12px 16px;
  margin-bottom: 16px;
}
.pages { display: flex; flex-direction: column; gap: 14px; }
.pages img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 1px 4px rgba(60, 30, 10, .1);
}
.pdf-link {
  display: block;
  padding: 18px;
  background: var(--card);
  border: 1px dashed var(--accent);
  border-radius: var(--radius);
  text-decoration: none;
}
.actions { display: flex; gap: 10px; margin: 20px 0 10px; }

/* ---------- Formulieren ---------- */
.form { display: flex; flex-direction: column; gap: 14px; max-width: 640px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.form label .muted { font-weight: normal; }
.form input[type=text],
.form input[type=password],
.form textarea {
  font: inherit;
  font-weight: normal;
  padding: 12px 14px;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  width: 100%;
}
.form input:focus, .form textarea:focus, .search input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}

.upload {
  align-items: center;
  text-align: center;
  padding: 22px 16px;
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  background: var(--accent-soft);
  cursor: pointer;
}
.upload-title { font-size: 1.1rem; color: var(--accent-dark); }
.upload .muted { font-weight: normal; }
.upload input[type=file] { margin-top: 8px; max-width: 100%; font-weight: normal; }

.preview { display: flex; flex-wrap: wrap; gap: 10px; }
.preview-item, .existing-file {
  width: 96px;
  font-weight: normal !important;
  font-size: .85rem;
}
.preview-item img, .existing-file img, .preview-item .placeholder, .existing-file .placeholder {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 8px;
  display: flex;
}
.existing { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.existing legend { font-weight: 600; padding: 0 6px; }

.danger-zone { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); }

.panel {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(60, 30, 10, .06);
}
.inline-form { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.inline-form input {
  flex: 1;
  min-width: 160px;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

/* ---------- Inloggen ---------- */
.login-box { max-width: 380px; margin: 8vh auto 0; text-align: center; }
.login-box .form { text-align: left; }
.login-icon { width: 72px; height: 72px; border-radius: 18px; }
