:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --border: #e2e4e8;
  --text: #1a1c20;
  --muted: #6b7280;
  --accent: #1db954;
  --accent-dark: #169c46;
  --blue: #2563eb;
  --amber: #d97706;
  --gray: #9ca3af;
}

* { box-sizing: border-box; }

/* Algemene hidden-class — cruciaal: zonder deze regel doet classList.add('hidden')
   niks voor elementen die geen eigen specifieke .xxx.hidden regel hebben. */
.hidden { display: none !important; }

body {
  margin: 0;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* Browsers gebruiken standaard hun eigen systeemlettertype voor formulier-
   elementen, ook als de pagina zelf een ander lettertype heeft — dit zorgt
   dat knoppen, invoervelden en dropdowns Montserrat ook echt overnemen. */
button, input, select, textarea {
  font-family: inherit;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #000000;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h1 { font-size: 18px; margin: 0; color: #ffffff; }
.topbar-left { display: flex; align-items: center; gap: 12px; }
.logo { height: 56px; width: auto; display: block; filter: invert(1); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.last-sync { font-size: 13px; color: #cbd5e1; }
.stock-warning {
  background: #f59e0b;
  color: #1a1a1a;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 20px;
}
.stock-warning.hidden { display: none; }

main { padding: 24px; max-width: 1100px; margin: 0 auto; }

.filters-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.filters { display: flex; gap: 8px; flex-wrap: wrap; }

.selection-bar { display: flex; align-items: center; gap: 10px; }
.selection-bar span { font-size: 13px; color: var(--muted); }

.bulk-status-select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 13px;
  background: var(--card);
}

.search-bar { flex: 1; min-width: 220px; max-width: 360px; }
.search-bar input {
  width: 100%;
  padding: 9px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  font-size: 13px;
  outline: none;
}
.search-bar input:focus { border-color: var(--blue); }

.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.load-more-btn {
  padding: 10px 18px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.load-more-icon { font-size: 15px; }
.filter-btn {
  padding: 8px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
}
.filter-btn.active { background: var(--text); color: white; border-color: var(--text); }

.btn {
  padding: 8px 14px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #d5d8dd; }
.btn-whatsapp { background: #25d366; color: white; }
.btn-whatsapp:hover { background: #1eb455; }
.btn-primary { background: var(--blue); color: white; }
.btn-primary:hover { background: #1d4ed8; }
.btn-spotify { background: var(--accent); color: white; }
.btn-spotify:hover { background: var(--accent-dark); }
.btn-qr { background: #374151; color: white; }
.btn-qr:hover { background: #1f2937; }
.btn-status { background: var(--amber); color: white; }
.btn-status:hover { background: #b45309; }
.btn-status.done { background: #16a34a; }

.orders-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
/* Op een smal scherm past de tabel (8 kolommen) niet naast elkaar — i.p.v. de
   inhoud onleesbaar samen te persen, laten we 'm gewoon zijwaarts scrollen.
   Op een breed scherm (desktop) verandert hier niets aan. */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px;
}
.table-scroll .orders-table { min-width: 720px; box-shadow: none; }
.orders-table th, .orders-table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.orders-table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
.orders-table tbody tr:hover { background: #fafbfc; cursor: pointer; }
.orders-table tbody tr .no-row-open { cursor: default; }
.orders-table tbody tr .no-row-open input[type="checkbox"] { cursor: pointer; }
.empty-row { text-align: center; color: var(--muted); padding: 40px 0; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.badge.wacht-op-drukwerkbestand { background: #fee2e2; color: #b91c1c; }
.badge.wacht-op-productie { background: #fef3c7; color: #92400e; }
.badge.verzonden { background: #dcfce7; color: #166534; }
.badge.geannuleerd { background: #e5e7eb; color: #4b5563; }
.badge.onjuiste-gegevens { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.badge.other { background: #e5e7eb; color: #374151; }

.spotify-dot { color: var(--accent); font-size: 16px; }
.customer-cell {
  display: inline-flex;
  align-items: center;
}
.order-flag {
  width: 16px;
  height: 12px;
  margin-right: 6px;
  border-radius: 2px;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
  opacity: 0.85;
}

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal-overlay.hidden { display: none; }

.modal {
  background: var(--card);
  border-radius: 12px;
  width: min(600px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  padding: 24px;
  position: relative;
}

.modal-close {
  position: absolute; top: 14px; right: 14px;
  background: none; border: none; font-size: 18px; cursor: pointer; color: var(--muted);
}

.modal h2 { margin-top: 0; font-size: 18px; }
.modal-section { margin-bottom: 18px; }
.modal-section h3 { font-size: 13px; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.note-textarea {
  width: 100%;
  min-height: 70px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  margin-bottom: 10px;
  box-sizing: border-box;
}

.address-lines { margin-top: 4px; line-height: 1.5; }
.address-lines div { display: block; }

.contact-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.line-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.line-item .title { font-weight: 600; }
.line-item .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.line-item .props { font-size: 12px; color: var(--muted); margin-top: 6px; }

.spotify-link-row {
  display: flex; flex-direction: column; gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.spotify-link-row a { font-size: 13px; word-break: break-all; }
.spotify-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.code-preview { margin-top: 8px; }
.code-preview img { max-width: 220px; border-radius: 6px; border: 1px solid var(--border); }
.code-preview svg { max-width: 220px; height: auto; border-radius: 6px; border: 1px solid var(--border); background: white; }

.copyable {
  cursor: pointer;
  border-bottom: 1px dashed transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
  border-radius: 3px;
  padding: 1px 2px;
}
.copyable:hover {
  background: #eef2ff;
  border-bottom-color: var(--blue);
}
.copyable.copied-flash {
  background: #dcfce7;
  color: #166534;
  font-weight: 600;
}

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

/* --- Pakbon / receipt printlayout (los printvenster) --- */
.receipt-page {
  width: 80mm;
  padding: 4mm;
  margin: 0 auto 6mm auto;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: #000;
  page-break-after: always;
}
.receipt-page h2 {
  font-size: 15px;
  margin: 0 0 4px 0;
  text-align: center;
}
.receipt-divider { border-top: 1px dashed #000; margin: 6px 0; }
.receipt-row { display: flex; justify-content: space-between; gap: 6px; margin: 2px 0; }
.receipt-item { margin: 6px 0; }
.receipt-item .name { font-weight: bold; }
.receipt-item .props { font-size: 11px; margin-top: 2px; }
.receipt-photo { text-align: center; margin: 6px 0; }
.receipt-photo img { width: 45mm; max-height: 45mm; object-fit: cover; border: 1px solid #000; }
.receipt-footer { text-align: center; font-size: 11px; margin-top: 8px; }

/* Voorraad-tabblad */
.inventory-panel {
  background: var(--card);
  border-radius: 10px;
  padding: 24px 28px;
  width: 100%;
}
.inventory-panel h2 { margin: 0 0 6px 0; font-size: 18px; }
.inventory-hint { color: var(--muted); font-size: 13px; margin: 0 0 20px 0; line-height: 1.5; }
.inventory-items { display: flex; flex-direction: column; gap: 14px; margin-bottom: 20px; }
.inventory-row {
  display: grid;
  grid-template-columns: 1fr 110px 32px;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.inventory-row:last-child { border-bottom: none; padding-bottom: 0; }
.inventory-row label { font-size: 14px; font-weight: 600; }
.inventory-row .inventory-low-label { color: #b91c1c; font-size: 12px; font-weight: 600; margin-left: 8px; }
.inventory-row input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 14px;
  text-align: right;
}
.inventory-row input.low-stock { border-color: #f59e0b; background: #fffbeb; color: #b45309; font-weight: 700; }
.inventory-row .inventory-delete-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  padding: 4px 6px;
}
.inventory-row .inventory-delete-btn:hover { color: #b91c1c; }

.inventory-add-row {
  display: flex;
  gap: 8px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.inventory-add-row input[type="text"] {
  flex: 1;
  min-width: 180px;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 14px;
}
.inventory-add-row input[type="number"] {
  width: 90px;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 14px;
}

/* Hamburger-knop: standaard verborgen (alleen relevant op mobiel, zie hieronder) */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  color: #ffffff;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  margin-left: auto;
}

/* --- Mobiel (iPhone/Android e.d.) --- */
@media (max-width: 640px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 16px;
  }
  .topbar-left { display: flex; align-items: center; }
  .logo { height: 40px; }
  .mobile-menu-toggle { display: block; }

  /* Knoppenrij (drukwerkbestanden/sync/uitloggen) + statusfilters klappen
     samen open/dicht met de hamburger-knop — scheelt ruimte voor de
     ordertabel zelf. Zoekbalk + selectiebalk blijven WEL altijd zichtbaar,
     die heb je immers meteen nodig zodra je orders aanvinkt. */
  .topbar-right, .filters {
    display: none;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 8px;
  }
  .topbar-right.mobile-open { display: flex; }
  .filters.mobile-open { display: flex; overflow-x: auto; flex-wrap: nowrap; }

  .topbar-right .btn { font-size: 12px; padding: 7px 10px; }
  .last-sync { font-size: 11px; }

  main { padding: 12px; }

  .filters-row { flex-direction: column; align-items: stretch; }
  .filter-btn { flex-shrink: 0; white-space: nowrap; }
  .search-bar { max-width: none; }
  .selection-bar { flex-wrap: wrap; }

  .modal { width: 100vw; max-height: 100vh; height: 100vh; border-radius: 0; padding: 16px; }
  .modal-overlay { padding: 0; }
}
