:root {
  --bg: #FFF8F0;
  --card: #FFFFFF;
  --primary: #7B3F00;
  --primary-hover: #5C2E00;
  --primary-light: #A0522D;
  --accent: #E8A45A;
  --accent-light: #FDF0E0;
  --text: #2C1500;
  --text-muted: #7A5C3A;
  --border: #E5C9A8;
  --success: #2D6A4F;
  --success-bg: #D8F3DC;
  --danger: #C0392B;
  --danger-bg: #FDECEA;
  --warning-bg: #FFF3CD;
  --warning-text: #856404;
  --shadow: rgba(90, 40, 0, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ── Layout ── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }
.page-center {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 2rem 1rem;
}

/* ── Cards ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 2px 16px var(--shadow);
  padding: 2rem;
}

/* ── Topbar ── */
.topbar {
  background: var(--primary);
  color: white;
  padding: 0.75rem 0;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
}
.topbar-brand {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 1.2rem; font-weight: 700; color: white; text-decoration: none;
}
.topbar-brand .logo-emoji { font-size: 1.5rem; }
.topbar-right { display: flex; align-items: center; gap: 0.75rem; }
.topbar-user { color: rgba(255,255,255,0.85); font-size: 0.9rem; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.4rem; padding: 0.6rem 1.2rem; border-radius: var(--radius-sm);
  font-size: 0.9rem; font-weight: 600; cursor: pointer;
  border: none; text-decoration: none; transition: all 0.15s ease;
  line-height: 1;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover:not(:disabled) { background: #c8863a; }
.btn-outline {
  background: transparent; color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--accent-light); }
.btn-ghost { background: rgba(255,255,255,0.15); color: white; }
.btn-ghost:hover { background: rgba(255,255,255,0.25); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: #962d22; }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.85rem 2rem; font-size: 1rem; }
.btn-block { width: 100%; }

/* ── Forms ── */
.form-group { margin-bottom: 1.25rem; }
.form-group label {
  display: block; font-weight: 600; color: var(--primary);
  margin-bottom: 0.4rem; font-size: 0.9rem;
}
.form-control {
  width: 100%; padding: 0.65rem 0.9rem;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 0.95rem; color: var(--text); background: white;
  transition: border-color 0.15s;
}
.form-control:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232, 164, 90, 0.2);
}
.form-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.3rem; }

/* ── Badges ── */
.badge {
  display: inline-block; padding: 0.2rem 0.6rem; border-radius: 99px;
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-einfach { background: var(--success-bg); color: var(--success); }
.badge-mittel { background: var(--warning-bg); color: var(--warning-text); }
.badge-anspruchsvoll { background: var(--danger-bg); color: var(--danger); }

/* ── Alert ── */
.alert {
  padding: 0.75rem 1rem; border-radius: var(--radius-sm);
  margin-bottom: 1rem; font-size: 0.9rem;
}
.alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid #f5c6cb; }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #b7e4c7; }

/* ── Tag input ── */
.tag-input-wrapper {
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 0.5rem; min-height: 48px; background: white;
  display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center;
  cursor: text; transition: border-color 0.15s;
}
.tag-input-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232, 164, 90, 0.2);
}
.tag {
  display: inline-flex; align-items: center; gap: 0.3rem;
  background: var(--accent-light); border: 1px solid var(--border);
  border-radius: 99px; padding: 0.2rem 0.6rem 0.2rem 0.75rem;
  font-size: 0.85rem; color: var(--primary); font-weight: 500;
}
.tag-remove {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 1rem; line-height: 1;
  padding: 0; display: flex; align-items: center;
}
.tag-remove:hover { color: var(--danger); }
.tag-real-input {
  border: none; outline: none; flex: 1; min-width: 120px;
  font-size: 0.9rem; color: var(--text); background: transparent;
  padding: 0.1rem 0.25rem;
}

/* ── Category buttons ── */
.category-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.5rem;
}
.cat-btn {
  display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
  padding: 0.75rem 0.5rem; border-radius: var(--radius-sm);
  border: 2px solid var(--border); background: white; cursor: pointer;
  font-size: 0.82rem; font-weight: 600; color: var(--text-muted);
  transition: all 0.15s ease; text-align: center;
}
.cat-btn .cat-emoji { font-size: 1.6rem; }
.cat-btn:hover { border-color: var(--accent); color: var(--primary); background: var(--accent-light); }
.cat-btn.active { border-color: var(--primary); color: var(--primary); background: var(--accent-light); }

/* ── Loading ── */
.loading-box {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 1rem; padding: 4rem 2rem;
  color: var(--text-muted); text-align: center;
}
.spinner {
  width: 48px; height: 48px; border: 4px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Recipe cards ── */
.recipes-grid { display: flex; flex-direction: column; gap: 2rem; margin-top: 1.5rem; }
.recipe-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 2px 16px var(--shadow);
  overflow: hidden; animation: slideUp 0.3s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.recipe-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white; padding: 1.5rem 2rem;
}
.recipe-title-row {
  display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem;
}
.recipe-emoji { font-size: 2.5rem; }
.recipe-title { font-size: 1.5rem; font-weight: 700; }
.recipe-meta { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.meta-chip {
  background: rgba(255,255,255,0.2); border-radius: 99px;
  padding: 0.2rem 0.65rem; font-size: 0.8rem; font-weight: 500;
}
.recipe-body { padding: 1.75rem 2rem; }
.recipe-description { color: var(--text-muted); margin-bottom: 1.5rem; font-size: 0.95rem; }
.recipe-two-col {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1.5rem; margin-bottom: 1.5rem;
}
@media (max-width: 600px) { .recipe-two-col { grid-template-columns: 1fr; } }
.recipe-section h3 {
  font-size: 0.9rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--primary); margin-bottom: 0.6rem;
  padding-bottom: 0.4rem; border-bottom: 2px solid var(--border);
}
.ingredient-list { list-style: none; }
.ingredient-list li {
  padding: 0.3rem 0; border-bottom: 1px solid var(--bg);
  font-size: 0.9rem; display: flex; align-items: center; gap: 0.5rem;
}
.ingredient-list li::before { content: "·"; color: var(--accent); font-weight: 900; }
.missing-list { list-style: none; }
.missing-list li {
  padding: 0.3rem 0; font-size: 0.9rem;
  color: var(--danger); display: flex; align-items: center; gap: 0.5rem;
}
.missing-list li::before { content: "✗"; font-weight: 700; }
.all-good-box {
  background: var(--success-bg); border-radius: var(--radius-sm);
  padding: 1rem; text-align: center; color: var(--success);
}
.all-good-box .check-icon { font-size: 2rem; margin-bottom: 0.25rem; }
.all-good-box p { font-weight: 600; font-size: 0.9rem; }
.steps-section { margin-bottom: 1.5rem; }
.steps-section h3 {
  font-size: 0.9rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--primary); margin-bottom: 0.75rem;
  padding-bottom: 0.4rem; border-bottom: 2px solid var(--border);
}
.steps-list { list-style: none; counter-reset: step-counter; }
.steps-list li {
  counter-increment: step-counter;
  display: flex; gap: 1rem; padding: 0.6rem 0;
  border-bottom: 1px solid var(--bg); font-size: 0.9rem;
}
.steps-list li::before {
  content: counter(step-counter);
  min-width: 1.8rem; height: 1.8rem;
  background: var(--primary); color: white;
  border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-size: 0.75rem; font-weight: 700;
  flex-shrink: 0; margin-top: 0.1rem;
}
.tip-box {
  background: var(--accent-light); border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm); padding: 1rem 1.25rem;
  display: flex; gap: 0.75rem; align-items: flex-start;
}
.tip-icon { font-size: 1.25rem; flex-shrink: 0; }
.tip-box p { font-size: 0.9rem; color: var(--text-muted); }

/* ── Admin table ── */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th {
  text-align: left; padding: 0.6rem 0.75rem;
  background: var(--accent-light); color: var(--primary);
  font-weight: 700; font-size: 0.8rem; text-transform: uppercase;
  letter-spacing: 0.04em; border-bottom: 2px solid var(--border);
}
.data-table td {
  padding: 0.7rem 0.75rem; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:hover td { background: var(--bg); }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 1rem;
}
.modal-box {
  background: white; border-radius: var(--radius); padding: 2rem;
  max-width: 400px; width: 100%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.modal-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; color: var(--primary); }
.modal-actions { display: flex; gap: 0.75rem; margin-top: 1.25rem; }
.hidden { display: none !important; }

/* ── Misc ── */
.greeting-box {
  background: var(--accent-light); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.9rem 1.25rem;
  font-style: italic; color: var(--primary); margin-bottom: 1.5rem;
  display: flex; align-items: center; gap: 0.6rem;
}
.section-title {
  font-size: 1.3rem; font-weight: 700; color: var(--primary); margin-bottom: 0.25rem;
}
.section-sub { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.25rem; }

/* ── Cook Mode ── */
#cookmode-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: #1a0a00;
  display: flex; flex-direction: column;
}
#cookmode-overlay.hidden { display: none; }
.cm-container {
  display: flex; flex-direction: column; height: 100%;
  max-width: 680px; margin: 0 auto; width: 100%; padding: 0;
}
.cm-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; background: rgba(0,0,0,0.3);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.cm-title {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 1rem; font-weight: 700; color: rgba(255,255,255,0.9);
  overflow: hidden;
}
.cm-title span:last-child {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px;
}
.cm-emoji { font-size: 1.4rem; flex-shrink: 0; }
.cm-header-actions { display: flex; gap: 0.5rem; }
.cm-btn-icon {
  background: rgba(255,255,255,0.1); border: none; border-radius: 8px;
  width: 38px; height: 38px; font-size: 1.1rem; cursor: pointer;
  color: white; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.cm-btn-icon:hover { background: rgba(255,255,255,0.2); }
.cm-progress-wrap {
  height: 4px; background: rgba(255,255,255,0.15); flex-shrink: 0;
}
.cm-progress-bar {
  height: 100%; background: var(--accent);
  transition: width 0.3s ease;
}
.cm-step-count {
  text-align: center; font-size: 0.8rem; font-weight: 600;
  color: rgba(255,255,255,0.5); padding: 0.6rem 1rem 0;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.cm-ingredients {
  margin: 0.75rem 1.25rem; background: rgba(255,255,255,0.08);
  border-radius: var(--radius-sm); padding: 1rem 1.25rem;
  max-height: 200px; overflow-y: auto;
}
.cm-ingredients h3 {
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--accent); margin-bottom: 0.5rem;
}
.cm-ingredients ul { list-style: none; }
.cm-ingredients li {
  font-size: 0.9rem; color: rgba(255,255,255,0.8);
  padding: 0.2rem 0; border-bottom: 1px solid rgba(255,255,255,0.06);
}
.cm-step-area {
  flex: 1; display: flex; flex-direction: column;
  justify-content: center; padding: 2rem 1.75rem;
  overflow-y: auto;
}
.cm-step-text {
  font-size: clamp(1.2rem, 4vw, 1.6rem);
  color: white; line-height: 1.7; text-align: center;
  font-weight: 400;
}
.cm-tip {
  margin-top: 1.5rem; background: rgba(232,164,90,0.15);
  border-left: 3px solid var(--accent); border-radius: var(--radius-sm);
  padding: 0.9rem 1.1rem; font-size: 0.9rem;
  color: rgba(255,255,255,0.75); text-align: left;
}
.cm-nav {
  display: flex; gap: 1rem; padding: 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  background: rgba(0,0,0,0.2);
}
.cm-nav-btn {
  flex: 1; padding: 1rem; border-radius: var(--radius-sm);
  font-size: 1.1rem; font-weight: 700; cursor: pointer; border: none;
  background: rgba(255,255,255,0.12); color: white;
  transition: background 0.15s;
}
.cm-nav-btn:hover:not(:disabled) { background: rgba(255,255,255,0.2); }
.cm-nav-btn:disabled { opacity: 0.25; cursor: not-allowed; }
.cm-nav-next { background: var(--primary); }
.cm-nav-next:hover { background: var(--primary-hover); }
.cm-nav-done { background: var(--success); }
.cm-nav-done:hover { background: #236040; }

@media (max-width: 768px) {
  .card { padding: 1.25rem; }
  .recipe-header { padding: 1.25rem; }
  .recipe-body { padding: 1.25rem; }
  .recipe-title { font-size: 1.2rem; }
}
