/* style.css — Globale Styles
   Jogi Koch-App — ADS-freundlich, Mobile-First */

/* ── Reset & Basis ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green: #1D9E75;
  --green-dark: #157a5c;
  --green-light: #e8f8f2;
  --orange: #f0a500;
  --red: #e05252;
  --text: #1a1a1a;
  --text-muted: #666;
  --bg: #f7f9f8;
  --card-bg: #ffffff;
  --border: #e0e8e4;
  --radius: 16px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --tap-min: 56px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: var(--font); border: none; background: none; }
img { max-width: 100%; }

/* ── Header / Nav ───────────────────────────────────────────── */
.app-header {
  background: var(--green);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.app-header h1 {
  font-size: 1.2rem;
  font-weight: 700;
  flex: 1;
}

.back-btn {
  color: #fff;
  font-size: 1.5rem;
  min-width: var(--tap-min);
  min-height: var(--tap-min);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  transition: background 0.15s;
}
.back-btn:active { background: rgba(255,255,255,0.2); }

.header-actions {
  display: flex;
  gap: 8px;
}

.header-btn {
  color: #fff;
  font-size: 1.4rem;
  min-width: var(--tap-min);
  min-height: var(--tap-min);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  transition: background 0.15s;
}
.header-btn:active { background: rgba(255,255,255,0.2); }

/* ── Haupt-Container ────────────────────────────────────────── */
.main-container {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px;
}

/* ── Filter-Bar ─────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 8px;
  padding: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }

.filter-btn {
  flex-shrink: 0;
  padding: 10px 18px;
  border-radius: 24px;
  border: 2px solid var(--border);
  background: var(--card-bg);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.15s;
  min-height: 44px;
}
.filter-btn.active,
.filter-btn:active {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

/* ── Rezeptkarten ────────────────────────────────────────────── */
#recipe-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 16px 24px;
}

.recipe-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  gap: 0;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  border: 1.5px solid var(--border);
}
.recipe-card:active {
  transform: scale(0.98);
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.card-emoji {
  font-size: 3rem;
  padding: 20px 16px;
  display: flex;
  align-items: center;
  background: var(--green-light);
  min-width: 80px;
  justify-content: center;
}

.card-thumb {
  min-width: 90px;
  width: 90px;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
  background: var(--green-light);
}
.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-body {
  flex: 1;
  padding: 14px 14px 14px 0;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.3;
}

.fav-btn {
  font-size: 1.4rem;
  color: #ccc;
  min-width: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
  transition: color 0.15s;
}
.fav-btn.active { color: var(--orange); }
.fav-btn:active { transform: scale(1.2); }

.card-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 4px 0 8px;
  line-height: 1.4;
}

.card-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.82rem;
}

.tag {
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.78rem;
}
.tag-quick    { background: #fff3cd; color: #856404; }
.tag-mealprep { background: #d1ecf1; color: #0c5460; }
.tag-dessert  { background: #f8d7e8; color: #7a1040; }

.diff-easy { color: var(--green); font-weight: 600; }
.diff-medium { color: var(--orange); font-weight: 600; }
.diff-hard { color: var(--red); font-weight: 600; }

/* ── Rezept-Detail ───────────────────────────────────────────── */
.recipe-hero {
  background: var(--green-light);
  text-align: center;
  padding: 24px 20px 16px;
}
.recipe-hero .hero-emoji { font-size: 4rem; }
.recipe-hero .hero-image {
  width: 100%;
  height: 200px;
  overflow: hidden;
  margin-bottom: 8px;
}
.recipe-hero .hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.recipe-hero h2 { font-size: 1.5rem; font-weight: 800; margin-top: 8px; }
.recipe-hero .hero-desc { color: var(--text-muted); font-size: 0.95rem; margin-top: 4px; }

.recipe-meta-row {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 12px 20px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.meta-item { text-align: center; }
.meta-item .meta-val { font-weight: 700; font-size: 1rem; color: var(--green); }
.meta-item .meta-lbl { color: var(--text-muted); font-size: 0.8rem; }

/* Portionen-Regler */
.servings-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}
.servings-label { font-weight: 600; font-size: 1rem; }
.servings-btn {
  width: var(--tap-min);
  height: var(--tap-min);
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 1.6rem;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.servings-btn:active { background: var(--green-dark); }
.servings-count { font-size: 1.4rem; font-weight: 800; min-width: 40px; text-align: center; }

/* Zutaten */
.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 16px 16px 8px;
}

.ingredient-list {
  list-style: none;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ingredient-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 1rem;
}
.ingredient-list li:last-child { border-bottom: none; }
.ing-amount { color: var(--green); font-weight: 700; }

/* Aktions-Buttons */
.action-btns {
  display: flex;
  gap: 12px;
  padding: 16px;
}
.btn-primary, .btn-secondary {
  flex: 1;
  min-height: var(--tap-min);
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s;
}
.btn-primary {
  background: var(--green);
  color: #fff;
}
.btn-primary:active { background: var(--green-dark); transform: scale(0.98); }
.btn-secondary {
  background: var(--card-bg);
  color: var(--green);
  border: 2px solid var(--green);
}
.btn-secondary:active { background: var(--green-light); transform: scale(0.98); }

/* ── Kochmodus ───────────────────────────────────────────────── */
.cook-mode {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
}

.cook-progress-bar-wrap {
  height: 6px;
  background: var(--border);
}
.cook-progress-bar {
  height: 100%;
  background: var(--green);
  transition: width 0.3s ease;
}

.cook-step-counter {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
  padding: 12px;
  font-weight: 600;
}

.cook-step-content {
  flex: 1;
  padding: 20px 20px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cook-step-title {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--text);
}

.cook-step-text {
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--text);
}

/* Timer */
.timer-wrap {
  background: var(--green-light);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}
.timer-display {
  font-size: 3rem;
  font-weight: 800;
  color: var(--green);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.timer-btn {
  margin-top: 12px;
  min-height: var(--tap-min);
  min-width: 160px;
  border-radius: 14px;
  background: var(--green);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  padding: 0 24px;
  transition: background 0.15s;
}
.timer-btn:active { background: var(--green-dark); }
.timer-btn.running { background: var(--orange); }
.timer-btn.finished { background: var(--red); }

/* Zutaten dieses Schritts */
.step-ingredients {
  background: var(--bg);
  border-radius: 12px;
  padding: 12px 16px;
}
.step-ingredients h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.step-ingredients ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.step-ingredients li {
  font-size: 0.95rem;
  display: flex;
  justify-content: space-between;
}
.step-ing-amount { color: var(--green); font-weight: 600; }

/* Nav-Buttons */
.cook-nav {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
}
.cook-nav-btn {
  flex: 1;
  min-height: 64px;
  border-radius: 16px;
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s;
}
.cook-btn-back {
  background: var(--bg);
  color: var(--text);
  border: 2px solid var(--border);
}
.cook-btn-back:active { background: var(--border); }
.cook-btn-next {
  background: var(--green);
  color: #fff;
}
.cook-btn-next:active { background: var(--green-dark); transform: scale(0.98); }
.cook-btn-next:disabled { background: #ccc; cursor: not-allowed; }
.cook-btn-finish {
  background: var(--orange);
  color: #fff;
}
.cook-btn-finish:active { background: #d08d00; }

/* ── Einkaufsliste ───────────────────────────────────────────── */
.progress-bar-wrap {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  margin: 16px 16px 4px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--green);
  border-radius: 4px;
  transition: width 0.3s ease;
  width: 0%;
}
.progress-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: right;
  padding: 0 16px 12px;
}

#shopping-groups {
  padding: 0 16px 24px;
}

.shop-group { margin-bottom: 24px; }
.shop-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding: 0 4px;
}

.shop-items {
  list-style: none;
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow);
}

.shopping-item {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.shopping-item:last-child { border-bottom: none; }
.shopping-item.checked { opacity: 0.55; }
.shopping-item.checked .item-name { text-decoration: line-through; }

.item-label {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  min-height: var(--tap-min);
  cursor: pointer;
  width: 100%;
}

/* Custom Checkbox */
.checkbox-wrap {
  position: relative;
  flex-shrink: 0;
}
.checkbox-wrap input[type=checkbox] {
  opacity: 0;
  position: absolute;
  width: 0; height: 0;
}
.checkmark {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  transition: all 0.15s;
  cursor: pointer;
}
.checkbox-wrap input:checked + .checkmark {
  background: var(--green);
  border-color: var(--green);
}
.checkbox-wrap input:checked + .checkmark::after {
  content: '✓';
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
}

.item-text {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.item-name { font-size: 1rem; flex: 1; }
.item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}
.item-amount { font-size: 0.9rem; color: var(--green); font-weight: 700; }
.item-for {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
  text-align: right;
  max-width: 160px;
  line-height: 1.3;
}

/* Manuell hinzufügen */
.manual-add {
  display: flex;
  gap: 8px;
  padding: 0 16px 16px;
}
.manual-input {
  flex: 1;
  min-height: 48px;
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 0 16px;
  font-size: 1rem;
  font-family: var(--font);
  background: var(--card-bg);
  outline: none;
  transition: border-color 0.15s;
}
.manual-input:focus { border-color: var(--green); }
.manual-add-btn {
  min-width: 48px;
  min-height: 48px;
  border-radius: 12px;
  background: var(--green);
  color: #fff;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.manual-add-btn:active { background: var(--green-dark); }

.reset-btn {
  display: block;
  width: calc(100% - 32px);
  margin: 8px 16px;
  min-height: 48px;
  border-radius: 12px;
  background: var(--bg);
  color: var(--red);
  border: 2px solid #f0c0c0;
  font-size: 0.95rem;
  font-weight: 700;
  transition: background 0.15s;
}
.reset-btn:active { background: #fce8e8; }

.empty-hint {
  text-align: center;
  color: var(--text-muted);
  font-size: 1rem;
  padding: 40px 20px;
  line-height: 1.8;
}

/* ── Abschluss-Screen (Kochmodus) ───────────────────────────── */
.finish-screen {
  text-align: center;
  padding: 40px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.finish-emoji { font-size: 5rem; }
.finish-title { font-size: 1.8rem; font-weight: 800; }
.finish-sub { color: var(--text-muted); font-size: 1rem; }
.finish-btns { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 300px; margin-top: 16px; }

/* ── Responsive Desktop ─────────────────────────────────────── */
@media (min-width: 600px) {
  #recipe-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .card-emoji { font-size: 2.5rem; min-width: 70px; }
}

@media (min-width: 900px) {
  .main-container { padding: 24px; }
  .cook-step-title { font-size: 2rem; }
  .cook-step-text { font-size: 1.2rem; }
}

/* ── Timer Bar (unterhalb Schritt-Inhalt, über Navigation) ──── */
#timer-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(20,20,20,0.95);
  border-top: 1.5px solid var(--green);
}
.timer-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #2a2a2a;
  border: 1.5px solid var(--green);
  border-radius: 20px;
  padding: 6px 10px 6px 12px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
  min-height: 40px;
}
.timer-chip.running { border-color: var(--green); background: #1a3a2a; }
.timer-chip.paused  { border-color: #888; }
.timer-chip.done    { border-color: var(--orange); background: #2a1a00; }
.timer-chip:active  { opacity: 0.8; }
.chip-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #eee;
  white-space: nowrap;
}
.chip-time {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--green);
  font-variant-numeric: tabular-nums;
  min-width: 42px;
  text-align: right;
}
.timer-chip.done .chip-time { color: var(--orange); font-size: 0.8rem; }
.chip-remove {
  background: none;
  border: none;
  color: #888;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 50%;
  line-height: 1;
  display: flex;
  align-items: center;
}
.chip-remove:active { color: var(--red); }

/* ── App-Version ────────────────────────────────────────────── */
.app-version {
  text-align: center;
  padding: 12px;
  font-size: 0.72rem;
  color: var(--text-muted);
  opacity: 0.5;
}

/* ── Glossar-Links ──────────────────────────────────────────── */
.glossary-link {
  display: inline;
  background: none;
  border: none;
  border-bottom: 1.5px dashed var(--green);
  color: var(--green-dark);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  line-height: inherit;
}
.glossary-link:active { opacity: 0.7; }

/* ── Glossar-Modal ──────────────────────────────────────────── */
.glossary-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  align-items: flex-end;
  justify-content: center;
}
.glossary-modal-overlay.open {
  display: flex;
}
.glossary-modal-box {
  background: var(--card-bg);
  border-radius: 20px 20px 0 0;
  padding: 28px 24px 36px;
  width: 100%;
  max-width: 560px;
  position: relative;
  animation: slideUp 0.22s ease;
}
@keyframes slideUp {
  from { transform: translateY(60px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.glossary-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--green-light);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 1rem;
  cursor: pointer;
  color: var(--green-dark);
  display: flex;
  align-items: center;
  justify-content: center;
}
.glossary-modal-box h3 {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--green);
  margin-bottom: 12px;
}
.glossary-modal-box p {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
}
