/* ============================================================
   Elite High School Bweyale — Main Stylesheet (Vanilla CSS, no framework)
   Earth-tone palette matching the React version
   ============================================================ */

/* ── CSS Variables ────────────────────────────────────────── */
:root {
  --primary:         #2d5a27;
  --primary-hover:   #224420;
  --primary-fg:      #ffffff;
  --secondary:       #c17f24;
  --secondary-hover: #a36b1c;
  --secondary-fg:    #ffffff;
  --bg:              #f5f0ea;
  --card:            #ffffff;
  --border:          #e0d9d0;
  --muted:           #f0ebe3;
  --muted-fg:        #7a6f65;
  --fg:              #1a1a18;
  --fg-subtle:       #5a534a;
  --sidebar-bg:      #1c3a18;
  --sidebar-hover:   #2a4e24;
  --sidebar-active:  #2d5a27;
  --sidebar-fg:      #c8dcc5;
  --destructive:     #b91c1c;
  --radius:          0.625rem;
  --sidebar-w:       240px;
  --shadow:          0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:       0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
  --shadow-lg:       0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
  --font-sans:       'Inter', system-ui, sans-serif;
  --font-serif:      'Playfair Display', Georgia, serif;
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-sans); background: var(--bg); color: var(--fg); line-height: 1.6; }
a    { color: inherit; text-decoration: none; }
img  { max-width: 100%; display: block; }
ul   { list-style: none; }
button { cursor: pointer; font-family: inherit; }

/* ── Layout ───────────────────────────────────────────────── */
.app-wrapper   { display: flex; min-height: 100vh; }
.main-content  { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; transition: margin-left .3s; }
.container     { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }
.page-section  { padding: 4rem 0; }

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  position: fixed; inset-y: 0; left: 0; z-index: 100;
  width: var(--sidebar-w);
  background: var(--sidebar-bg); color: var(--sidebar-fg);
  display: flex; flex-direction: column;
  transition: width .3s;
  overflow: hidden;
}
.sidebar.collapsed { width: 56px; }
.sidebar.collapsed .nav-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .brand-name,
.sidebar.collapsed .btn-donate { display: none; }
.sidebar.collapsed .sidebar-toggle { transform: scaleX(-1); }

.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1rem; border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-brand { display: flex; align-items: center; gap: .625rem; }
.brand-icon { color: #6dbd65; font-size: 1.25rem; }
.brand-name { font-family: var(--font-serif); font-size: 1.1rem; font-weight: 700; color: #fff; }
.sidebar-toggle {
  background: none; border: none; color: rgba(255,255,255,.4);
  font-size: 1.1rem; padding: .25rem;
  border-radius: .375rem; line-height: 1;
  transition: background .2s, color .2s;
}
.sidebar-toggle:hover { background: var(--sidebar-hover); color: #fff; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 1rem .5rem; }
.nav-label {
  font-size: .65rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: rgba(255,255,255,.3); padding: 0 .75rem; margin-bottom: .5rem;
}
.nav-link {
  display: flex; align-items: center; gap: .75rem;
  padding: .625rem .75rem; border-radius: var(--radius);
  font-size: .875rem; font-weight: 500; color: rgba(255,255,255,.7);
  transition: background .2s, color .2s; white-space: nowrap;
}
.nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.nav-link.active { background: var(--sidebar-active); color: #fff; }
.nav-icon { font-size: 1rem; flex-shrink: 0; width: 1.1rem; text-align: center; }

.sidebar-footer { padding: 1rem; border-top: 1px solid rgba(255,255,255,.1); }
.btn-donate {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  width: 100%; padding: .625rem 1rem; border-radius: var(--radius);
  background: var(--primary); color: #fff; font-size: .875rem; font-weight: 600;
  transition: background .2s;
}
.btn-donate:hover { background: var(--primary-hover); }

/* ── Mobile header ────────────────────────────────────────── */
.mobile-header {
  display: none; position: sticky; top: 0; z-index: 90;
  height: 3.5rem; padding: 0 1rem;
  background: rgba(245,240,234,.95); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  align-items: center; justify-content: space-between;
}
.mobile-menu-btn {
  background: none; border: none; font-size: 1.375rem;
  color: var(--fg-subtle); padding: .375rem;
  border-radius: var(--radius);
}
.mobile-brand { font-family: var(--font-serif); font-weight: 700; color: var(--primary); font-size: 1.125rem; }

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 99;
}
.sidebar-overlay.active { display: block; }

/* ── Bottom tabs (mobile) — floating dock ────────────────────── */
.bottom-tabs {
  display: none; position: fixed; left: 50%; bottom: .75rem; transform: translateX(-50%); z-index: 80;
  width: calc(100% - 1.5rem); max-width: 440px; height: 3.75rem;
  background: rgba(245,240,234,.85); backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid rgba(255,255,255,.4);
  border-radius: 22px;
  box-shadow: 0 8px 28px rgba(26,74,46,.18), 0 1px 3px rgba(0,0,0,.08);
  justify-content: space-around; align-items: stretch;
  padding: 0 .25rem;
}
.tab-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; flex: 1; font-size: .625rem; font-weight: 600; color: var(--muted-fg);
  transition: color .2s, transform .15s; background: none; border: none; cursor: pointer; font-family: inherit;
}
.tab-item span:first-child { font-size: .875rem; }
.tab-item:hover, .tab-item.active { color: var(--primary); }
.tab-item:active { transform: scale(.92); }
.tab-item.tab-donate { color: var(--secondary); }

/* Start button — sits inline in the dock, slightly elevated like Win11 */
.tab-item.tab-start {
  color: #fff;
}
.tab-item.tab-start .start-icon-circle {
  width: 2.1rem; height: 2.1rem; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover, #163f27));
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; box-shadow: 0 4px 10px rgba(26,74,46,.35);
  margin-top: -.6rem; transition: transform .15s;
}
.tab-item.tab-start:active .start-icon-circle { transform: scale(.9); }
.tab-item.tab-start span:last-child { color: var(--muted-fg); font-weight: 600; }

/* ── Start Menu modal (Windows 11 style) ─────────────────────── */
.start-menu-overlay {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(20,30,22,.35); backdrop-filter: blur(4px);
  align-items: flex-end; justify-content: center;
}
.start-menu-overlay.active { display: flex; }
.start-menu {
  width: calc(100% - 1.25rem); max-width: 460px; margin-bottom: 5.5rem;
  background: rgba(250,247,242,.92); backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255,255,255,.5);
  border-radius: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.25);
  padding: 1.25rem; max-height: 80vh; overflow-y: auto;
  animation: startMenuIn .22s cubic-bezier(.16,1,.3,1);
}
@keyframes startMenuIn { from { opacity:0; transform: translateY(16px) scale(.97); } to { opacity:1; transform: translateY(0) scale(1); } }
.start-menu-header { display: flex; align-items: center; gap: .5rem; margin-bottom: 1.25rem; }
.start-search-input {
  flex: 1; padding: .75rem 1rem; border-radius: 999px; border: 1px solid var(--border);
  background: #fff; font-size: .9375rem; outline: none;
}
.start-search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,74,46,.12); }
.start-menu-close {
  width: 2.25rem; height: 2.25rem; border-radius: 50%; border: none; background: rgba(0,0,0,.06);
  font-size: 1rem; cursor: pointer; flex-shrink: 0; color: var(--fg-subtle);
}
.start-menu-close:hover { background: rgba(0,0,0,.12); }
.start-section-label { font-size: .6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted-fg); margin: 0 0 .75rem; }
.start-tiles-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .625rem; margin-bottom: 1.5rem; }
.start-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .375rem;
  padding: .875rem .25rem; border-radius: 14px; background: rgba(255,255,255,.6);
  border: 1px solid rgba(0,0,0,.04); text-decoration: none; color: var(--fg);
  font-size: .6875rem; font-weight: 600; text-align: center; transition: background .15s, transform .15s;
}
.start-tile:hover { background: #fff; transform: translateY(-2px); }
.start-tile:active { transform: scale(.95); }
.start-tile .tile-icon { font-size: 1.375rem; }
.start-tile.tile-highlight { background: var(--primary); color: #fff; }
.start-tile.tile-highlight:hover { background: var(--primary-hover, #163f27); }
.start-menu-footer { display: flex; align-items: center; justify-content: center; gap: .5rem; padding-top: .75rem; border-top: 1px solid rgba(0,0,0,.06); }
.start-menu-footer a { font-size: .75rem; color: var(--muted-fg); text-decoration: none; }
.start-menu-footer a:hover { color: var(--primary); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .625rem 1.25rem; border-radius: var(--radius);
  font-size: .875rem; font-weight: 600; border: none;
  cursor: pointer; transition: all .2s; text-align: center; white-space: nowrap;
}
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-secondary:hover { background: var(--secondary-hover); }
.btn-outline   { background: transparent; border: 1.5px solid var(--border); color: var(--fg); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm        { padding: .375rem .875rem; font-size: .8125rem; }
.btn-lg        { padding: .875rem 2rem; font-size: 1rem; }
.btn-full      { width: 100%; justify-content: center; }
.btn-danger    { background: var(--destructive); color: #fff; }

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden;
}
.card-body { padding: 1.5rem; }
.card-img   { width: 100%; height: 220px; object-fit: cover; background: var(--muted); }

/* ── Grid helpers ─────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 1rem; }

/* ── Typography ───────────────────────────────────────────── */
h1,h2,h3,h4,h5 { font-family: var(--font-serif); font-weight: 700; line-height: 1.25; }
h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); }
h3 { font-size: 1.375rem; }
.text-primary   { color: var(--primary); }
.text-secondary { color: var(--secondary); }
.text-muted     { color: var(--muted-fg); }
.text-sm        { font-size: .875rem; }
.text-xs        { font-size: .75rem; }
.font-sans      { font-family: var(--font-sans); }

/* ── Badge ────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: .2rem .625rem; border-radius: 999px;
  font-size: .7rem; font-weight: 600; letter-spacing: .03em;
}
.badge-primary   { background: #d4e8d2; color: var(--primary); }
.badge-secondary { background: #fae8cc; color: var(--secondary-hover); }
.badge-muted     { background: var(--muted); color: var(--muted-fg); }

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: .875rem; font-weight: 500; margin-bottom: .375rem; }
.form-control {
  width: 100%; padding: .625rem .875rem;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--card); font-size: .875rem; font-family: inherit;
  color: var(--fg); transition: border-color .2s, box-shadow .2s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(45,90,39,.15); }
textarea.form-control { resize: vertical; min-height: 7rem; }
.form-hint { font-size: .75rem; color: var(--muted-fg); margin-top: .25rem; }
.form-error{ font-size: .8rem; color: var(--destructive); margin-top: .375rem; }

/* ── Alerts ───────────────────────────────────────────────── */
.alert { padding: .875rem 1rem; border-radius: var(--radius); font-size: .875rem; margin-bottom: 1rem; }
.alert-success { background: #d4e8d2; color: #1a4716; border: 1px solid #b0d4ac; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* ── Progress bar ─────────────────────────────────────────── */
.progress { height: 8px; background: var(--muted); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--secondary); border-radius: 999px; transition: width .4s; }

/* ── Hero ─────────────────────────────────────────────────── */
.hero { padding: 5rem 0; }
.hero h1 span.accent { color: var(--secondary); }
.hero-desc { font-size: 1.125rem; color: var(--fg-subtle); max-width: 540px; margin: 1rem 0 2rem; }
.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; }

/* ── Hero with background image ──────────────────────────────── */
.hero-bg {
  position: relative;
  padding: 6rem 0;
  background: linear-gradient(rgba(20,45,20,.72), rgba(20,45,20,.58)), var(--hero-fallback, linear-gradient(135deg, var(--sidebar-bg), var(--primary)));
  background-image: linear-gradient(rgba(20,45,20,.72), rgba(20,45,20,.58)), var(--hero-image);
  background-size: cover;
  background-position: center;
  color: #fff;
}
.hero-bg h1 { color: #fff; }
.hero-bg .hero-desc { color: rgba(255,255,255,.85); }
.hero-bg .text-primary { color: #a8d99f; }
.hero-bg .text-secondary { color: #f0c675; }

/* ── School logo (top-right corner) ──────────────────────────── */
.site-logo-corner {
  position: absolute;
  top: 1.25rem;
  right: 1.5rem;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.site-logo-corner img {
  height: 56px;
  width: 56px;
  object-fit: contain;
  border-radius: 50%;
  background: #fff;
  padding: 4px;
  box-shadow: var(--shadow-md);
}
@media (max-width: 640px) {
  .site-logo-corner { top: .75rem; right: .75rem; }
  .site-logo-corner img { height: 40px; width: 40px; }
}

/* ── Stats row ────────────────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 1.5rem; text-align: center; padding: 3rem 0; }
.stat-num { font-family: var(--font-serif); font-size: 2.25rem; font-weight: 700; color: var(--primary); }
.stat-lbl { font-size: .875rem; color: var(--muted-fg); }

/* ── Section headings ─────────────────────────────────────── */
.section-header { text-align: center; margin-bottom: 2.5rem; }
.section-header p { color: var(--fg-subtle); max-width: 540px; margin: .75rem auto 0; }

/* ── Page header ──────────────────────────────────────────── */
.page-header { background: var(--primary); color: #fff; padding: 3rem 0 2.5rem; }
.page-header h1 { color: #fff; }
.page-header p  { color: rgba(255,255,255,.8); margin-top: .5rem; }

/* ── Table ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; background: var(--card); }
th { padding: .75rem 1rem; text-align: left; font-size: .8rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted-fg); background: var(--muted); border-bottom: 1px solid var(--border); }
td { padding: .875rem 1rem; border-bottom: 1px solid var(--border); font-size: .875rem; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--muted); }

/* ── Footer ───────────────────────────────────────────────── */
.site-footer { background: var(--sidebar-bg); color: var(--sidebar-fg); padding: 3.5rem 0 2rem; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: 2rem; }
.footer-brand { font-family: var(--font-serif); font-size: 1.5rem; font-weight: 700; color: #fff; margin-bottom: .5rem; }
.footer-tagline { font-size: .875rem; color: rgba(255,255,255,.6); max-width: 200px; }
.footer-heading { font-family: var(--font-sans); font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #fff; margin-bottom: 1rem; }
.footer-links li { margin-bottom: .625rem; }
.footer-links a  { font-size: .875rem; color: rgba(255,255,255,.6); transition: color .2s; }
.footer-links a:hover { color: #fff; }
.footer-bottom {
  margin-top: 2.5rem; padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,.1);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem;
  font-size: .75rem; color: rgba(255,255,255,.4);
}
.footer-bottom a { color: rgba(255,255,255,.6); }
.footer-bottom strong { color: rgba(255,255,255,.8); }

/* ── Admin styles ─────────────────────────────────────────── */
.admin-wrapper { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--sidebar-bg); color: var(--sidebar-fg);
  display: flex; flex-direction: column;
  position: fixed; inset-y: 0; left: 0; z-index: 100;
}
.admin-main { flex: 1; margin-left: 240px; display: flex; flex-direction: column; background: #f0ebe3; }
.admin-header {
  height: 3.5rem; display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem; background: #fff; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40;
}
.admin-content { flex: 1; padding: 1.5rem; }
.admin-page-title { font-size: 1.5rem; font-family: var(--font-serif); margin-bottom: 1.5rem; color: var(--fg); }

.admin-nav-link {
  display: flex; align-items: center; gap: .75rem;
  padding: .625rem .75rem; border-radius: var(--radius);
  font-size: .875rem; font-weight: 500; color: rgba(255,255,255,.7);
  transition: background .2s, color .2s;
}
.admin-nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.admin-nav-link.active { background: var(--sidebar-active); color: #fff; }

.admin-stat-card {
  background: #fff; border-radius: var(--radius); border: 1px solid var(--border);
  padding: 1.25rem; display: flex; align-items: flex-start; justify-content: space-between;
}
.admin-stat-icon { font-size: 1.5rem; opacity: .6; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); transition: transform .3s; }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .mobile-header { display: flex; }
  .bottom-tabs   { display: flex; }
  .main-content  { padding-bottom: 5.5rem; }
  .admin-sidebar { transform: translateX(-100%); transition: transform .3s; }
  .admin-sidebar.mobile-open { transform: translateX(0); }
  .admin-main    { margin-left: 0; }
  .admin-mobile-menu-btn { display: block !important; }
}

@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .hero-actions { flex-direction: column; }
  .btn-lg { width: 100%; justify-content: center; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Utility ──────────────────────────────────────────────── */
.flex   { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1  { gap: .25rem; }
.gap-2  { gap: .5rem; }
.gap-4  { gap: 1rem; }
.mb-2   { margin-bottom: .5rem; }
.mb-4   { margin-bottom: 1rem; }
.mb-6   { margin-bottom: 1.5rem; }
.mt-2   { margin-top: .5rem; }
.mt-4   { margin-top: 1rem; }
.mt-6   { margin-top: 1.5rem; }
.mt-auto { margin-top: auto; }
.text-center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
