/* Essens-Roulette – mobile-first Design */
:root {
  --accent: #e8590c;
  --accent-dark: #c94a08;
  --bg: #faf6f2;
  --card: #ffffff;
  --text: #2d2a26;
  --muted: #8a817a;
  --border: #eadfd6;
  --danger: #c0392b;
  --ok: #2e7d32;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---- Kopfzeile ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: .5rem; flex-wrap: wrap;
  padding: .7rem 1rem;
  padding-top: calc(.7rem + env(safe-area-inset-top));
  background: var(--accent); color: #fff;
}
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.15rem; }
.topbar .user { font-size: .85rem; opacity: .95; }
.topbar .user a { color: #fff; }

/* ---- Inhalt ---- */
.content {
  max-width: 780px; margin: 0 auto;
  padding: 1rem 1rem 5.5rem;  /* Platz für Bottom-Nav */
}
h1 { font-size: 1.5rem; margin: .4rem 0 .8rem; }
h2 { font-size: 1.15rem; margin: .2rem 0 .5rem; }
a { color: var(--accent-dark); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.ok { color: var(--ok); font-weight: 600; }

.flash {
  background: #fff3cd; border: 1px solid #ffe08a;
  padding: .6rem .9rem; border-radius: var(--radius); margin-bottom: .8rem;
}

/* ---- Karten ---- */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem; margin-bottom: .9rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.card.narrow { max-width: 420px; margin: 2rem auto; }

.grid { display: grid; gap: .9rem; grid-template-columns: 1fr; }
@media (min-width: 600px) { .grid { grid-template-columns: 1fr 1fr; } }

.recipe-card { display: block; text-decoration: none; color: inherit; }
.recipe-card:active { transform: scale(.99); }
.recipe-card h2 { color: var(--accent-dark); }
.recipe-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.recipe-card p { margin: .25rem 0; }

.meta { color: var(--muted); font-size: .9rem; }
.tags { display: flex; flex-wrap: wrap; gap: .35rem; margin: .4rem 0 0; }
.tag {
  background: #fdeee3; color: var(--accent-dark);
  padding: .1rem .55rem; border-radius: 999px;
  font-size: .8rem; text-decoration: none;
}

.fav { color: #d3c9c0; font-weight: 700; white-space: nowrap; }
.fav.on { color: #e0245e; }
.favbtn {
  background: none; border: 1px solid var(--border); border-radius: 999px;
  font-size: 1.1rem; padding: .3rem .8rem; color: #b5aca4; cursor: pointer;
}
.favbtn.on { color: #e0245e; border-color: #e0245e; background: #fdeef3; }

.detail-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; }

/* ---- Formulare ---- */
.stack { display: flex; flex-direction: column; gap: .8rem; }
label { display: flex; flex-direction: column; gap: .25rem; font-weight: 600; font-size: .92rem; }
label small { font-weight: 400; color: var(--muted); }
input[type="text"], input[type="password"], input[type="number"],
input[type="search"], select, textarea {
  font: inherit; padding: .6rem .7rem;
  border: 1px solid var(--border); border-radius: 10px;
  background: #fff; width: 100%;
  font-size: 16px; /* verhindert Auto-Zoom auf iPhone */
}
textarea { resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.checkline { flex-direction: row; align-items: center; gap: .5rem; }
.checkline input { width: auto; }

.btn {
  display: inline-block; font: inherit; font-weight: 600;
  padding: .55rem 1rem; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border); background: #fff; color: var(--text);
  text-decoration: none; text-align: center;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:active { background: var(--accent-dark); }
.btn.danger { color: var(--danger); border-color: #efc4bd; background: #fdf3f2; }
.btn.small { padding: .3rem .6rem; }
.btn.big { font-size: 1.15rem; padding: .8rem 1rem; }

.actions { display: flex; gap: .6rem; margin-top: 1rem; }

/* ---- Zutaten ---- */
.ingredients { list-style: none; padding: 0; margin: 0; }
.ingredients li { padding: .35rem 0; border-bottom: 1px dashed var(--border); }
.ingredients li:last-child { border-bottom: none; }
.ingredients li.staple { color: var(--muted); }
.instructions { white-space: pre-line; }

.ing-row {
  display: grid; grid-template-columns: 90px 1fr auto auto;
  gap: .4rem; align-items: center; margin-bottom: .45rem;
}
.staple-toggle {
  flex-direction: row; align-items: center; gap: .15rem;
  font-size: 1rem; cursor: pointer;
}
.staple-toggle input { width: auto; }

/* ---- Filterleiste ---- */
.filterbar {
  display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem;
}
.filterbar input[type="search"] { flex: 1 1 100%; }
.filterbar select { flex: 1; width: auto; }

/* ---- Roulette-Ergebnis ---- */
.result { text-align: center; animation: pop .35s ease; }
.result .pick-title { font-size: 1.6rem; color: var(--accent-dark); margin: .2rem 0; }
.result .ingredients { text-align: left; margin: .5rem auto 1rem; max-width: 420px; }
.result h3 { margin-bottom: .2rem; }
@keyframes pop {
  0% { transform: scale(.92); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ---- Vorrats-Abgleich ---- */
.score {
  font-weight: 700; color: var(--muted); white-space: nowrap;
}
.score.full { color: var(--ok); }
.matchbar {
  height: 8px; background: #f1e8e0; border-radius: 999px;
  overflow: hidden; margin: .3rem 0 .6rem;
}
.matchbar-fill { height: 100%; background: var(--accent); border-radius: 999px; }
.shopping li { color: var(--text); }

/* ---- Fotos ---- */
.card-photo {
  width: calc(100% + 2rem); margin: -1rem -1rem .6rem;
  height: 160px; object-fit: cover;
  border-radius: var(--radius) var(--radius) 0 0; display: block;
}
.detail-photo {
  width: 100%; max-height: 320px; object-fit: cover;
  border-radius: var(--radius); margin-bottom: .8rem; display: block;
}
.form-photo {
  max-width: 200px; border-radius: 10px; display: block;
}

.page-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: .6rem; flex-wrap: wrap;
}
.actions.wrap { flex-wrap: wrap; }
.center-actions { justify-content: center; flex-wrap: wrap; margin-top: .6rem; }

/* ---- Wochenplan ---- */
.weeknav {
  display: flex; justify-content: space-between; align-items: center;
  gap: .5rem; margin-bottom: 1rem;
}
.weekrange { text-align: center; font-weight: 600; font-size: .92rem; }
.dayrow.today { border-color: var(--accent); border-width: 2px; }
.dayrow h2 { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.planentry {
  display: flex; justify-content: space-between; align-items: center;
  gap: .5rem; padding: .4rem 0; border-bottom: 1px dashed var(--border);
}
.planentry a { font-weight: 600; }
.planbtns { display: flex; gap: .35rem; align-items: center; }
.planline { display: flex; gap: .5rem; align-items: center; margin-top: .5rem; }
.planline select, .planline input[type="date"], .planline input[type="text"] { flex: 1; }

/* ---- Einkaufsliste ---- */
.shoplist { list-style: none; padding: 0; margin: 0; }
.shoplist li {
  display: flex; align-items: center; gap: .6rem;
  padding: .4rem 0; border-bottom: 1px dashed var(--border);
}
.shoplist li:last-child { border-bottom: none; }
.shoplist li.done .shoptext { text-decoration: line-through; color: var(--muted); }
.shoptext { flex: 1; }
.checkbtn {
  background: none; border: none; font-size: 1.4rem; cursor: pointer;
  padding: 0 .2rem; color: var(--accent-dark); line-height: 1;
}

/* ---- Bottom-Navigation (mobil) ---- */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; justify-content: space-around;
  background: #fff; border-top: 1px solid var(--border);
  padding: .35rem 0 calc(.35rem + env(safe-area-inset-bottom));
  z-index: 10;
}
.bottomnav a {
  display: flex; flex-direction: column; align-items: center;
  gap: .05rem; font-size: .72rem; text-decoration: none;
  color: var(--muted); padding: .2rem .5rem; border-radius: 10px;
  min-width: 52px;
}
.bottomnav a .icon { font-size: 1.25rem; }
.bottomnav a.active { color: var(--accent-dark); background: #fdeee3; }
