/* ─── Fonts ──────────────────────────────────────────────────────────────── */
@font-face {
  font-family: 'Cera Pro';
  src: url('/fonts/Cera-Pro-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ─── Variables ──────────────────────────────────────────────────────────── */
:root {
  --bg:         #0a0a0a;
  --surface:    #141414;
  --border:     #252525;
  --text:       #f0f0f0;
  --muted:      #666;
  --accent-in:  #00e676;
  --accent-out: #ff5252;
  --accent-ui:  #ffffff;
  --danger:     #ff5252;
  --radius:     12px;
  --mono:       'Cera Pro', monospace;
  --display:    'Cera Pro', sans-serif;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  min-height: 100vh;
  line-height: 1.5;
}

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

/* ─── Layout ─────────────────────────────────────────────────────────────── */
.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px;
}

.page--wide {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 24px;
}

/* ─── Typography ─────────────────────────────────────────────────────────── */
h1 { font-family: var(--display); font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; }
h2 { font-family: var(--display); font-size: 1.4rem; font-weight: 700; }
h3 { font-family: var(--display); font-size: 1.1rem; font-weight: 700; }

.label {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ─── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

/* ─── Forms ──────────────────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.95rem;
  padding: 10px 14px;
  width: 100%;
  transition: border-color 0.15s;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent-ui);
}

/* Number inputs are shown without the browser's increment arrows. Counts are
   typed on the numeric keypad instead, which inputmode="numeric" requests. */
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* An error message shown inside a form, beneath its fields. */
.form-error {
  color: var(--accent-out);
  font-size: 0.85rem;
  margin-bottom: 12px;
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 10px 18px;
  transition: opacity 0.15s, transform 0.1s;
  display: inline-block;
}

.btn:active { transform: scale(0.97); }
.btn:hover  { opacity: 0.88; }

.btn--primary  { background: var(--accent-ui);  color: #000; }
.btn--danger   { background: var(--danger);      color: #fff; }
.btn--ghost    { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn--sm       { font-size: 0.75rem; padding: 6px 12px; }
.btn--full     { width: 100%; text-align: center; }

/* ─── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  border-radius: 4px;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  text-transform: uppercase;
  font-weight: 500;
}
.badge--in    { background: rgba(0,230,118,0.15); color: var(--accent-in); }
.badge--out   { background: rgba(255,82,82,0.15);  color: var(--accent-out); }
.badge--both  { background: rgba(92,158,255,0.15); color: var(--accent-ui); }
.badge--off   { background: rgba(100,100,100,0.15); color: var(--muted); }

/* ─── Error ──────────────────────────────────────────────────────────────── */
.error-msg {
  background: rgba(255,82,82,0.12);
  border: 1px solid rgba(255,82,82,0.3);
  border-radius: 8px;
  color: var(--accent-out);
  font-size: 0.85rem;
  margin-bottom: 16px;
  padding: 10px 14px;
}

/* ─── Divider ─────────────────────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* ─── Stat block ─────────────────────────────────────────────────────────── */
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 8px;
}

.stat {
  text-align: center;
}

.stat__value {
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.stat__value--in    { color: var(--accent-in); }
.stat__value--out   { color: var(--accent-out); }
.stat__value--total { color: var(--text); }

.stat__label {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 4px;
}

/* ─── Counter buttons ────────────────────────────────────────────────────── */
.tap-area {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.tap-area--both    { grid-template-columns: 1fr 1fr; }
.tap-area--single  { grid-template-columns: 1fr; }

.tap-btn {
  aspect-ratio: 1 / 1;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  gap: 8px;
  transition: transform 0.1s, opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.tap-btn:active { transform: scale(0.94); opacity: 0.85; }

.tap-btn--in  { background: rgba(0,230,118,0.12); border: 2px solid var(--accent-in);  color: var(--accent-in);  }
.tap-btn--out { background: rgba(255,82,82,0.12);  border: 2px solid var(--accent-out); color: var(--accent-out); }

.tap-btn__icon { font-size: 2.5rem; line-height: 1; }

/* A disabled tap button is dimmed and does not react to presses. Buttons are
   disabled while offline and at the limits of the count. */
.tap-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.tap-btn:disabled:active { transform: none; }

/* ─── Flash ──────────────────────────────────────────────────────────────── */
@keyframes flash-in  { 0%,100% { background: rgba(0,230,118,0.12);  } 50% { background: rgba(0,230,118,0.35);  } }
@keyframes flash-out { 0%,100% { background: rgba(255,82,82,0.12);  } 50% { background: rgba(255,82,82,0.35);  } }

.tap-btn--in.flash   { animation: flash-in  0.25s ease; }
.tap-btn--out.flash  { animation: flash-out 0.25s ease; }

/* ─── Connection indicator ───────────────────────────────────────────────── */
.conn-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  margin-right: 6px;
  transition: background 0.3s;
}
.conn-dot.connected    { background: var(--accent-in); }
.conn-dot.disconnected { background: var(--accent-out); }

/* ─── Admin table ────────────────────────────────────────────────────────── */
.entrance-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}

.entrance-card__header {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.entrance-card__body {
  padding: 14px 18px;
}

.code-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.code-row:last-child { border-bottom: none; }

.code-value {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 500;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 10px;
  letter-spacing: 0.08em;
}

.spacer { flex: 1; }

/* ─── Live totals admin ──────────────────────────────────────────────────── */
.live-totals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.live-total {
  text-align: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 4px;
}

.live-total__val {
  font-family: var(--display);
  font-size: 1.4rem;
  font-weight: 800;
}

.live-total__val--in    { color: var(--accent-in); }
.live-total__val--out   { color: var(--accent-out); }
.live-total__val--inside{ color: var(--text); }

.live-total__lbl {
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ─── Modal ──────────────────────────────────────────────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h2 { margin-bottom: 16px; }

/* ─── Radio group ────────────────────────────────────────────────────────── */
.radio-group { display: flex; flex-direction: column; gap: 8px; }

.radio-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.radio-option:has(input:checked) {
  border-color: var(--accent-ui);
  background: rgba(92,158,255,0.05);
}

.radio-option input { accent-color: var(--accent-ui); }

/* ─── Nav ─────────────────────────────────────────────────────────────────── */
.nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.nav__title { flex: 1; font-family: var(--display); font-size: 1rem; font-weight: 700; }

/* ─── Public restaurant list ─────────────────────────────────────────────── */
/* One row per restaurant: name and menu link on the left, seats on the right.
   The --full modifier marks a restaurant with no seats available. */
.venue-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.venue-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.venue-row:last-child { border-bottom: none; }

.venue-row__name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1rem;
}

.venue-row__menu {
  font-size: 0.75rem;
  color: var(--muted);
  text-decoration: underline;
}

.venue-row__count {
  margin-left: auto;
  text-align: right;
  white-space: nowrap;
}

.venue-row__seats {
  font-family: var(--display);
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1.1;
}

.venue-row__available {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-in);
}

.venue-row--full .venue-row__available { color: var(--accent-out); }
.venue-row--full .venue-row__seats     { color: var(--muted); }

/* A staff code that copies itself when clicked. It keeps the appearance of
   .code-value, with the colour and cursor a button would otherwise reset. */
.code-value--copy {
  color: var(--text);
  cursor: pointer;
}

.code-value--copy:hover { border-color: var(--muted); }