/* ============================================================
   Mowif — Main Stylesheet (Vanilla CSS, no framework)
   Earth-tone palette matching the React version
   ============================================================ */

/* ── CSS Variables ────────────────────────────────────────── */
:root {
  --primary:         #6d28d9;
  --primary-hover:   #5b21b6;
  --primary-fg:      #ffffff;
  --secondary:       #ea580c;
  --secondary-hover: #c2410c;
  --secondary-fg:    #ffffff;
  --bg:              #f5f0ea;
  --card:            #ffffff;
  --border:          #e0d9d0;
  --muted:           #f0ebe3;
  --muted-fg:        #7a6f65;
  --fg:              #1a1a18;
  --fg-subtle:       #5a534a;
  --sidebar-bg:      #2e1065;
  --sidebar-hover:   #3f1d78;
  --sidebar-active:  #6d28d9;
  --sidebar-fg:      #d9c9f5;
  --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: #fb923c; 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; }

/* ── Floating dock (mobile) ───────────────────────────────── */
.bottom-tabs {
  display: none; position: fixed; left: 50%; bottom: 1rem; z-index: 80;
  transform: translateX(-50%);
  height: 3.75rem; max-width: calc(100% - 2rem);
  padding: 0 .5rem; border-radius: 999px;
  background: rgba(255,255,255,.72); backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid rgba(255,255,255,.5);
  box-shadow: 0 8px 28px rgba(0,0,0,.18), 0 1px 0 rgba(255,255,255,.6) inset;
  align-items: center; gap: .25rem;
}
.tab-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; width: 3rem; height: 3rem; border-radius: 999px;
  font-size: .6rem; font-weight: 600; color: var(--muted-fg);
  transition: color .2s, background .2s;
}
.tab-item span:first-child { font-size: .95rem; }
.tab-item:hover, .tab-item.active { color: var(--primary); background: rgba(109,40,217,.1); }
.tab-item.tab-donate { color: var(--secondary); }
.tab-item.tab-donate:hover { background: rgba(234,88,12,.12); }

/* Start button — raised, centered, Windows 11 style */
.dock-start-btn {
  display: flex; align-items: center; justify-content: center;
  width: 3.5rem; height: 3.5rem; border-radius: 50%; flex-shrink: 0;
  margin: 0 .25rem;
  background: linear-gradient(145deg, var(--secondary), var(--primary));
  color: #fff; font-size: 1.25rem; border: 3px solid rgba(255,255,255,.85);
  box-shadow: 0 6px 16px rgba(0,0,0,.25), 0 0 0 1px rgba(0,0,0,.04);
  transform: translateY(-10px);
  transition: transform .2s;
}
.dock-start-btn:active { transform: translateY(-10px) scale(.92); }

/* ── Start Menu modal ─────────────────────────────────────── */
.start-menu-overlay {
  display: none; position: fixed; inset: 0; z-index: 150;
  background: rgba(20,10,35,.45); backdrop-filter: blur(4px);
  align-items: flex-end; justify-content: center;
}
.start-menu-overlay.active { display: flex; }
.start-menu-card {
  width: 100%; max-width: 480px; max-height: 80vh;
  background: rgba(255,255,255,.88); backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid rgba(255,255,255,.6);
  border-radius: 1.5rem 1.5rem 0 0;
  box-shadow: 0 -8px 40px rgba(0,0,0,.3);
  padding: 1.25rem 1.25rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform .28s ease-out;
}
.start-menu-overlay.active .start-menu-card { transform: translateY(0); }
.start-menu-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.start-menu-title { font-family: var(--font-serif); font-weight: 700; font-size: 1.1rem; color: var(--fg); }
.start-menu-close {
  width: 2rem; height: 2rem; border-radius: 50%; border: none;
  background: rgba(0,0,0,.06); color: var(--fg-subtle); font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
}
.start-menu-search {
  width: 100%; padding: .75rem 1rem; border-radius: 999px;
  border: 1px solid var(--border); background: #fff;
  font-size: .9rem; margin-bottom: 1.25rem;
}
.start-menu-search:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(109,40,217,.15); }
.start-menu-label {
  font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted-fg); margin: 0 0 .625rem .25rem;
}
.start-menu-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-bottom: 1.25rem;
}
.start-menu-tile {
  display: flex; flex-direction: column; align-items: center; gap: .375rem;
  padding: .75rem .25rem; border-radius: var(--radius);
  background: rgba(0,0,0,.03); color: var(--fg); text-align: center;
  font-size: .65rem; font-weight: 600; transition: background .2s;
}
.start-menu-tile:hover { background: rgba(109,40,217,.1); }
.start-menu-tile .tile-icon { font-size: 1.3rem; }
.start-menu-give {
  display: flex; gap: .625rem; margin-bottom: 1.25rem;
}
.start-menu-give a {
  flex: 1; text-align: center; padding: .75rem .5rem; border-radius: var(--radius);
  background: linear-gradient(145deg, var(--secondary), var(--primary));
  color: #fff; font-size: .8rem; font-weight: 700;
}
.start-menu-footer {
  border-top: 1px solid var(--border); padding-top: .875rem;
  text-align: center;
}
.start-menu-footer a { font-size: .8rem; color: var(--muted-fg); font-weight: 600; }

/* ── 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: #ede4fb; 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(109,40,217,.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; }

/* ── 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;
}
/* Org Chart */
.org-chart-wrap { overflow-x: auto; padding: 1rem 0 2rem; }
.org-chart, .org-chart ul { list-style: none; margin: 0; padding: 0; position: relative; }
.org-chart { text-align: center; white-space: nowrap; }
.org-chart ul { padding-top: 20px; white-space: nowrap; }
.org-chart li {
  display: inline-block; vertical-align: top;
  padding: 20px 8px 0 8px; position: relative; white-space: normal;
}
.org-chart li::before, .org-chart li::after {
  content: ''; position: absolute; top: 0; right: 50%;
  border-top: 2px solid var(--border); width: 50%; height: 20px;
}
.org-chart li::after { right: auto; left: 50%; border-left: 2px solid var(--border); }
.org-chart li:only-child::after, .org-chart li:only-child::before { display: none; }
.org-chart li:only-child { padding-top: 0; }
.org-chart > li { padding-top: 0; }
.org-chart > li::before, .org-chart > li::after { display: none; }
.org-chart li:first-child::before, .org-chart li:last-child::after { border: 0 none; }
.org-chart li:last-child::before { border-right: 2px solid var(--border); border-radius: 0 var(--radius) 0 0; }
.org-chart li:first-child::after { border-radius: var(--radius) 0 0 0; }
.org-box {
  display: inline-block; padding: .65rem 1.1rem; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow);
  font-size: .8rem; font-weight: 600; color: var(--fg);
}
.org-box-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.org-box-secondary { background: var(--secondary); color: #fff; border-color: var(--secondary); }
.org-box-light { background: var(--muted); color: var(--fg-subtle); font-weight: 500; }

.admin-mobile-header {
  display: none; position: sticky; top: 0; z-index: 90;
  height: 3.5rem; padding: 0 1rem;
  background: var(--sidebar-bg); color: #fff;
  align-items: center; gap: .75rem;
}
.admin-mobile-menu-btn {
  background: none; border: none; color: #fff; font-size: 1.25rem;
  padding: .25rem .5rem; cursor: pointer; line-height: 1;
}
.admin-mobile-brand { display: flex; align-items: center; gap: .4rem; color: #fff; font-weight: 700; font-family: var(--font-serif); text-decoration: none; }

.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: 4rem; }
  .admin-sidebar { transform: translateX(-100%); transition: transform .3s; }
  .admin-sidebar.mobile-open { transform: translateX(0); }
  .admin-main    { margin-left: 0; }
  .admin-mobile-header { display: flex; }
}


@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); }