/* ==========================================================================
   CCSS Okoboh 2021 Graduates - shared stylesheet (public + admin pages)
   Layout plan:
     - Fixed black header (56px) on every page
     - <nav> is a fixed BOTTOM bar on mobile
     - From 768px up, the same <nav> becomes a fixed SIDEBAR on the left
   ========================================================================== */

/* ---------- Design tokens: change colours here only ---------- */
:root {
  --header-h: 56px;      /* fixed header height */
  --bottom-nav-h: 64px;  /* mobile bottom nav height */
  --sidebar-w: 224px;    /* desktop sidebar width */
  --black: #0a0a0a;
  --bg: #f6f4ee;
  --card: #ffffff;
  --ink: #1c2420;
  --muted: #5f6b64;
  --line: #e3e0d6;
  --green: #14532d;
  --green-soft: #dcefe2;
  --gold: #8a5a0b;
  --gold-soft: #fdf0cf;
  --red: #a32a2a;
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  /* Reserve room for the fixed header and the mobile bottom nav */
  padding-top: var(--header-h);
  padding-bottom: var(--bottom-nav-h);
}
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; line-height: 1.25; margin: 0; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
a { color: var(--green); }
svg.feather { width: 1.1em; height: 1.1em; vertical-align: -0.18em; stroke-width: 2; }

/* Visually hidden but readable by screen readers */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Keyboard focus ring for every interactive element */
:focus-visible { outline: 3px solid #d99a1e; outline-offset: 2px; }

/* ---------- Fixed black header ---------- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  height: var(--header-h);
  background: var(--black); color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; min-width: 0; }
.brand-mark {
  background: #fde68a; color: #3b2a00; font-weight: 700; font-size: .8rem;
  width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; flex: none;
}
.brand-text { font-family: Georgia, serif; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
.brand-text small { display: block; font-family: "Segoe UI", sans-serif; font-weight: 400; font-size: .7rem; color: #b9c2bc; }
.header-actions { display: flex; gap: 8px; align-items: center; }

/* ---------- Navigation: bottom bar (mobile) ---------- */
.main-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: var(--bottom-nav-h);
  background: #fff; border-top: 1px solid var(--line);
}
.main-nav ul { list-style: none; margin: 0; padding: 0; height: 100%; display: flex; }
.main-nav li { flex: 1; }
.main-nav a {
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: .72rem; color: var(--muted); text-decoration: none;
}
.main-nav a svg { width: 22px; height: 22px; }
.main-nav a[aria-current="page"] { color: var(--green); font-weight: 700; }

/* ---------- Page container ---------- */
main { max-width: 760px; margin: 0 auto; padding: 20px 16px 32px; }
.page-title { margin-bottom: 4px; }
.page-lead { color: var(--muted); margin: 0 0 18px; }
section + section { margin-top: 28px; }
section > h2 { margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.site-footer { text-align: center; color: var(--muted); font-size: .82rem; padding: 0 16px 24px; }

/* ---------- Buttons ---------- */
.btn {
  font: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 8px 14px; border-radius: 8px; text-decoration: none;
}
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-danger { color: var(--red); }
.btn-small { padding: 5px 10px; font-size: .85rem; }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }

/* ---------- Event cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.card.is-past { opacity: .88; }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.fee { font-weight: 700; color: var(--green); white-space: nowrap; margin: 0; }
.meta { list-style: none; padding: 0; margin: 8px 0 0; color: var(--muted); font-size: .9rem; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.meta li { display: flex; align-items: center; gap: 6px; }
.desc { margin: 10px 0 0; color: var(--muted); font-size: .95rem; white-space: pre-line; }
.stats { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 14px 0 8px; }
.stats div { font-size: .82rem; color: var(--muted); }
.stats dt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } /* label kept for screen readers */
.stats dd { margin: 0; }
.stats strong { display: block; font-size: 1.15rem; color: var(--ink); }
.meter { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--green); }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
caption { text-align: left; padding: 12px 12px 4px; font-weight: 600; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
thead th { color: var(--muted); font-size: .82rem; font-weight: 600; }
tbody th { font-weight: 500; }
tfoot th, tfoot td { border-bottom: 0; font-weight: 700; }
.num { text-align: right; white-space: nowrap; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: .78rem; font-weight: 600; }
.tag-full { background: var(--green-soft); color: var(--green); }
.tag-part { background: var(--gold-soft); color: var(--gold); }

/* ---------- Forms ---------- */
form { margin: 0; }
fieldset { border: 0; padding: 0; margin: 0; }
label { display: block; font-size: .85rem; color: var(--muted); margin: 12px 0 4px; }
input, select, textarea {
  width: 100%; font: inherit; padding: 10px; border: 1px solid #cfcabb; border-radius: 8px;
  background: #fff; color: var(--ink);
}
textarea { min-height: 80px; resize: vertical; }
.form-row { display: grid; gap: 0 12px; grid-template-columns: 1fr; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.form-error { color: var(--red); font-size: .88rem; min-height: 1.3em; margin: 8px 0 0; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }

dialog { border: 1px solid var(--line); border-radius: 14px; padding: 20px; width: min(440px, 92vw); background: #fff; color: var(--ink); }
dialog::backdrop { background: rgba(0,0,0,.55); }
dialog h2 { margin-bottom: 8px; }

/* ---------- Misc ---------- */
.empty { color: var(--muted); padding: 20px; text-align: center; border: 1px dashed #cfcabb; border-radius: 12px; }
.summary-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 0; }
.summary-grid .panel strong { display: block; font-size: 1.4rem; }
.summary-grid .panel span { color: var(--muted); font-size: .85rem; }
.note { font-size: .85rem; color: var(--muted); }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--bottom-nav-h) + 14px); transform: translateX(-50%);
  background: var(--black); color: #fff; padding: 10px 16px; border-radius: 8px;
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 60;
}
.toast.is-visible { opacity: 1; }

/* Login screen (admin/login.html): no nav, so no bottom padding needed */
body.is-login { padding-bottom: 0; padding-left: 0; }
.login-box { max-width: 380px; margin: 40px auto 0; }

/* ==========================================================================
   Desktop / tablet: 768px and up -> bottom nav turns into a left SIDEBAR
   ========================================================================== */
@media (min-width: 768px) {
  body { padding-bottom: 0; padding-left: var(--sidebar-w); }
  body.is-login { padding-left: 0; }
  /* The header stays full width and sits above the sidebar */
  .main-nav {
    top: var(--header-h); right: auto; bottom: 0; width: var(--sidebar-w);
    height: auto; border-top: 0; border-right: 1px solid var(--line); padding: 16px 12px;
  }
  .main-nav ul { flex-direction: column; gap: 4px; height: auto; }
  .main-nav li { flex: none; }
  .main-nav a { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 11px 12px; border-radius: 8px; font-size: .95rem; }
  .main-nav a svg { width: 20px; height: 20px; }
  .main-nav a[aria-current="page"] { background: var(--green-soft); }
  .toast { bottom: 24px; }
  .form-row { grid-template-columns: 1fr 1fr; }
  .summary-grid { grid-template-columns: repeat(4, 1fr); }
  main { padding-top: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
