/* styles.css — shared styling, branded from the National ID logo
 * Palette extracted from asset/ni_logo.jpg:
 *   deep teal #5B679F (primary) · darker #0a0a2e · slate #5b628f · mist #9bacd8
 */
:root {
  --brand: #5B679F;            /* FaydaVerse indigo (main) — lighter, easier to read */
  --brand-dark: #414a7d;       /* darker indigo: headings, button hover, gradients */
  --brand-slate: #5b628f;
  --brand-mist: #9bacd8;
  --brand-tint: #eaecf7;       /* very light indigo wash for chips/hovers */
  --accent: #f98613;           /* FaydaVerse vibrant orange (CTA / accent) */
  --accent-dark: #e0740a;      /* orange hover */
  --accent-tint: #fdefe0;      /* light orange wash */
  --success: #1a7a4a;          /* semantic green: registered / checked-in OK */
  --success-tint: #d9f2e4;
  --red: #c0392b;
  --amber: #b7791f;
  --amber-tint: #fdf0d5;
  --ink: #1f2430;
  --muted: #6b7280;
  --line: #e8ebef;
  --bg: #f4f6f8;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(17, 17, 67, 0.06), 0 1px 3px rgba(17, 17, 67, 0.05);
  --shadow: 0 4px 12px rgba(17, 17, 67, 0.07), 0 2px 4px rgba(17, 17, 67, 0.05);
  --shadow-lg: 0 12px 30px rgba(17, 17, 67, 0.12);
}

* { box-sizing: border-box; }

/* Inline line-icons inherit text colour and align with the baseline */
.ico { display: inline-block; vertical-align: -0.18em; flex-shrink: 0; }

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

.container { max-width: 1000px; margin: 0 auto; padding: 20px; }
.container.narrow { max-width: 520px; }

/* ── App shell: left sidebar + main content (mediaplan-style) ──── */
body.app { display: flex; min-height: 100vh; }
body.app .main { flex: 1; min-width: 0; padding: 22px 26px; display: flex; flex-direction: column; }
body.app .main > .site-footer { margin-top: auto; }
body.app.viewer .admin-only { display: none !important; }  /* read-only mode */

.sidebar {
  width: 232px; flex-shrink: 0;
  background: linear-gradient(180deg, #5f6ba6 0%, #464f85 100%);
  color: #fff;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  margin: 18px 14px 10px;
  padding: 4px 10px; text-align: center;
}
.sidebar-brand img { width: 100%; max-width: 172px; display: block; margin: 0 auto; }
.sidebar-title {
  text-align: center; font-size: 0.72rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--brand-mist); margin: 4px 0 12px;
}
.sidebar nav { flex: 1; padding: 4px 10px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  color: #fff; text-decoration: none;
  padding: 10px 12px; border-radius: 9px; margin-bottom: 3px;
  font-size: 0.92rem; font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-item:hover { background: rgba(255,255,255,0.12); color: #fff; }
.nav-item.active { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(249, 134, 19, 0.35); }
.nav-item.active .nav-icon { color: #fff; }
.nav-icon { width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; color: rgba(255,255,255,0.92); }
.nav-item:hover .nav-icon { color: #fff; }
.sidebar-footer { padding: 12px 14px; border-top: 1px solid rgba(255,255,255,0.12); }
.sidebar-user { margin-bottom: 8px; font-size: 0.85rem; }
.sidebar-user strong { display: block; }
.sidebar-user span { color: var(--brand-mist); font-size: 0.75rem; }
.sidebar-footer button { width: 100%; }

.page-head { margin: 0 0 20px; }
.page-head h1 { margin: 0; font-size: 1.45rem; font-weight: 800; color: var(--brand-dark); letter-spacing: -0.01em; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; }
.page-head .eyebrow {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--brand-slate); margin-bottom: 4px;
}
.page-head #eventMeta { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.meta-item { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.88rem; }
.meta-item .ico { color: var(--brand-slate); }

/* Email-in-console-mode warning banner */
.email-warning {
  display: flex; align-items: flex-start; gap: 12px;
  border-color: #f2d48b; background: #fdf9ee; color: #7a5b1a;
}
.email-warning .warn-ico { color: var(--amber); flex-shrink: 0; margin-top: 1px; }
.email-warning a { color: var(--brand); font-weight: 600; }

@media (max-width: 760px) {
  body.app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .sidebar nav { display: flex; overflow-x: auto; padding-bottom: 8px; }
  .nav-item { white-space: nowrap; }
  .sidebar-brand { max-width: 220px; margin: 12px auto 4px; }
  .sidebar-footer { display: flex; align-items: center; justify-content: space-between; }
  .sidebar-footer button { width: auto; }
}

/* Header bar: white with the National ID logo, teal accent line */
.topbar {
  background: #fff;
  border-bottom: 3px solid var(--brand);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}
.topbar img.brand-logo { width: auto; max-width: 320px; max-height: 56px; height: auto; display: block; margin: 0 auto; }
.topbar h1 { margin: 0; font-size: 1.1rem; font-weight: 700; color: var(--brand); }
.topbar .sub { font-size: 0.85rem; color: var(--muted); font-weight: 700; }
.topbar .sub a { color: var(--brand); font-weight: 600; text-decoration: none; }
.topbar .sub a:hover { text-decoration: underline; }
.topbar .spacer { flex: 1; }

/* Site footer (registration page) */
.site-footer {
  margin-top: 40px;
  padding: 22px 20px 30px;
  border-top: 1px solid var(--line);
  text-align: center;
}
.site-footer .footer-tagline {
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  color: var(--muted);
}
.site-footer .footer-tagline a {
  color: var(--brand);
  font-weight: 700;
  text-decoration: none;
}
.site-footer .footer-tagline a:hover { text-decoration: underline; }
.site-footer .footer-domain {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-slate);
  text-decoration: none;
}
.site-footer .footer-domain:hover { color: var(--brand); }

/* Cards */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.card h2 { margin: 0 0 14px; font-size: 1rem; color: var(--brand-dark); font-weight: 700; }

/* Stat counters row: icon chip + number */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  border-top: 5px solid var(--accent);
  padding: 16px 18px; display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}
.stat:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.stat-icon {
  width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-tint); color: var(--brand);
}
/* Per-stage accent: coloured top border, icon chip and number for
   maximum contrast and instant read of the funnel stage. */
.stat-icon.added      { background: #e0e2ef; color: #223381; }
.stat-icon.invited    { background: var(--accent-tint); color: var(--accent); }
.stat-icon.registered { background: var(--brand-tint); color: var(--brand); }
.stat-icon.checked_in { background: #e9edf8; color: #5f6ba6; }
/* Bold per-card edge, each a distinct brand-guideline colour */
.stat:has(.stat-icon.added)      { border-top-color: #223381; }  /* deep indigo */
.stat:has(.stat-icon.invited)    { border-top-color: #f98613; }  /* orange */
.stat:has(.stat-icon.registered) { border-top-color: #5B679F; }  /* indigo */
.stat:has(.stat-icon.checked_in) { border-top-color: #9bacd8; }  /* light blue */
.stat .num { font-size: 2.1rem; font-weight: 800; color: var(--brand); line-height: 1.03; letter-spacing: -0.02em; }
.stat .lbl { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; margin-top: 2px; }

/* Forms */
input, textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  margin-bottom: 10px;
}
input:focus, textarea:focus { outline: 2px solid var(--brand); border-color: transparent; }
label { font-size: 0.85rem; font-weight: 600; display: block; margin-bottom: 4px; }

/* Modern select: hidden native chevron + custom teal chevron, focus ring */
.select-modern {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  padding: 10px 40px 10px 14px; margin: 0;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235b628f' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; background-size: 16px;
  box-shadow: var(--shadow-sm);
  font-weight: 600; color: var(--brand-dark); cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.select-modern:hover { border-color: var(--brand-mist); background-color: var(--brand-tint); }
.select-modern:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(17, 17, 67, 0.16); }
.field-label { text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.08em; color: var(--brand-slate); font-weight: 700; margin-bottom: 5px; }

/* Buttons */
button {
  font: inherit;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  cursor: pointer;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}
button:hover { background: var(--brand-dark); box-shadow: var(--shadow); }
button:active { transform: translateY(1px); }
button.secondary { background: #fff; color: var(--brand-dark); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
button.secondary:hover { background: var(--brand-tint); border-color: var(--brand-mist); }
button.danger { background: #fff; color: var(--red); border: 1px solid var(--line); box-shadow: none; }
button.danger:hover { background: #fdecea; border-color: #f3b0a8; }
button.small { padding: 6px 9px; font-size: 0.8rem; border-radius: 8px; }
button.btn-accent { background: var(--accent); }
button.btn-accent:hover { background: var(--accent-dark); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

/* Styled file-picker (hides the native "Choose file" control) */
.file-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 16px; border-radius: var(--radius-sm);
  background: #fff; color: var(--brand-dark); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm); font-weight: 600; font-size: 0.9rem;
  cursor: pointer; margin: 0; user-select: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.file-btn:hover { background: var(--brand-tint); border-color: var(--brand-mist); }
.file-btn .ico { color: var(--brand-slate); }
.file-btn input[type="file"] { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }

/* Table */
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); }
th { font-size: 0.72rem; color: var(--brand-slate); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; }
tbody tr { transition: background 0.12s ease; }
tbody tr:hover { background: #fafbfc; }
tbody tr:last-child td { border-bottom: 0; }

/* Status badges: coloured dot + label */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 11px 3px 9px; border-radius: 99px;
  font-size: 0.75rem; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge.added      { background: #eef1f4; color: #52606d; }
.badge.invited    { background: var(--amber-tint); color: var(--amber); }
.badge.registered { background: var(--brand-tint); color: var(--brand); }
.badge.checked_in { background: var(--success-tint); color: var(--success); }

/* Filter pills */
.filters { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.filters button { background: #fff; color: var(--muted); border: 1px solid var(--line); font-weight: 600; box-shadow: none; padding: 7px 13px; border-radius: 99px; font-size: 0.83rem; }
.filters button:hover { background: var(--brand-tint); color: var(--brand-dark); border-color: var(--brand-mist); }
.filters button.active { background: var(--brand); color: #fff; border-color: var(--brand); box-shadow: var(--shadow-sm); }

/* Attention tab (e.g. "Invited, not registered"): amber so the
   follow-up list stands out from the normal funnel tabs */
.filters button.attention {
  background: #fef3c7; color: var(--amber);
  border-color: #f2d48b; font-weight: 700;
}
.filters button.attention:hover { background: #fdeaa8; }
.filters button.attention.active {
  background: var(--amber); color: #fff; border-color: var(--amber);
}

/* VIP category badge + stat subcount */
.badge-vip {
  display: inline-block; background: #e0a92e; color: #111143;
  padding: 1px 8px; border-radius: 5px; font-size: 0.68rem; font-weight: 800;
  letter-spacing: 0.5px; vertical-align: 1px; margin-left: 2px;
}
.vipsub { font-size: 0.68rem; font-weight: 800; color: #c08a1e; letter-spacing: 0.3px; margin-top: 3px; min-height: 0.8em; }
.chan { font-size: 0.66rem; color: var(--muted); margin-top: 4px; letter-spacing: 0.2px; }

/* Invitee search box */
.search-box { position: relative; display: inline-flex; align-items: center; }
.search-box .search-ico { position: absolute; left: 11px; display: inline-flex; color: var(--brand-slate); pointer-events: none; }
.search-box input {
  width: 240px; max-width: 52vw; margin: 0; padding: 8px 12px 8px 34px;
  border: 1px solid var(--line); border-radius: 99px; font-size: 0.86rem;
  background: #fff; box-shadow: var(--shadow-sm); transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search-box input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(91,103,159,0.16); }

/* Inline-editable phone cell (admins). Viewers see the plain value. */
.viewer-only { display: none; }
body.app.viewer .viewer-only { display: inline; }
.phone-cell {
  cursor: pointer; color: var(--muted); border-bottom: 1px dashed #cfd6ee;
  padding-bottom: 1px; transition: color 0.12s ease, border-color 0.12s ease;
}
.phone-cell:hover { color: var(--brand); border-bottom-color: var(--brand); }
.phone-add { color: var(--brand-slate); font-size: 0.82rem; font-style: italic; }
.badge-letter {
  display: inline-block; background: var(--brand-tint); color: var(--brand);
  padding: 1px 8px; border-radius: 5px; font-size: 0.66rem; font-weight: 700;
  letter-spacing: 0.3px; vertical-align: 1px; margin-left: 2px; border: 1px solid #cfd6ee;
}

/* Animated attention hint under the "Remind registered" button */
.er-hint {
  text-align: right;
  margin: 9px 2px 0;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--accent);
  animation: erPulse 1.5s ease-in-out infinite;
}
@keyframes erPulse {
  0%, 100% { opacity: 1; transform: translateY(0); }
  50%      { opacity: 0.5; transform: translateY(-2px); }
}
@media (prefers-reduced-motion: reduce) { .er-hint { animation: none; } }

/* ── Button progress spinner ───────────────────────────────────── */
.spinner {
  display: inline-block; width: 13px; height: 13px;
  border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff;
  border-radius: 50%; vertical-align: -2px; margin-right: 6px;
  animation: spin 0.7s linear infinite;
}
button.secondary .spinner {
  border-color: rgba(17, 17, 67,0.25); border-top-color: var(--brand);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Modal dialogs (replaces native prompt/confirm) ────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 30, 40, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: modalFade 0.15s ease;
}
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
  background: #fff; border-radius: 12px; width: 100%; max-width: 400px;
  box-shadow: 0 24px 70px rgba(0,0,0,0.35);
  animation: modalPop 0.18s ease;
  overflow: hidden;
}
@keyframes modalPop { from { transform: translateY(10px) scale(0.98); opacity: 0.6; } to { transform: none; opacity: 1; } }
.modal-box header {
  padding: 14px 20px; border-bottom: 3px solid var(--brand);
  display: flex; align-items: center; gap: 10px;
}
.modal-box header .m-icon { font-size: 1.3rem; }
.modal-box header h3 { margin: 0; font-size: 1rem; color: var(--brand-dark); }
.modal-box .m-body { padding: 18px 20px 6px; }
.modal-box .m-body p { margin: 0 0 12px; color: var(--ink); font-size: 0.92rem; }
.modal-box .m-error { color: var(--red); font-size: 0.82rem; min-height: 1.2em; margin: 2px 0 0; }
.modal-box footer {
  padding: 12px 20px 18px; display: flex; justify-content: flex-end; gap: 10px;
}
.modal-box button.confirm-danger { background: var(--red); }
.modal-box button.confirm-danger:hover { background: #96271b; }

/* Toast (temporary notification) */
#toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--brand-dark); color: #fff; padding: 10px 20px; border-radius: 8px;
  font-size: 0.9rem; opacity: 0; transition: opacity 0.25s; pointer-events: none;
  max-width: 90vw;
}
#toast.show { opacity: 1; }

.muted { color: var(--muted); font-size: 0.85rem; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

@media (max-width: 640px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  th:nth-child(4), td:nth-child(4) { display: none; } /* hide email col on phones */
  .topbar img.brand-logo { max-width: 240px; }
}
