/* ── Base ─────────────────────────────────── */
:root {
  --aqua:      #00c6ff;
  --blue:      #0072ff;
  --bg:        #050508;
  --surface:   #0d0d14;
  --card:      #111118;
  --border:    #1e1e2e;
  --text:      #e0e0f0;
  --muted:     #666680;
  --error:     #ff4d6d;
  --success:   #00d68f;
  --radius:    12px;
  --shadow:    0 8px 32px rgba(0,198,255,.08);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ── Typography ──────────────────────────── */
h1, h2, h3 { font-weight: 700; line-height: 1.2; letter-spacing: -.02em; }

/* ── Layout ──────────────────────────────── */
.container {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 20px;
}

.page-center {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

/* ── Hero Header ─────────────────────────── */
.site-header {
  text-align: center;
  padding: 48px 0 32px;
}

.site-logo {
  font-size: clamp(28px, 6vw, 42px);
  font-weight: 900;
  letter-spacing: .12em;
  background: linear-gradient(135deg, var(--aqua), var(--blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-transform: uppercase;
}

.site-tagline {
  font-size: 12px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 6px;
}

.site-date {
  display: inline-block;
  margin-top: 12px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .15em;
  color: var(--aqua);
  text-transform: uppercase;
}

/* ── Card ────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 32px;
  box-shadow: var(--shadow);
}

@media (max-width: 480px) {
  .card { padding: 28px 20px; }
}

.card-title {
  font-size: 22px;
  color: #fff;
  margin-bottom: 6px;
}

.card-subtitle {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 28px;
}

/* ── Form ────────────────────────────────── */
.form-group {
  margin-bottom: 18px;
}

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 15px;
  padding: 12px 16px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none;
}

input:focus,
select:focus {
  border-color: var(--aqua);
  box-shadow: 0 0 0 3px rgba(0,198,255,.12);
}

input.error, select.error {
  border-color: var(--error);
}

.field-error {
  font-size: 12px;
  color: var(--error);
  margin-top: 4px;
  display: none;
}

.field-error.visible { display: block; }

/* ── Checkbox ────────────────────────────── */
.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 24px;
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  border-radius: 4px;
  accent-color: var(--aqua);
  margin-top: 2px;
}

.checkbox-group label {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
  line-height: 1.5;
}

.checkbox-group a {
  color: var(--aqua);
  text-decoration: none;
}

/* ── Buttons ─────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 24px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity .2s, transform .15s;
}

.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--aqua), var(--blue));
  color: #fff;
}

.btn-primary:hover:not(:disabled) { opacity: .9; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-danger {
  background: var(--error);
  color: #fff;
}

/* ── Alert / Status ──────────────────────── */
.alert {
  padding: 14px 16px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
  display: none;
  margin-bottom: 20px;
}

.alert.visible { display: block; }

.alert-success {
  background: rgba(0,214,143,.1);
  border: 1px solid rgba(0,214,143,.3);
  color: var(--success);
}

.alert-error {
  background: rgba(255,77,109,.1);
  border: 1px solid rgba(255,77,109,.3);
  color: var(--error);
}

.alert-info {
  background: rgba(0,198,255,.08);
  border: 1px solid rgba(0,198,255,.2);
  color: var(--aqua);
}

/* ── QR Box ──────────────────────────────── */
.qr-box {
  text-align: center;
  padding: 32px 0;
}

.qr-box img {
  width: 220px;
  height: 220px;
  border-radius: 12px;
  background: #fff;
  padding: 16px;
}

.qr-code-text {
  font-family: 'Courier New', monospace;
  font-size: 18px;
  font-weight: 700;
  color: var(--aqua);
  letter-spacing: .1em;
  margin-top: 16px;
}

/* ── Stats Grid ──────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.stat-number {
  font-size: 32px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--aqua), var(--blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
}

/* ── Table ───────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: var(--surface);
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr { transition: background .15s; }
tbody tr:hover { background: rgba(255,255,255,.03); }

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(30,30,46,.8);
  vertical-align: middle;
  white-space: nowrap;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
}

.badge-green { background: rgba(0,214,143,.15); color: var(--success); }
.badge-red   { background: rgba(255,77,109,.15); color: var(--error); }
.badge-blue  { background: rgba(0,198,255,.12); color: var(--aqua); }
.badge-gray  { background: rgba(102,102,128,.15); color: var(--muted); }

/* ── Admin Nav ───────────────────────────── */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
}

.sidebar-logo {
  padding: 0 20px 24px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .15em;
  color: var(--aqua);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: color .15s, background .15s;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  color: var(--text);
  background: rgba(0,198,255,.06);
}

.sidebar-nav a.active { border-left: 2px solid var(--aqua); }

.admin-main {
  flex: 1;
  overflow-y: auto;
  padding: 32px 36px;
}

@media (max-width: 768px) {
  .admin-layout { flex-direction: column; }
  .admin-sidebar { width: 100%; min-width: unset; flex-direction: row; overflow-x: auto; padding: 0; }
  .admin-main { padding: 20px 16px; }
  .sidebar-logo { display: none; }
  .sidebar-nav { display: flex; padding: 0; }
  .sidebar-nav a { padding: 14px 16px; white-space: nowrap; }
}

/* ── Scanner ─────────────────────────────── */
#qr-scanner-wrap {
  position: relative;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--aqua);
}

#qr-scanner-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scanner-crosshair {
  width: 60%;
  height: 60%;
  border: 2px solid rgba(0,198,255,.8);
  border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.5);
}

/* ── Loader ──────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

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

/* ── QR Valid Modal ───────────────────────── */
.qr-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.qr-modal-overlay.active {
  display: flex;
  animation: modalFadeIn .2s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(.95); }
  to   { opacity: 1; transform: scale(1); }
}

.qr-modal-card {
  background: #0d1a12;
  border: 1px solid rgba(0,214,143,.25);
  border-radius: 20px;
  padding: 40px 32px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 0 60px rgba(0,214,143,.15), 0 24px 64px rgba(0,0,0,.6);
}

.qr-modal-icon {
  width: 72px;
  height: 72px;
  background: rgba(0,214,143,.15);
  border: 2px solid rgba(0,214,143,.5);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.qr-modal-icon svg {
  width: 36px;
  height: 36px;
  color: #00d68f;
}

.qr-modal-status {
  font-size: 36px;
  font-weight: 900;
  letter-spacing: .12em;
  color: #00d68f;
  margin-bottom: 24px;
  text-shadow: 0 0 24px rgba(0,214,143,.4);
}

.qr-modal-body {
  background: rgba(0,214,143,.05);
  border: 1px solid rgba(0,214,143,.12);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 28px;
}

.qr-modal-name {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}

.qr-modal-meta {
  font-size: 13px;
  color: rgba(0,214,143,.8);
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.qr-modal-sep {
  color: rgba(0,214,143,.4);
}

.qr-modal-close {
  width: 100%;
  padding: 14px;
  background: rgba(0,214,143,.1);
  border: 1px solid rgba(0,214,143,.3);
  border-radius: 10px;
  color: #00d68f;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .05em;
  cursor: pointer;
  transition: background .15s;
}

.qr-modal-close:hover {
  background: rgba(0,214,143,.2);
}

/* ── Search / Filters ─────────────────────── */
.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.search-input {
  flex: 1;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
}

.search-input:focus { border-color: var(--aqua); }

/* ── Pagination ──────────────────────────── */
.pagination {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-top: 20px;
}

.pagination button {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: border-color .15s;
}

.pagination button:hover,
.pagination button.active { border-color: var(--aqua); color: var(--aqua); }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }

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

.text-center { text-align: center; }
.text-muted  { color: var(--muted); font-size: 13px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }

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

/* ── Reduced motion ──────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
