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

:root {
  /* Orania-vlag kleure */
  --blue-deepest: #000d24;
  --blue-dark:    #001845;
  --blue:         #002868;
  --blue-mid:     #003399;
  --blue-light:   #1a5aff;
  --orange:       #f47920;
  --orange-hover: #ff8f33;
  --orange-dark:  #b85a10;

  /* UI */
  --text:    #e8edf5;
  --muted:   #7a8ba6;
  --border:  #1a3a6e;
  --success: #4ade80;
  --error:   #f87171;
  --warning: #fbbf24;
  --radius:  12px;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--blue-dark);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* ── Skerms ─────────────────────────────────────────────────────────────── */
.view {
  display: none;
  flex-direction: column;
  height: 100vh;
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.view.active { display: flex; }

.icon-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}
.icon-btn:hover { color: var(--text); background: rgba(255,255,255,0.08); }

/* ── POS-hoofinhoud ──────────────────────────────────────────────────────── */
.pos-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 1rem 1rem 0.5rem;
  overflow: visible;
}

/* ── POS: instellings-knoppie ─────────────────────────────────────────────── */
.pos-settings-btn {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 60;
  width: 42px;
  height: 42px;
  font-size: 1.15rem;
  background: rgba(0,0,0,0.18);
  border: 1px solid rgba(255,255,255,0.12);
}
.pos-settings-btn:hover {
  background: rgba(255,255,255,0.08);
}

/* ── Terminaal (kaartmasjien-liggaam) ────────────────────────────────────── */
.terminal {
  width: 100%;
  max-width: 340px;
  background: var(--blue);
  border-radius: 18px;
  padding: 1rem;
  box-shadow:
    0 5px 0 var(--blue-deepest),
    0 10px 30px rgba(0,0,0,0.55),
    inset 0 1px 0 rgba(255,255,255,0.07);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

/* ── Skermbord (LCD-vertoning) ───────────────────────────────────────────── */
.terminal-display {
  background: var(--blue-deepest);
  border-radius: 10px;
  padding: 0.95rem 0.9rem 0.9rem;
  border: 1px solid rgba(26, 90, 255, 0.25);
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.6);
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.35rem;
}

.display-row {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.6rem;
  position: relative;
}

.clear-btn {
  background: rgba(244, 121, 32, 0.15);
  border: 1px solid rgba(244, 121, 32, 0.4);
  color: var(--orange);
  border-radius: 4px;
  padding: 2px 10px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: background 0.15s;
  flex-shrink: 0;
}
.clear-btn:hover  { background: rgba(244, 121, 32, 0.3); }
.clear-btn:active { background: rgba(244, 121, 32, 0.5); }

.display-amount {
  font-size: 2.35rem;
  font-weight: 700;
  color: var(--orange);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  text-align: center;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

/* ── Sleutelbord ─────────────────────────────────────────────────────────── */
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.key {
  background: var(--blue-mid);
  border: 1px solid rgba(100, 150, 255, 0.2);
  border-bottom: 3px solid var(--blue-deepest);
  border-radius: 8px;
  color: var(--text);
  font-size: 1.45rem;
  font-weight: 500;
  cursor: pointer;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.key:hover  { background: #0044bb; }
.key:active {
  background: var(--blue-light);
  border-bottom-width: 1px;
  transform: translateY(2px);
}

.key-back {
  color: var(--orange);
  font-size: 1.1rem;
}

.key-dot {
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1;
}

/* ── Betaalknoppie ───────────────────────────────────────────────────────── */
.btn-pay {
  width: 100%;
  padding: 0.95rem;
  background: var(--orange);
  border: none;
  border-bottom: 4px solid var(--orange-dark);
  border-radius: 10px;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  cursor: pointer;
  text-transform: uppercase;
  transition: opacity 0.15s, transform 0.1s, border-bottom-width 0.07s;
  -webkit-tap-highlight-color: transparent;
}

.btn-pay:hover:not(:disabled)  { opacity: 0.9; }
.btn-pay:active:not(:disabled) {
  border-bottom-width: 1px;
  transform: translateY(3px);
}
.btn-pay:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── Wisselkoersbalk ─────────────────────────────────────────────────────── */
.rate-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.65rem;
  font-size: 0.76rem;
  color: var(--muted);
  width: 100%;
  max-width: 340px;
}

#rate-display { flex: 1; text-align: center; }

.rate-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 0.3rem;
  vertical-align: middle;
}
.rate-dot.fresh { background: var(--success); }
.rate-dot.warn  { background: var(--warning); }
.rate-dot.stale { background: var(--error); }

.rate-age { opacity: 0.65; }

.rate-refresh-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}
.rate-refresh-btn:hover { color: var(--text); background: rgba(255,255,255,0.07); }

/* ── Skerm-opskrif ──────────────────────────────────────────────────────── */
.view-header {
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
  height: 56px;
  background: var(--blue);
  border-bottom: 2px solid var(--orange);
  flex-shrink: 0;
  gap: 0.5rem;
}

.view-header h2 {
  flex: 1;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
}

.header-spacer { width: 36px; }

.back-btn { color: var(--orange); }
.back-btn:hover { color: var(--orange-hover); background: rgba(244,121,32,0.1); }

/* ── Skerminhoud ─────────────────────────────────────────────────────────── */
.view-content {
  flex: 1;
  padding: 1.5rem 1rem;
  overflow-y: auto;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
}

/* ── Instellings ─────────────────────────────────────────────────────────── */
.settings-group { margin-bottom: 1.5rem; }

.settings-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}

.settings-input {
  width: 100%;
  padding: 0.8rem 1rem;
  background: var(--blue);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s;
}
.settings-input:focus { border-color: var(--orange); }

.settings-hint {
  margin-top: 0.5rem;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
}

.btn-primary {
  width: 100%;
  padding: 0.9rem;
  background: var(--orange);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.88; }

/* ── QR-oortrekking ──────────────────────────────────────────────────────── */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 8, 36, 0.9);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.overlay.open { display: flex; }

.qr-modal {
  background: var(--blue);
  border: 1px solid var(--border);
  border-top: 3px solid var(--orange);
  border-radius: var(--radius);
  width: 100%;
  max-width: 360px;
  padding: 1.5rem;
  position: relative;
  text-align: center;
}

.setup-modal {
  background: var(--blue);
  border: 1px solid var(--border);
  border-top: 3px solid var(--orange);
  border-radius: var(--radius);
  width: 100%;
  max-width: 420px;
  padding: 1.5rem;
  position: relative;
  text-align: center;
}

.settings-modal {
  background: var(--blue);
  border: 1px solid var(--border);
  border-top: 3px solid var(--orange);
  border-radius: var(--radius);
  width: 100%;
  max-width: 420px;
  padding: 1.5rem;
  position: relative;
  text-align: center;
}

.close-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
  padding: 2px 8px;
  transition: color 0.15s;
}
.close-btn:hover { color: var(--text); }

.qr-title {
  font-size: 2.35rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  text-align: center;
  color: var(--orange);
}

.qr-sub {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.qr-wrap {
  width: 240px;
  height: 240px;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

#qr-link { display: block; line-height: 0; }

#qr-canvas { border-radius: 6px; cursor: pointer; }

.qr-expired-mask {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.10);
  z-index: 5;
}

.qr-expired-circle {
  width: 196px;
  height: 196px;
  border-radius: 50%;
  border: 10px solid rgba(248, 113, 113, 0.95);
  box-shadow: 0 0 0 6px rgba(0,0,0,0.18);
}

.qr-expired-slash {
  position: absolute;
  width: 240px;
  height: 12px;
  background: rgba(248, 113, 113, 0.95);
  transform: rotate(-38deg);
  border-radius: 8px;
  box-shadow: 0 0 0 6px rgba(0,0,0,0.18);
}

.success-icon {
  width: 140px;
  height: 140px;
  object-fit: contain;
  animation: pop-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes pop-in {
  from { transform: scale(0.4); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.qr-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  color: var(--muted);
  font-size: 0.88rem;
}

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

.status-line {
  font-size: 0.84rem;
  color: var(--muted);
  min-height: 1.4em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.expiry-line {
  margin-top: 0.4rem;
  margin-bottom: 0.35rem;
  font-size: 0.78rem;
  color: rgba(232, 237, 245, 0.78);
  text-align: center;
}

.confirm-modal {
  background: var(--blue);
  border: 1px solid var(--border);
  border-top: 3px solid var(--orange);
  border-radius: var(--radius);
  width: 100%;
  max-width: 420px;
  padding: 1.25rem;
  position: relative;
  text-align: center;
}

.confirm-title {
  font-size: 1.05rem;
  font-weight: 750;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.confirm-body {
  font-size: 0.9rem;
  color: rgba(232, 237, 245, 0.85);
  line-height: 1.5;
  margin-bottom: 1rem;
}

.confirm-actions {
  display: flex;
  gap: 0.6rem;
}

.qr-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 1rem;
}

.qr-actions .btn-secondary,
.qr-actions .btn-primary {
  width: 100%;
}

.btn-secondary {
  width: 100%;
  padding: 0.9rem;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-secondary:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.18); }

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

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

.paid-msg {
  color: var(--success);
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 0.4rem;
  animation: fade-up 0.3s ease both;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.invoice-copy {
  margin-top: 1rem;
  font-size: 0.7rem;
  color: var(--muted);
  word-break: break-all;
  text-align: left;
  background: var(--blue-deepest);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s;
  user-select: all;
}
.invoice-copy:hover { border-color: var(--orange); }

/* ── Klein skerms ────────────────────────────────────────────────────────── */
@media (max-height: 680px) {
  .terminal { gap: 0.7rem; padding: 0.8rem; }
  .terminal-display { min-height: 76px; }
  .display-amount { font-size: 1.9rem; }
  .keypad { gap: 6px; }
  .btn-pay { padding: 0.8rem; font-size: 1rem; }
}

@media (max-height: 580px) {
  .display-amount { font-size: 1.6rem; }
  .terminal { gap: 0.5rem; padding: 0.65rem; }
  .btn-pay { padding: 0.65rem; }
  .pos-main { padding: 0.6rem 0.6rem 0.3rem; }
}

@media (max-width: 360px) {
  .terminal { max-width: 100%; }
  .key { font-size: 1.2rem; }
}
