/* ============================================================
   Bardot Platform — Core Stylesheet
   Dark nightclub brand theme
   ============================================================ */

:root {
  --bardot-bg:          #0a0a0f;
  --bardot-surface:     #1a1a2e;
  --bardot-primary:     #e94560;
  --bardot-secondary:   #16213e;
  --bardot-accent:      #ffd700;
  --bardot-text:        #eee;
  --bardot-text-muted:  #888;
  --bardot-success:     #00d084;
  --bardot-danger:      #ff4757;
  --bardot-radius:      0.75rem;

  /* Derived / composite */
  --bardot-border:      rgba(255, 255, 255, 0.07);
  --bardot-overlay:     rgba(10, 10, 15, 0.85);
  --bardot-glow-red:    0 0 24px rgba(233, 69, 96, 0.35);
  --bardot-glow-gold:   0 0 24px rgba(255, 215, 0, 0.30);

  /* Spacing scale */
  --sp-xs:  0.25rem;
  --sp-sm:  0.5rem;
  --sp-md:  1rem;
  --sp-lg:  1.5rem;
  --sp-xl:  2rem;
  --sp-2xl: 3rem;

  /* Typography */
  --font-sans: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Transitions */
  --transition: 150ms ease;
}

/* ============================================================
   Reset & Base
   ============================================================ */

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

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

body[data-theme="dark"] {
  background-color: var(--bardot-bg);
  color: var(--bardot-text);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--bardot-primary);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--bardot-accent); }

img, svg { display: block; max-width: 100%; }

button {
  font-family: inherit;
  cursor: pointer;
}

/* ============================================================
   Layout
   ============================================================ */

.layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - 56px); /* subtract nav height */
}

@media (max-width: 768px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Navigation (#main-nav)
   ============================================================ */

#main-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 var(--sp-lg);
  background-color: var(--bardot-secondary);
  border-bottom: 1px solid var(--bardot-border);
  backdrop-filter: blur(12px);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--bardot-text);
}

.nav-brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--bardot-primary);
  box-shadow: var(--bardot-glow-red);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.6; transform: scale(0.85); }
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  margin-left: auto;
  list-style: none;
}

.nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--bardot-text-muted);
  padding: var(--sp-xs) var(--sp-sm);
  border-radius: var(--bardot-radius);
  transition: color var(--transition), background-color var(--transition);
}
.nav-link:hover,
.nav-link[aria-current="page"] {
  color: var(--bardot-text);
  background-color: rgba(255, 255, 255, 0.06);
}

/* ============================================================
   Sidebar
   ============================================================ */

.sidebar {
  background-color: var(--bardot-secondary);
  border-right: 1px solid var(--bardot-border);
  padding: var(--sp-lg) var(--sp-md);
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
  overflow-y: auto;
}

.sidebar-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bardot-text-muted);
  padding: var(--sp-md) var(--sp-sm) var(--sp-xs);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--bardot-radius);
  font-size: 0.875rem;
  color: var(--bardot-text-muted);
  transition: background-color var(--transition), color var(--transition);
}
.sidebar-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--bardot-text);
}
.sidebar-item[aria-current="page"],
.sidebar-item.active {
  background-color: rgba(233, 69, 96, 0.12);
  color: var(--bardot-primary);
}

.sidebar-item-icon {
  width: 18px;
  height: 18px;
  opacity: 0.7;
  flex-shrink: 0;
}

/* ============================================================
   Main Content
   ============================================================ */

#content {
  padding: var(--sp-xl);
  overflow-y: auto;
}

.page-header {
  margin-bottom: var(--sp-xl);
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--bardot-text);
  line-height: 1.2;
}

.page-subtitle {
  margin-top: var(--sp-xs);
  font-size: 0.9rem;
  color: var(--bardot-text-muted);
}

/* ============================================================
   Cards
   ============================================================ */

.card {
  background-color: var(--bardot-surface);
  border: 1px solid var(--bardot-border);
  border-radius: var(--bardot-radius);
  padding: var(--sp-lg);
  min-width: 0;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-md);
}

.card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--bardot-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ============================================================
   Stat Card
   ============================================================ */

.stat-card {
  background-color: var(--bardot-surface);
  border: 1px solid var(--bardot-border);
  border-radius: var(--bardot-radius);
  padding: var(--sp-lg);
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.stat-card:hover {
  border-color: rgba(233, 69, 96, 0.3);
  box-shadow: var(--bardot-glow-red);
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bardot-text-muted);
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--bardot-text);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat-trend {
  display: flex;
  align-items: center;
  gap: var(--sp-xs);
  font-size: 0.8rem;
  font-weight: 500;
}
.stat-trend[data-trend="up"]   { color: var(--bardot-success); }
.stat-trend[data-trend="down"] { color: var(--bardot-danger); }
.stat-trend[data-trend="flat"] { color: var(--bardot-text-muted); }

/* ============================================================
   Capacity Indicator
   ============================================================ */

.capacity-indicator {
  background-color: var(--bardot-surface);
  border: 1px solid var(--bardot-border);
  border-radius: var(--bardot-radius);
  padding: var(--sp-md) var(--sp-lg);
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

.capacity-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 0.8rem;
}

.capacity-label {
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bardot-text-muted);
}

.capacity-count {
  font-size: 1.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--bardot-text);
}

.capacity-bar-track {
  height: 6px;
  background-color: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.capacity-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 400ms ease, background-color 400ms ease;
  background-color: var(--bardot-success);
}

/* Warn states driven by htmx-r data-when state machine */
.capacity-indicator[data-state-alert="true"] {
  border-color: rgba(255, 71, 87, 0.4);
}
.capacity-indicator[data-state-alert="true"] .capacity-bar-fill {
  background-color: var(--bardot-danger);
  box-shadow: 0 0 8px rgba(255, 71, 87, 0.5);
}

.capacity-alert-banner {
  display: none;
  align-items: center;
  gap: var(--sp-xs);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--bardot-danger);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
/* Shown declaratively by htmx-r when data-state-alert="true" */
[data-when="alert=true"] { display: flex; }

/* ============================================================
   Member Badge
   ============================================================ */

.member-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-xs);
  padding: 2px var(--sp-sm);
  border-radius: calc(var(--bardot-radius) / 2);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.member-badge[data-tier="partner"] {
  background-color: rgba(255, 215, 0, 0.12);
  border-color: rgba(255, 215, 0, 0.35);
  color: var(--bardot-accent);
}

.member-badge[data-tier="ambassador"] {
  background-color: rgba(233, 69, 96, 0.12);
  border-color: rgba(233, 69, 96, 0.35);
  color: var(--bardot-primary);
}

.member-badge[data-tier="individual"] {
  background-color: rgba(255, 255, 255, 0.06);
  border-color: var(--bardot-border);
  color: var(--bardot-text-muted);
}

.member-badge-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: currentColor;
}

/* ============================================================
   Loading Spinner
   ============================================================ */

.htmx-spinner {
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--sp-md);
}

/* htmx shows elements with class htmx-indicator while request is in flight */
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: flex;
}

.spinner-ring {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-top-color: var(--bardot-primary);
  animation: spin 600ms linear infinite;
}

.spinner-ring--sm { width: 16px; height: 16px; }
.spinner-ring--lg { width: 44px; height: 44px; border-width: 3px; }

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

/* ============================================================
   Toast Container
   ============================================================ */

#toast-container {
  position: fixed;
  bottom: var(--sp-lg);
  right: var(--sp-lg);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  pointer-events: none;
}

/* htmx-r-toast.js injects .bardot-toast elements */
.bardot-toast {
  pointer-events: auto;
  background-color: var(--bardot-surface);
  border: 1px solid var(--bardot-border);
  border-left: 3px solid var(--bardot-primary);
  border-radius: var(--bardot-radius);
  padding: var(--sp-sm) var(--sp-md);
  font-size: 0.875rem;
  color: var(--bardot-text);
  min-width: 260px;
  max-width: 400px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  animation: toast-in 200ms ease forwards;
}
.bardot-toast[data-type="success"] { border-left-color: var(--bardot-success); }
.bardot-toast[data-type="error"]   { border-left-color: var(--bardot-danger); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-xs);
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--bardot-radius);
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: background-color var(--transition), box-shadow var(--transition), opacity var(--transition);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background-color: var(--bardot-primary);
  color: #fff;
}
.btn-primary:hover { box-shadow: var(--bardot-glow-red); }

.btn-ghost {
  background-color: transparent;
  border-color: var(--bardot-border);
  color: var(--bardot-text-muted);
}
.btn-ghost:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: var(--bardot-text);
}

.btn-accent {
  background-color: var(--bardot-accent);
  color: #0a0a0f;
}
.btn-accent:hover { box-shadow: var(--bardot-glow-gold); }

/* ============================================================
   Grid helpers
   ============================================================ */

.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--sp-md);
}

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-lg);
  min-width: 0;
}

/* ============================================================
   Utilities
   ============================================================ */

.text-muted   { color: var(--bardot-text-muted); }
.text-primary { color: var(--bardot-primary); }
.text-accent  { color: var(--bardot-accent); }
.text-success { color: var(--bardot-success); }
.text-danger  { color: var(--bardot-danger); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.divider {
  border: none;
  border-top: 1px solid var(--bardot-border);
  margin: var(--sp-md) 0;
}

/* ============================================================
   Forms
   ============================================================ */

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
  margin-bottom: var(--sp-md);
}

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bardot-text-muted);
}

.form-control {
  background-color: var(--bardot-secondary);
  border: 1px solid var(--bardot-border);
  border-radius: var(--bardot-radius);
  color: var(--bardot-text);
  font-family: inherit;
  font-size: 0.9rem;
  padding: var(--sp-sm) var(--sp-md);
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

.form-control::placeholder {
  color: var(--bardot-text-muted);
}

.form-control:focus {
  border-color: var(--bardot-primary);
  box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.15);
  outline: none;
}

.form-control:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10L6 8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--sp-md) center;
  padding-right: 2.5rem;
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--bardot-text-muted);
}

.form-error {
  font-size: 0.75rem;
  color: var(--bardot-danger);
}

.form-control.is-invalid {
  border-color: var(--bardot-danger);
}

.form-control.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(255, 71, 87, 0.15);
}

/* ============================================================
   Tables
   ============================================================ */

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--bardot-radius);
  border: 1px solid var(--bardot-border);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table thead {
  background-color: var(--bardot-secondary);
}

.table th {
  padding: var(--sp-sm) var(--sp-md);
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bardot-text-muted);
  border-bottom: 1px solid var(--bardot-border);
  white-space: nowrap;
}

.table td {
  padding: var(--sp-sm) var(--sp-md);
  border-bottom: 1px solid var(--bardot-border);
  color: var(--bardot-text);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr {
  transition: background-color var(--transition);
}

.table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

.table-striped tbody tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.02);
}

/* ============================================================
   Modal
   ============================================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background-color: var(--bardot-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-lg);
  animation: fade-in 150ms ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background-color: var(--bardot-surface);
  border: 1px solid var(--bardot-border);
  border-radius: var(--bardot-radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modal-in 150ms ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(-8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-lg);
  border-bottom: 1px solid var(--bardot-border);
}

.modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--bardot-text);
}

.modal-close {
  background: none;
  border: none;
  color: var(--bardot-text-muted);
  font-size: 1.25rem;
  line-height: 1;
  padding: var(--sp-xs);
  border-radius: calc(var(--bardot-radius) / 2);
  transition: color var(--transition), background-color var(--transition);
}
.modal-close:hover {
  color: var(--bardot-text);
  background-color: rgba(255, 255, 255, 0.06);
}

.modal-body {
  padding: var(--sp-lg);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-sm);
  padding: var(--sp-md) var(--sp-lg);
  border-top: 1px solid var(--bardot-border);
}

/* htmx-r-modal.js targets this id */
#modal-container:empty { display: none; }

/* ============================================================
   Scrollbars (WebKit / Blink)
   ============================================================ */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.22);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

/* ============================================================
   Door Tablet UI — fullscreen scanner, decision cards
   ============================================================ */

/* Tablet fullscreen layout */
.tablet-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: var(--sp-lg);
  gap: var(--sp-lg);
}

/* Decision cards */
.decision-admit    { background: var(--bardot-success); color: #000; }
.decision-deny     { background: var(--bardot-danger);  color: #fff; }
.decision-waitlist { background: var(--bardot-accent);  color: #000; }

/* Large QR input */
.qr-input {
  font-size: 2rem;
  padding: 1rem;
  width: 100%;
  text-align: center;
  background: var(--bardot-surface);
  border: 2px solid var(--bardot-border);
  border-radius: var(--bardot-radius);
  color: var(--bardot-text);
  outline: none;
  transition: border-color var(--transition);
}
.qr-input:focus {
  border-color: var(--bardot-primary);
  box-shadow: var(--bardot-glow-red);
}

/* Scanner layout */
.scanner-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-xl);
  padding: var(--sp-xl) 0;
}

.scanner-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--bardot-primary);
}

.qr-input-wrap {
  width: 100%;
  max-width: 640px;
}

/* Decision result panel */
.decision-result-panel {
  width: 100%;
  max-width: 640px;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.decision-idle {
  text-align: center;
  color: var(--bardot-text-muted);
  font-size: 1.25rem;
}
.decision-idle-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: var(--sp-sm);
}

/* Decision card (admit/deny/waitlist) */
.decision-card {
  width: 100%;
  border-radius: var(--bardot-radius);
  padding: var(--sp-xl);
  text-align: center;
  animation: decision-pop 150ms ease;
}

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

.decision-icon  { font-size: 4rem; line-height: 1; }
.decision-label { font-size: 2.5rem; font-weight: 900; letter-spacing: 0.1em; margin: var(--sp-sm) 0; }
.decision-name  { font-size: 1.5rem; font-weight: 600; }
.decision-score { font-size: 1.1rem; margin-top: var(--sp-xs); opacity: 0.85; }
.decision-reason { font-size: 0.9rem; margin-top: var(--sp-sm); opacity: 0.75; }

/* Scanner footer nav */
.scanner-footer {
  display: flex;
  gap: var(--sp-md);
  justify-content: center;
  padding-bottom: var(--sp-lg);
}

/* Capacity bar */
.capacity-bar-inner {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  padding: var(--sp-sm) var(--sp-lg);
  background: var(--bardot-surface);
  border-radius: var(--bardot-radius);
  border: 1px solid var(--bardot-border);
}

.capacity-track {
  flex: 1;
  height: 12px;
  background: rgba(255,255,255,0.08);
  border-radius: 6px;
  overflow: hidden;
}

.capacity-fill {
  height: 100%;
  background: var(--bardot-success);
  border-radius: 6px;
  transition: width 0.4s ease, background 0.4s ease;
}

.capacity-ok   .capacity-fill { background: var(--bardot-success); }
.capacity-busy .capacity-fill { background: var(--bardot-accent);  }
.capacity-full .capacity-fill { background: var(--bardot-danger);  }

.capacity-count        { font-weight: 700; font-size: 1.1rem; white-space: nowrap; }
.capacity-status-label { font-size: 0.85rem; color: var(--bardot-text-muted); white-space: nowrap; }

/* Capacity page large display */
.capacity-display {
  text-align: center;
  padding: var(--sp-2xl);
}

.capacity-actions {
  display: flex;
  gap: var(--sp-md);
  align-items: center;
}

/* Decisions table */
.decisions-table-wrap {
  overflow-x: auto;
}

.decisions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.decisions-table th,
.decisions-table td {
  padding: var(--sp-sm) var(--sp-md);
  text-align: left;
  border-bottom: 1px solid var(--bardot-border);
}

.decisions-table th {
  font-weight: 600;
  color: var(--bardot-text-muted);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.row-admit    { background: rgba(0, 208, 132, 0.04); }
.row-deny     { background: rgba(255, 71, 87, 0.06); }
.row-waitlist { background: rgba(255, 215, 0, 0.04); }

/* Decision badge in table */
.decision-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.decision-badge.decision-admit    { background: var(--bardot-success); color: #000; }
.decision-badge.decision-deny     { background: var(--bardot-danger);  color: #fff; }
.decision-badge.decision-waitlist { background: var(--bardot-accent);  color: #000; }

/* Walk-in form layout */
.walkin-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-xl);
  flex: 1;
}

@media (max-width: 900px) {
  .walkin-layout { grid-template-columns: 1fr; }
}

.walkin-form    { padding: var(--sp-xl); }
.walkin-sidebar { display: flex; flex-direction: column; gap: var(--sp-lg); }

/* Score preview */
.score-preview-card { padding: var(--sp-lg); }

.score-big {
  font-size: 5rem;
  font-weight: 900;
  text-align: center;
  line-height: 1;
  margin: var(--sp-md) 0;
}
.score-high { color: var(--bardot-success); }
.score-mid  { color: var(--bardot-accent);  }
.score-low  { color: var(--bardot-danger);  }

.score-factors     { list-style: none; display: flex; flex-direction: column; gap: var(--sp-xs); }
.score-factor-row  { display: flex; align-items: baseline; gap: var(--sp-sm); font-size: 0.85rem; }
.factor-name       { font-weight: 600; min-width: 130px; }
.factor-score      { font-weight: 700; }
.factor-reason     { font-size: 0.8rem; }

/* Toggle group (local/tourist, dress code) */
.toggle-group { display: flex; gap: var(--sp-sm); }

.toggle-option input[type="radio"] { display: none; }

.toggle-option .toggle-label {
  display: block;
  padding: var(--sp-sm) var(--sp-lg);
  border: 1px solid var(--bardot-border);
  border-radius: var(--bardot-radius);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  user-select: none;
}

.toggle-option input[type="radio"]:checked + .toggle-label {
  background: var(--bardot-primary);
  border-color: var(--bardot-primary);
  color: #fff;
}

/* Algorithm config form */
.config-form { padding: var(--sp-xl); }

.weight-slider {
  width: 100%;
  accent-color: var(--bardot-primary);
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--bardot-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: var(--sp-lg) 0 var(--sp-sm);
}

.config-result { margin-top: var(--sp-md); }

/* Alert helpers */
.alert {
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--bardot-radius);
  margin-bottom: var(--sp-md);
  font-weight: 500;
}
.alert-success { background: rgba(0, 208, 132, 0.12); color: var(--bardot-success); border: 1px solid var(--bardot-success); }
.alert-error   { background: rgba(255, 71, 87, 0.12);  color: var(--bardot-danger);  border: 1px solid var(--bardot-danger); }

/* Button size variants */
.btn-sm  { padding: 0.35rem 0.75rem; font-size: 0.82rem; }
.btn-lg  { padding: 0.85rem 2rem;    font-size: 1.1rem;  }
.btn-xs  { padding: 0.2rem 0.5rem;   font-size: 0.75rem; }

/* Text helpers */
.text-center { text-align: center; }

/* ============================================================
   POS Terminal — Tablet-optimised layout
   ============================================================ */

.pos-terminal {
  display: grid;
  grid-template-columns: 1fr 1.5fr 1fr;
  gap: var(--sp-md);
  height: calc(100vh - 60px);
}

/* Item buttons */
.item-btn {
  background: var(--bardot-surface);
  border: 1px solid var(--bardot-border);
  border-radius: var(--bardot-radius);
  color: var(--bardot-text);
  padding: var(--sp-md);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}
.item-btn:hover { border-color: var(--bardot-primary); }

/* Coin earned animation */
@keyframes coin-pop {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}
.coins-earned { animation: coin-pop 0.4s ease forwards; }

/* ============================================================
   Page header with actions row
   ============================================================ */

.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-md);
  flex-wrap: wrap;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* ============================================================
   Dashboard / quick links
   ============================================================ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--sp-md);
}

.dashboard-row {
  display: flex;
  gap: var(--sp-lg);
  flex-wrap: wrap;
}

.dashboard-row > .card {
  min-width: 0;
}

.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--sp-md);
}

.quick-link-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-sm);
  padding: var(--sp-lg);
  background-color: var(--bardot-surface);
  border: 1px solid var(--bardot-border);
  border-radius: var(--bardot-radius);
  text-decoration: none;
  color: var(--bardot-text);
  transition: border-color var(--transition), box-shadow var(--transition);
  text-align: center;
}

.quick-link-card:hover {
  border-color: rgba(233, 69, 96, 0.35);
  box-shadow: var(--bardot-glow-red);
  color: var(--bardot-text);
}

.ql-icon { font-size: 1.75rem; line-height: 1; }
.ql-label { font-size: 0.8rem; font-weight: 600; letter-spacing: 0.04em; }

/* Card as link */
.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.card-link:hover {
  border-color: rgba(233, 69, 96, 0.35);
  box-shadow: var(--bardot-glow-red);
  color: inherit;
}

/* ============================================================
   Schedule layout
   ============================================================ */

.schedule-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-lg);
}

/* ============================================================
   Analytics
   ============================================================ */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--sp-md);
}

.analytics-row {
  display: flex;
  gap: var(--sp-lg);
  margin-top: var(--sp-lg);
  flex-wrap: wrap;
}

.analytics-row .card {
  flex: 1;
  min-width: 0;
}

.chart-card { min-height: 240px; }
.leaderboard-card { min-height: 240px; }

.loading-hint {
  color: var(--bardot-text-muted);
  font-size: 0.85rem;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.leaderboard-table th,
.leaderboard-table td {
  padding: var(--sp-xs) var(--sp-sm);
  text-align: left;
  border-bottom: 1px solid var(--bardot-border);
}

.leaderboard-table th {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bardot-text-muted);
  white-space: nowrap;
}

/* Wrap leaderboard tables so they scroll rather than cramp */
#ambassador-board,
.leaderboard-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.leaderboard-top { background: rgba(255, 215, 0, 0.06); }
.rank { font-weight: 700; color: var(--bardot-text-muted); }
.credits { color: var(--bardot-accent); font-weight: 700; }
.empty-row { text-align: center; color: var(--bardot-text-muted); padding: var(--sp-lg) !important; }

/* ============================================================
   Stat card partial (stat-card.html partial)
   ============================================================ */

.stat-card__label { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--bardot-text-muted); }
.stat-card__value { font-size: 1.75rem; font-weight: 800; color: var(--bardot-text); line-height: 1.1; font-variant-numeric: tabular-nums; }

/* ============================================================
   Analytics sub-pages
   ============================================================ */

.analytics-page { display: flex; flex-direction: column; gap: var(--sp-lg); }
.analytics-nav  { display: flex; gap: var(--sp-sm); flex-wrap: wrap; }

/* ============================================================
   Responsive — Navigation
   ============================================================ */

/* Hamburger button (hidden by default on desktop) */
.nav-hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--bardot-text);
  font-size: 1.5rem;
  line-height: 1;
  padding: var(--sp-xs);
  cursor: pointer;
  margin-left: auto;
}

@media (max-width: 860px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background-color: var(--bardot-secondary);
    border-bottom: 1px solid var(--bardot-border);
    flex-direction: column;
    padding: var(--sp-sm) var(--sp-md);
    gap: var(--sp-xs);
    z-index: 99;
  }

  .nav-links.nav-open {
    display: flex;
  }

  .nav-link { width: 100%; }

  .nav-hamburger { display: block; }
  #main-nav { position: relative; }
}

/* ============================================================
   Responsive — Layout / Sidebar
   ============================================================ */

@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
    position: relative;
  }

  .sidebar {
    position: fixed;
    left: -240px;
    top: 56px;
    bottom: 0;
    width: 240px;
    z-index: 200;
    transition: left 200ms ease;
    overflow-y: auto;
    border-right: 1px solid var(--bardot-border);
  }

  .sidebar.sidebar-open {
    left: 0;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
  }

  /* Overlay when sidebar is open */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 199;
  }
  .sidebar-overlay.sidebar-open { display: block; }

  #content {
    padding: var(--sp-md);
    min-width: 0;
  }
}

@media (max-width: 480px) {
  #content {
    padding: var(--sp-sm);
  }

  .page-title { font-size: 1.25rem; }
}

/* ============================================================
   Responsive — Content grids
   ============================================================ */

@media (max-width: 860px) {
  .schedule-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-row {
    flex-direction: column;
  }

  .analytics-row {
    flex-direction: column;
  }
}

@media (max-width: 600px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .quick-links {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  }

  .stat-grid {
    grid-template-columns: 1fr 1fr;
  }

  .grid-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 380px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Responsive — POS Terminal
   ============================================================ */

@media (max-width: 1024px) {
  .pos-terminal {
    grid-template-columns: 1fr 1.5fr;
    height: auto;
    min-height: calc(100vh - 60px);
  }
}

@media (max-width: 700px) {
  .pos-terminal {
    grid-template-columns: 1fr;
    height: auto;
  }
}

/* ============================================================
   Responsive — Door tablet
   ============================================================ */

@media (max-width: 600px) {
  .scanner-title { font-size: 1.25rem; }
  .decision-label { font-size: 1.75rem; }
  .decision-name  { font-size: 1.1rem; }
  .decision-icon  { font-size: 2.5rem; }

  .walkin-layout {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Responsive — Tables
   ============================================================ */

@media (max-width: 600px) {
  .table-wrapper {
    font-size: 0.8rem;
  }
  .table th, .table td {
    padding: var(--sp-xs) var(--sp-sm);
  }
}

/* ============================================================
   Responsive — Modals
   ============================================================ */

@media (max-width: 480px) {
  .modal-backdrop { padding: var(--sp-sm); }
  .modal { max-height: 95vh; }
  .modal-header, .modal-body, .modal-footer { padding: var(--sp-md); }
}

/* ============================================================
   Responsive — Toast
   ============================================================ */

@media (max-width: 480px) {
  #toast-container {
    bottom: var(--sp-sm);
    right: var(--sp-sm);
    left: var(--sp-sm);
  }
  .bardot-toast {
    min-width: unset;
    max-width: unset;
    width: 100%;
  }
}

/* ============================================================
   General overflow protection
   ============================================================ */

/* Prevent any element from blowing out the viewport horizontally */
#content > * { max-width: 100%; }
img, svg, video, canvas { max-width: 100%; }

/* Force scroll on overflow tables */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
