/* ============================================================
   Department Student Registry — Shared Stylesheet
   ============================================================ */

/* ---------- Design Tokens ---------------------------------- */
:root {
  --navy:      #082486;
  --navy-deep: #0E226D;
  --navy-700:  #0a1f5c;
  --surface:   #EEEEF9;
  --ink:       #1b1d2b;
  --muted:     #737790;
  --line:      #e6e7f2;
  --ok:        #1f9d63;
  --ok-bg:     #e6f6ee;
  --empty:     #b08400;
  --empty-bg:  #fbf3dc;
  --danger:    #c0392b;
  --danger-bg: #fdeaea;
  --board:     #eef0f7;
}

/* ---------- Reset ------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: 'Poppins', sans-serif;
  /* Hero pages override this; admin/dashboard shows board colour */
  background: var(--board);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Page Wrapper ----------------------------------- */
/* Shared by ALL pages — no colour here, each section owns its own background */
.page-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--board);  /* light grey — dashboard / admin pages */
}

/* ---------- Hero Panel ------------------------------------- */
/* Only register.php and login.php use .hero */
.hero {
  flex: 1;                  /* stretches to fill full viewport height */
  display: flex;
  flex-direction: column;
  position: relative;
  /* The navy gradient lives HERE, not on .page-wrap */
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-deep) 70%, #0a1652 100%);
  padding: 46px 0 0;
  color: #fff;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(140px 140px at 82% 18%, rgba(255,255,255,.12), transparent 70%),
    radial-gradient(180px 180px at -5% 60%,  rgba(255,255,255,.07), transparent 70%);
  pointer-events: none;
}
.hero-gear {
  position: absolute;
  right: -30px;
  top: 30px;
  width: 170px;
  height: 170px;
  opacity: .10;
  pointer-events: none;
}
.hero-pill { display: block; margin: 0 0 0 24px; font-size: 26px; font-weight: 800; letter-spacing: -.01em; }
.hero-sub  { display: block; margin: 6px 0 26px 24px; font-size: 12.5px; opacity: .8; font-weight: 400; }

/* ---------- White Sheet ------------------------------------ */
.sheet {
  flex: 1;                  /* grows to fill remaining hero height */
  display: flex;
  flex-direction: column;   /* lets .sheet-foot push to the bottom */
  background: #fff;
  border-radius: 34px 34px 0 0;
  margin-top: 6px;
  padding: 26px 22px 0;     /* bottom padding handled by .sheet-foot */
  position: relative;
  z-index: 2;
}

/* Centred, max-width content area inside the sheet */
.sheet-body {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

/* Sticky footer inside the sheet — always at the bottom */
.sheet-foot {
  margin-top: auto;
  padding: 24px 0 36px;
  text-align: center;
}
.sheet-foot a {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  text-decoration: none;
}
.sheet-foot a:hover { text-decoration: underline; }
/* safe area for phones with home-indicator bar */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .sheet-foot { padding-bottom: max(36px, env(safe-area-inset-bottom)); }
}

/* ---------- Logo / Crest ----------------------------------- */
.crest {
  width: 80px;
  height: 80px;
  margin: -50px auto 0;
  position: relative;
  z-index: 5;
}
.crest img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.school-name { text-align: center; font-weight: 700; font-size: 18px; color: var(--ink); margin-top: 14px; }
.school-tag  { text-align: center; font-size: 11px; color: var(--muted); margin-top: 3px; letter-spacing: .02em; }

/* ---------- Form Fields ------------------------------------ */
.field { margin-top: 18px; }
.field > label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  margin: 0 0 7px 4px;
}

.input-wrap {
  background: var(--surface);
  border: 1.5px solid transparent;
  border-radius: 14px;
  height: 54px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  transition: border-color .2s, background .2s;
}
.input-wrap:focus-within { border-color: var(--navy); background: #fff; }
.input-wrap .ic { margin-right: 11px; color: var(--navy); opacity: .8; flex: none; }
.input-wrap input,
.input-wrap select {
  border: 0;
  background: transparent;
  outline: 0;
  width: 100%;
  font-family: 'Poppins', sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  min-width: 0;
}
.input-wrap input::placeholder { color: var(--muted); font-weight: 400; }

/* Matric number composite */
.matric-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border-radius: 14px;
  padding: 0 8px;
  height: 54px;
}
.matric-lock {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  flex-shrink: 0;
}
.matric-edit {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  background: #fff;
  border: 1.5px solid var(--navy);
  border-radius: 10px;
  height: 40px;
  padding: 0 4px;
}
.matric-edit button {
  border: 0;
  background: var(--surface);
  color: var(--navy);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  display: grid;
  place-items: center;
  flex: none;
  transition: background .15s;
}
.matric-edit button:hover { background: var(--line); }
.matric-edit input {
  border: 0;
  outline: 0;
  text-align: center;
  width: 100%;
  min-width: 0;
  font-family: 'Poppins', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  background: transparent;
  -moz-appearance: textfield;
}
.matric-edit input::-webkit-outer-spin-button,
.matric-edit input::-webkit-inner-spin-button { -webkit-appearance: none; }

.hint {
  font-size: 11px;
  color: var(--muted);
  margin: 8px 0 0 4px;
  display: flex;
  gap: 6px;
  align-items: flex-start;
  line-height: 1.45;
}
.hint svg { flex: none; margin-top: 1px; color: var(--navy); }

/* ---------- Buttons ---------------------------------------- */
.btn {
  height: 56px;
  border-radius: 16px;
  background: var(--navy);
  color: #fff;
  font-family: 'Poppins', sans-serif;
  font-size: 16px;
  font-weight: 700;
  border: 0;
  width: 100%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  box-shadow: 0 12px 24px -8px rgba(8,36,134,.5);
  transition: transform .15s, box-shadow .2s, background .2s;
  letter-spacing: .01em;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover  { background: var(--navy-700); text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn.block  { display: flex; margin-top: 26px; }
.btn.sm     { height: 44px; font-size: 14px; border-radius: 12px; }
.btn.ghost  { background: #fff; color: var(--navy); border: 1.5px solid var(--line); box-shadow: none; }
.btn.ghost:hover { border-color: var(--navy); background: var(--surface); }
.btn.danger { background: var(--danger); box-shadow: 0 12px 24px -8px rgba(192,57,43,.4); }
.btn.danger:hover { background: #a93226; }
.btn.w-auto { width: auto; padding: 0 22px; }

/* ---------- Terms ------------------------------------------ */
.terms { font-size: 12.5px; color: var(--muted); margin-top: 16px; line-height: 1.55; }
.terms a { color: var(--navy); font-weight: 700; }

/* ---------- Success Screen --------------------------------- */
.success-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 46px 24px 60px;
  text-align: center;
  background: linear-gradient(180deg, #fff, #f7f8ff);
}
.tick {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--ok-bg);
  display: grid;
  place-items: center;
  margin-bottom: 24px;
  position: relative;
  flex-shrink: 0;
}
.tick::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px dashed rgba(31,157,99,.35);
}
.success-wrap h2 { font-size: 22px; font-weight: 800; color: var(--ink); margin-bottom: 8px; }
.success-wrap .p { font-size: 13.5px; color: var(--muted); line-height: 1.55; max-width: 280px; margin-bottom: 26px; }

/* Confirmation slip */
.slip {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 6px 18px;
  box-shadow: 0 14px 30px -18px rgba(8,36,134,.35);
  text-align: left;
}
.slip .li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13px;
  gap: 8px;
}
.slip .li:last-child { border-bottom: 0; }
.slip .li span { color: var(--muted); font-weight: 500; flex-shrink: 0; }
.slip .li b {
  color: var(--ink);
  font-weight: 700;
  text-align: right;
  word-break: break-all;  /* prevents matric number overflow */
}
.slip .li b.code {
  color: var(--navy);
  font-family: 'Source Serif 4', serif;
  letter-spacing: .02em;
  font-size: 12px;
}

/* ---------- Admin App Bar ---------------------------------- */
.appbar {
  background: linear-gradient(150deg, var(--navy), var(--navy-deep));
  color: #fff;
  padding: 20px 20px 18px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(8,36,134,.25);
}
.appbar-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.appbar-top .ttl { font-size: 12px; opacity: .75; font-weight: 500; }
.appbar-top h2   { font-size: 20px; font-weight: 700; margin-top: 2px; }
.appbar-actions  { display: flex; align-items: center; gap: 10px; }

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: rgba(255,255,255,.16);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  flex-shrink: 0;
  border: 0;
}
.avatar:hover { background: rgba(255,255,255,.24); text-decoration: none; color: #fff; }

/* Stats row */
.stats { display: flex; gap: 8px; margin-top: 16px; }
.stat {
  flex: 1;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 14px;
  padding: 12px 10px;
  min-width: 0;
}
.stat .v { font-size: 20px; font-weight: 800; line-height: 1; }
.stat .k { font-size: 10px; opacity: .8; margin-top: 4px; font-weight: 500; }
.stat.hl { background: #fff; border-color: #fff; }
.stat.hl .v { color: var(--navy); }
.stat.hl .k { color: var(--muted); opacity: 1; }

/* ---------- Dashboard Body --------------------------------- */
.dash-body { padding: 16px 16px 48px; }

/* Full-viewport layout: only #rlist scrolls, everything above is fixed */
.dash-page {
  height: 100vh;
  overflow: hidden;
}
.dash-page .dash-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 0;
}
.dash-page #rlist {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding-bottom: 48px;
  -webkit-overflow-scrolling: touch;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  height: 48px;
  padding: 0 15px;
  margin-bottom: 12px;
  transition: border-color .2s;
}
.search-bar:focus-within { border-color: var(--navy); }
.search-bar input {
  border: 0;
  background: transparent;
  outline: 0;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  width: 100%;
  color: var(--ink);
  min-width: 0;
}
.search-bar svg { color: var(--muted); flex: none; }

/* Action chips */
.actions { display: flex; gap: 8px; margin-bottom: 18px; }
.chip-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 6px;
  font-family: 'Poppins', sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition: border-color .18s, transform .18s;
  -webkit-tap-highlight-color: transparent;
}
.chip-btn:hover { border-color: var(--navy); transform: translateY(-2px); color: var(--ink); text-decoration: none; }
.chip-btn .ci {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.chip-btn.prev .ci { background: var(--surface);  color: var(--navy); }
.chip-btn.pdf  .ci { background: var(--danger-bg); color: var(--danger); }
.chip-btn.xls  .ci { background: var(--ok-bg);     color: var(--ok); }

/* List section header */
.list-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 4px 2px 12px;
}
.list-head b    { font-size: 14px; color: var(--ink); }
.list-head span { font-size: 11px; color: var(--muted); }

/* Student row cards */
.rowcard {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 8px;
  background: #fff;
  transition: border-color .15s;
}
.rowcard:hover { border-color: #cfd2ec; }
.rowcard.is-empty .nm { color: var(--muted); font-style: italic; font-weight: 500; }

.sn-badge {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--surface);
  color: var(--navy);
  font-weight: 700;
  font-size: 11px;
  display: grid;
  place-items: center;
  flex: none;
}
.rowcard .meta { flex: 1; min-width: 0; }
.rowcard .meta .nm {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rowcard .meta .mt {
  font-size: 10.5px;
  color: var(--muted);
  font-family: 'Source Serif 4', serif;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Status tags */
.tag {
  font-size: 9px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  flex: none;
  white-space: nowrap;
}
.tag.ok    { background: var(--ok-bg);    color: var(--ok); }
.tag.empty { background: var(--empty-bg); color: var(--empty); }

/* Edit icon */
.edit-ic {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--navy);
  flex: none;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  background: transparent;
  -webkit-tap-highlight-color: transparent;
}
.edit-ic:hover { border-color: var(--navy); background: var(--surface); }

/* ---------- Flash / Alert ---------------------------------- */
.alert {
  border-radius: 12px;
  padding: 13px 16px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.5;
}
.alert svg  { flex: none; margin-top: 1px; }
.alert.ok   { background: var(--ok-bg);    color: var(--ok); }
.alert.err  { background: var(--danger-bg); color: var(--danger); }
.alert.warn { background: var(--empty-bg); color: var(--empty); }

/* ---------- Bottom Sheet Modal (edit) ---------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11,18,52,.5);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet-modal {
  background: #fff;
  width: 100%;
  border-radius: 26px 26px 0 0;
  padding: 14px 20px 36px;
  position: relative;
  box-shadow: 0 -8px 40px rgba(11,18,52,.2);
  /* safe area for phones with home bar */
  padding-bottom: max(36px, env(safe-area-inset-bottom, 36px));
}
.grab { width: 42px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 18px; }
.sheet-modal h3  { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.sheet-modal .sub { font-size: 12px; color: var(--muted); margin-bottom: 18px; }

.locked-field {
  background: var(--surface);
  border-radius: 12px;
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 8px;
  font-family: 'Source Serif 4', serif;
  font-weight: 600;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 14px;
  overflow: hidden;
}
.btns2 { display: flex; gap: 10px; margin-top: 20px; }
.btns2 .btn { height: 50px; font-size: 14px; }

/* ---------- Preview / Booklet ------------------------------ */
.prev-bar {
  background: var(--navy-deep);
  color: #fff;
  padding: 16px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.prev-bar h2 { font-size: 14px; font-weight: 600; line-height: 1.3; }
.prev-bar-btns { display: flex; gap: 8px; flex-shrink: 0; }
.prev-bar-btns button,
.prev-bar-btns a {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: rgba(255,255,255,.14);
  border: 0;
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
  flex-shrink: 0;
}
.prev-bar-btns button:hover,
.prev-bar-btns a:hover { background: rgba(255,255,255,.25); }

.prev-body {
  background: #cdd0e0;
  padding: 16px 12px 48px;
  min-height: calc(100vh - 70px);
}

.page {
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 10px 24px -10px rgba(0,0,0,.28);
  padding: 20px 14px;
  font-family: 'Source Serif 4', serif;
  color: #15161d;
  margin-bottom: 20px;
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}
.page .ph { text-align: center; border-bottom: 2px solid #15161d; padding-bottom: 10px; margin-bottom: 14px; }
.page .ph .sn1 { font-size: 13px; font-weight: 700; letter-spacing: .02em; }
.page .ph .sn2 { font-size: 9.5px; margin-top: 3px; text-transform: uppercase; letter-spacing: .06em; }
.page .ph .sn3 { font-size: 11px; margin-top: 7px; font-weight: 600; }

/* Scroll wrapper so table never breaks page layout on mobile */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table.bk { width: 100%; border-collapse: collapse; font-size: 10.5px; }
table.bk th {
  background: var(--navy-deep);
  color: #fff;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 7px 6px;
  text-align: left;
  white-space: nowrap;
}
table.bk td { border: 1px solid #c9ccdb; padding: 7px 6px; vertical-align: middle; }
table.bk td.c { text-align: center; width: 36px; font-weight: 700; }
table.bk td.m { font-size: 9.5px; white-space: nowrap; }
table.bk tr:nth-child(even) td { background: #f6f7fc; }

.page .pf {
  text-align: center;
  font-family: 'Poppins', sans-serif;
  font-size: 9px;
  color: #888;
  margin-top: 10px;
  border-top: 1px solid #ddd;
  padding-top: 8px;
}

/* Pagination */
.pagination { display: flex; gap: 5px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 600;
  padding: 0 8px;
  text-decoration: none;
  transition: .15s;
}
.pagination a       { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.pagination a:hover { border-color: var(--navy); color: var(--navy); }
.pagination span.active { background: var(--navy); color: #fff; border: 1px solid var(--navy); }

/* ---------- Print styles ----------------------------------- */
@media print {
  .prev-bar, .pagination, .no-print { display: none !important; }
  .prev-body { background: #fff; padding: 0; }
  .page { box-shadow: none; margin-bottom: 0; page-break-after: always; }
  body { background: #fff; }
}

/* ---------- Tiny phones (< 360px) -------------------------- */
@media (max-width: 359px) {
  .hero-pill  { font-size: 22px; margin-left: 18px; }
  .hero-sub   { margin-left: 18px; }
  .sheet      { padding: 22px 16px 40px; }
  .matric-lock { font-size: 11px; }
  .matric-edit input { font-size: 13px; }
  .school-name { font-size: 16px; }
  .stat .v { font-size: 18px; }
}

/* ---------- Tablet / Desktop (≥ 600px) --------------------- */
@media (min-width: 600px) {
  /* Hero pages: cap width and centre */
  .page-wrap { align-items: center; }
  .hero {
    width: 100%;
    max-width: 480px;
    min-height: 100vh;
    box-shadow: 0 0 80px rgba(8,36,134,.4);
  }

  /* Modal centres on tablet+ */
  .modal-overlay { align-items: center; }
  .sheet-modal {
    border-radius: 22px !important;
    max-width: 440px;
    margin: auto;
    padding-bottom: 30px;
  }
}

/* ---------- Wide admin layout (≥ 768px) -------------------- */
@media (min-width: 768px) {
  .appbar    { padding: 22px 32px; }
  .dash-body { max-width: 900px; margin: 0 auto; padding: 24px 32px 0; }
  .dash-page #rlist { padding-bottom: 60px; }
  .stats .stat .v { font-size: 24px; }
  .rowcard .meta .nm { font-size: 14px; }
  .rowcard .meta .mt { font-size: 11px; }
  table.bk { font-size: 11.5px; }
  table.bk th { font-size: 10px; }
  table.bk td { padding: 9px 10px; }
  .page { padding: 28px 24px; }
  .page .ph .sn1 { font-size: 15px; }
  .prev-bar { padding: 18px 24px; }
  .prev-bar h2 { font-size: 16px; }
  .prev-body { padding: 24px 20px 60px; }
}
