:root {
  --primary: #1a1a2e;
  --accent: #e94560;
  --secondary: #ffffff;
  --grey: #f5f5f5;
  --border: #e0e0e0;
  --text: #1a1a1a;
  --muted: #666;
  --radius: 12px;
  --shadow: 0 2px 16px rgba(0,0,0,0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--grey);
  color: var(--text);
  min-height: 100vh;
}

.container { max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* Auth */
.auth-page { display: flex; align-items: center; justify-content: center; background: var(--primary); }
.auth-card {
  background: white; border-radius: var(--radius); padding: 40px;
  width: 100%; max-width: 380px; box-shadow: var(--shadow);
}
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo h1 { color: var(--primary); font-size: 28px; }
.auth-logo p { color: var(--muted); margin-top: 4px; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.form-group input, .form-group select {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 15px; outline: none; transition: border 0.2s;
}
.form-group input:focus, .form-group select:focus { border-color: var(--accent); }

/* Buttons */
.btn {
  display: inline-block; padding: 11px 22px; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer; border: none;
  text-decoration: none; transition: opacity 0.2s;
}
.btn:hover { opacity: 0.85; }
.btn-primary { background: var(--accent); color: white; }
.btn-full { width: 100%; text-align: center; }
.btn-sm { padding: 7px 14px; font-size: 13px; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }

/* Site Header */
.site-header { background: var(--primary); color: white; padding: 32px 0; margin-bottom: 32px; }
.site-header h1 { font-size: 28px; }
.site-header p { color: rgba(255,255,255,0.7); margin-top: 4px; }

/* Events Grid */
.events-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; padding-bottom: 40px; }
.event-card {
  background: white; border-radius: var(--radius); overflow: hidden;
  text-decoration: none; color: var(--text); box-shadow: var(--shadow);
  display: flex; flex-direction: column; transition: transform 0.2s;
  border-top: 4px solid var(--accent);
}
.event-card:hover { transform: translateY(-2px); }
.event-logo { width: 100%; height: 120px; object-fit: cover; }
.event-card-body { padding: 20px; flex: 1; }
.event-card-body h2 { font-size: 18px; margin-bottom: 4px; }
.event-org { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.event-meta { font-size: 14px; color: var(--text); margin-bottom: 4px; }
.event-venue { font-size: 13px; color: var(--muted); }
.event-card-footer {
  padding: 14px 20px; background: var(--grey);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px;
}
.scan-btn { color: var(--accent); font-weight: 600; }
.empty-state { text-align: center; padding: 80px 20px; color: var(--muted); }

/* Scanner */
.scanner-page { background: #000; min-height: 100vh; display: flex; flex-direction: column; }
.scanner-header {
  padding: 12px 16px; color: white; display: flex;
  flex-direction: column; gap: 8px;
}
.back-link { color: rgba(255,255,255,0.7); text-decoration: none; font-size: 14px; }
.scanner-event-info { display: flex; align-items: center; gap: 12px; }
.scanner-logo { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; }
.scanner-event-info h1 { font-size: 18px; }
.scanner-event-info p { font-size: 13px; opacity: 0.7; }
.scanner-main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; }

#reader-container { position: relative; width: 100%; max-width: 400px; }
#reader { width: 100% !important; }
#reader video { border-radius: 0; }
.scanner-hint { text-align: center; color: rgba(255,255,255,0.6); font-size: 14px; padding: 12px; }
.scanner-error { color: #ef4444; text-align: center; padding: 24px; }

/* Result */
.result {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 40px 24px; text-align: center;
  width: 100%; min-height: 60vh;
}
.result.hidden { display: none; }
.result-valid { background: #052e16; }
.result-invalid { background: #450a0a; }

.result-icon {
  width: 100px; height: 100px; border-radius: 50%; font-size: 52px;
  display: flex; align-items: center; justify-content: center; margin-bottom: 24px;
}
.result-valid .result-icon { background: #16a34a; color: white; }
.result-invalid .result-icon { background: #dc2626; color: white; }

.result h2 { font-size: 28px; color: white; margin-bottom: 6px; }
.result p { color: rgba(255,255,255,0.7); font-size: 16px; margin-bottom: 4px; }
.result-time { font-size: 13px !important; margin-top: 8px; }
.result #result-message { font-size: 20px !important; font-weight: 700; color: white !important; margin-top: 8px; }
.result-invalid #result-message { color: #fca5a5 !important; }
.result .btn-primary { margin-top: 32px; padding: 14px 40px; font-size: 16px; }

/* Admin */
.admin-header {
  background: var(--primary); color: white; padding: 16px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.admin-header h1 { font-size: 20px; }
.admin-nav { display: flex; align-items: center; gap: 16px; font-size: 14px; }
.admin-page main { padding: 32px 24px; }
.stats-row { display: flex; gap: 16px; margin-bottom: 32px; flex-wrap: wrap; }
.stat-card {
  background: white; border-radius: var(--radius); padding: 20px 28px;
  display: flex; flex-direction: column; align-items: center; box-shadow: var(--shadow);
  min-width: 130px;
}
.stat-number { font-size: 36px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 13px; color: var(--muted); margin-top: 4px; }
.admin-table { width: 100%; border-collapse: collapse; background: white; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.admin-table th { background: var(--primary); color: white; padding: 12px 16px; text-align: left; font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; }
.admin-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table a { color: var(--accent); text-decoration: none; }

.hidden { display: none !important; }

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