/* Genussquelle - Dark Theme, handgeschrieben (kein Build-Schritt noetig) */

:root {
  --bg: #15130f;
  --bg-elevated: #1e1b16;
  --card: #242019;
  --card-hover: #2c2720;
  --border: #38322a;
  --text: #f2ece1;
  --text-muted: #b3a996;
  --accent: #e0a458;
  --accent-strong: #f0b96e;
  --accent-contrast: #1a1408;
  --danger: #d9695c;
  --success: #7fb36a;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); text-decoration: underline; }

h1, h2, h3 {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
  margin: 0 0 0.5em 0;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.footer-link-header {
  color: var(--text-muted);
  font-size: 13px;
  margin-right: 4px;
}
.footer-link-header:hover,
.footer-link-header.active {
  color: var(--accent);
}

.back-to-top {
  position: fixed;
  right: 20px;
  bottom: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  z-index: 15;
}
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.back-to-top:hover {
  background: var(--accent-strong);
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 0;
  margin-top: 40px;
}
.site-footer .container {
  display: flex;
  justify-content: center;
}
.site-footer a {
  color: var(--text-muted);
  font-size: 13px;
}
.site-footer a:hover {
  color: var(--accent);
}

/* ---------- Kopfzeile / Navigation ---------- */
.site-header {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.site-header .bar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 20px;
  max-width: 1200px;
  margin: 0 auto;
}
.brand {
  font-family: Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}
.brand span { color: var(--text); }
.main-nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  flex: 1;
}
.main-nav a {
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
}
.main-nav a:hover, .main-nav a.active {
  background: var(--card);
  color: var(--text);
  text-decoration: none;
}
.nav-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-muted);
}
.nav-user form { margin: 0; }
.btn {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-contrast);
  border: none;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: var(--accent-strong); text-decoration: none; }
.btn.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn.secondary:hover { background: var(--card); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.small { padding: 5px 10px; font-size: 13px; }

/* ---------- Layout ---------- */
.page { padding: 32px 0 64px; }
.page-header { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-header h1 { font-size: 30px; }
.muted { color: var(--text-muted); }

.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 14.5px;
  animation: flashIn 0.35s ease;
}
@keyframes flashIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.flash.success { background: rgba(127, 179, 106, 0.15); border: 1px solid var(--success); color: var(--success); }
.flash.error { background: rgba(217, 105, 92, 0.15); border: 1px solid var(--danger); color: var(--danger); }

/* ---------- Filterleiste ---------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 28px;
}
.filter-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-muted); }
.filter-field input[type="text"],
.filter-field input[type="number"],
.filter-field select {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  min-width: 140px;
}
.filter-field.grow { flex: 1; min-width: 200px; }
.filter-field .range-row { display: flex; align-items: center; gap: 8px; color: var(--text); }

/* ---------- Rezeptkarten ---------- */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 20px;
}
.recipe-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  display: flex;
  flex-direction: column;
  opacity: 0;
  animation: cardIn 0.5s ease forwards;
  animation-delay: calc(var(--i, 0) * 40ms);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.recipe-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  background: var(--card-hover);
  text-decoration: none;
}
.recipe-card .thumb {
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, var(--bg-elevated), var(--card));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  padding: 10px;
  overflow: hidden;
}
.recipe-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}
.recipe-card:hover .thumb img { transform: scale(1.06); }
.recipe-card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.chapter-badge {
  align-self: flex-start;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(224, 164, 88, 0.12);
  padding: 3px 8px;
  border-radius: 100px;
}
.recipe-card h3 { font-size: 17px; margin: 2px 0 0; color: var(--text); }
.recipe-meta { display: flex; gap: 10px; font-size: 12.5px; color: var(--text-muted); flex-wrap: wrap; }
.recipe-meta span { display: inline-flex; align-items: center; gap: 4px; }

/* Platzhalter-Farben je Kapitel (dezente Verlaeufe statt Icon-Font) */
.placeholder-saucen-dips-gewuerze { color: #e0a458; }
.placeholder-burger { color: #d97a4a; }
.placeholder-buns-brot { color: #c9a25c; }
.placeholder-hauptgerichte { color: #d9695c; }
.placeholder-getraenke { color: #6fa8c9; }
.placeholder-suesses { color: #d98cbf; }
.placeholder-salate-bowls-fruehstueck { color: #7fb36a; }
.placeholder-cocktails { color: #a48ce0; }

/* ---------- Rezept-Detail ---------- */
.recipe-detail-head { display: flex; gap: 28px; flex-wrap: wrap; margin-bottom: 28px; }
.recipe-detail-head .thumb-large {
  width: 280px; max-width: 100%; aspect-ratio: 4/3; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; color: var(--accent);
  overflow: hidden; position: relative;
}
.recipe-detail-head .thumb-large img { width: 100%; height: 100%; object-fit: cover; }
.recipe-detail-head .thumb-large .gallery-slide {
  position: absolute; inset: 0; opacity: 0; transition: opacity 0.25s ease;
}
.recipe-detail-head .thumb-large .gallery-slide.active { opacity: 1; }
.gallery-credit {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 11px;
  padding: 3px 9px; border-radius: 100px; white-space: nowrap;
}
.gallery-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  background: rgba(0, 0, 0, 0.45); color: #fff; border: none; border-radius: 50%;
  width: 32px; height: 32px; font-size: 20px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.gallery-nav:hover { background: rgba(0, 0, 0, 0.7); }
.gallery-nav.prev { left: 8px; }
.gallery-nav.next { right: 8px; }
.gallery-dots {
  position: absolute; bottom: 8px; left: 0; right: 0; z-index: 2;
  display: flex; justify-content: center; gap: 6px;
}
.gallery-dot {
  width: 8px; height: 8px; border-radius: 50%; border: none; padding: 0;
  background: rgba(255, 255, 255, 0.5); cursor: pointer;
}
.gallery-dot.active { background: #fff; }
.image-gallery-editor { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.image-gallery-editor .image-tile {
  position: relative; width: 100px; height: 100px; border-radius: 8px;
  overflow: hidden; border: 1px solid var(--border);
}
.image-gallery-editor .image-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.image-gallery-editor .remove-image {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0, 0, 0, 0.6); color: #fff; border: none; cursor: pointer; font-size: 14px; line-height: 1;
}
.image-gallery-editor .remove-image:hover { background: rgba(220, 50, 50, 0.85); }
.pending-image-grid { display: flex; flex-wrap: wrap; gap: 14px; }
.pending-image-card {
  display: flex; flex-direction: column; width: 170px; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden;
}
.pending-image-card img { width: 100%; height: 110px; object-fit: cover; display: block; }
.pending-image-info { padding: 10px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.pending-image-info a { font-weight: 600; }
.pending-image-actions { display: flex; gap: 6px; margin-top: 6px; }
.pending-image-actions form { margin: 0; }
.recipe-detail-info { flex: 1; min-width: 260px; }
.recipe-detail-info .subtitle { color: var(--text-muted); margin-bottom: 10px; }
.badge-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0 16px; }
.badge {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 6px 12px; font-size: 13.5px; color: var(--text-muted);
}

.nutrition-facts {
  list-style: none; margin: -6px 0 16px; padding: 0;
  display: flex; gap: 16px; flex-wrap: wrap; font-size: 13.5px; color: var(--text-muted);
}
.nutrition-facts li { display: flex; gap: 6px; }
.nutrition-facts li span:last-child { color: var(--text); font-weight: 600; }

.purine-badge {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
  font-size: 13px; padding: 6px 12px; border-radius: var(--radius-sm); margin: -6px 0 16px;
  border: 1px solid var(--border);
}
.purine-badge.purine-niedrig { color: var(--success); border-color: var(--success); background: rgba(127, 179, 106, 0.1); }
.purine-badge.purine-mittel { color: var(--accent); border-color: var(--accent); background: rgba(224, 164, 88, 0.1); }
.purine-badge.purine-hoch { color: var(--danger); border-color: var(--danger); background: rgba(217, 105, 92, 0.1); }
.purine-note { color: var(--text-muted); font-weight: 400; }

.detail-grid { display: grid; grid-template-columns: 320px 1fr; gap: 32px; }
@media (max-width: 800px) { .detail-grid { grid-template-columns: 1fr; } .recipe-detail-head { flex-direction: column; } }

.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.panel h2 { font-size: 16px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--accent); margin-bottom: 14px; }

.portion-control { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; font-size: 14px; }
.portion-control input {
  width: 60px; text-align: center; background: var(--card); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius-sm); padding: 6px;
}
.portion-control button {
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 16px;
}

ul.ingredient-list { list-style: none; margin: 0; padding: 0; }
ul.ingredient-list li { padding: 7px 0; border-bottom: 1px dotted var(--border); font-size: 14.5px; }
ul.ingredient-list li:last-child { border-bottom: none; }
ul.ingredient-list .qty { color: var(--accent); font-weight: 600; margin-right: 6px; }
h3.group-label { font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin: 16px 0 6px; }
h3.group-label:first-child { margin-top: 0; }

ol.step-list { list-style: none; counter-reset: step; margin: 0; padding: 0; }
ol.step-list li {
  counter-increment: step;
  position: relative;
  padding: 2px 0 16px 38px;
  font-size: 15px;
}
ol.step-list li::before {
  content: counter(step);
  position: absolute; left: 0; top: -1px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: var(--accent-contrast);
  font-size: 13px; font-weight: 700; text-align: center; line-height: 26px;
}
.tip-box {
  margin-top: 18px; padding: 14px 16px; background: rgba(224, 164, 88, 0.1);
  border-left: 3px solid var(--accent); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: 14px;
}

/* ---------- Formulare ---------- */
.form-card {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px 30px; max-width: 480px; margin: 0 auto;
}
.form-card.wide { max-width: 900px; }
.field { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13.5px; color: var(--text-muted); }
.field input, .field select, .field textarea {
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  padding: 10px 12px; border-radius: var(--radius-sm); font-size: 15px; font-family: inherit;
}
.field textarea { resize: vertical; min-height: 90px; }
.field-row { display: flex; gap: 14px; flex-wrap: wrap; }
.field-row .field { flex: 1; min-width: 160px; }

table.admin-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.admin-table th, table.admin-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
table.admin-table th { color: var(--text-muted); font-weight: 600; font-size: 13px; text-transform: uppercase; }

.repeatable-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.repeatable-row input { flex: 1; }
.repeatable-row input.qty-value { max-width: 90px; flex: none; }
.repeatable-row input.qty-unit { max-width: 90px; flex: none; }
.remove-row { background: transparent; border: none; color: var(--danger); cursor: pointer; font-size: 18px; }

/* ---------- Wochenplan / Einkaufsliste ---------- */
.chapter-filter-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; margin-bottom: 20px; }
.chapter-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 0;
  flex: 1;
  min-width: 240px;
}
.chapter-filter legend { font-size: 13px; color: var(--text-muted); padding: 0 4px; }
.chapter-checkbox { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text); }
.chapter-checkbox input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
.week-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.week-day { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.week-day .day-name { font-size: 12.5px; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.week-day a { color: var(--text); font-weight: 600; }

.shopping-list { list-style: none; margin: 0; padding: 0; }
.shopping-list li {
  display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px dotted var(--border);
}
.shopping-list li.checked { opacity: 0.45; text-decoration: line-through; }
.shopping-list input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  .container { padding: 0 14px; }
  .page { padding: 20px 0 48px; }
  .page-header h1 { font-size: 24px; }

  .site-header .bar { flex-wrap: wrap; gap: 10px 14px; padding: 12px 14px; }
  .main-nav { order: 3; flex: 1 1 100%; gap: 2px; }
  .main-nav a { padding: 7px 10px; font-size: 13.5px; }

  .filter-bar { padding: 14px 16px; gap: 12px; }
  .filter-field, .filter-field.grow { flex: 1 1 100%; }
  .filter-field input[type="text"], .filter-field input[type="number"], .filter-field select {
    min-width: 0; width: 100%;
  }

  .chapter-filter-form { flex-direction: column; align-items: stretch; }
  .chapter-filter { min-width: 0; }

  .form-card, .form-card.wide { padding: 20px; max-width: 100%; }
  .field-row .field { flex: 1 1 100%; min-width: 0; }

  .repeatable-row { flex-wrap: wrap; }
  .repeatable-row input:not(.qty-value):not(.qty-unit) { flex: 1 1 100%; }
  .repeatable-row input.qty-value, .repeatable-row input.qty-unit { flex: 1 1 calc(50% - 4px); max-width: none; }

  table.admin-table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }

  .gallery-nav { width: 38px; height: 38px; font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .recipe-card {
    opacity: 1;
    animation: none;
  }
  .recipe-card .thumb img,
  .back-to-top,
  .flash {
    animation: none;
    transition: none;
  }
}

@media print {
  .site-header, .filter-bar, .btn, form, .back-to-top, .site-footer { display: none !important; }
  body { background: #fff; color: #000; }
}
