/* ==========================================================================
   Recepten PWA - stijl
   Palet:  achtergrond antraciet/espresso, brass-goud accent, paprika-rood voor
           allergenen. Type: Fjalla One (koppen, ticket-lettering), Work Sans
           (leestekst), IBM Plex Mono (tijden/porties, zoals een keukentimer).
   Signatuur: recepten als "expo-tickets" met een geponste scheurlijn tussen
   foto en tekst - een knipoog naar de bonnetjes op de pass in een keuken.
   ========================================================================== */

:root {
  --bg: #17140F;
  --surface: #221D16;
  --surface-2: #2D2619;
  --accent: #C99A2E;
  --accent-dark: #96751F;
  --accent-2: #7A2E22;
  --text: #F4EEE1;
  --muted: #B8AC94;
  --line: #3A3223;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(0,0,0,0.35);
  --tap: 48px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Work Sans', system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

h1, h2, h3, .display {
  font-family: 'Fjalla One', 'Work Sans', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-weight: 400;
  margin: 0;
}

.mono { font-family: 'IBM Plex Mono', monospace; letter-spacing: 0.02em; }

a { color: var(--accent); }

button, input, select, textarea { font-family: inherit; font-size: 1rem; color: var(--text); }

button {
  cursor: pointer;
  min-height: var(--tap);
  border-radius: 10px;
  border: none;
  padding: 0 20px;
  font-weight: 600;
}

.btn-primary { background: var(--accent); color: #191408; }
.btn-primary:active { background: var(--accent-dark); }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.btn-danger { background: var(--accent-2); color: var(--text); }
.btn-ghost { background: transparent; color: var(--muted); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

input, select, textarea {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  min-height: var(--tap);
  width: 100%;
}
textarea { min-height: 90px; }
label { display: block; margin: 14px 0 6px; color: var(--muted); font-size: 0.9rem; }

/* ---------- App shell ---------- */
#app { max-width: 1100px; margin: 0 auto; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  background: linear-gradient(180deg, var(--bg) 70%, transparent);
  border-bottom: 1px solid var(--line);
}
.topbar__brand { display: flex; align-items: baseline; gap: 10px; }
.topbar__brand .tenant { color: var(--accent); font-size: 1.3rem; }
.topbar__brand .app-name { color: var(--muted); font-size: 0.8rem; }
.topbar__actions { display: flex; gap: 8px; align-items: center; }

.status-pill {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.status-pill.offline { color: var(--accent-2); border-color: var(--accent-2); }
.status-pill.syncing { color: var(--accent); border-color: var(--accent); }

.filters {
  display: flex; gap: 8px; overflow-x: auto; padding: 12px 18px;
  -webkit-overflow-scrolling: touch;
}
.chip {
  flex: none;
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); font-size: 0.85rem;
  min-height: 38px;
}
.chip.active { background: var(--accent); color: #191408; border-color: var(--accent); font-weight: 600; }

main { padding: 8px 18px 90px; }

.fab {
  position: fixed; right: 20px; bottom: 24px; z-index: 30;
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--accent); color: #191408; font-size: 2rem; line-height: 1;
  box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center;
}
.fab-secondary {
  bottom: 96px; width: 52px; height: 52px; font-size: 1.5rem;
  background: var(--surface-2); color: var(--accent); border: 1px solid var(--accent);
}

.scan-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10, 8, 5, 0.92);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 30px; text-align: center;
}
.scan-spinner {
  width: 44px; height: 44px; border-radius: 50%;
  border: 4px solid var(--surface-2); border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.scan-overlay p { color: var(--text); font-size: 1.05rem; max-width: 320px; }
.scan-banner {
  background: var(--surface-2); border: 1px solid var(--accent); border-radius: 10px;
  padding: 12px 16px; margin: 14px 0; color: var(--accent); font-size: 0.9rem;
}

/* ---------- Ticket cards (signature element) ---------- */
.ticket-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px;
  margin-top: 8px;
}
.ticket {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.ticket__media {
  position: relative; aspect-ratio: 4/3; background: var(--surface-2);
}
.ticket__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ticket__stamp {
  position: absolute; top: 10px; left: 10px;
  background: var(--accent); color: #191408;
  font-family: 'IBM Plex Mono', monospace; font-size: 0.68rem; font-weight: 600;
  padding: 5px 10px; border-radius: 999px; text-transform: uppercase;
}
.ticket__pending {
  position: absolute; top: 10px; right: 10px;
  background: var(--bg); color: var(--accent-2); border: 1px solid var(--accent-2);
  font-family: 'IBM Plex Mono', monospace; font-size: 0.65rem;
  padding: 4px 8px; border-radius: 999px;
}

/* geponste scheurlijn tussen foto en tekst */
.ticket__tear {
  position: relative;
  height: 1px;
  background: repeating-linear-gradient(90deg, var(--line) 0 6px, transparent 6px 12px);
}
.ticket__tear::before, .ticket__tear::after {
  content: ''; position: absolute; top: -7px; width: 14px; height: 14px;
  background: var(--bg); border-radius: 50%;
}
.ticket__tear::before { left: -7px; }
.ticket__tear::after { right: -7px; }

.ticket__body { padding: 14px 16px 18px; flex: 1; display: flex; flex-direction: column; }
.ticket__title { font-size: 1.25rem; line-height: 1.15; }
.ticket__subtitle { color: var(--muted); font-size: 0.88rem; margin-top: 4px; }
.ticket__meta { display: flex; gap: 14px; margin-top: auto; padding-top: 12px; }
.ticket__meta span { display: flex; align-items: center; gap: 5px; font-size: 0.8rem; color: var(--accent); }

.empty-state {
  text-align: center; padding: 60px 20px; color: var(--muted);
}
.empty-state h2 { color: var(--text); margin-bottom: 8px; }

/* ---------- Login ---------- */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-card {
  width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 32px 26px; box-shadow: var(--shadow);
}
.login-card h1 { font-size: 1.9rem; color: var(--accent); margin-bottom: 4px; }
.login-card .tag { color: var(--muted); margin-bottom: 22px; display: block; font-size: 0.9rem; }
.error-text { color: var(--accent-2); font-size: 0.88rem; margin-top: 10px; min-height: 1.2em; }

/* ---------- Recipe detail ---------- */
.detail-hero { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); margin-top: 8px; }
.detail-hero img { width: 100%; max-height: 340px; object-fit: cover; display: block; }
.detail-gallery { display: flex; gap: 8px; overflow-x: auto; padding: 10px; background: var(--surface); }
.detail-gallery img { width: 92px; height: 92px; object-fit: cover; border-radius: 8px; flex: none; }
.detail-title { font-size: 2rem; margin-top: 18px; }
.detail-subtitle { color: var(--muted); margin-top: 4px; }
.detail-meta-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; }
.meta-chip {
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px;
  font-size: 0.82rem; color: var(--accent);
}
.allergen-chip { border-color: var(--accent-2); color: var(--accent-2); }

.detail-columns { display: grid; grid-template-columns: 1fr; gap: 26px; margin-top: 10px; }
@media (min-width: 760px) {
  .detail-columns { grid-template-columns: 320px 1fr; }
}
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.panel h3 { color: var(--accent); font-size: 1rem; margin-bottom: 12px; }
.ingredient-list { list-style: none; margin: 0; padding: 0; }
.ingredient-list li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 0.95rem;
}
.ingredient-list li .amount { color: var(--accent); font-family: 'IBM Plex Mono', monospace; white-space: nowrap; }

.step-list { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.step-list li {
  counter-increment: step;
  display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line);
}
.step-list li:last-child { border-bottom: none; }
.step-list li::before {
  content: counter(step);
  font-family: 'IBM Plex Mono', monospace; font-weight: 600;
  background: var(--surface-2); color: var(--accent);
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; flex: none;
}

.notes-box { margin-top: 20px; }
.notes-box p { white-space: pre-line; }
.step-list li .step-content { white-space: pre-line; }

.detail-actions { display: flex; gap: 10px; margin: 18px 0; flex-wrap: wrap; }

/* ---------- Form ---------- */
.form-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-top: 16px; }
.repeat-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.repeat-row input, .repeat-row textarea { flex: 1; }
.icon-btn { min-height: 40px; width: 40px; padding: 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; color: var(--muted); }

.photo-grid { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.photo-thumb { position: relative; width: 100px; height: 100px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb button {
  position: absolute; top: 2px; right: 2px; min-height: auto; width: 22px; height: 22px;
  padding: 0; border-radius: 50%; background: var(--accent-2); color: var(--text); font-size: 0.8rem; line-height: 1;
}
.photo-add {
  width: 100px; height: 100px; border-radius: 8px; border: 2px dashed var(--line);
  display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 2rem;
  background: transparent;
}

.form-actions { position: sticky; bottom: 0; display: flex; gap: 10px; padding: 14px 0; background: linear-gradient(0deg, var(--bg) 60%, transparent); }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
  padding: 12px 20px; border-radius: 10px; box-shadow: var(--shadow); z-index: 50;
  font-size: 0.9rem;
}

.detail-hero img, .detail-gallery img { cursor: zoom-in; }

.lightbox-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10, 8, 5, 0.92);
  display: flex; align-items: center; justify-content: center;
  padding: 30px;
}
.lightbox-img {
  max-width: 100%; max-height: 100%;
  border-radius: 10px;
  box-shadow: var(--shadow);
  object-fit: contain;
}
.lightbox-close {
  position: absolute; top: 16px; right: 16px;
  width: 46px; height: 46px; min-height: 46px; padding: 0;
  border-radius: 50%; background: var(--surface-2); color: var(--text);
  font-size: 1.6rem; line-height: 1; border: 1px solid var(--line);
}
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 52px; height: 52px; min-height: 52px; padding: 0;
  border-radius: 50%; background: var(--surface-2); color: var(--text);
  font-size: 2rem; line-height: 1; border: 1px solid var(--line);
}
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }
@media (max-width: 600px) {
  .lightbox-nav { width: 44px; height: 44px; min-height: 44px; font-size: 1.6rem; }
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
