/* ============================================================
   Event Spot Registration — Firework Night theme
   Self-contained: no external fonts/CDNs (works offline on venue LAN).
   Animations are transform/opacity only to stay light on cheap tablets.
   ============================================================ */

:root {
  --bg-1: #05060f;
  --bg-2: #0d1130;
  --bg-3: #1a1440;
  --gold: #ffcf4d;
  --gold-strong: #ffb703;
  --orange: #ff7a33;
  --red: #ff4d5e;
  --card-bg: rgba(18, 16, 40, 0.72);
  --card-border: rgba(255, 207, 77, 0.35);
  --text: #f4f2ff;
  --text-dim: #b7b3d9;
  --input-bg: #1b1740;
  --input-border: #3a3470;
  --success: #37d67a;
  --error: #ff6b6b;
  --radius: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(ellipse at 20% -10%, #26205a 0%, transparent 55%),
              radial-gradient(ellipse at 90% 0%, #3a1f4d 0%, transparent 45%),
              linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 55%, var(--bg-3) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* ---------- decorative firework bursts (pure CSS, cheap) ---------- */
.fw-sky {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.fw-burst {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  animation: fw-pop 3.4s ease-out infinite;
  opacity: 0;
}
.fw-burst::before, .fw-burst::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow:
    0 -34px 0 -1px currentColor, 24px -24px 0 -1px currentColor,
    34px 0 0 -1px currentColor, 24px 24px 0 -1px currentColor,
    0 34px 0 -1px currentColor, -24px 24px 0 -1px currentColor,
    -34px 0 0 -1px currentColor, -24px -24px 0 -1px currentColor;
}
.fw-burst.b1 { top: 12%; left: 15%; color: var(--gold); animation-delay: 0s; }
.fw-burst.b2 { top: 20%; left: 78%; color: var(--orange); animation-delay: 1.1s; }
.fw-burst.b3 { top: 55%; left: 8%;  color: var(--red);   animation-delay: 2.2s; }
.fw-burst.b4 { top: 65%; left: 88%; color: var(--gold-strong); animation-delay: 0.6s; }
.fw-burst.b5 { top: 8%;  left: 48%; color: var(--red);   animation-delay: 1.8s; }

@keyframes fw-pop {
  0%   { transform: scale(0.1); opacity: 0; }
  12%  { opacity: 1; }
  45%  { transform: scale(1.15); opacity: 0.9; }
  75%  { transform: scale(1.5); opacity: 0; }
  100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .fw-burst { animation: none; opacity: 0.5; transform: scale(1); }
}

/* ---------- layout ---------- */
.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 16px 48px;
}

.page-header {
  text-align: center;
  margin-bottom: 22px;
}
.page-header .eyebrow {
  letter-spacing: 3px;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 6px;
}
.page-header h1 {
  font-size: clamp(24px, 5vw, 34px);
  margin: 0;
  color: var(--gold); /* fallback for browsers without background-clip:text (never leave this invisible) */
  font-weight: 800;
}
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .page-header h1 {
    background: linear-gradient(90deg, var(--gold) 0%, var(--orange) 50%, var(--red) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
}
.page-header p {
  color: var(--text-dim);
  margin-top: 8px;
  font-size: 14px;
}

.card {
  width: 100%;
  max-width: 640px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 26px;
  backdrop-filter: blur(6px);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.02), 0 20px 60px rgba(0,0,0,0.45), 0 0 40px rgba(255,183,3,0.06);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
  .page { padding: 18px 10px 36px; }
  .card { padding: 16px; }
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.field .req { color: var(--red); }

.field input[type="text"],
.field input[type="tel"],
.field input[type="email"],
.field input[type="number"],
.field input[type="password"],
.field input[type="date"],
.field select,
.field textarea {
  width: 100%;
  background: var(--input-bg);
  border: 1.5px solid var(--input-border);
  color: var(--text);
  border-radius: 10px;
  padding: 12px;
  /* 16px is deliberate, not a style choice: iOS Safari auto-zooms the page
     on focus for any input with a computed font-size under 16px. */
  font-size: 16px;
  min-height: 44px;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; min-height: 70px; font-family: inherit; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(255, 207, 77, 0.18);
}
.field select { cursor: pointer; }
.field select:disabled { opacity: 0.5; cursor: not-allowed; }

.field-error {
  color: var(--error);
  font-size: 12.5px;
  margin-top: 5px;
  min-height: 15px;
  display: block;
}

.radio-row, .yn-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.yn-option {
  flex: 1;
  min-width: 100px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1.5px solid var(--input-border);
  background: var(--input-bg);
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 16px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: all .15s;
}
.yn-option input { display: none; }
.yn-option.selected {
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(255,207,77,0.22), rgba(255,122,51,0.12));
  box-shadow: 0 0 0 3px rgba(255,207,77,0.15);
}

.btn-primary {
  width: 100%;
  margin-top: 22px;
  border: none;
  border-radius: 12px;
  padding: 15px;
  min-height: 48px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.4px;
  color: #201200;
  background: linear-gradient(90deg, var(--gold) 0%, var(--orange) 100%);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 8px 24px rgba(255, 138, 0, 0.35);
  transition: transform .1s, box-shadow .15s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 30px rgba(255, 138, 0, 0.45); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: wait; transform: none; }

.btn-secondary {
  border: 1.5px solid var(--input-border);
  background: transparent;
  color: var(--text);
  border-radius: 10px;
  padding: 12px 16px;
  min-height: 44px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn-secondary:hover { border-color: var(--gold); }
.btn-secondary:disabled { opacity: 0.4; cursor: not-allowed; border-color: var(--input-border); }
.btn-secondary:disabled:hover { border-color: var(--input-border); }

.form-banner {
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  margin-bottom: 16px;
  display: none;
}
.form-banner.show { display: block; }
.form-banner.error { background: rgba(255,77,94,0.14); border: 1px solid rgba(255,77,94,0.4); color: #ffd7da; }
.form-banner.success { background: rgba(55,214,122,0.14); border: 1px solid rgba(55,214,122,0.4); color: #d8ffe9; }

/* success overlay shown after a submit, then form resets for next attendee */
.success-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(4, 4, 14, 0.88);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.success-overlay.show { display: flex; }
.success-card {
  text-align: center;
  max-width: 420px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 34px 26px;
  box-shadow: 0 0 60px rgba(255,183,3,0.18);
}
.success-card .emoji { font-size: 52px; margin-bottom: 8px; }
.success-card h2 { margin: 6px 0 14px; color: var(--gold); }
.success-card .success-name { font-size: 19px; font-weight: 800; color: var(--text); }
.success-card .success-business { font-size: 14px; color: var(--gold); margin-top: 2px; margin-bottom: 10px; }
.success-card p { color: var(--text-dim); font-size: 14px; }

.footer-note {
  margin-top: 22px;
  text-align: center;
  color: var(--text-dim);
  font-size: 12.5px;
}
.footer-note a { color: var(--gold); text-decoration: none; }

/* ---------- admin ---------- */
.admin-wrap { width: 100%; max-width: 1180px; }
.admin-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.stat-card .num { font-size: 30px; font-weight: 800; color: var(--gold); }
.stat-card .lbl { color: var(--text-dim); font-size: 13px; margin-top: 4px; }
.stat-bar-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; margin-top: 4px; color: var(--text-dim); }
.stat-bar-track { flex: 1; height: 6px; background: var(--input-bg); border-radius: 4px; overflow: hidden; }
.stat-bar-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--orange)); }

.tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.tab-btn {
  padding: 9px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--input-border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-weight: 600;
  font-size: 13.5px;
}
.tab-btn.active { border-color: var(--gold); color: var(--gold); background: rgba(255,207,77,0.08); }

.table-toolbar { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.table-toolbar input[type="search"] {
  background: var(--input-bg); border: 1.5px solid var(--input-border); color: var(--text);
  border-radius: 10px; padding: 9px 12px; font-size: 14px; min-width: 220px;
}

.table-scroll { width: 100%; overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--card-border); }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; background: var(--card-bg); }
table.data-table th, table.data-table td {
  padding: 10px 12px; text-align: left; white-space: nowrap; border-bottom: 1px solid rgba(255,255,255,0.06);
}
table.data-table th { color: var(--gold); font-weight: 700; position: sticky; top: 0; background: #16123a; }
table.data-table tbody tr:hover { background: rgba(255,255,255,0.03); }

.pagination { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 14px; color: var(--text-dim); font-size: 13.5px; }

.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 80vh; width: 100%; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.badge.yes { background: rgba(55,214,122,0.16); color: #7CFFB2; }
.badge.no { background: rgba(255,77,94,0.16); color: #FF9AA5; }
.badge.role-master { background: rgba(255,207,77,0.18); color: var(--gold); }
.badge.role-admin { background: rgba(255,255,255,0.08); color: var(--text-dim); }

/* ---------- admin shell: sidebar + main ---------- */
.admin-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
  position: relative;
  z-index: 1;
  align-items: stretch;
}
.admin-sidebar {
  width: 250px;
  flex-shrink: 0;
  background: rgba(9, 8, 24, 0.88);
  border-right: 1px solid var(--card-border);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.admin-sidebar .brand {
  font-weight: 800;
  font-size: 15.5px;
  color: var(--gold);
  margin-bottom: 20px;
  padding: 0 10px;
  white-space: nowrap;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  width: 100%;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.nav-item.active { background: linear-gradient(90deg, rgba(255,207,77,0.16), rgba(255,122,51,0.05)); color: var(--gold); }
.nav-item .count-pill {
  margin-left: auto;
  background: var(--input-bg);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
  color: var(--text-dim);
}
.nav-divider { height: 1px; background: rgba(255,255,255,0.06); margin: 10px 6px; }

.admin-main {
  flex: 1;
  min-width: 0;
  padding: 26px 32px 60px;
  overflow-x: hidden;
}

.admin-view { display: none; }
.admin-view.active { display: block; }

@media (max-width: 900px) {
  .admin-shell { flex-direction: column; }
  .admin-sidebar {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--card-border);
    padding: 10px;
    gap: 6px;
  }
  .admin-sidebar .brand { display: none; }
  .nav-item { width: auto; white-space: nowrap; }
  .admin-main { padding: 18px 14px 40px; }
}

/* ---------- filters ---------- */
.filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 14px;
  padding: 14px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
}
.filter-field { display: flex; flex-direction: column; gap: 4px; }
.filter-field label {
  font-size: 11px; color: var(--text-dim); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.filter-field select, .filter-field input {
  background: var(--input-bg); border: 1.5px solid var(--input-border); color: var(--text);
  border-radius: 8px; padding: 8px 10px; font-size: 13.5px; min-width: 140px;
}
.filter-bar .btn-secondary { padding: 8px 14px; font-size: 13px; min-height: auto; }

/* ---------- sortable table headers ---------- */
table.data-table th.sortable { cursor: pointer; user-select: none; }
table.data-table th.sortable:hover { color: var(--gold-strong); }
table.data-table th .sort-arrow { margin-left: 4px; opacity: 0.7; font-size: 10px; }

/* ---------- overview ---------- */
.grand-total-card {
  background: linear-gradient(135deg, rgba(255,207,77,0.16), rgba(255,77,94,0.05));
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 26px 28px;
  margin-bottom: 22px;
}
.grand-total-card .num { font-size: 42px; font-weight: 800; color: var(--gold); line-height: 1; }
.grand-total-card .lbl { color: var(--text-dim); font-size: 13.5px; margin-top: 8px; }

.overview-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 18px;
  margin-bottom: 22px;
}
@media (max-width: 800px) {
  .overview-grid { grid-template-columns: 1fr; }
}

.trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 140px;
  padding: 10px 4px 0;
}
.trend-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
  min-width: 0;
}
.trend-bar {
  width: 100%;
  max-width: 30px;
  background: linear-gradient(180deg, var(--gold), var(--orange));
  border-radius: 4px 4px 0 0;
  min-height: 3px;
}
.trend-count { font-size: 11px; color: var(--gold); font-weight: 700; }
.trend-label { font-size: 9.5px; color: var(--text-dim); white-space: nowrap; }
