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

:root {
  --bg:        #0f0f0f;
  --surface:   #1a1a1a;
  --border:    #2a2a2a;
  --accent:    #f5a623;
  --accent2:   #e8951f;
  --green:     #2ecc71;
  --blue:      #3498db;
  --red:       #e74c3c;
  --text:      #f0f0f0;
  --muted:     #888;
  --radius:    10px;
}

html.light {
  --bg:      #f0f0f0;
  --surface: #ffffff;
  --border:  #d0d0d0;
  --text:    #111111;
  --muted:   #666666;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  overflow: hidden;
  user-select: none;
}

/* ── LAYOUT ── */
#app {
  display: grid;
  grid-template-rows: 100px 1fr;
  grid-template-columns: 1fr 420px;
  height: 100vh;
}

/* ── CATEGORIES ── */
#categories {
  grid-column: 1 / 2;
  grid-row: 1 / 2;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}

#categories::-webkit-scrollbar { display: none; }

#admin-btn {
  flex-shrink: 0;
  padding: 22px 36px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 1.3rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  margin-right: 8px;
}
#admin-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── ADMIN OVERLAY ── */
#admin-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
#admin-overlay.open { opacity: 1; pointer-events: all; }

#admin-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#admin-header {
  padding: 24px 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#admin-header h2 { font-size: 1.4rem; font-weight: 700; }

#admin-sluiten {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.15s;
}
#admin-sluiten:hover { border-color: var(--red); color: var(--red); }

#admin-print {
  height: 44px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.15s;
}
#admin-print:hover { border-color: var(--accent); color: var(--accent); }

@media print {
  #admin-overlay { opacity: 1 !important; pointer-events: all !important; background: #fff !important; }
  #admin-panel { width: 100% !important; max-height: none !important; border: none !important; background: #fff !important; color: #000 !important; }
  #admin-header button { display: none !important; }
  .admin-stat { background: #f5f5f5 !important; }
  .admin-stat-label { color: #555 !important; }
  .admin-stat-value { color: #000 !important; }
  .admin-stat-value.accent, .admin-stat-value.green { color: #000 !important; }
  body > *:not(#admin-overlay) { display: none !important; }
}

#admin-content {
  padding: 28px;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.admin-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
  margin-bottom: 20px;
}

.admin-stat {
  background: var(--bg);
  border-radius: 10px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-stat-label { font-size: 0.85rem; color: var(--muted); }
.admin-stat-value { font-size: 2rem; font-weight: 700; color: var(--text); }
.admin-stat-value.green { color: var(--green); }
.admin-stat-value.accent { color: var(--accent); }


/* ── PIN NUMPAD ── */
.pin-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 8px 0;
}

.pin-label {
  font-size: 0.95rem;
  color: var(--muted);
}

.pin-error {
  font-size: 0.9rem;
  color: var(--red);
  font-weight: 600;
}

.pin-dots {
  display: flex;
  gap: 12px;
}

.pin-dots span {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  transition: background 0.1s, border-color 0.1s;
}

.pin-dots span.filled {
  background: var(--accent);
  border-color: var(--accent);
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 72px);
  gap: 10px;
}

.pin-key {
  height: 72px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pin-key:hover  { border-color: var(--accent); color: var(--accent); }
.pin-key:active { transform: scale(0.93); }

.pin-key-del { font-size: 1.2rem; color: var(--muted); }
.pin-key-ok  { background: var(--green); border-color: var(--green); color: #fff; }
.pin-key-ok:hover { background: #27ae60; border-color: #27ae60; color: #fff; }

.pin-reset-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline;
}

.pin-reset-btn:hover { color: var(--text); }

/* ── THEME DROPDOWN ── */
#theme-select {
  height: 44px;
  padding: 0 28px 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color 0.15s;
}
#theme-select:hover { border-color: var(--accent); }
#theme-select option { background: var(--surface); color: var(--text); }

.admin-btw-tabel {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.admin-btw-tabel td { padding: 10px 0; border-bottom: 1px solid var(--border); }
.admin-btw-tabel td:last-child { text-align: right; color: var(--accent); font-weight: 600; }
.admin-btw-tabel tr:last-child td { border-bottom: none; }

.cat-btn {
  flex-shrink: 0;
  padding: 22px 52px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 1.5rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.cat-btn:hover { border-color: var(--accent); color: var(--text); }
.cat-btn.active { background: var(--accent); border-color: var(--accent); color: #000; font-weight: 700; }

/* ── PRODUCTS ── */
#products {
  grid-column: 1 / 2;
  grid-row: 2 / 3;
  padding: 16px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
  align-content: start;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 28px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 180px;
  justify-content: center;
}

.product-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.product-card:active { transform: scale(0.96); background: #222; }

.product-name {
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
}

.product-price {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
}

.product-btw {
  font-size: 1rem;
  color: var(--muted);
}

/* ── RECEIPT ── */
#receipt {
  grid-column: 2 / 3;
  grid-row: 1 / 3;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

#receipt-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#receipt-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
}

#clear-btn {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  border: 2px solid var(--red);
  background: transparent;
  color: var(--red);
  font-size: 1.6rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

#clear-btn:hover { background: var(--red); color: #fff; }

#receipt-items {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#receipt-items::-webkit-scrollbar { width: 4px; }
#receipt-items::-webkit-scrollbar-track { background: transparent; }
#receipt-items::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.receipt-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--bg);
  border-radius: 10px;
}

.receipt-item-name {
  font-size: 1.1rem;
  font-weight: 500;
}

.receipt-item-qty {
  display: flex;
  align-items: center;
  gap: 10px;
}

.qty-btn {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s;
}

.qty-btn:hover { border-color: var(--accent); color: var(--accent); }

.qty-num {
  font-size: 1.3rem;
  font-weight: 700;
  min-width: 28px;
  text-align: center;
}

.receipt-item-price {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
  min-width: 70px;
  text-align: right;
}

#receipt-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.85rem;
  gap: 8px;
}

/* ── TOTAAL + BTW ── */
#receipt-footer {
  border-top: 1px solid var(--border);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#btw-overzicht {
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

#btw-overzicht span { display: flex; justify-content: space-between; }

#totaal-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

#totaal-label { font-size: 0.9rem; color: var(--muted); }
#totaal-bedrag { font-size: 2.4rem; font-weight: 700; color: var(--text); }

#betaal-knoppen {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.betaal-btn {
  padding: 28px 8px;
  border: none;
  border-radius: var(--radius);
  font-size: 1.4rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.betaal-btn:active { transform: scale(0.97); }
.betaal-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.betaal-icon { font-size: 2rem; }

#cash-btn { background: var(--green); color: #fff; }
#cash-btn:not(:disabled):hover { background: #27ae60; }
#kaart-btn { background: var(--blue); color: #fff; }
#kaart-btn:not(:disabled):hover { background: #2980b9; }

/* ── BETAALMETHODE MODAL ── */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

#modal-overlay.open { opacity: 1; pointer-events: all; }

#modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  width: 380px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

#modal h3 { font-size: 1.3rem; font-weight: 600; text-align: center; }

#payment-methods {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.pay-btn {
  padding: 20px 8px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.15s;
}

.pay-btn:hover { border-color: var(--accent); }
.pay-btn.selected { border-color: var(--accent); background: rgba(245,166,35,0.1); }

.pay-icon { font-size: 1.8rem; }

#modal-bevestig {
  width: 100%;
  padding: 14px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}

#modal-bevestig:disabled { opacity: 0.4; cursor: not-allowed; }
#modal-bevestig:not(:disabled):hover { opacity: 0.85; }

#modal-annuleer {
  width: 100%;
  padding: 10px;
  background: transparent;
  color: var(--muted);
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
}

#modal-annuleer:hover { color: var(--text); }

/* ── LOADING / ERROR ── */
#status-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 200;
}

#status-screen.hidden { display: none; }

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

#status-msg { font-size: 0.95rem; color: var(--muted); }

#retry-btn {
  padding: 10px 24px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: none;
}

/* ── PRINT (POS80 — 80mm thermisch) ── */
@media print {
  @page {
    size: 80mm auto;
    margin: 0;
  }
  body * { visibility: hidden; }
  #print-ticket, #print-ticket * { visibility: visible; }
  #print-ticket {
    position: fixed;
    top: 0; left: 0;
    width: 76mm;
    padding: 4mm;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    line-height: 1.4;
    color: #000;
    background: #fff;
  }
}
