/* ================================================================
   GREEN-TOP SCHOOL MANAGEMENT SYSTEM
   Main Stylesheet — Deep Institutional Green + Gold
   ================================================================ */

:root {
  --green-900: #0a2e1a;
  --green-800: #0f3d24;
  --green-700: #145230;
  --green-600: #1a6b3e;
  --green-500: #217a48;
  --green-400: #2d9e61;
  --green-300: #4dc87e;
  --green-100: #d4f4e2;
  --green-50:  #f0faf4;

  --gold-600:  #b8860b;
  --gold-500:  #d4a017;
  --gold-400:  #e8b84b;
  --gold-200:  #fae5a0;
  --gold-50:   #fdf8e8;

  --sidebar-w: 260px;
  --topbar-h:  64px;
  --font-main: 'DM Sans', system-ui, sans-serif;
  --font-head: 'Playfair Display', Georgia, serif;

  --text-primary:   #1a2e23;
  --text-secondary: #4a6657;
  --text-muted:     #8aa898;
  --border:         #d8e8df;
  --bg-light:       #f5f9f6;
  --white:          #ffffff;

  --shadow-sm: 0 1px 3px rgba(10,46,26,.08), 0 1px 2px rgba(10,46,26,.04);
  --shadow-md: 0 4px 16px rgba(10,46,26,.10), 0 2px 4px rgba(10,46,26,.06);
  --shadow-lg: 0 10px 40px rgba(10,46,26,.14);
  --radius:    10px;
  --radius-lg: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 15px; }
body {
  margin: 0; font-family: var(--font-main);
  background: var(--bg-light); color: var(--text-primary);
  line-height: 1.6; -webkit-font-smoothing: antialiased;
}

/* ── LAYOUT ─────────────────────────────────────────────── */
.wrapper { display: flex; min-height: 100vh; }
.main-content {
  flex: 1; min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
  transition: margin .3s ease;
}
.content-area {
  padding: 1.75rem 2rem;
  flex: 1;
}

/* ── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: linear-gradient(175deg, var(--green-900) 0%, var(--green-800) 100%);
  display: flex; flex-direction: column;
  z-index: 1000; overflow-y: auto;
  box-shadow: 4px 0 20px rgba(0,0,0,.15);
  transition: transform .3s ease;
}

.sidebar-header {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.school-logo { display: flex; align-items: center; gap: .85rem; }
.logo-emblem {
  width: 44px; height: 44px; border-radius: 10px;
  background: linear-gradient(135deg, var(--gold-500), var(--gold-600));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-size: 1.1rem; font-weight: 700;
  color: white; letter-spacing: .5px; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(212,160,23,.4);
}
.school-name { display: flex; flex-direction: column; }
.name-main { font-family: var(--font-head); font-size: 1.1rem; color: white; font-weight: 700; line-height: 1.1; }
.name-sub { font-size: .72rem; color: rgba(255,255,255,.5); text-transform: uppercase; letter-spacing: 1.5px; }

.sidebar-nav { flex: 1; padding: .75rem 0; overflow-y: auto; }
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-item { margin: 1px .75rem; }

.nav-link {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem .9rem; border-radius: 8px;
  color: rgba(255,255,255,.65); text-decoration: none;
  font-size: .875rem; font-weight: 400; cursor: pointer;
  transition: all .18s ease; border: none; background: none; width: 100%;
}
.nav-link svg, .nav-link i { width: 17px; height: 17px; flex-shrink: 0; }
.nav-link span { flex: 1; }
.nav-link:hover { background: rgba(255,255,255,.08); color: white; }
.nav-link.active { background: rgba(45,158,97,.25); color: var(--green-300); }
.nav-link.active svg, .nav-link.active i { color: var(--green-300); }
.nav-arrow { width: 14px !important; height: 14px !important; transition: transform .2s; opacity: .5; }
.nav-group-toggle:not(.collapsed) .nav-arrow { transform: rotate(90deg); }

.nav-sub {
  list-style: none; padding: .25rem 0 .25rem 2.6rem; margin: 0;
}
.nav-sub li a {
  display: block; padding: .4rem .75rem; border-radius: 6px;
  color: rgba(255,255,255,.5); text-decoration: none;
  font-size: .83rem; transition: all .15s;
}
.nav-sub li a:hover { color: rgba(255,255,255,.85); }
.nav-sub li a.active { color: var(--green-300); }

.sidebar-footer {
  padding: .75rem; border-top: 1px solid rgba(255,255,255,.08);
}

/* ── TOPBAR ──────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 900;
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 2rem; gap: 1rem;
  box-shadow: var(--shadow-sm);
}
.topbar-left { display: flex; align-items: center; gap: 1rem; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: .5rem; }

.sidebar-toggle {
  background: none; border: none; cursor: pointer; padding: 6px;
  display: flex; flex-direction: column; gap: 5px;
}
.sidebar-toggle span {
  display: block; width: 20px; height: 2px;
  background: var(--text-secondary); border-radius: 2px;
  transition: all .2s;
}

.page-title { font-weight: 600; font-size: 1rem; color: var(--text-primary); }
.term-badge {
  background: var(--green-100); color: var(--green-700);
  padding: 2px 10px; border-radius: 20px; font-size: .75rem; font-weight: 500;
}

.icon-btn { width: 20px; height: 20px; cursor: pointer; color: var(--text-secondary); }
.topbar-item { padding: 8px; border-radius: 8px; cursor: pointer; transition: background .15s; }
.topbar-item:hover { background: var(--bg-light); }

.user-chip {
  display: flex; align-items: center; gap: .6rem;
  padding: 6px 10px; border-radius: 10px; cursor: pointer;
  transition: background .15s;
}
.user-chip:hover { background: var(--bg-light); }
.user-avatar, .user-avatar-placeholder {
  width: 34px; height: 34px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
}
.user-avatar-placeholder {
  background: linear-gradient(135deg, var(--green-600), var(--green-400));
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 600; font-size: .9rem;
}
.user-info { display: flex; flex-direction: column; }
.user-name { font-size: .85rem; font-weight: 600; color: var(--text-primary); line-height: 1.1; }
.user-role { font-size: .72rem; color: var(--text-muted); }

/* ── LOGIN PAGE ──────────────────────────────────────────── */
body.login-page {
  background: var(--green-900);
  min-height: 100vh; display: flex; align-items: center;
  justify-content: center; padding: 2rem;
}
.login-bg {
  position: fixed; inset: 0; z-index: 0;
  background: radial-gradient(ellipse at 20% 50%, rgba(21,82,48,.8) 0%, var(--green-900) 60%),
              linear-gradient(135deg, var(--green-900) 0%, #061a0e 100%);
}
.login-overlay { position: absolute; inset: 0; background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.015'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"); }
.login-shapes { position: absolute; inset: 0; overflow: hidden; }
.shape {
  position: absolute; border-radius: 50%;
  background: rgba(45,158,97,.06);
}
.s1 { width: 500px; height: 500px; top: -200px; right: -100px; }
.s2 { width: 300px; height: 300px; bottom: -100px; left: -50px; }
.s3 { width: 200px; height: 200px; top: 50%; left: 30%; }

.login-container {
  position: relative; z-index: 1;
  width: 100%; max-width: 440px;
  display: flex; flex-direction: column; gap: 1.25rem;
}
.login-card {
  background: rgba(255,255,255,.97);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,.1);
  overflow: hidden;
}
.login-brand {
  background: linear-gradient(135deg, var(--green-800), var(--green-700));
  padding: 2rem; text-align: center;
}
.brand-emblem {
  width: 60px; height: 60px; border-radius: 14px; margin: 0 auto 1rem;
  background: linear-gradient(135deg, var(--gold-400), var(--gold-600));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-size: 1.4rem; font-weight: 700;
  color: white; box-shadow: 0 4px 16px rgba(212,160,23,.4);
}
.brand-name { font-family: var(--font-head); font-size: 1.5rem; color: white; margin: 0 0 .3rem; }
.brand-motto { color: rgba(255,255,255,.6); font-size: .85rem; margin: 0; }
.login-divider { height: 3px; background: linear-gradient(90deg, var(--gold-500), var(--green-400), var(--gold-500)); }
.login-form-area { padding: 2rem; }
.form-heading { font-family: var(--font-head); font-size: 1.3rem; margin: 0 0 .25rem; color: var(--text-primary); }
.form-subheading { color: var(--text-muted); font-size: .875rem; margin: 0 0 1.5rem; }

.input-with-icon { position: relative; }
.input-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none; width: 18px; height: 18px;
}
.login-input {
  padding-left: 2.5rem !important; padding-right: 2.75rem;
  height: 46px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: .9rem; transition: border .2s;
}
.login-input:focus { border-color: var(--green-500); box-shadow: 0 0 0 3px rgba(33,122,72,.12); outline: none; }
.toggle-password {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--text-muted);
  padding: 4px;
}
.btn-login {
  background: linear-gradient(135deg, var(--green-600), var(--green-700));
  color: white; border: none; height: 48px; border-radius: 8px;
  font-size: .95rem; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s; letter-spacing: .3px;
}
.btn-login:hover { background: linear-gradient(135deg, var(--green-500), var(--green-600)); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(21,82,48,.35); }
.login-hint {
  background: var(--bg-light); border: 1px solid var(--border);
  border-radius: 8px; padding: .75rem; font-size: .8rem;
  color: var(--text-secondary); margin-top: 1.25rem; text-align: center;
}
.login-hint code { background: var(--green-100); color: var(--green-800); padding: 1px 5px; border-radius: 4px; }
.login-footer { text-align: center; color: rgba(255,255,255,.4); font-size: .78rem; }
.login-footer .separator { margin: 0 .5rem; }

/* ── DASHBOARD ───────────────────────────────────────────── */
.dashboard-grid { display: flex; flex-direction: column; gap: 1.5rem; }
.welcome-banner {
  background: linear-gradient(135deg, var(--green-700), var(--green-600));
  border-radius: var(--radius-lg); padding: 1.5rem 2rem;
  display: flex; align-items: center; justify-content: space-between;
  color: white; box-shadow: var(--shadow-md);
}
.welcome-banner h2 { font-family: var(--font-head); font-size: 1.5rem; margin: 0 0 .25rem; }
.welcome-banner p { margin: 0; opacity: .8; font-size: .9rem; }
.welcome-banner strong { color: var(--gold-400); }
.welcome-date { text-align: right; opacity: .75; }
.date-day { display: block; font-size: .85rem; text-transform: uppercase; letter-spacing: 1px; }
.date-full { display: block; font-size: 1.05rem; font-weight: 600; }

.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.stat-card {
  background: var(--white); border-radius: var(--radius);
  padding: 1.25rem 1.5rem; display: flex; align-items: center; gap: 1rem;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
  transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg, .stat-icon i { width: 22px; height: 22px; }
.stat-card.green .stat-icon { background: var(--green-100); color: var(--green-600); }
.stat-card.blue .stat-icon { background: #e8f0fe; color: #1a56db; }
.stat-card.amber .stat-icon { background: #fef3c7; color: #d97706; }
.stat-card.teal .stat-icon { background: #d1fae5; color: #059669; }
.stat-card.emerald .stat-icon { background: #d1fae5; color: #047857; }
.stat-card.red .stat-icon { background: #fee2e2; color: #dc2626; }
.stat-card.purple .stat-icon { background: #ede9fe; color: #7c3aed; }
.stat-card.gold .stat-icon { background: var(--gold-200); color: var(--gold-600); }
.stat-body { display: flex; flex-direction: column; }
.stat-value { font-size: 1.4rem; font-weight: 700; color: var(--text-primary); line-height: 1.1; }
.stat-label { font-size: .78rem; color: var(--text-muted); margin-top: .15rem; text-transform: uppercase; letter-spacing: .5px; }

.dashboard-body { display: grid; grid-template-columns: 1fr 360px; gap: 1.5rem; }
.dash-sidebar { display: flex; flex-direction: column; gap: 1.25rem; }

.dash-card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
  overflow: hidden;
}
.dash-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
}
.dash-card-header h3 { font-size: .9rem; font-weight: 600; margin: 0; color: var(--text-primary); }
.btn-link { font-size: .8rem; color: var(--green-600); text-decoration: none; font-weight: 500; }
.btn-link:hover { color: var(--green-700); }

.dash-table { margin: 0; font-size: .85rem; }
.dash-table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); font-weight: 600; padding: .6rem 1.25rem; background: var(--bg-light); border-bottom: 1px solid var(--border); }
.dash-table td { padding: .7rem 1.25rem; vertical-align: middle; border-bottom: 1px solid #f0f4f1; }
.dash-table tbody tr:last-child td { border-bottom: none; }

.att-summary { padding: 1rem 1.25rem; display: flex; flex-direction: column; gap: .75rem; }
.att-row { display: flex; align-items: center; gap: .6rem; font-size: .82rem; }
.att-label { width: 85px; color: var(--text-secondary); flex-shrink: 0; }
.att-bar-wrap { flex: 1; }
.att-bar { height: 6px; background: var(--bg-light); border-radius: 4px; overflow: hidden; }
.att-fill { height: 100%; border-radius: 4px; transition: width .5s ease; }
.att-fill.green { background: var(--green-400); }
.att-fill.red { background: #f87171; }
.att-count { width: 28px; text-align: right; font-weight: 600; color: var(--text-primary); flex-shrink: 0; }

.notice-list { list-style: none; margin: 0; padding: 0; }
.notice-list li { display: flex; align-items: center; justify-content: space-between; padding: .7rem 1.25rem; border-bottom: 1px solid #f0f4f1; gap: .5rem; }
.notice-list li:last-child { border-bottom: none; }
.notice-title { font-size: .83rem; color: var(--text-primary); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notice-date { font-size: .72rem; color: var(--text-muted); flex-shrink: 0; }

.quick-actions { padding: .75rem; display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.quick-btn {
  display: flex; flex-direction: column; align-items: center; gap: .4rem;
  padding: .75rem; border-radius: 8px; background: var(--bg-light);
  text-decoration: none; color: var(--text-secondary); font-size: .75rem;
  font-weight: 500; text-align: center; transition: all .15s;
  border: 1px solid var(--border);
}
.quick-btn svg, .quick-btn i { width: 20px; height: 20px; color: var(--green-600); }
.quick-btn:hover { background: var(--green-100); color: var(--green-700); border-color: var(--green-300); }

/* ── TABLES / GENERIC ────────────────────────────────────── */
.card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
}
.card-header {
  padding: 1rem 1.5rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--white);
}
.card-header h4 { font-size: .95rem; font-weight: 700; margin: 0; }
.card-body { padding: 1.5rem; }

.table th {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-muted); font-weight: 600; background: var(--bg-light);
  border-bottom: 1px solid var(--border) !important;
}
.table td { vertical-align: middle; font-size: .875rem; }

/* ── FORMS ───────────────────────────────────────────────── */
.form-label { font-size: .82rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .4px; margin-bottom: .35rem; }
.form-control, .form-select {
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: .88rem; padding: .5rem .85rem; color: var(--text-primary);
  transition: border .2s, box-shadow .2s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--green-500); box-shadow: 0 0 0 3px rgba(33,122,72,.1);
  outline: none;
}
.btn { border-radius: 8px; font-size: .875rem; font-weight: 500; padding: .5rem 1.25rem; }
.btn-primary { background: var(--green-600); border-color: var(--green-600); }
.btn-primary:hover { background: var(--green-700); border-color: var(--green-700); }
.btn-success { background: var(--green-500); border-color: var(--green-500); }
.btn-outline-primary { color: var(--green-600); border-color: var(--green-600); }
.btn-outline-primary:hover { background: var(--green-600); border-color: var(--green-600); }

/* ── BADGES ─────────────────────────────────────────────── */
.badge { font-size: .72rem; font-weight: 600; padding: .3em .65em; border-radius: 6px; }

/* ── ALERT ───────────────────────────────────────────────── */
.alert { border-radius: var(--radius); border: none; font-size: .875rem; }
.alert-sm { padding: .6rem .9rem; font-size: .82rem; }

/* ── FINANCE MODULE ──────────────────────────────────────── */
.fin-stat {
  text-align: center; padding: 1.5rem;
  border-right: 1px solid var(--border);
}
.fin-stat:last-child { border-right: none; }
.fin-amount { font-size: 1.6rem; font-weight: 700; display: block; margin-bottom: .25rem; }
.fin-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); }
.fin-income { color: #059669; }
.fin-expense { color: #dc2626; }
.fin-balance { color: var(--green-600); }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 1200px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .dashboard-body { grid-template-columns: 1fr; }
  .dash-sidebar { display: grid; grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .main-content { margin-left: 0; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .content-area { padding: 1.25rem; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 0 1rem; }
  .welcome-banner { flex-direction: column; gap: 1rem; }
}
@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; }
  .dash-sidebar { grid-template-columns: 1fr; }
}

/* ── SCROLLBAR ───────────────────────────────────────────── */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }
