/* ============================================================================
   UI KIT — shared across online-server and offline-client
   Extends design-system.css. Same "Exam Hall, Digitized" language:
   ruled edges, serial-code typography, seal/alert/gold semantics.
   Loaded after design-system.css; do not redefine tokens here.
   ============================================================================ */

/* ---- Toasts: styled like a stamped notice slip, not a generic snackbar ---- */
.cbt-toast-stack {
  position: fixed; top: 1rem; right: 1rem; z-index: 1080;
  display: flex; flex-direction: column; gap: .6rem; width: min(360px, calc(100vw - 2rem));
}
.cbt-toast {
  background: var(--paper); border: 1px solid var(--rule); border-left: 4px solid var(--ink);
  border-radius: var(--radius-sm); box-shadow: 0 4px 16px rgba(11,37,69,.12);
  padding: .75rem .9rem; display: flex; gap: .65rem; align-items: flex-start;
  font-size: .875rem; color: var(--graphite);
  animation: cbt-toast-in .18s ease-out;
}
.cbt-toast.hide { animation: cbt-toast-out .15s ease-in forwards; }
@keyframes cbt-toast-in { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: translateX(0); } }
@keyframes cbt-toast-out { to { opacity: 0; transform: translateX(12px); } }
@media (prefers-reduced-motion: reduce) { .cbt-toast, .cbt-toast.hide { animation: none; } }
.cbt-toast .cbt-toast-icon { font-family: var(--font-mono); font-weight: 700; flex: none; width: 1.4rem; height: 1.4rem;
  border-radius: 50%; display: grid; place-content: center; font-size: .72rem; }
.cbt-toast .cbt-toast-body { flex: 1; }
.cbt-toast .cbt-toast-title { font-weight: 600; color: var(--ink); display: block; margin-bottom: .1rem; }
body.dark-mode .cbt-toast .cbt-toast-title { color: #E7ECF1; }
.cbt-toast .cbt-toast-close { background: none; border: 0; color: var(--graphite-soft); cursor: pointer; line-height: 1; font-size: 1rem; padding: 0; }
.cbt-toast.success { border-left-color: var(--seal-green); }
.cbt-toast.success .cbt-toast-icon { background: var(--seal-green-bg); color: var(--seal-green); }
.cbt-toast.error { border-left-color: var(--alert-red); }
.cbt-toast.error .cbt-toast-icon { background: var(--alert-red-bg); color: var(--alert-red); }
.cbt-toast.info { border-left-color: var(--ink); }
.cbt-toast.info .cbt-toast-icon { background: var(--sheet); color: var(--ink); }
.cbt-toast.warning { border-left-color: var(--stamp-gold); }
.cbt-toast.warning .cbt-toast-icon { background: var(--stamp-gold-bg); color: var(--stamp-gold); }

/* ---- Confirmation dialog: a modal "attestation" — deliberate, not a browser confirm() ---- */
.cbt-dialog-backdrop {
  position: fixed; inset: 0; background: rgba(11,37,69,.45); z-index: 1090;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  animation: cbt-fade-in .15s ease-out;
}
@keyframes cbt-fade-in { from { opacity: 0; } to { opacity: 1; } }
.cbt-dialog {
  background: var(--paper); border-radius: var(--radius); max-width: 420px; width: 100%;
  padding: 1.5rem; box-shadow: 0 12px 32px rgba(11,37,69,.25); border-top: 3px solid var(--ink);
}
.cbt-dialog.danger { border-top-color: var(--alert-red); }
.cbt-dialog h5 { margin-bottom: .5rem; }
.cbt-dialog p { color: var(--graphite-soft); font-size: .9rem; margin-bottom: 1.25rem; }
.cbt-dialog .cbt-dialog-actions { display: flex; justify-content: flex-end; gap: .6rem; }

/* ---- Loading skeletons: ruled placeholder bars, like a blank OMR sheet ---- */
.cbt-skel { background: linear-gradient(90deg, var(--rule) 25%, var(--sheet) 50%, var(--rule) 75%);
  background-size: 200% 100%; animation: cbt-skel-shimmer 1.4s ease-in-out infinite; border-radius: var(--radius-sm); }
@keyframes cbt-skel-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .cbt-skel { animation: none; opacity: .6; } }
.cbt-skel-text { height: .85em; margin-bottom: .5rem; width: 100%; }
.cbt-skel-text.short { width: 40%; }
.cbt-skel-title { height: 1.4rem; width: 55%; margin-bottom: .9rem; }
.cbt-skel-card { height: 92px; border-radius: var(--radius); }
.cbt-skel-row { height: 2.4rem; border-radius: var(--radius-sm); margin-bottom: .5rem; }
.cbt-skel-avatar { width: 2.5rem; height: 2.5rem; border-radius: 50%; }

/* ---- Empty states: an invitation to act, not a dead end ---- */
.cbt-empty { text-align: center; padding: 3rem 1.5rem; color: var(--graphite-soft); }
.cbt-empty .cbt-empty-icon { font-size: 2.2rem; color: var(--rule); margin-bottom: .9rem; }
.cbt-empty h6 { color: var(--ink); margin-bottom: .4rem; font-family: var(--font-display); }
body.dark-mode .cbt-empty h6 { color: #E7ECF1; }
.cbt-empty p { font-size: .875rem; max-width: 360px; margin: 0 auto 1rem; }
.cbt-empty p:last-child { margin-bottom: 0; }
/* Compact variant for dashboard widgets / small side-panel lists */
.cbt-empty.compact { padding: 1.1rem .75rem; }
.cbt-empty.compact .cbt-empty-icon { font-size: 1.1rem; margin-bottom: .35rem; }
.cbt-empty.compact h6 { font-size: .85rem; margin-bottom: .15rem; }
.cbt-empty.compact p { font-size: .78rem; margin-bottom: 0; }

/* ---- Progress indicators: reused exam-clock language for consistency ---- */
.cbt-progress { height: .5rem; border-radius: 999px; background: var(--rule); overflow: hidden; }
.cbt-progress > span { display: block; height: 100%; background: var(--ink); border-radius: 999px; transition: width .2s ease; }
.cbt-progress.success > span { background: var(--seal-green); }
.cbt-progress.warning > span { background: var(--stamp-gold); }
.cbt-progress.danger > span { background: var(--alert-red); }
.cbt-steps { display: flex; align-items: center; gap: 0; }
.cbt-steps .step { display: flex; align-items: center; gap: .5rem; color: var(--graphite-soft); font-size: .82rem; font-weight: 600; }
.cbt-steps .step .dot { width: 1.6rem; height: 1.6rem; border-radius: 50%; border: 2px solid var(--rule); display: grid; place-content: center;
  font-family: var(--font-mono); font-size: .75rem; background: var(--paper); }
.cbt-steps .step.done .dot { background: var(--seal-green); border-color: var(--seal-green); color: #fff; }
.cbt-steps .step.active .dot { border-color: var(--ink); color: var(--ink); }
.cbt-steps .step.active { color: var(--ink); }
.cbt-steps .step-line { flex: 1; height: 2px; background: var(--rule); margin: 0 .4rem; }
.cbt-steps .step-line.done { background: var(--seal-green); }

/* ---- Micro-interactions: restrained, not decorative ---- */
.cbt-fade-up { animation: cbt-fade-up .2s ease-out; }
@keyframes cbt-fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .cbt-fade-up { animation: none; } }
.card { transition: box-shadow .15s ease; }
.card.cbt-hover:hover { box-shadow: 0 4px 14px rgba(11,37,69,.09); }

/* ---------------------------------------------------------------------------
   Auth shell (login / forgot-password / reset-password) — split visual +
   form layout. Referenced by login.php, forgot_password.php, and
   reset_password.php but never actually defined, so those pages were
   rendering as unstyled raw HTML (bug found via a screenshot showing the
   login page with no card, no split panes, and a bare floating "N" avatar
   letter). One definition here fixes all three pages at once.
---------------------------------------------------------------------------- */
.cbt-auth-shell { min-height: 100vh; display: flex; background: var(--sheet); }

.cbt-auth-visual {
  flex: 0 0 44%; position: relative; overflow: hidden; display: flex; flex-direction: column;
  justify-content: space-between; background: var(--ink); color: #fff; padding: 3rem 3.25rem;
}
.cbt-auth-visual .brand { font-family: var(--font-display); font-weight: 700; letter-spacing: .01em; }
.cbt-auth-copy { position: relative; z-index: 1; }
.cbt-auth-copy h2 { font-family: var(--font-display); font-weight: 700; font-size: 1.9rem; line-height: 1.3; color: #fff; }
.cbt-auth-copy p { color: rgba(255,255,255,.72); font-size: .95rem; max-width: 26rem; }
.cbt-auth-badges { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: .6rem 1.4rem; }
.cbt-auth-badges span { font-size: .8rem; color: rgba(255,255,255,.75); white-space: nowrap; }

/* Decorative background shapes — purely ambient, never affects layout */
.cbt-auth-shapes { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.cbt-auth-shapes span { position: absolute; border-radius: 50%; background: rgba(255,255,255,.05); }
.cbt-auth-shapes span:nth-child(1) { width: 22rem; height: 22rem; top: -8rem; right: -6rem; }
.cbt-auth-shapes span:nth-child(2) { width: 14rem; height: 14rem; bottom: -4rem; left: -3rem; background: rgba(255,255,255,.04); }
.cbt-auth-shapes span:nth-child(3) { width: 9rem; height: 9rem; bottom: 5rem; right: 3rem; background: rgba(255,255,255,.035); }

.cbt-auth-form-pane {
  flex: 1; position: relative; display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.5rem 5rem;
}

.cbt-auth-theme-toggle {
  position: absolute; top: 1.25rem; right: 1.25rem; width: 2.4rem; height: 2.4rem; border-radius: 50%;
  border: 1px solid var(--rule); background: var(--paper); color: var(--graphite); display: grid; place-content: center;
  cursor: pointer; transition: background .12s ease, box-shadow .12s ease;
}
.cbt-auth-theme-toggle:hover { box-shadow: 0 2px 8px rgba(11,37,69,.12); }

.cbt-glass-card {
  width: 100%; max-width: 26rem; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(11,37,69,.1); padding: 2.25rem 2rem;
}

.cbt-auth-logo {
  width: 3rem; height: 3rem; margin: 0 auto 1.1rem; border-radius: 50%; background: var(--ink); color: #fff;
  font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; display: grid; place-content: center;
}

/* Floating-label field: inputs use placeholder=" " so :placeholder-shown
   reliably tells us whether the field is empty and unfocused. */
.cbt-field { position: relative; margin-bottom: 1.15rem; }
.cbt-field input, .cbt-field select {
  width: 100%; padding: 1.05rem .9rem .45rem; border: 1px solid var(--rule); border-radius: var(--radius-sm);
  background: var(--paper); color: var(--graphite); font-size: .95rem; transition: border-color .12s ease;
}
.cbt-field input:focus, .cbt-field select:focus { outline: none; border-color: var(--ink); }
.cbt-field label {
  position: absolute; left: .9rem; top: .68rem; font-size: .95rem; color: var(--graphite-soft);
  pointer-events: none; transition: top .12s ease, font-size .12s ease, color .12s ease; background: var(--paper); padding: 0 .2rem;
}
.cbt-field input:focus + label, .cbt-field input:not(:placeholder-shown) + label,
.cbt-field select:focus + label, .cbt-field select:not(:placeholder-shown) + label {
  top: -.55rem; font-size: .72rem; color: var(--ink); font-weight: 600;
}
.cbt-field-error input { border-color: var(--alert-red); }

.cbt-btn-primary-block {
  width: 100%; padding: .8rem 1rem; background: var(--ink); color: #fff; border: none; border-radius: var(--radius-sm);
  font-weight: 600; font-size: .95rem; cursor: pointer; transition: background .12s ease; text-align: center; display: block;
}
.cbt-btn-primary-block:hover, .cbt-btn-primary-block:focus { background: var(--ink-soft); color: #fff; }
.cbt-btn-primary-block:disabled { opacity: .65; cursor: not-allowed; }

/* Below ~900px the marketing pane isn't worth the space it costs the form */
@media (max-width: 900px) {
  .cbt-auth-visual { display: none; }
  .cbt-auth-form-pane { padding-top: 4rem; }
}
