/* ============================================================
   KCC Voucher Management System — brand theme
   Kigali Convention Centre. Colors & type per the design spec.
   Loaded on top of Bootstrap 5; overrides a handful of tokens.
   ============================================================ */

:root {
  /* Brand */
  --kcc-navy:        #003080;  /* primary */
  --kcc-navy-deep:   #012a6b;
  --kcc-sidebar:     #04173a;  /* dark sidebar */
  --kcc-accent:      #2563eb;  /* accent blue */
  --kcc-accent-soft: #5b8def;
  --kcc-success:     #0f9d58;
  --kcc-success-2:   #10b981;
  --kcc-danger:      #dc2626;
  --kcc-warning:     #f59e0b;

  /* Surfaces & text */
  --kcc-bg:          #eef2f7;  /* page background */
  --kcc-surface:     #ffffff;
  --kcc-border:      #e9eef5;
  --kcc-border-2:    #dbe3ee;
  --kcc-ink:         #0f172a;
  --kcc-ink-soft:    #334155;
  --kcc-muted:       #64748b;
  --kcc-muted-2:     #94a3b8;

  /* Bootstrap variable overrides */
  --bs-primary:      var(--kcc-navy);
  --bs-body-bg:      var(--kcc-bg);
  --bs-body-color:   var(--kcc-ink);
  --bs-body-font-family: 'Plus Jakarta Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --bs-border-radius: 14px;
}

* { box-sizing: border-box; }

body {
  font-family: var(--bs-body-font-family);
  background: var(--kcc-bg);
  color: var(--kcc-ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Cards: white, hairline border, soft shadow, rounded. */
.card,
.kcc-card {
  background: var(--kcc-surface);
  border: 1px solid var(--kcc-border);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -16px rgba(15, 23, 42, .18);
}

/* Buttons */
.btn-primary {
  --bs-btn-bg: var(--kcc-navy);
  --bs-btn-border-color: var(--kcc-navy);
  --bs-btn-hover-bg: var(--kcc-navy-deep);
  --bs-btn-hover-border-color: var(--kcc-navy-deep);
  --bs-btn-active-bg: var(--kcc-navy-deep);
  --bs-btn-active-border-color: var(--kcc-navy-deep);
}
.btn-accent {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--kcc-accent);
  --bs-btn-border-color: var(--kcc-accent);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #1d4ed8;
  --bs-btn-hover-border-color: #1d4ed8;
  color: #fff;
}

/* Modals — wider, softer, on-brand. */
.modal-content {
  border: 0;
  border-radius: 18px;
  box-shadow: 0 30px 80px -24px rgba(2, 8, 23, .45);
  overflow: hidden;
}
.modal-header {
  background: #f8fafc;
  border-bottom: 1px solid var(--kcc-border);
  padding: 1.05rem 1.6rem;
}
.modal-title { font-weight: 700; color: var(--kcc-navy); font-size: 1.05rem; }
.modal-body { padding: 1.5rem 1.6rem; }
.modal-footer { border-top: 1px solid var(--kcc-border); padding: 1rem 1.6rem; background: #f8fafc; }
.modal-body .form-label { margin-bottom: .3rem; color: var(--kcc-ink-soft); }
/* A roomier dialog for our CRUD forms. */
.modal-dialog.modal-lg { --bs-modal-width: 720px; }
@media (min-width: 992px) {
  .modal-dialog.modal-wide { max-width: 860px; }
}

/* Form fields — give inputs a distinct fill so they stand out from the white
   card/modal surface they sit on (instead of blending in). */
.form-control,
.form-select {
  background-color: #f1f5f9;
  border-color: #d7e0ec;
}
.form-control::placeholder { color: #9aa6b8; }
.form-control:focus,
.form-select:focus {
  background-color: #fff;
  border-color: var(--kcc-accent);
  box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .12);
}
textarea.form-control { background-color: #f1f5f9; }

/* Logo tile — the navy mark is invisible on the dark sidebar, so sit it on a
   small white rounded tile wherever the background is dark (per spec option 1). */
.logo-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 12px;
  padding: 8px 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}
.logo-tile img { display: block; height: 34px; width: auto; }

/* Status pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .72rem;
  font-weight: 600;
  line-height: 1;
  padding: .35rem .6rem;
  border-radius: 999px;
  border: 1px solid transparent;
}
.pill-active   { background: #e7f7ef; color: #0f7a45; border-color: #cdeede; }
.pill-success  { background: #e7f7ef; color: #0f7a45; }
.pill-redeemed { background: #e8f0fe; color: #1d4ed8; }
.pill-expired  { background: #f1f5f9; color: #64748b; }
.pill-blocked  { background: #fdecec; color: #b91c1c; }
.pill-warning  { background: #fef3e2; color: #b45309; }

/* Auth / landing gradient panel */
.brand-hero {
  background:
    radial-gradient(1200px 600px at 110% -10%, rgba(37, 99, 235, .25), transparent 60%),
    linear-gradient(160deg, var(--kcc-navy) 0%, var(--kcc-sidebar) 100%);
  color: #fff;
}

/* Utility text colors */
.text-muted-2 { color: var(--kcc-muted-2) !important; }
.text-navy    { color: var(--kcc-navy) !important; }

/* ===== Admin shell ======================================================== */
.kcc-shell { display: flex; min-height: 100vh; }

.kcc-sidebar {
  width: 260px;
  flex: 0 0 260px;
  background: var(--kcc-sidebar);
  color: #cdd7e8;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.kcc-sidebar::-webkit-scrollbar { width: 8px; }
.kcc-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 8px; }

.kcc-brand {
  padding: 1.1rem 1rem .9rem;
}
/* Full-width white tile holding the complete KCC logo (navy mark needs a light bg). */
.kcc-logo-full {
  display: block;
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}
.kcc-logo-full img { display: block; width: 100%; height: auto; }

.kcc-nav { padding: .25rem .6rem 1rem; flex: 1 1 auto; }
.kcc-nav-group { margin-top: 1rem; }
.kcc-nav-group-label {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
  color: #5b6a85; padding: 0 .6rem .35rem; font-weight: 700;
}
.kcc-nav-item {
  display: flex; align-items: center; gap: .7rem;
  padding: .55rem .65rem; margin: .1rem 0;
  border-radius: 10px; color: #b8c4d9; text-decoration: none;
  font-size: .9rem; font-weight: 500; position: relative;
}
.kcc-nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.kcc-nav-item.active { background: rgba(91,141,239,.16); color: #fff; box-shadow: inset 3px 0 0 #5b8def; }
.kcc-nav-item svg { width: 18px; height: 18px; flex: 0 0 auto; opacity: .85; }
.kcc-nav-item .soon {
  margin-left: auto; font-size: .6rem; font-weight: 700; letter-spacing: .04em;
  color: #7c8aa0; border: 1px solid #2a3a59; border-radius: 6px; padding: .05rem .3rem;
}

.kcc-sidebar-user {
  border-top: 1px solid rgba(255,255,255,.08);
  padding: .8rem 1rem; display: flex; align-items: center; gap: .6rem;
}

.kcc-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.kcc-topbar {
  background: #fff; border-bottom: 1px solid var(--kcc-border);
  padding: .7rem 1.25rem; display: flex; align-items: center; gap: 1rem;
  position: sticky; top: 0; z-index: 20;
}
.kcc-content { padding: 1.5rem 1.25rem; max-width: 1280px; width: 100%; }

.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--kcc-accent); color: #fff; font-size: .8rem; font-weight: 700; flex: 0 0 auto;
}
.avatar-sm { width: 30px; height: 30px; font-size: .7rem; }

/* Page header (title + actions) inside content */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.page-header h1 { font-size: 1.4rem; font-weight: 800; color: var(--kcc-navy); margin: 0; }
.page-header p { color: var(--kcc-muted); margin: .15rem 0 0; font-size: .9rem; }

/* Tables */
.kcc-table { width: 100%; }
.kcc-table thead th {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--kcc-muted-2); font-weight: 700; border-bottom: 1px solid var(--kcc-border-2);
  padding: .6rem .75rem; white-space: nowrap;
}
.kcc-table tbody td { padding: .75rem; border-bottom: 1px solid var(--kcc-border); vertical-align: middle; font-size: .9rem; }
.kcc-table tbody tr:last-child td { border-bottom: 0; }
.kcc-table tbody tr:hover { background: #f8fafc; }

@media (max-width: 991.98px) {
  .kcc-sidebar { position: fixed; left: 0; top: 0; z-index: 1045; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .kcc-sidebar.show { transform: translateX(0); }
  .kcc-backdrop { position: fixed; inset: 0; background: rgba(2,8,23,.5); z-index: 1040; display: none; }
  .kcc-backdrop.show { display: block; }
}
@media (min-width: 992px) {
  .kcc-hamburger { display: none; }
}

/* ===== Staff mobile app ================================================== */
.staff-app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--kcc-bg);
  position: relative;
  padding-bottom: 84px;
  box-shadow: 0 0 60px -20px rgba(2,8,23,.25);
}
.staff-topbar {
  background: var(--kcc-sidebar);
  color: #fff;
  padding: 1rem 1.1rem;
  border-bottom-left-radius: 18px;
  border-bottom-right-radius: 18px;
}
.staff-content { padding: 1rem 1.1rem; }

.staff-kpi {
  background: #fff; border: 1px solid var(--kcc-border); border-radius: 14px;
  padding: .8rem; text-align: center;
}
.staff-kpi .v { font-size: 1.5rem; font-weight: 800; color: var(--kcc-navy); line-height: 1; }
.staff-kpi .l { font-size: .72rem; color: var(--kcc-muted); margin-top: .25rem; }

.scan-btn {
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  width: 100%; padding: 1rem; border: 0; border-radius: 16px;
  background: linear-gradient(160deg, var(--kcc-accent), var(--kcc-navy));
  color: #fff; font-weight: 700; font-size: 1.05rem;
  box-shadow: 0 12px 24px -12px rgba(37,99,235,.7);
}

.staff-bottomnav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  background: #fff; border-top: 1px solid var(--kcc-border);
  display: flex; justify-content: space-around; padding: .4rem .25rem .55rem;
  z-index: 50;
}
.staff-tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: .15rem;
  color: var(--kcc-muted-2); text-decoration: none; font-size: .68rem; font-weight: 600; padding: .3rem 0;
}
.staff-tab svg { width: 22px; height: 22px; }
.staff-tab.active { color: var(--kcc-navy); }

#qr-reader { border-radius: 14px; overflow: hidden; border: 1px solid var(--kcc-border); }
#qr-reader video { border-radius: 14px; }

/* Fast Scan */
.fast-banner {
  border-radius: 14px; padding: .9rem 1rem; color: #fff; font-weight: 700;
  display: flex; align-items: center; gap: .6rem; min-height: 58px;
  transition: background .12s ease; background: #475569;
}
.fast-banner small { font-weight: 500; opacity: .92; }
.fast-ok   { background: linear-gradient(160deg, #10b981, #0f7a45); }
.fast-warn { background: linear-gradient(160deg, #f59e0b, #b45309); }
.fast-bad  { background: linear-gradient(160deg, #ef4444, #b91c1c); }
.fast-idle { background: #334155; }

/* Full-screen colour flash for peripheral feedback while scanning. */
.fast-flash {
  position: fixed; inset: 0; z-index: 2000; pointer-events: none;
  opacity: 0; transition: opacity .18s ease;
}
.fast-flash.show { opacity: .28; }

.fast-tally { display: flex; gap: .5rem; }
.fast-tally .t { flex: 1; text-align: center; border-radius: 12px; padding: .55rem; background: #fff; border: 1px solid var(--kcc-border); }
.fast-tally .t .n { font-size: 1.4rem; font-weight: 800; line-height: 1; }

.result-hero {
  border-radius: 16px; padding: 1.4rem 1.1rem; text-align: center; color: #fff;
}
.result-ok  { background: linear-gradient(160deg, #10b981, #0f7a45); }
.result-bad { background: linear-gradient(160deg, #ef4444, #b91c1c); }

.stepper-btn {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--kcc-border-2);
  background: #fff; font-size: 1.3rem; font-weight: 700; color: var(--kcc-navy);
}

/* Status page (Phase 0) */
.status-row { display: flex; align-items: center; gap: .75rem; padding: .6rem 0; border-bottom: 1px dashed var(--kcc-border-2); }
.status-row:last-child { border-bottom: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.dot-ok   { background: var(--kcc-success); }
.dot-warn { background: var(--kcc-warning); }
.dot-bad  { background: var(--kcc-danger); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
