/* ============================================================
   SchoolERP - Main Stylesheet
   Brand: Green theme matching Majestic Infotech / KCC Automation
============================================================ */

:root {
  --green:        #1a7a4a;
  --green-dark:   #0f4d2e;
  --green-mid:    #156040;
  --green-light:  #e8f5ee;
  --green-soft:   #c8e6d4;
  --gold:         #e6a817;
  --gold-light:   #fef3d4;
  --red:          #dc3545;
  --red-light:    #fdecea;
  --blue:         #2563eb;
  --blue-light:   #eff6ff;
  --purple:       #7c3aed;
  --sidebar-bg:   #0d3d25;
  --sidebar-w:    240px;
  --text:         #1a202c;
  --text-mid:     #4a5568;
  --text-soft:    #718096;
  --border:       #e2e8f0;
  --bg:           #f7fafc;
  --white:        #ffffff;
  --radius:       8px;
  --shadow:       0 1px 4px rgba(0,0,0,.08);
  --shadow-md:    0 4px 16px rgba(0,0,0,.12);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
}
a { color: inherit; text-decoration: none; }

/* ════════════════════════════════
   LOGIN PAGE
════════════════════════════════ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--green) 60%, #2d9e62 100%);
  position: relative;
  overflow: hidden;
}
.login-bg-pattern {
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.03) 0, rgba(255,255,255,.03) 1px, transparent 0, transparent 50%);
  background-size: 24px 24px;
}
.login-left { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 60px; position: relative; z-index: 1; }
.school-logo-wrap { display: flex; align-items: center; gap: 14px; margin-bottom: 48px; }
.school-logo { width: 52px; height: 52px; background: rgba(255,255,255,.15); border-radius: 14px; display: grid; place-items: center; font-size: 24px; border: 1px solid rgba(255,255,255,.2); }
.school-title h2 { font-size: 18px; font-weight: 700; letter-spacing: .3px; color: #fff; margin: 0; }
.school-title span { font-size: 12px; opacity: .7; color: #fff; }
.login-hero h1 { font-size: 36px; font-weight: 800; color: #fff; line-height: 1.2; margin-bottom: 16px; }
.login-hero p { font-size: 15px; color: rgba(255,255,255,.72); line-height: 1.7; max-width: 360px; margin-bottom: 36px; }
.feature-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { padding: 6px 14px; border-radius: 20px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); color: rgba(255,255,255,.9); font-size: 12px; font-weight: 500; }

.login-right { width: 420px; display: flex; align-items: center; justify-content: center; padding: 40px; position: relative; z-index: 1; }
.login-card { width: 100%; background: var(--white); border-radius: 16px; padding: 40px; box-shadow: 0 24px 64px rgba(0,0,0,.25); }
.login-card h3 { font-size: 20px; font-weight: 700; color: var(--green-dark); margin: 0 0 4px; }
.login-card > p { font-size: 13px; color: var(--text-soft); margin: 0 0 28px; }

.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-mid); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .5px; }
.form-input,
.form-control {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--border);
  border-radius: var(--radius); font-size: 14px; color: var(--text);
  transition: border .2s, box-shadow .2s; background: #fafafa;
}
.form-input:focus, .form-control:focus {
  outline: none; border-color: var(--green); background: #fff;
  box-shadow: 0 0 0 3px rgba(26,122,74,.12);
}
.form-check { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.form-check input { accent-color: var(--green); width: 14px; height: 14px; }
.form-check label { font-size: 12px; color: var(--text-mid); }

.btn-login {
  width: 100%; padding: 13px; background: var(--green); color: #fff; border: none;
  border-radius: var(--radius); font-size: 15px; font-weight: 600; cursor: pointer;
  margin-top: 6px; transition: background .2s, transform .1s;
}
.btn-login:hover { background: var(--green-mid); }
.btn-login:active { transform: scale(.99); }

.validation-summary-errors {
  background: var(--red-light); color: var(--red); border: 1px solid #f5b5bb;
  border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; font-size: 13px;
}
.validation-summary-errors ul { margin: 0; padding-left: 18px; }
.text-danger { color: var(--red); font-size: 11px; display: block; margin-top: 4px; }
span.field-validation-error { color: var(--red); font-size: 11px; }

/* ════════════════════════════════
   APP SHELL (sidebar + topbar)
════════════════════════════════ */
.erp-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); background: var(--sidebar-bg);
  display: flex; flex-direction: column; flex-shrink: 0;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

.sidebar-header { padding: 18px 16px 12px; border-bottom: 1px solid rgba(255,255,255,.06); }
.sidebar-school { display: flex; align-items: center; gap: 10px; }
.sidebar-school-icon { width: 36px; height: 36px; background: var(--green); border-radius: 8px; display: grid; place-items: center; font-size: 16px; flex-shrink: 0; }
.sidebar-school-name { color: #fff; font-size: 12px; font-weight: 700; line-height: 1.3; }
.sidebar-school-year { color: rgba(255,255,255,.45); font-size: 10px; }

.sidebar-user { padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,.06); display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--green); display: grid; place-items: center; font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0; }
.user-info { min-width: 0; }
.user-name { color: #fff; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { color: rgba(255,255,255,.45); font-size: 10px; }

.sidebar-nav { padding: 8px 0; flex: 1; }
.nav-section { padding: 12px 16px 4px; }
.nav-section-label { font-size: 9px; font-weight: 700; color: rgba(255,255,255,.3); text-transform: uppercase; letter-spacing: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 16px; cursor: pointer;
  color: rgba(255,255,255,.65); font-size: 13px; font-weight: 500; transition: all .15s;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav-item.active { color: #fff; background: rgba(26,122,74,.5); border-left: 3px solid var(--green); }
.nav-icon { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }
.nav-badge { margin-left: auto; background: var(--green); color: #fff; font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 8px; }
.nav-badge.red { background: var(--red); }

.main-content { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  background: var(--white); border-bottom: 1px solid var(--border); padding: 0 24px; height: 56px;
  display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 16px; font-weight: 700; color: var(--text); flex: 1; }
.topbar-title span { font-size: 12px; font-weight: 400; color: var(--text-soft); margin-left: 6px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar-btn {
  width: 36px; height: 36px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--white); display: grid; place-items: center; cursor: pointer; font-size: 16px;
  position: relative; transition: background .15s;
}
.topbar-btn:hover { background: var(--bg); }
.notif-dot { position: absolute; top: 7px; right: 7px; width: 6px; height: 6px; background: var(--red); border-radius: 50%; border: 1.5px solid white; }
.academic-badge { padding: 4px 10px; background: var(--green-light); color: var(--green-dark); border-radius: 4px; font-size: 11px; font-weight: 700; border: 1px solid var(--green-soft); }

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

/* ── STAT CARDS ── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--white); border-radius: var(--radius); padding: 18px 20px; border: 1px solid var(--border); display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s; }
.stat-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.stat-icon { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; font-size: 20px; flex-shrink: 0; }
.ic-green { background: var(--green-light); }
.ic-blue  { background: var(--blue-light); }
.ic-gold  { background: var(--gold-light); }
.ic-red   { background: var(--red-light); }
.ic-purple{ background: #f5f3ff; }
.stat-value { font-size: 24px; font-weight: 800; color: var(--text); line-height: 1; margin-bottom: 3px; }
.stat-label { font-size: 11px; color: var(--text-soft); font-weight: 500; text-transform: uppercase; letter-spacing: .3px; }
.stat-sub { font-size: 11px; color: var(--text-soft); margin-top: 2px; }
.stat-sub.up   { color: #16a34a; }
.stat-sub.down { color: var(--red); }

/* ── CARD ── */
.card { background: var(--white); border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 14px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 6px; }
.card-action { font-size: 12px; color: var(--green); font-weight: 600; cursor: pointer; }
.card-body { padding: 16px 20px; }

/* ── TABLE ── */
.erp-table { width: 100%; border-collapse: collapse; }
.erp-table th { padding: 9px 12px; text-align: left; font-size: 10px; font-weight: 700; color: var(--text-soft); text-transform: uppercase; letter-spacing: .5px; border-bottom: 2px solid var(--border); background: #fafbfc; }
.erp-table td { padding: 10px 12px; font-size: 13px; border-bottom: 1px solid var(--border); color: var(--text); }
.erp-table tr:last-child td { border-bottom: none; }
.erp-table tr:hover td { background: #fafbfc; }

/* ── BADGES ── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.badge-green  { background: var(--green-light); color: var(--green-dark); }
.badge-red    { background: var(--red-light); color: var(--red); }
.badge-gold   { background: var(--gold-light); color: #92400e; }
.badge-blue   { background: var(--blue-light); color: var(--blue); }
.badge-gray   { background: #f1f5f9; color: #64748b; }

/* ── BUTTONS (general app use) ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: var(--radius); font-size: 13px; font-weight: 600; cursor: pointer; border: 1.5px solid transparent; transition: all .15s; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-mid); }
.btn-outline { background: #fff; color: var(--green); border-color: var(--green); }
.btn-outline:hover { background: var(--green-light); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #c1212e; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .login-left { display: none; }
  .login-right { width: 100%; }
  .sidebar { position: fixed; left: -240px; z-index: 200; transition: left .2s; }
  .sidebar.open { left: 0; }
}
