/* Tampilan halaman panitia (login, dashboard, scan). Halaman tamu memakai invite.css */
:root {
  --bg: #f3f4f8;
  --surface: #ffffff;
  --text: #1c2233;
  --muted: #6b7185;
  --border: #e3e6ee;
  --navy: #0b1426;
  --navy-2: #1b2d4f;
  --primary: #1b2d4f;
  --primary-dark: #0b1426;
  --gold: #d4af37;
  --gold-light: #f3d98b;
  --gold-dark: #a8842a;
  --ok: #148a4a;
  --ok-bg: #e3f6eb;
  --warn: #a36800;
  --warn-bg: #fff3d6;
  --err: #c0322a;
  --err-bg: #fde7e5;
  --info: #2f5fc4;
  --info-bg: #e6edfc;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; }
a { color: var(--primary); }
code { background: #eef0f5; padding: 1px 6px; border-radius: 6px; font-size: .85em; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

/* ---------- Form ---------- */
label { display: block; font-size: .82rem; font-weight: 600; margin: 12px 0 5px; color: #3a4156; }
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212, 175, 55, .2); }
textarea { resize: vertical; min-height: 80px; }
input[type=file] { padding: 8px; background: #fafbfd; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s, transform .15s, box-shadow .15s;
}
.btn:hover { background: var(--primary-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.gold {
  color: var(--navy);
  background: linear-gradient(135deg, var(--gold-light), var(--gold) 55%, var(--gold-dark));
  box-shadow: 0 4px 14px rgba(212, 175, 55, .35);
}
.btn.gold:hover { box-shadow: 0 6px 18px rgba(212, 175, 55, .5); }
.btn.secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn.secondary:hover { background: #f6f7fa; }
.btn.danger { background: #fff; color: var(--err); border-color: #f4cbc7; }
.btn.danger:hover { background: var(--err-bg); }
.btn.wa { background: #25d366; }
.btn.wa:hover { background: #1ebe5a; }
.btn.sm { padding: 6px 10px; font-size: .78rem; border-radius: 8px; }
.btn.block { width: 100%; }

.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.alert { padding: 10px 14px; border-radius: 10px; font-size: .9rem; margin-top: 12px; }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.alert.err { background: var(--err-bg); color: var(--err); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 600;
  background: #eef0f5;
  color: var(--muted);
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.err { background: var(--err-bg); color: var(--err); }
.badge.gold { background: #fbf1d3; color: #8a6a12; }

/* ---------- Topbar ---------- */
.topbar {
  background: linear-gradient(90deg, var(--navy), var(--navy-2));
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 12px rgba(11, 20, 38, .25);
}
.topbar .container { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 12px; padding-bottom: 12px; }
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .01em; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 1rem;
  color: var(--navy); background: linear-gradient(135deg, var(--gold-light), var(--gold));
}
.brand small { display: block; font-weight: 500; font-size: .72rem; color: var(--gold-light); letter-spacing: .08em; text-transform: uppercase; }
.topbar form { margin: 0; }
.topbar .btn.secondary { background: rgba(255, 255, 255, .08); color: #fff; border-color: rgba(255, 255, 255, .2); }
.topbar .btn.secondary:hover { background: rgba(255, 255, 255, .16); }

/* ---------- Statistik ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin: 20px 0 4px; }
.page-head h1 { font-size: 1.5rem; margin: 0; }
.page-head p { margin: 2px 0 0; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 16px 0; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; display: flex; gap: 12px; align-items: center; box-shadow: var(--shadow);
}
.stat-icon { width: 42px; height: 42px; flex-shrink: 0; border-radius: 12px; display: grid; place-items: center; }
.stat-icon svg { width: 22px; height: 22px; }
.stat .v { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.stat .l { font-size: .78rem; color: var(--muted); }
.stat.navy .stat-icon { background: #e8ecf5; color: var(--navy-2); }
.stat.ok .stat-icon { background: var(--ok-bg); color: var(--ok); }
.stat.err .stat-icon { background: var(--err-bg); color: var(--err); }
.stat.warn .stat-icon { background: var(--warn-bg); color: var(--warn); }
.stat.gold .stat-icon { background: #fbf1d3; color: #8a6a12; }

.progress-card { margin-bottom: 16px; padding: 16px 20px; }
.progress-card .row { justify-content: space-between; margin-bottom: 8px; font-size: .9rem; }
.progress { height: 10px; border-radius: 999px; background: #eceef4; overflow: hidden; }
.progress > div {
  height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold), var(--gold-light));
  transition: width .6s ease;
}

/* ---------- Tab ---------- */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; overflow-x: auto; background: #e8eaf1; padding: 4px; border-radius: 12px; width: fit-content; max-width: 100%; }
.tabs button {
  background: none; border: 0; padding: 8px 16px; font: inherit; font-weight: 600; color: var(--muted);
  border-radius: 9px; cursor: pointer; white-space: nowrap; transition: all .15s;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { background: #fff; color: var(--navy); box-shadow: 0 1px 4px rgba(16, 24, 40, .1); }

/* ---------- Tabel ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: #f8f9fb; }
thead th:first-child { border-top-left-radius: 10px; }
thead th:last-child { border-top-right-radius: 10px; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: #fafbfd; }
td .actions { display: flex; gap: 4px; flex-wrap: wrap; }
.person { display: flex; gap: 10px; align-items: center; }
.avatar {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: .8rem; color: #fff;
}
.person b { display: block; }
.person small { color: var(--muted); font-size: .78rem; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty .big { font-size: 2.2rem; margin-bottom: 6px; }

.dropzone { border: 2px dashed #cfd4e0; border-radius: 14px; padding: 20px; background: #fafbfd; }

dialog {
  border: 0; border-radius: 18px; padding: 24px; width: min(480px, calc(100vw - 32px));
  box-shadow: 0 30px 80px rgba(11, 20, 38, .35);
}
dialog::backdrop { background: rgba(11, 20, 38, .55); backdrop-filter: blur(3px); }
.qr-box { text-align: center; }
.qr-box img { width: 240px; max-width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--border); background: #fff; padding: 8px; }

/* ---------- Login ---------- */
.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background:
    radial-gradient(700px 400px at 50% 0%, rgba(212, 175, 55, .22), transparent 70%),
    linear-gradient(180deg, #12203a, var(--navy));
}
.login-page .card { width: 100%; max-width: 380px; padding: 32px 28px; border: 0; box-shadow: 0 30px 80px rgba(0, 0, 0, .4); }
.login-page .brand-mark { width: 52px; height: 52px; font-size: 1.4rem; border-radius: 14px; margin: 0 auto 14px; }
.login-page h2 { text-align: center; margin-bottom: 2px; }
.login-page .sub { text-align: center; color: var(--muted); margin: 0 0 12px; font-size: .9rem; }

/* ---------- Scanner (tema gelap) ---------- */
body.scan-page { background: var(--navy); color: #e9ecf4; }
.scan-page .card { background: rgba(255, 255, 255, .05); border-color: rgba(255, 255, 255, .1); color: #e9ecf4; box-shadow: none; }
.scan-page input, .scan-page select { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .15); color: #fff; }
.scan-page select option { color: #000; }
.scan-page .muted { color: #9aa3b8; }
.scan-page .btn.secondary { background: rgba(255, 255, 255, .08); color: #fff; border-color: rgba(255, 255, 255, .2); }
.scan-layout { max-width: 520px; margin: 0 auto; padding: 16px; }
.reader-wrap { position: relative; border-radius: 20px; overflow: hidden; background: #000; box-shadow: 0 0 0 1px rgba(212, 175, 55, .35), 0 20px 50px rgba(0, 0, 0, .5); }
#reader { width: 100%; min-height: 260px; }
#reader video { display: block; }
.reader-wrap::after {
  content: ''; position: absolute; left: 12%; right: 12%; height: 2px; top: 20%;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  box-shadow: 0 0 12px var(--gold); animation: scanline 2.4s ease-in-out infinite alternate; pointer-events: none;
}
@keyframes scanline { to { top: 80%; } }

.result {
  margin-top: 16px; padding: 20px; border-radius: 18px; text-align: center; border: 2px solid transparent;
  transition: background .2s, border-color .2s;
}
.result .icon { font-size: 2rem; line-height: 1; margin-bottom: 4px; }
.result .name { font-size: 1.6rem; font-weight: 700; margin: 4px 0 0; }
.result.ok { background: #0f3d27; border-color: #2fbf71; color: #b8f5d2; animation: pop .35s; }
.result.already { background: #3d2e05; border-color: #e0a526; color: #ffe2a3; animation: pop .35s; }
.result.invalid { background: #4a1512; border-color: #ef5a4f; color: #ffc9c4; animation: shake .4s; }
.result.idle { background: rgba(255, 255, 255, .04); border-color: rgba(255, 255, 255, .12); color: #9aa3b8; }
@keyframes pop { from { transform: scale(.94); } to { transform: none; } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.search-results, .history { list-style: none; padding: 0; margin: 8px 0 0; }
.search-results li, .history li {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.history li:last-child, .search-results li:last-child { border-bottom: 0; }
.history .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-right: 8px; }
.history .dot.ok { background: #2fbf71; }
.history .dot.already { background: #e0a526; }
.history .dot.invalid { background: #ef5a4f; }
.history time { font-size: .78rem; color: #9aa3b8; font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
