/* ================================================================
   MWU·IRIS — styles.css
   Madda Walabu University Integrated Records & Information System
   ================================================================ */

/* ── Fonts & Root Variables ─────────────────────────────────────── */
:root {
  --f-serif:  'Cormorant Garamond', Georgia, serif;
  --f-sans:   'Inter', system-ui, sans-serif;
  --f-mono:   'JetBrains Mono', 'Courier New', monospace;
  --f-eth:    'Noto Serif Ethiopic', serif;

  /* Brand palette */
  --forest:      #152e7a;  /* MWU Blue */
  --forest-dark: #0d1e52;
  --forest-soft: #e8ecf7;
  --gold:        #c9a84c;
  --gold-soft:   #fdf6e3;
  --rust:        #b5372a;
  --slate:       #4a5568;

  /* Ink (text) */
  --ink:         #1a1a1a;
  --ink-mute:    #6b7280;
  --ink-soft:    #9ca3af;

  /* Paper (backgrounds) */
  --paper-0:     #ffffff;
  --paper-1:     #fafaf8;
  --paper-2:     #f3f1ec;
  --paper-3:     #e8e4de;

  /* Lines / borders */
  --line:        #d1cdc7;
  --line-soft:   #e8e4de;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 20px;
  --space-5: 32px;
  --space-6: 48px;

  /* Shape */
  --radius:   6px;
  --radius-lg: 10px;
}

/* ── Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--f-sans);
  background: var(--paper-2);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--forest); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* ── Header / Ledger Band ───────────────────────────────────────── */
.ledger-band {
  background: var(--forest);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.ledger-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}
.crest {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
  font-family: var(--f-serif);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .01em;
}
.crest:hover { text-decoration: none; opacity: .92; }
.crest-logo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,.4);
  background: rgba(255,255,255,.15);
}
.ml-am {
  font-family: var(--f-eth);
  font-size: 11px;
  font-weight: 400;
  opacity: .75;
  margin-top: 2px;
}
.signout {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  padding: 6px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  transition: background .15s;
}
.signout:hover { background: rgba(255,255,255,.25); }

/* ── Navigation ─────────────────────────────────────────────────── */
.page-nav {
  background: var(--paper-0);
  border-bottom: 1px solid var(--line-soft);
  position: relative; /* Not sticky — scrolls with page content */
  z-index: 999;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  overflow: visible;
  height: 48px;
}
.page-nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 2px;
  overflow: visible;
  scrollbar-width: none;
  height: 100%;
}
.page-nav-inner::-webkit-scrollbar { display: none; }
.page-nav-inner a {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-mute);
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
  text-decoration: none;
}
.page-nav-inner a:hover { color: var(--forest); }
.page-nav-inner a.active {
  color: var(--forest);
  border-bottom-color: var(--forest);
}

/* ── Page Layout ────────────────────────────────────────────────── */
.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 24px 48px;
  scroll-margin-top: 120px;
}
.page-title { margin-bottom: var(--space-5); }
.page-title h1 {
  font-family: var(--f-serif);
  font-size: 32px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
}
.lede {
  color: var(--ink-mute);
  font-size: 15px;
  margin-top: 6px;
}

/* ── Panel / Card ───────────────────────────────────────────────── */
.panel {
  background: var(--paper-0);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--paper-1);
}
.panel-head h2 {
  font-family: var(--f-serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
}
.panel-meta {
  font-size: 12px;
  color: var(--ink-mute);
}
.panel-body {
  padding: 20px;
}

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--paper-0);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
  line-height: 1.4;
}
.btn:hover { background: var(--paper-2); text-decoration: none; }
.btn:active { transform: scale(.98); }

.btn-primary {
  background: var(--forest);
  border-color: var(--forest-dark);
  color: #fff;
}
.btn-primary:hover { background: var(--forest-dark); }

.btn-secondary {
  background: var(--gold-soft);
  border-color: var(--gold);
  color: #7a5c00;
}
.btn-secondary:hover { background: #f5e9c0; }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-mute);
}
.btn-ghost:hover { background: var(--paper-2); color: var(--ink); }

.btn-sm {
  padding: 4px 12px;
  font-size: 12px;
}

.btn-block { width: 100%; justify-content: center; }

/* ── Forms ──────────────────────────────────────────────────────── */
.form-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: .05em;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="date"],
input[type="number"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-0);
  color: var(--ink);
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(21,46,122,.12);
}
input::placeholder { color: var(--ink-soft); }
textarea { resize: vertical; min-height: 100px; }

.error-msg {
  color: var(--rust);
  font-size: 13px;
  padding: 6px 0;
}

/* ── Chips / Badges ─────────────────────────────────────────────── */
.chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .03em;
}
.chip-forest { background: var(--forest-soft); color: var(--forest); }
.chip-gold   { background: var(--gold-soft);   color: #7a5c00; }
.chip-slate  { background: #edf2f7;            color: var(--slate); }
.chip-rust   { background: #fdecea;            color: var(--rust); }

/* ── Stats / Ledger cells ───────────────────────────────────────── */
.stat-ledger {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.stat-cell {
  background: var(--paper-0);
  padding: 20px 24px;
  text-align: center;
}
.stat-number {
  font-family: var(--f-serif);
  font-size: 36px;
  font-weight: 600;
  color: var(--forest);
  line-height: 1;
}
.stat-label {
  font-size: 12px;
  color: var(--ink-mute);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.stat-meta {
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 2px;
}

/* ── Auth pages ─────────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 300px 1fr;
}
.auth-hero {
  background: var(--forest);
  color: #fff;
  padding: var(--space-6) var(--space-5);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.institutional-mark {
  font-family: var(--f-serif);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 4px;
}
.am-mark {
  font-family: var(--f-eth);
  font-size: 14px;
  opacity: .8;
  margin-bottom: var(--space-4);
}
.motto-block { margin-top: auto; }
.motto {
  font-family: var(--f-serif);
  font-size: 16px;
  font-style: italic;
  color: var(--gold);
  margin-bottom: 4px;
}
.est {
  font-size: 12px;
  opacity: .7;
}
.auth-form-wrap {
  background: var(--paper-1);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
}
.auth-form {
  background: var(--paper-0);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  padding: 40px 48px;
  width: 100%;
  max-width: 480px;
}
.auth-form h2 {
  font-family: var(--f-serif);
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 8px;
}
.auth-lede {
  color: var(--ink-mute);
  font-size: 14px;
  margin-bottom: var(--space-5);
}

/* ── Enrollment table ───────────────────────────────────────────── */
.enrollment-row {
  display: grid;
  grid-template-columns: 1fr repeat(6, 90px);
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
}
.enrollment-input {
  width: 100%;
  text-align: center;
  padding: 6px 4px;
}

/* ── Eyebrow / section labels ───────────────────────────────────── */
.eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-mute);
  margin-bottom: 6px;
}

/* ── Net active badge ───────────────────────────────────────────── */
.net-active {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--forest);
  background: var(--forest-soft);
  padding: 3px 10px;
  border-radius: 20px;
}
.net-active::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--forest);
}

/* ── Error page ─────────────────────────────────────────────────── */
.error-code {
  font-family: var(--f-serif);
  font-size: 100px;
  color: var(--forest);
  opacity: .2;
  line-height: 1;
}

/* ── Responsive ─────────────────────────────────────────────────── */

/* Keep inner containers within the viewport on small screens.
   (Avoid overflow-x:hidden on html/body — it can break the sticky header.) */
@media (max-width: 1024px) {
  .ledger-inner,
  .page-nav-inner,
  .page { max-width: 100%; }
  .ledger-inner,
  .page-nav-inner { padding-left: 16px; padding-right: 16px; }
}

/* ── Tablets and large phones ───────────────────────────────────── */
@media (max-width: 768px) {
  /* Auth / login */
  .auth-page { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-form { padding: 28px 20px; }
  .auth-form-wrap { padding: 24px 16px; }

  /* Header band: shrink crest, drop the long bilingual subtitle */
  .ledger-inner { padding: 8px 14px; gap: 10px; min-height: 56px; }
  .crest { font-size: 14px; gap: 9px; }
  .crest-logo { width: 36px; height: 36px; }
  .ml-am { display: none !important; }

  /* Navigation becomes a horizontally swipeable strip */
  .page-nav { height: auto; }
  .page-nav-inner {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 10px;
    gap: 0;
  }
  .page-nav-inner > a,
  .page-nav-inner .nav-dropdown > a { padding: 12px 12px; font-size: 13px; }

  /* Page + panels: tighter padding, headings scale down */
  .page { padding: 18px 14px 36px; }
  .page-title h1 { font-size: 22px; line-height: 1.2; }
  .panel { padding: 0; }
  .panel-head { padding: 14px 16px; flex-wrap: wrap; gap: 6px; }
  .panel-body { padding: 16px; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Wide tables scroll inside their panel instead of breaking layout */
  .panel-body table { min-width: 560px; }
  .data-table { min-width: 560px; }

  /* Page headers with actions wrap instead of overflowing */
  .page-head { flex-wrap: wrap; gap: 10px; }

  /* Comfortable tap targets */
  .btn { min-height: 42px; }
}

/* ── Phones ─────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  /* Hide the role/name text in the header to make room for icons */
  .user-meta { display: none !important; }

  /* Stack every multi-column grid (class-based and inline) to one column */
  .stat-ledger { grid-template-columns: 1fr 1fr; }
  [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }

  /* Enrollment-style wide grids: let them scroll */
  .enrollment-row { min-width: 560px; }

  /* Buttons in toolbars stretch full width for easy tapping */
  .page-head .btn,
  .panel-head .btn { width: 100%; }
}

/* ── Very small phones ──────────────────────────────────────────── */
@media (max-width: 380px) {
  .crest span:not(.ml-am) { font-size: 13px; }
  .page-title h1 { font-size: 19px; }
  .stat-ledger { grid-template-columns: 1fr; }
}
