/* ============================================================
   SCHOOL RESULTS MANAGEMENT SYSTEM — DESIGN SYSTEM
   Font: Poppins (Google Fonts)
   Palette: Deep Navy + Emerald + Gold + Soft White
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800;900&display=swap');

/* CSS VARIABLES */
:root {
  --navy:        #0f172a;
  --navy-mid:    #1e293b;
  --navy-light:  #334155;
  --emerald:     #059669;
  --emerald-light: #10b981;
  --emerald-pale:  #d1fae5;
  --gold:        #f59e0b;
  --gold-pale:   #fef3c7;
  --crimson:     #e11d48;
  --crimson-pale:#fee2e2;
  --sky:         #0ea5e9;
  --sky-pale:    #e0f2fe;

  --white:       #ffffff;
  --bg:          #f1f5f9;
  --card:        #ffffff;
  --border:      #e2e8f0;
  --text-dark:   #0f172a;
  --text-mid:    #475569;
  --text-soft:   #94a3b8;

  --font:        'Poppins', sans-serif;

  --sidebar-w:   260px;
  --radius:      12px;
  --radius-sm:   8px;
  --shadow:      0 4px 20px rgba(0,0,0,0.08);
  --shadow-md:   0 8px 30px rgba(0,0,0,0.12);
}

/* RESET */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-dark);
  min-height: 100vh;
  line-height: 1.6;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; }

/* ============================================================
   LAYOUT
   ============================================================ */
.layout {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 30px;
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 100;
  box-shadow: 4px 0 20px rgba(0,0,0,0.15);
}

.sidebar-brand {
  padding: 28px 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand .brand-icon {
  font-size: 28px;
  margin-bottom: 8px;
  display: block;
}

.sidebar-brand h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
  line-height: 1.3;
  letter-spacing: 0.3px;
}

.sidebar-brand p {
  font-size: 11px;
  color: var(--text-soft);
  font-weight: 500;
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-nav {
  padding: 16px 0;
  flex: 1;
}

.sidebar-nav .nav-section-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 16px 24px 6px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 24px;
  color: #cbd5e1;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,0.06);
  color: var(--white);
  border-left-color: var(--emerald);
}

.sidebar-nav a.active {
  background: rgba(5, 150, 105, 0.15);
  color: var(--emerald-light);
  border-left-color: var(--emerald);
  font-weight: 600;
}

.sidebar-nav a .nav-icon {
  font-size: 17px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ef4444;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.sidebar-footer a:hover {
  background: rgba(239,68,68,0.1);
}

/* ============================================================
   MOBILE HAMBURGER + OVERLAY (default hidden on desktop)
   ============================================================ */
.hamburger-btn {
  display: none;
}

.sidebar-overlay {
  display: none;
}

/* ============================================================
   TOP BAR
   ============================================================ */
.topbar {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  box-shadow: var(--shadow);
}

.topbar-left h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-dark);
}

.topbar-left p {
  font-size: 13px;
  color: var(--text-soft);
  font-weight: 400;
  margin-top: 2px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--emerald), var(--sky));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.topbar-user-info span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
}

.topbar-user-info small {
  font-size: 11px;
  color: var(--text-soft);
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.emerald { background: var(--emerald-pale); }
.stat-icon.gold    { background: var(--gold-pale); }
.stat-icon.sky     { background: var(--sky-pale); }
.stat-icon.crimson { background: var(--crimson-pale); }
.stat-icon.navy    { background: #e2e8f0; }

.stat-info h3 {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1;
}

.stat-info p {
  font-size: 12px;
  color: var(--text-soft);
  font-weight: 500;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================================
   CARDS / PANELS
   ============================================================ */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h2, .card-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
}

.card-body {
  padding: 24px;
}

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

thead tr {
  background: var(--navy);
}

thead th {
  padding: 13px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

tbody tr:hover {
  background: #f8fafc;
}

tbody td {
  padding: 13px 16px;
  color: var(--text-dark);
  font-weight: 500;
}

tbody tr:last-child {
  border-bottom: none;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 7px;
}

.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-dark);
  background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-control:focus {
  border-color: var(--emerald);
  box-shadow: 0 0 0 3px rgba(5,150,105,0.12);
}

.form-control::placeholder {
  color: var(--text-soft);
  font-weight: 400;
}

select.form-control {
  cursor: pointer;
}

textarea.form-control {
  min-height: 110px;
  resize: vertical;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--emerald);
  color: white;
}
.btn-primary:hover { background: #047857; transform: translateY(-1px); }

.btn-navy {
  background: var(--navy);
  color: white;
}
.btn-navy:hover { background: var(--navy-light); }

.btn-gold {
  background: var(--gold);
  color: white;
}
.btn-gold:hover { background: #d97706; }

.btn-danger {
  background: var(--crimson);
  color: white;
}
.btn-danger:hover { background: #be123c; }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-mid);
}
.btn-outline:hover { border-color: var(--emerald); color: var(--emerald); }

.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 15px;
}

/* ============================================================
   BADGES / PILLS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.badge-emerald { background: var(--emerald-pale); color: #065f46; }
.badge-gold    { background: var(--gold-pale);    color: #92400e; }
.badge-crimson { background: var(--crimson-pale); color: #9f1239; }
.badge-sky     { background: var(--sky-pale);     color: #075985; }
.badge-navy    { background: #e2e8f0;             color: var(--navy); }
.badge-purple  { background: #f3e8ff;             color: #6b21a8; }

/* Role badges */
.role-super_admin { background:#f3e8ff; color:#6b21a8; }
.role-admin       { background:var(--sky-pale); color:#075985; }
.role-head_master { background:var(--emerald-pale); color:#065f46; }
.role-teacher     { background:var(--gold-pale); color:#92400e; }
.role-parent      { background:var(--crimson-pale); color:#9f1239; }
.role-student     { background:#e2e8f0; color:var(--navy); }

/* Grade badges */
.grade-A { background:#d1fae5; color:#065f46; font-size:14px; font-weight:800; }
.grade-B { background:#dbeafe; color:#1e40af; font-size:14px; font-weight:800; }
.grade-C { background:#fef3c7; color:#92400e; font-size:14px; font-weight:800; }
.grade-D { background:#fed7aa; color:#9a3412; font-size:14px; font-weight:800; }
.grade-E { background:#fce7f3; color:#9d174d; font-size:14px; font-weight:800; }
.grade-F { background:#fee2e2; color:#9f1239; font-size:14px; font-weight:800; }

/* ============================================================
   ALERTS / NOTICES
   ============================================================ */
.alert {
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-success { background: var(--emerald-pale); color: #065f46; border-left: 4px solid var(--emerald); }
.alert-error   { background: var(--crimson-pale); color: #9f1239; border-left: 4px solid var(--crimson); }
.alert-warning { background: var(--gold-pale);    color: #92400e; border-left: 4px solid var(--gold); }
.alert-info    { background: var(--sky-pale);     color: #075985; border-left: 4px solid var(--sky); }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, #1a3a4a 50%, #0d3d2e 100%);
  padding: 20px;
}

.login-box {
  background: var(--white);
  border-radius: 20px;
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.3);
}

.login-brand {
  text-align: center;
  margin-bottom: 32px;
}

.login-brand .brand-emoji {
  font-size: 44px;
  display: block;
  margin-bottom: 12px;
}

.login-brand h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.2;
}

.login-brand p {
  font-size: 13px;
  color: var(--text-soft);
  margin-top: 6px;
  font-weight: 400;
}

.login-divider {
  text-align: center;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
  margin: 24px 0 20px;
  position: relative;
}

.login-divider::before,
.login-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: var(--border);
}

.login-divider::before { left: 0; }
.login-divider::after  { right: 0; }

.login-demo {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-mid);
  text-align: center;
  line-height: 1.8;
}

.login-demo strong {
  color: var(--navy);
  font-weight: 700;
}

/* ============================================================
   LANDING PAGE (index.php)
   ============================================================ */
.landing-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, #1a3a4a 50%, #0d3d2e 100%);
  padding: 20px;
}

.landing-card {
  background: white;
  border-radius: 20px;
  padding: 48px 44px;
  max-width: 520px;
  width: 100%;
  text-align: center;
  box-shadow: 0 30px 70px rgba(0,0,0,0.25);
}

.landing-card h1 {
  font-size: 26px;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 10px;
}

.landing-card .tagline {
  color: var(--text-soft);
  font-size: 14px;
  margin-bottom: 32px;
}

.features-list {
  text-align: left;
  margin: 28px 0;
}

.features-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dark);
  border-bottom: 1px solid var(--border);
}

.features-list li:last-child { border-bottom: none; }

/* ============================================================
   INFO BANNERS
   ============================================================ */
.info-banner {
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 24px;
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
}

.info-banner.current-term {
  background: linear-gradient(135deg, var(--navy), var(--navy-mid));
  color: white;
}

.info-banner.warning {
  background: var(--crimson-pale);
  color: #9f1239;
  border: 1px solid #fca5a5;
}

/* ============================================================
   REPORT CARD SPECIFIC
   ============================================================ */
.report-card {
  max-width: 800px;
  margin: 0 auto;
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.report-card-header {
  background: linear-gradient(135deg, var(--navy), #1a3a4a);
  color: white;
  padding: 30px;
  text-align: center;
}

.report-card-header h2 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.report-card-header p {
  font-size: 13px;
  opacity: 0.75;
  margin-top: 4px;
}

.student-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-bottom: 1px solid var(--border);
}

.student-meta-item {
  padding: 14px 20px;
  border-right: 1px solid var(--border);
}

.student-meta-item:nth-child(even) { border-right: none; }
.student-meta-item:nth-child(3),
.student-meta-item:nth-child(4) { border-bottom: none; }

.student-meta-item label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 1px;
  display: block;
  margin-bottom: 3px;
}

.student-meta-item span {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
}

.gpa-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border-top: 1px solid var(--border);
}

.gpa-item {
  background: white;
  padding: 18px;
  text-align: center;
}

.gpa-item .value {
  font-size: 28px;
  font-weight: 800;
  color: var(--emerald);
  display: block;
}

.gpa-item .label {
  font-size: 11px;
  color: var(--text-soft);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: 3px;
}

/* ============================================================
   UTILITIES
   ============================================================ */
.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2        { gap: 8px; }
.gap-3        { gap: 12px; }
.gap-4        { gap: 16px; }
.mt-2         { margin-top: 8px; }
.mt-3         { margin-top: 12px; }
.mt-4         { margin-top: 16px; }
.mb-4         { margin-bottom: 16px; }
.mb-6         { margin-bottom: 24px; }
.text-center  { text-align: center; }
.text-sm      { font-size: 12px; }
.text-soft    { color: var(--text-soft); }
.fw-bold      { font-weight: 700; }
.fw-black     { font-weight: 800; }
.w-full       { width: 100%; }

/* ============================================================
   SCROLLBAR (custom)
   ============================================================ */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ============================================================
   PRINT (report card)
   ============================================================ */
@media print {
  .sidebar, .topbar, .btn, .no-print, .hamburger-btn, .sidebar-overlay { display: none !important; }
  .main-content { margin-left: 0; padding: 0; }
  body { background: white; }
  .report-card { box-shadow: none; }
}

/* ============================================================
   RESPONSIVE — MOBILE (single source of truth)
   ============================================================ */
@media (max-width: 768px) {

  .hamburger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 14px;
    left: 14px;
    width: 42px;
    height: 42px;
    background: var(--navy);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
    z-index: 1001;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  }

  .sidebar-overlay.open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 998;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 999;
    width: 260px;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 10px 0 30px rgba(0,0,0,0.4);
  }

  .main-content {
    margin-left: 0 !important;
    padding: 16px !important;
    padding-top: 70px !important;
  }

  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .student-meta { grid-template-columns: 1fr; }
  .gpa-summary { grid-template-columns: 1fr; }
}