/* ============================================================
   ST CATHERINE OF ALEXANDRIA GIRLS' COLLEGE — LMS Design System
   Colors: Navy, Gold, Green, White, Grey
   Phase 1 refresh: refined palette, softer shadows, better states.
   All class names and CSS variable names unchanged — safe to drop in.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@500;600;700&family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');

:root {
  /* Brand palette */
  --navy:        #1a3a6b;
  --navy-dark:   #0f2347;
  --navy-light:  #2a4e8f;
  --gold:        #b8935a;      /* warmed from flat #c8a94d for a richer, less generic gold */
  --gold-light:  #d9b384;
  --gold-pale:   #faf3e8;
  --green:       #2e7d52;
  --green-light: #4caf77;
  --green-pale:  #edf7f1;

  /* Neutrals */
  --white:       #ffffff;
  --grey-50:     #f7f8fb;
  --grey-100:    #eef1f6;
  --grey-200:    #dfe4ee;
  --grey-300:    #c5cddc;
  --grey-500:    #7c879c;
  --grey-700:    #47536a;
  --grey-900:    #182338;

  /* Semantic */
  --success:     #2e7d52;
  --warning:     #b8935a;
  --danger:      #c0392b;
  --info:        #1a3a6b;

  /* Typography */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;

  /* Spacing */
  --sidebar-w:   260px;
  --header-h:    64px;
  --radius:      9px;
  --radius-lg:   14px;

  /* Navy-tinted shadows instead of flat black — softer, more cohesive with brand */
  --shadow:      0 1px 2px rgba(15,35,71,0.06), 0 4px 14px rgba(15,35,71,0.08);
  --shadow-lg:   0 4px 10px rgba(15,35,71,0.10), 0 16px 40px rgba(15,35,71,0.16);
  --shadow-hover: 0 4px 8px rgba(15,35,71,0.08), 0 10px 24px rgba(15,35,71,0.13);
}

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

html, body {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--grey-900);
  background: var(--grey-50);
  height: 100%;
  -webkit-font-smoothing: antialiased;
}

/* ── LAYOUT ─────────────────────────────────────────────────── */
.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--navy-dark);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  transition: transform 0.3s ease;
}

.sidebar-logo {
  padding: 26px 24px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo .school-name {
  font-family: var(--font-display);
  font-size: 13px;
  line-height: 1.4;
  color: var(--gold-light);
  letter-spacing: 0.02em;
  font-weight: 600;
}
.sidebar-logo .crest { font-size: 26px; margin-bottom: 8px; display: block; }

.sidebar-nav { padding: 14px 0; flex: 1; }

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.32);
  padding: 14px 24px 5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  color: rgba(255,255,255,0.70);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: white; }
.nav-item.active {
  background: rgba(184,147,90,0.16);
  color: var(--gold-light);
  border-left-color: var(--gold);
  font-weight: 600;
}
.nav-item .icon { font-size: 17px; width: 22px; text-align: center; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.nav-item .icon svg { width: 18px; height: 18px; stroke: currentColor; }
.nav-item .badge {
  margin-left: auto;
  background: var(--gold);
  color: var(--navy-dark);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
}

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-chip .avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--navy-light);
  border: 2px solid var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: var(--gold-light);
  flex-shrink: 0;
}
.user-chip .name { font-size: 13px; font-weight: 600; color: white; }
.user-chip .role { font-size: 11px; color: rgba(255,255,255,0.45); }

/* ── MAIN CONTENT ────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--header-h);
  background: white;
  border-bottom: 1px solid var(--grey-200);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky; top: 0;
  z-index: 50;
}
.topbar-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  color: var(--navy);
  flex: 1;
}
.topbar-actions { display: flex; gap: 10px; align-items: center; }

.notif-btn {
  position: relative;
  background: none; border: none;
  font-size: 20px; cursor: pointer;
  padding: 6px; border-radius: 8px;
  transition: background 0.15s;
}
.notif-btn:hover { background: var(--grey-100); }
.notif-dot {
  position: absolute; top: 4px; right: 4px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid white;
}

.page-body { padding: 28px; flex: 1; }

/* ── COMPONENTS ─────────────────────────────────────────────── */
.page-header {
  margin-bottom: 26px;
}
.page-header h1 {
  font-family: var(--font-display);
  font-size: 25px;
  color: var(--navy);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.page-header p { color: var(--grey-500); margin-top: 4px; font-size: 14px; }

/* Cards */
.card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid rgba(15,35,71,0.05);
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}
.card-header {
  padding: 17px 22px;
  border-bottom: 1px solid var(--grey-100);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h2 { font-size: 15px; font-weight: 600; color: var(--navy); }
.card-body { padding: 22px; }

/* Stat cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 26px; }
.stat-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(15,35,71,0.05);
  display: flex; align-items: flex-start; gap: 16px;
  border-left: 4px solid transparent;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.stat-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.stat-card.navy { border-left-color: var(--navy); }
.stat-card.gold  { border-left-color: var(--gold); }
.stat-card.green { border-left-color: var(--green); }
.stat-card.grey  { border-left-color: var(--grey-300); }

.stat-icon { font-size: 26px; line-height: 1; }
.stat-label { font-size: 11.5px; color: var(--grey-500); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-size: 27px; font-weight: 700; color: var(--navy); line-height: 1.1; margin-top: 3px; letter-spacing: -0.01em; }
.stat-sub { font-size: 12px; color: var(--grey-500); margin-top: 4px; }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead tr { background: var(--navy); color: white; }
thead th { padding: 12px 16px; font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; text-align: left; }
tbody tr { border-bottom: 1px solid var(--grey-100); transition: background 0.12s; }
tbody tr:hover { background: var(--grey-50); }
tbody td { padding: 11px 16px; }

/* Badges */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.badge-pass    { background: var(--green-pale); color: var(--green); }
.badge-fail    { background: #fdecea; color: var(--danger); }
.badge-pending { background: var(--gold-pale); color: #7a5a30; }
.badge-admin   { background: #eef0f8; color: var(--navy); }
.badge-teacher { background: var(--green-pale); color: var(--green); }
.badge-student { background: #eef2fb; color: #3352aa; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 14px; font-weight: 600;
  cursor: pointer; border: none;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }

.btn-navy    { background: var(--navy); color: white; box-shadow: 0 1px 2px rgba(15,35,71,0.15); }
.btn-navy:hover { background: var(--navy-light); box-shadow: 0 2px 6px rgba(15,35,71,0.22); }

.btn-gold    { background: var(--gold); color: white; box-shadow: 0 1px 2px rgba(184,147,90,0.25); }
.btn-gold:hover { background: #a5804c; box-shadow: 0 2px 6px rgba(184,147,90,0.32); }

.btn-green   { background: var(--green); color: white; box-shadow: 0 1px 2px rgba(46,125,82,0.2); }
.btn-green:hover { background: var(--green-light); box-shadow: 0 2px 6px rgba(46,125,82,0.26); }

.btn-outline { background: none; border: 1.5px solid var(--navy); color: var(--navy); }
.btn-outline:hover { background: var(--navy); color: white; }

.btn-danger  { background: var(--danger); color: white; box-shadow: 0 1px 2px rgba(192,57,43,0.2); }
.btn-danger:hover { background: #a5301f; box-shadow: 0 2px 6px rgba(192,57,43,0.28); }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-icon { padding: 8px; border-radius: 8px; }

/* Forms */
.form-group { margin-bottom: 18px; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--grey-700); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--grey-200);
  border-radius: var(--radius);
  font-family: var(--font-body); font-size: 14px;
  color: var(--grey-900);
  transition: border-color 0.15s, box-shadow 0.15s;
  background: white;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--navy-light);
  box-shadow: 0 0 0 3px rgba(42,78,143,0.12);
}
textarea { resize: vertical; min-height: 100px; }

/* Grid helpers */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px;
}
.alert-info    { background: #eef4ff; color: var(--navy); border: 1px solid #c5d5f8; }
.alert-success { background: var(--green-pale); color: var(--green); border: 1px solid #b2e0c7; }
.alert-warning { background: var(--gold-pale); color: #7a5a30; border: 1px solid #e6cca3; }
.alert-danger  { background: #fdecea; color: var(--danger); border: 1px solid #f5c6c3; }

/* Login page */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 60%, var(--navy-light) 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 420px;
  overflow: hidden;
}
.login-header {
  background: var(--navy-dark);
  padding: 32px 36px;
  text-align: center;
  border-bottom: 3px solid var(--gold);
}
.login-header .crest { font-size: 38px; margin-bottom: 10px; }
.login-header h1 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--gold-light);
  line-height: 1.4;
}
.login-header p { color: rgba(255,255,255,0.5); font-size: 12px; margin-top: 6px; }
.login-body { padding: 32px 36px; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* Loading spinner */
.spinner {
  width: 34px; height: 34px;
  border: 3px solid var(--grey-200);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty state */
.empty-state {
  text-align: center; padding: 48px 24px;
  color: var(--grey-500);
}
.empty-state .icon { font-size: 44px; margin-bottom: 12px; opacity: 0.7; }
.empty-state p { font-size: 14px; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,35,71,0.45);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%; max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.96) translateY(-8px); } }
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--grey-100);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--navy); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--grey-100);
  display: flex; justify-content: flex-end; gap: 10px;
}
.close-btn { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--grey-500); transition: color 0.15s; }
.close-btn:hover { color: var(--grey-900); }
