/* NutriGiro, Stufe 3: Rezepte
   Handy: Karten waagrecht wischen, eine Karte fast bildschirmbreit.
   Tablet und PC: mehrere Karten nebeneinander, Pfeile zum Blättern,
   Rezept in zwei Spalten (Zutaten | Zubereitung). */

.suche {
  width: 100%; min-height: 46px; margin: 0 0 4px; padding: 10px 14px;
  font: inherit; border: 1.5px solid var(--rand); border-radius: 999px; background: var(--flaeche);
}
.suche:focus { outline: 3px solid #9fd0e2; border-color: var(--blau); }
.kopfzeile { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }

/* ---------- Karten zum Wischen ---------- */
.rezept-reihe { margin: 0 0 8px; }
.rezept-reihe__kopf { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rezept-reihe__kopf h2 { margin-bottom: 0.4em; }
.rezept-reihe__pfeile { display: none; gap: 6px; }
.rezept-reihe__spur {
  display: grid; grid-auto-flow: column; grid-auto-columns: 82%; gap: 12px;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory;
  padding: 4px 16px 14px; margin: 0 -16px; scroll-padding: 0 16px;
  scrollbar-width: thin;
}
.rezept-reihe__spur:focus-visible { outline: 3px solid #f59e0b; outline-offset: -3px; }
.rezept-reihe__spur--gross { grid-auto-columns: 90%; }
.rezept-karte {
  scroll-snap-align: start;
  display: flex; flex-direction: column; min-width: 0;
  color: inherit; text-decoration: none; background: var(--flaeche);
  border: 1px solid var(--rand); border-radius: 18px; overflow: hidden; box-shadow: var(--schatten);
  transition: transform 0.15s, box-shadow 0.15s;
}
.rezept-karte:hover { transform: translateY(-2px); box-shadow: 0 6px 22px rgba(20, 50, 70, 0.16); }
.rezept-karte:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }
.rezept-karte__bild { position: relative; display: block; aspect-ratio: 3 / 2; overflow: hidden; background: #e8efe9; }
/* Fotos in jedem Format füllen den Rahmen 3:2, ohne ihn zu verziehen */
.rezept-karte__bild img, .rezept-kopf__bild img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
.rezept-karte__text { display: grid; gap: 3px; padding: 12px 14px 14px; }
.rezept-karte__text strong { font-size: 1.08rem; line-height: 1.25; }
.rezept-reihe__spur--gross .rezept-karte__text strong { font-size: 1.3rem; }
.rezept-karte__ersatz { color: #6b4300; }
.rezept-karte__fehlt { color: var(--rot); }

.rezept-status {
  position: absolute; left: 10px; top: 10px;
  padding: 3px 10px; border-radius: 999px; font-size: 0.82rem; font-weight: 700;
  color: #fff; background: rgba(29, 42, 48, 0.82); backdrop-filter: blur(4px);
}
.rezept-status.is-kochbar { background: #2e7d32; }
.rezept-status.is-ersatz { background: #b26a00; }
.rezept-status.is-fast { background: #7a5b16; }
.rezept-status.is-fehlt { background: rgba(29, 42, 48, 0.75); }

.kochen-kasten { background: linear-gradient(135deg, #f0f9f1, #fff); }

/* ---------- Ein Rezept ---------- */
.rezept-kopf { display: grid; gap: 16px; margin-bottom: 8px; }
.rezept-kopf__bild { position: relative; aspect-ratio: 3 / 2; border-radius: 18px; overflow: hidden; box-shadow: var(--schatten); background: #e8efe9; }
.rezept-kopf__text h1 { margin-top: 0; }
.portionen { display: inline-flex; align-items: center; gap: 12px; margin: 0 0 14px; padding: 4px; background: var(--flaeche); border: 1px solid var(--rand); border-radius: 999px; }
.portionen span { min-width: 7.5em; text-align: center; font-weight: 700; }

.zutaten > li.zutat { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; }
.zutat__zeichen {
  flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 0.9rem; color: #fff; background: #9fb0b7;
}
.zutat > span:last-child { display: grid; min-width: 0; }
.zutat__info { color: var(--text-leise); }
.zutat.is-da .zutat__zeichen { background: #2e7d32; }
.zutat.is-ersatz .zutat__zeichen { background: #b26a00; }
.zutat.is-ersatz .zutat__info { color: #6b4300; }
.zutat.is-wenig .zutat__zeichen { background: var(--gelb); color: #4a3000; }
.zutat.is-fehlt .zutat__zeichen { background: var(--rot); }
.zutat.is-fehlt .zutat__info { color: var(--rot); }
.zutat.is-grund .zutat__zeichen { background: #c9d6db; color: var(--text); }

.einkauf-rezept { margin-top: 16px; border-color: #efb4ae; background: #fffafa; }
.btn--whatsapp { color: #fff; background: #1da851; border-color: #1da851; }
.btn--whatsapp:hover { background: #128c3e; border-color: #128c3e; }

.schritte { margin: 0; padding-left: 1.4em; display: grid; gap: 10px; }
.schritte li { padding-left: 4px; }
.schritte li::marker { font-weight: 800; color: var(--blau); }

.naehrwerte { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 0; }
.naehrwerte div { padding: 10px; background: var(--grund); border-radius: 10px; text-align: center; }
.naehrwerte dt { font-size: 0.82rem; color: var(--text-leise); }
.naehrwerte dd { margin: 2px 0 0; font-size: 1.2rem; font-weight: 800; }

/* ---------- Kochen ---------- */
.koch-liste > li.koch-zeile { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 0; }
.koch-zeile__name { display: flex; gap: 10px; align-items: flex-start; flex: 1 1 220px; min-width: 0; }
.koch-zeile__name input { width: 22px; height: 22px; margin-top: 2px; flex: none; }
.koch-zeile__name > span { display: grid; }
.haken input[type=number] { width: 4.5rem; min-height: 38px; padding: 4px 8px; font: inherit; border: 1.5px solid var(--rand); border-radius: 8px; }

/* ---------- Kochmodus: Schritte abhaken, Timer, Vorlesen ---------- */
.koch-kopf { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.koch-kopf h1 { margin-bottom: 0.1em; }
.koch-fortschritt { margin: 0 0 10px; }
.koch-vorlesen { width: 52px; height: 52px; font-size: 1.5rem; margin-top: 4px; }
.koch-vorlesen[aria-pressed="true"] { background: var(--blau-hell); border-color: var(--blau); }

/* Timer bleiben beim Scrollen oben sichtbar */
.koch-timer {
  position: sticky; top: 0; z-index: 5;
  display: grid; gap: 6px; margin: 0 -16px 12px; padding: 8px 16px;
  background: rgba(243, 247, 249, 0.94); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--rand);
}
.koch-timer__neu { justify-self: start; }
.koch-timer__eintrag {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  padding: 8px 10px; background: var(--flaeche); border: 1.5px solid var(--blau); border-radius: 12px;
}
.koch-timer__zeit { min-width: 3.2em; font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--blau-dunkel); }
.koch-timer__name { flex: 1 1 0; min-width: 0; font-weight: 600; line-height: 1.25; }
.koch-timer__knoepfe { display: inline-flex; gap: 6px; margin-left: auto; }
.koch-timer__plus { font-size: 0.85rem; font-weight: 700; }
.koch-timer__eintrag.is-pause { border-style: dashed; border-color: var(--rand); }
.koch-timer__eintrag.is-pause .koch-timer__zeit { color: var(--text-leise); }
.koch-timer__eintrag.is-fertig { background: var(--gelb-hell); border-color: var(--gelb); animation: koch-blinken 1s ease-in-out infinite alternate; }
.koch-timer__eintrag.is-fertig .koch-timer__zeit { color: #8a5300; }
@keyframes koch-blinken { from { box-shadow: 0 0 0 0 rgba(244, 182, 63, 0.0); } to { box-shadow: 0 0 0 6px rgba(244, 182, 63, 0.55); } }

/* Schritte: grosses Kästchen links, Text zum Antippen (vorlesen) */
.koch-schritte { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.koch-schritt {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px; background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius);
  transition: border-color 0.15s, background 0.15s, opacity 0.15s;
}
.koch-schritt__haken { position: relative; display: grid; place-items: center; flex: none; width: 52px; height: 52px; cursor: pointer; }
.koch-schritt__haken input {
  appearance: none; -webkit-appearance: none; margin: 0; width: 52px; height: 52px; cursor: pointer;
  border: 2.5px solid var(--blau); border-radius: 12px; background: var(--flaeche);
}
.koch-schritt__haken input:checked { background: var(--gruen); border-color: var(--gruen); }
.koch-schritt__haken input:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }
.koch-schritt__nr { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; font-size: 1.25rem; font-weight: 800; color: var(--blau); }
.koch-schritt__haken input:checked + .koch-schritt__nr { color: transparent; }
.koch-schritt__haken input:checked + .koch-schritt__nr::after { content: '✓'; position: absolute; color: #fff; font-size: 1.7rem; }
.koch-schritt__inhalt { flex: 1; min-width: 0; display: grid; gap: 8px; }
.koch-schritt__text {
  padding: 2px 0; text-align: left; font: inherit; font-size: 1.15rem; line-height: 1.45; color: inherit;
  background: none; border: 0; border-radius: 6px; cursor: pointer;
}
.koch-schritt__text:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }
.koch-schritt__timer { display: flex; flex-wrap: wrap; gap: 6px; }
.koch-schritt__timer-frei { opacity: 0.8; }
.koch-schritt.is-aktuell { border: 2px solid var(--blau); box-shadow: var(--schatten); }
.koch-schritt.is-aktuell .koch-schritt__text { font-weight: 600; }
.koch-schritt.is-erledigt { background: #f1f6f2; opacity: 0.72; }
.koch-schritt.is-erledigt .koch-schritt__text { text-decoration: line-through; text-decoration-color: rgba(46, 125, 50, 0.6); }
.koch-schritt.is-erledigt .koch-schritt__timer { display: none; }
.koch-alles { margin-top: 12px; }
.koch-zutaten summary { font-weight: 700; cursor: pointer; }
.koch-zutaten ul { margin-top: 8px; }
.koch-ende { margin: 20px 0 8px; }

/* Kleine Anzeige der Timer, wenn man den Kochmodus verlässt */
.koch-schwebend {
  position: fixed; right: 12px; bottom: calc(var(--navi-hoehe) + 12px + env(safe-area-inset-bottom)); z-index: 20;
  max-width: calc(100vw - 24px); padding: 10px 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 700; color: #fff; text-decoration: none; background: var(--blau-dunkel); border-radius: 999px; box-shadow: var(--schatten);
}
.koch-schwebend.is-fertig { color: var(--text); background: var(--gelb); animation: koch-blinken 1s ease-in-out infinite alternate; }
.koch-schwebend:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }

/* ---------- Bearbeiten ---------- */
.feld textarea { font: inherit; resize: vertical; }
.rezept-bildwahl, .naehrwerte-eingabe { margin: 0; padding: 12px 14px; border: 1px solid var(--rand); border-radius: var(--radius); background: var(--flaeche); min-width: 0; }
.rezept-bildwahl legend, .naehrwerte-eingabe legend { font-weight: 700; padding: 0 4px; }
.rezept-bildwahl__foto img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 12px; margin-bottom: 8px; }
.rezept-bildwahl__liste { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.rezept-bildwahl__knopf { padding: 0; border: 3px solid transparent; border-radius: 12px; overflow: hidden; background: none; cursor: pointer; }
.rezept-bildwahl__knopf img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.rezept-bildwahl__knopf[aria-pressed="true"] { border-color: var(--blau); box-shadow: 0 0 0 2px #fff inset; }
.rezept-bildwahl__knopf:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }
.zutaten-vorschau { margin-top: 8px; }
.zutaten-vorschau li { display: flex; gap: 8px; }
.zutaten-vorschau__menge { min-width: 5.5em; color: var(--text-leise); }

/* ---------- Ernährung ---------- */
.balken { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; height: 190px; padding-top: 8px; }
.balken__tag { display: grid; grid-template-rows: auto 1fr auto; height: 100%; text-align: center; gap: 4px; }
.balken__saeule { align-self: end; min-height: 3px; border-radius: 8px 8px 3px 3px; background: linear-gradient(#4caf50, #2e7d32); }
.balken__name { font-weight: 700; }
.balken__wert { color: var(--text-leise); }
.mahlzeiten > li.mahlzeit { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.mahlzeit > span:first-child { flex: 1; min-width: 0; }

/* ---------- Rezeptvorschläge aus dem Katalog ---------- */
.vorschlag-herstellbar { margin: 4px 0 12px; }
.vorschlag-filter summary { display: flex; align-items: center; gap: 8px; font-weight: 700; cursor: pointer; min-height: 32px; }
.vorschlag-filter[open] summary { margin-bottom: 10px; }
.vorschlag-filter__felder { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.vorschlag-filter__tags { margin: 12px 0 8px; }
.chip[aria-pressed="true"] { color: #fff; background: var(--blau); border-color: var(--blau); }
.vorschlag-gitter { display: grid; grid-template-columns: 1fr; gap: 14px; margin: 0 0 16px; }
.vorschlag-rang {
  position: absolute; right: 10px; top: 10px; padding: 2px 9px; border-radius: 999px;
  font-size: 0.8rem; font-weight: 700; color: var(--text); background: rgba(255, 255, 255, 0.88);
}
.merkmale { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 4px; }
.merkmal { white-space: nowrap; font-size: 0.95rem; letter-spacing: -0.05em; }
.rezept-kopf__text .merkmale { margin: 8px 0 14px; letter-spacing: 0; }
.rezept-kopf__text .merkmal { letter-spacing: 0; padding: 2px 10px; border-radius: 999px; background: var(--grund); }
.vorschlag-da { color: #2e7d32; font-weight: 700; }
.vorschlag-stufen { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 4px; }
.vorschlag-stufen div { padding: 8px; background: var(--flaeche); border: 1px solid var(--rand); border-radius: 10px; }
.vorschlag-stufen dt { font-size: 0.8rem; color: var(--text-leise); }
.vorschlag-stufen dd { margin: 2px 0 0; font-weight: 700; font-size: 0.92rem; }
.vorschlag-mehr { display: block; margin: 0 auto 24px; }

/* ---------- Mittlere Breite ---------- */
@media (min-width: 600px) {
  .rezept-reihe__spur { grid-auto-columns: calc((100% - 12px) / 2.15); }
  .rezept-reihe__spur--gross { grid-auto-columns: calc((100% - 12px) / 1.6); }
  .naehrwerte { grid-template-columns: repeat(4, 1fr); }
  .vorschlag-gitter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vorschlag-filter__felder { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Tablet und PC: Platz nutzen ---------- */
@media (min-width: 900px) {
  .rezept-kopf { grid-template-columns: minmax(0, 1.25fr) minmax(320px, 1fr); align-items: center; gap: 28px; }
  .spalten--rezept { grid-template-columns: minmax(300px, 1fr) minmax(0, 1.4fr); align-items: start; gap: 32px; }
  .balken { height: 240px; }
  .spalten--koch { grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); align-items: start; gap: 28px; }
  .koch-zutaten { position: sticky; top: 16px; }
  .koch-timer { margin: 0 0 14px; padding: 8px 0; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
  .koch-timer__neu { align-self: center; }
  .koch-schwebend { bottom: 24px; right: 24px; max-width: 420px; }
}
/* ---------- Tablet quer und PC: kompakte Liste statt Wischen ----------
   Karten: kleines Bild links, Text rechts, untereinander in Spalten.
   Rezept: Bild und Infos | Zutaten | Zubereitung nebeneinander.
   Vorschläge: Suche und Filter als Spalte links. Handy bleibt beim Wischen. */
@media (min-width: 900px) {
  .rezept-reihe__pfeile { display: none; }
  .rezept-reihe__spur, .rezept-reihe__spur--gross {
    grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible; scroll-snap-type: none; margin: 0; padding: 2px 0 12px; gap: 10px;
  }
  .rezept-karte { flex-direction: row; min-height: 112px; border-radius: 14px; }
  .rezept-karte:hover { transform: none; }
  .rezept-karte__bild { flex: none; width: 128px; aspect-ratio: auto; }
  .rezept-karte__text { align-content: start; gap: 2px; padding: 10px 12px; min-width: 0; }
  .rezept-karte__text strong, .rezept-reihe__spur--gross .rezept-karte__text strong { font-size: 1rem; }
  .rezept-karte__text > span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .rezept-karte .rezept-status { left: 6px; top: 6px; right: 6px; width: fit-content; max-width: calc(100% - 12px); padding: 2px 7px; font-size: 0.72rem; }
  .rezept-karte .merkmal { font-size: 0.85rem; }
  .vorschlag-rang { right: auto; left: 6px; top: auto; bottom: 6px; padding: 1px 7px; font-size: 0.72rem; }

  .vorschlag-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 20px; align-items: start; }
  .vorschlag-layout__filter { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; }
  .vorschlag-layout__filter .vorschlag-filter__felder { grid-template-columns: 1fr; }
  .vorschlag-layout__filter .suche { margin-top: 0; }
  .vorschlag-layout__filter .vorschlag-filter { padding: 10px 12px; }
  .vorschlag-layout__liste > p:first-child { margin-top: 0; }
  .vorschlag-gitter { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

  .rezept-seite { display: grid; grid-template-columns: minmax(240px, 0.85fr) minmax(0, 1fr) minmax(0, 1.25fr); gap: 24px; align-items: start; }
  .rezept-seite .rezept-kopf { display: block; position: sticky; top: 12px; margin: 0; }
  .rezept-seite .rezept-kopf__bild { aspect-ratio: 4 / 3; border-radius: 14px; }
  .rezept-seite .rezept-kopf__text h1 { font-size: 1.5rem; margin: 12px 0 4px; }
  .rezept-seite .spalten--rezept { display: contents; }
  .rezept-seite .spalten--rezept > div > h2:first-child { margin-top: 0; }
  .rezept-seite .vorschlag-stufen { grid-template-columns: 1fr; gap: 4px; }
  .rezept-seite .vorschlag-stufen div { display: flex; align-items: baseline; gap: 8px; padding: 5px 10px; }
  .rezept-seite .vorschlag-stufen dt { flex: none; width: 6.5em; }
  .rezept-seite .vorschlag-stufen dd { margin: 0; }
  .rezept-seite .rezept-kopf__text .merkmale { gap: 6px; margin: 8px 0 12px; }
  .rezept-seite .rezept-kopf__text .merkmal { font-size: 0.85rem; padding: 2px 8px; }
  .rezept-seite .zutaten > li.zutat { padding: 5px 0; }
  .rezept-karte .merkmal { letter-spacing: 0; }
  .rezept-karte .merkmale { gap: 2px 10px; }
  .rezept-seite .naehrwerte { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1300px) {
  .rezept-reihe__spur, .rezept-reihe__spur--gross, .vorschlag-gitter { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .rezept-karte, .koch-schritt { transition: none; }
  .koch-timer__eintrag.is-fertig, .koch-schwebend.is-fertig { animation: none; }
}
