/* style.css — Voorraadkast, mobile-first, Apple-achtige stijl */

:root {
  --accent: #0071e3;
  --accent-dark: #0058b0;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --text: #1d1d1f;
  --text-muted: #6e6e73;
  --border: #d2d2d7;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.04);

  --expired: #ff3b30;
  --soon: #ff9500;
  --warning: #ffcc00;
  --ok: #34c759;
  --none: #a1a1a6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --text: #f5f5f7;
    --text-muted: #98989d;
    --border: #38383a;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

.container { max-width: 900px; margin: 0 auto; padding: 16px; padding-bottom: 96px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: rgba(255,255,255,.85);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
@media (prefers-color-scheme: dark) {
  .topbar { background: rgba(28,28,30,.85); }
}
.topbar h1 { font-size: 18px; margin: 0; }
.topbar nav { display: flex; gap: 8px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 18px;
}

/* Stats */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.stat-card {
  background: var(--surface); border-radius: var(--radius); padding: 14px;
  text-align: center; box-shadow: var(--shadow);
}
.stat-card .num { font-size: 24px; font-weight: 700; }
.stat-card .lbl { font-size: 12px; color: var(--text-muted); }

/* Filters */
.filters {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px;
}
.filters input, .filters select {
  flex: 1 1 auto; min-width: 120px;
  padding: 10px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 15px;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 18px; border-radius: 12px; border: none;
  background: var(--accent); color: #fff; font-size: 15px; font-weight: 600;
  min-height: 44px; cursor: pointer;
}
.btn:active { background: var(--accent-dark); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: var(--expired); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 12px; font-size: 13px; min-height: 36px; }
.fab {
  position: fixed; right: 20px; bottom: 24px; z-index: 30;
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 28px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(0,113,227,.4); border: none;
}

/* Product grid */
.grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .grid { grid-template-columns: 1fr 1fr; } }

.card {
  background: var(--surface); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow);
  border-left: 5px solid var(--none);
}
.card.tht-expired { border-left-color: var(--expired); }
.card.tht-soon { border-left-color: var(--soon); }
.card.tht-warning { border-left-color: var(--warning); }
.card.tht-ok { border-left-color: var(--ok); }
.card.tht-none { border-left-color: var(--none); }

.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.card-title { font-size: 16px; font-weight: 600; margin: 0 0 2px; }
.card-icon { font-size: 22px; }
.card-meta { font-size: 13px; color: var(--text-muted); margin: 4px 0; }
.card-tht {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; font-weight: 600; padding: 3px 8px; border-radius: 8px;
  background: var(--bg);
}
.card-actions { display: flex; gap: 8px; margin-top: 10px; }

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

/* Forms */
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { font-size: 14px; font-weight: 600; display: flex; flex-direction: column; gap: 6px; }
.form input, .form select, .form textarea {
  padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 16px; font-weight: 400;
}
.form-row { display: flex; gap: 10px; }
.form-row > label { flex: 1; }

/* Auth pages */
.auth-wrap {
  max-width: 380px; margin: 60px auto; padding: 24px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
}
.auth-form { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.auth-form input {
  padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 16px;
}

/* Alerts */
.alert { padding: 12px 14px; border-radius: 10px; font-size: 14px; margin: 10px 0; }
.alert-error { background: #ff3b3020; color: var(--expired); }
.alert-success { background: #34c75920; color: var(--ok); }
.alert-warning { background: #ff950020; color: var(--soon); }

/* Scanner modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface); border-radius: var(--radius);
  width: 100%; max-width: 420px; padding: 16px; max-height: 90vh; overflow-y: auto;
}
.modal h2 { margin-top: 0; font-size: 17px; }
#scanner-viewport { width: 100%; border-radius: 10px; overflow: hidden; background: #000; min-height: 260px; }
.modal-actions { display: flex; gap: 8px; margin-top: 12px; }

.product-preview {
  display: flex; gap: 12px; align-items: center;
  background: var(--bg); border-radius: 10px; padding: 10px; margin-top: 10px;
}
.product-preview img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; background: #fff; }
.loading { text-align: center; color: var(--text-muted); padding: 10px; font-size: 14px; }

/* Categories page */
.cat-list { display: flex; flex-direction: column; gap: 8px; }
.cat-row {
  display: flex; align-items: center; gap: 10px; background: var(--surface);
  border-radius: 12px; padding: 10px 14px; box-shadow: var(--shadow);
}
.cat-row .cat-name { flex: 1; font-weight: 600; }

/* Scan mode list */
.scan-log { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.scan-log-item {
  background: var(--surface); border-radius: 10px; padding: 10px 12px;
  display: flex; justify-content: space-between; align-items: center; box-shadow: var(--shadow);
}
