/* ── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 15px; color: #1e2533; background: #f4f6fa; min-height: 100vh; }
a { color: #1a4fa0; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Nav ────────────────────────────────────────────────────────────────────── */
.topnav { display: flex; align-items: center; justify-content: space-between; background: #0f2d6b; color: #fff; padding: 0 24px; height: 56px; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.topnav .brand { color: #fff; font-size: 18px; font-weight: 700; }
.topnav .brand:hover { text-decoration: none; }
.nav-right { display: flex; align-items: center; gap: 16px; }
.nav-right a { color: #c5d5f5; font-size: 14px; }
.nav-right a:hover { color: #fff; text-decoration: none; }

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

/* ── Page Header ────────────────────────────────────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-header h1 { font-size: 22px; font-weight: 700; color: #0f2d6b; }
.page-header .sub { font-size: 14px; color: #6b7a99; margin-top: 2px; }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 4px; padding: 8px 16px; border: none; border-radius: 6px; font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none; transition: background .15s, opacity .15s; }
.btn:hover { text-decoration: none; opacity: .88; }
.btn-primary { background: #1a4fa0; color: #fff; }
.btn-ghost { background: #e8edf7; color: #1e2533; }
.btn-success { background: #16a34a; color: #fff; }
.btn-warning { background: #d97706; color: #fff; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-link { background: none; border: none; color: #c5d5f5; font-size: 14px; cursor: pointer; padding: 0; }
.btn-link:hover { color: #fff; }

/* ── Cards / Grid ────────────────────────────────────────────────────────────── */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.event-card { background: #fff; border: 1px solid #dde3ef; border-radius: 10px; padding: 20px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.event-card-header { display: flex; align-items: center; justify-content: space-between; }
.event-title { font-size: 17px; font-weight: 600; }
.event-title a { color: #0f2d6b; }
.event-meta { display: flex; gap: 12px; font-size: 13px; color: #6b7a99; flex-wrap: wrap; }
.event-stats { display: flex; gap: 16px; font-size: 14px; color: #3a4a70; }
.event-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.event-code { font-family: monospace; font-size: 13px; color: #6b7a99; background: #f0f3fa; padding: 2px 7px; border-radius: 4px; }

/* ── Status Badges ───────────────────────────────────────────────────────────── */
.status-badge { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 20px; }
.status-draft { background: #e8edf7; color: #3a4a70; }
.status-published { background: #dbeafe; color: #1d4ed8; }
.status-live { background: #dcfce7; color: #15803d; }
.status-ended { background: #f3f4f6; color: #6b7280; }
.status-archived { background: #fefce8; color: #854d0e; }
.status-cancelled { background: #fee2e2; color: #991b1b; }

/* ── Form Elements ───────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 14px; font-weight: 500; color: #374151; margin-bottom: 5px; }
.form-control { width: 100%; padding: 9px 12px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 15px; transition: border-color .15s; }
.form-control:focus { outline: none; border-color: #1a4fa0; box-shadow: 0 0 0 3px rgba(26,79,160,.12); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { font-size: 12px; color: #9ca3af; margin-top: 4px; }
.form-card { background: #fff; border: 1px solid #dde3ef; border-radius: 10px; padding: 28px; max-width: 700px; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.form-title { font-size: 20px; font-weight: 700; color: #0f2d6b; margin-bottom: 22px; }
.form-footer { display: flex; gap: 12px; margin-top: 24px; }
.alert-error { background: #fee2e2; color: #991b1b; border-radius: 6px; padding: 10px 14px; margin-bottom: 18px; font-size: 14px; }

/* ── Empty State ─────────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 20px; color: #9ca3af; font-size: 15px; }

/* ── Pause Bar ───────────────────────────────────────────────────────────────── */
.pause-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.pause-badge { background: #fee2e2; color: #991b1b; font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 20px; }

/* ── Filter Tabs ─────────────────────────────────────────────────────────────── */
.filter-tabs { display: flex; gap: 4px; margin-bottom: 20px; flex-wrap: wrap; }
.tab { display: inline-block; padding: 6px 14px; border-radius: 6px; font-size: 14px; color: #3a4a70; background: #e8edf7; text-decoration: none; transition: background .15s; }
.tab:hover { background: #d0dbf0; text-decoration: none; }
.tab.active { background: #1a4fa0; color: #fff; }

/* ── Question Admin List ─────────────────────────────────────────────────────── */
.q-admin-list { display: flex; flex-direction: column; gap: 10px; }
.q-admin-item { background: #fff; border: 1px solid #dde3ef; border-radius: 8px; padding: 16px; display: flex; gap: 16px; align-items: flex-start; }
.q-admin-item.q-status-answered { border-left: 4px solid #16a34a; }
.q-admin-item.q-status-pending { border-left: 4px solid #d97706; }
.q-admin-item.q-status-hidden, .q-admin-item.q-status-spam { opacity: .6; }
.q-admin-main { flex: 1; }
.q-text { font-size: 15px; line-height: 1.5; margin-bottom: 8px; }
.q-admin-meta { display: flex; gap: 12px; font-size: 13px; color: #6b7a99; flex-wrap: wrap; align-items: center; }
.q-admin-actions { display: flex; gap: 6px; flex-wrap: wrap; flex-shrink: 0; }
.q-status-badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 12px; }
.q-sb-pending { background: #fef3c7; color: #92400e; }
.q-sb-public { background: #dbeafe; color: #1e40af; }
.q-sb-answered { background: #dcfce7; color: #14532d; }
.q-sb-later { background: #ede9fe; color: #5b21b6; }
.q-sb-hidden { background: #f3f4f6; color: #6b7280; }
.q-sb-spam { background: #fee2e2; color: #991b1b; }
.star-icon { font-size: 16px; }
.q-time { font-size: 12px; }

/* ── Event Detail ─────────────────────────────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; margin-top: 16px; }
@media (max-width: 700px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-card { background: #fff; border: 1px solid #dde3ef; border-radius: 10px; padding: 20px; box-shadow: 0 1px 4px rgba(0,0,0,.04); }
.detail-card h2 { font-size: 15px; font-weight: 700; color: #0f2d6b; margin-bottom: 14px; border-bottom: 1px solid #edf0f8; padding-bottom: 8px; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.stat-box { background: #f4f6fa; border-radius: 8px; padding: 14px; text-align: center; }
.stat-num { font-size: 28px; font-weight: 800; color: #0f2d6b; }
.stat-label { font-size: 12px; color: #6b7a99; margin-top: 2px; }
.status-actions { display: flex; flex-direction: column; gap: 8px; }
.info-row { display: flex; gap: 8px; font-size: 14px; margin-bottom: 8px; }
.info-label { color: #6b7a99; min-width: 70px; }
.action-links { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.mini-q-list { display: flex; flex-direction: column; gap: 8px; }
.mini-q { background: #f4f6fa; border-radius: 6px; padding: 10px 12px; }
.mini-q-text { font-size: 14px; line-height: 1.4; }
.mini-q-meta { font-size: 12px; color: #9ca3af; margin-top: 4px; }

/* ── QR Page ──────────────────────────────────────────────────────────────────── */
.qr-page { text-align: center; padding: 40px 0; }
.qr-page img { border: 4px solid #0f2d6b; border-radius: 12px; display: block; margin: 0 auto 20px; }
.qr-url { font-family: monospace; font-size: 15px; background: #f4f6fa; padding: 8px 16px; border-radius: 6px; display: inline-block; margin-bottom: 16px; }

/* ── Error/404 Page ───────────────────────────────────────────────────────────── */
.error-page { text-align: center; padding: 80px 20px; }
.error-icon { font-size: 64px; font-weight: 900; color: #d1d5db; margin-bottom: 16px; }
.error-page h1 { font-size: 24px; margin-bottom: 10px; color: #374151; }
.error-page p { color: #9ca3af; margin-bottom: 24px; }

/* ── Checkbox / Radio ─────────────────────────────────────────────────────────── */
.check-row { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check-row input { width: 16px; height: 16px; cursor: pointer; }
.radio-group { display: flex; gap: 16px; }

/* ── Event Form (field / field-row / toggle-label) ──────────────────────────── */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 16px; }
.field label { font-size: 14px; font-weight: 500; color: #374151; }
.field input, .field textarea, .field select { padding: 9px 12px; border: 1.5px solid #d1d5db; border-radius: 6px; font-size: 15px; font-family: inherit; transition: border-color .15s; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: #1a4fa0; box-shadow: 0 0 0 3px rgba(26,79,160,.1); }
.field .required { color: #dc2626; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 4px; }
.toggle-label { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; margin-top: 6px; }
.toggle-label input[type=checkbox] { width: 16px; height: 16px; accent-color: #1a4fa0; cursor: pointer; }
.form-actions { display: flex; gap: 12px; margin-top: 24px; }
.alert { border-radius: 6px; padding: 10px 14px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-success { background: #dcfce7; color: #14532d; }

/* ── Event Detail ─────────────────────────────────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin: 20px 0; }
.stat-box { background: #fff; border: 1px solid #dde3ef; border-radius: 10px; padding: 20px; text-align: center; }
.stat-num { font-size: 32px; font-weight: 800; color: #0f2d6b; }
.stat-label { font-size: 12px; color: #6b7a99; margin-top: 3px; }
.stat-link { text-decoration: none; display: block; }
.stat-url { font-size: 14px; font-weight: 600; color: #1a4fa0; margin-top: 3px; word-break: break-all; }
.action-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.detail-card { background: #fff; border: 1px solid #dde3ef; border-radius: 10px; padding: 20px 24px; margin-bottom: 20px; }
.detail-card h2 { font-size: 15px; font-weight: 700; color: #0f2d6b; margin-bottom: 14px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-header h2 { margin-bottom: 0; }
.info-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; }
.info-grid dt { color: #6b7a99; }
.info-grid dd { color: #1e2533; }
.description { font-size: 14px; color: #4b5563; line-height: 1.6; margin-top: 14px; border-top: 1px solid #edf0f8; padding-top: 12px; }
.question-list { display: flex; flex-direction: column; gap: 8px; }
.question-item { background: #f4f6fa; border-radius: 6px; padding: 10px 14px; }
.question-item.question-status-answered { border-left: 3px solid #16a34a; }
.question-item.question-status-pending { border-left: 3px solid #d97706; }
.q-text { font-size: 14px; line-height: 1.5; }
.q-meta { display: flex; gap: 12px; font-size: 12px; color: #9ca3af; margin-top: 5px; }
.q-status { font-weight: 600; color: #6b7a99; }
.q-time { color: #c0c8dc; }
.empty { color: #9ca3af; font-size: 14px; }

/* ── Responsive ───────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .q-admin-item { flex-direction: column; }
  .q-admin-actions { flex-direction: row; }
  .stats-row { grid-template-columns: 1fr 1fr; }
}
