/* =====================================================
   Edward Kings Academy SMS — Main Stylesheet
   Theme: Navy Blue & Gold (Light Mode, Dark Sidebar)
   Colors: #1a3a6b (Navy) · #d97706 (Gold) · #f8fafc (Light BG)
   ===================================================== */

:root {
  /* Brand colours */
  --primary:        #1a3a6b;
  --primary-light:  #2563eb;
  --primary-dark:   #0f2244;

  /* Gold accent */
  --accent:         #d97706;
  --accent-light:   #f59e0b;
  --accent-dark:    #b45309;

  /* Semantic */
  --success:  #059669;
  --danger:   #dc2626;
  --warning:  #d97706;
  --info:     #2563eb;

  /* Page / content backgrounds */
  --bg-page:    #f1f5f9;   /* light slate-100  */
  --bg-dark:    #f1f5f9;   /* alias used by forms/inputs → same as page */
  --bg-card:    #ffffff;
  --bg-hover:   #f8fafc;

  /* Sidebar (stays dark) */
  --bg-sidebar:       #0f1e36;
  --sidebar-border:   rgba(255,255,255,0.07);

  /* Typography */
  --text-primary:   #0f172a;   /* slate-900 */
  --text-secondary: #475569;   /* slate-600 */
  --text-muted:     #94a3b8;   /* slate-400 */

  /* Border */
  --border-color: #e2e8f0;    /* slate-200 */

  /* Layout */
  --sidebar-width:  260px;
  --navbar-height:  64px;

  /* Shadows (light theme — subtle) */
  --shadow-sm: 0 1px 3px rgba(15,23,42,0.06), 0 1px 2px rgba(15,23,42,0.04);
  --shadow-md: 0 4px 12px rgba(15,23,42,0.08);
  --shadow-lg: 0 10px 30px rgba(15,23,42,0.10);

  /* Shape */
  --radius:    12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-page); }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ═══════════════════ SIDEBAR ═══════════════════
   Always dark navy so it pops against the light content.
   All text inside must be explicitly light.
   ════════════════════════════════════════════════ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow-y: auto;
  transition: transform 0.3s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.brand-logo {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  color: #ffffff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(217,119,6,0.35);
}

.brand-name {
  display: block;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 15px;
  font-weight: 800;
  color: #ffffff;          /* explicit white on dark sidebar */
  line-height: 1.2;
}

.brand-subtitle {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--accent-light);
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-section { margin-bottom: 4px; }

.nav-section-label {
  display: block;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);   /* light on dark */
  padding: 12px 20px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.65);   /* light on dark */
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  border-radius: 0;
  transition: var(--transition);
  border-left: 3px solid transparent;
  margin: 1px 0;
}

.nav-item i { font-size: 16px; flex-shrink: 0; width: 18px; }

.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: #ffffff;
  border-left-color: var(--accent-light);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(245,158,11,0.18), transparent);
  color: var(--accent-light);
  border-left-color: var(--accent-light);
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.school-motto {
  font-size: 10px;
  color: rgba(255,255,255,0.3);
  letter-spacing: 0.5px;
  text-align: center;
}

/* ═══════════════════ MAIN WRAPPER ═══════════════════ */
.main-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

/* ═══════════════════ TOP NAVBAR ═══════════════════ */
.top-navbar {
  position: sticky;
  top: 0;
  height: var(--navbar-height);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  z-index: 900;
  box-shadow: var(--shadow-sm);
}

.sidebar-toggle {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: none;
  align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 18px;
  transition: var(--transition);
}
.sidebar-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--primary);
}

.navbar-breadcrumb { flex: 1; }

.page-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.school-info-pill {
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.school-info-pill i { color: var(--accent); }

.user-btn {
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 6px 14px 6px 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
}
.user-btn:hover {
  background: #e8f0fe;
  border-color: var(--primary-light);
}

.user-avatar {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  color: white;
}

/* ═══════════════════ PAGE CONTENT ═══════════════════ */
.page-content {
  padding: 28px;
  min-height: calc(100vh - var(--navbar-height));
}

/* ═══════════════════ CARDS ═══════════════════ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border-color);
  padding: 16px 20px;
}

.card-footer {
  background: transparent;
}

.card-body { padding: 20px; }

/* ═══════════════════ STAT CARDS ═══════════════════ */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 90px; height: 90px;
  border-radius: 50%;
  opacity: 0.06;
  transform: translate(20px, -20px);
}

.stat-card.blue::before  { background: var(--info); }
.stat-card.green::before { background: var(--success); }
.stat-card.amber::before { background: var(--accent); }
.stat-card.red::before   { background: var(--danger); }

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  margin-bottom: 14px;
}

.stat-icon.blue   { background: rgba(37,99,235,0.10); color: var(--info); }
.stat-icon.green  { background: rgba(5,150,105,0.10);  color: var(--success); }
.stat-icon.amber  { background: rgba(217,119,6,0.12);  color: var(--accent); }
.stat-icon.red    { background: rgba(220,38,38,0.10);   color: var(--danger); }
.stat-icon.purple { background: rgba(124,58,237,0.10); color: #7c3aed; }

.stat-value {
  font-size: 32px;
  font-weight: 800;
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: var(--primary-dark);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12.5px;
  color: var(--text-secondary);
  font-weight: 500;
}

.stat-change { font-size: 11px; margin-top: 8px; }
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ═══════════════════ TABLES ═══════════════════ */
.table {
  color: var(--text-primary);
  border-color: var(--border-color);
  font-size: 13.5px;
}

.table thead th {
  background: #f8fafc;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  border-bottom: 2px solid var(--border-color);
  padding: 12px 16px;
}

.table tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: background 0.15s;
}

.table tbody tr:hover { background: #f8fafc; }
.table td { padding: 12px 16px; vertical-align: middle; }

/* ═══════════════════ BADGES ═══════════════════ */
.badge-status {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-active   { background: rgba(5,150,105,0.10);  color: #047857; }
.badge-inactive { background: rgba(220,38,38,0.10);   color: #b91c1c; }
.badge-present  { background: rgba(5,150,105,0.10);  color: #047857; }
.badge-absent   { background: rgba(220,38,38,0.10);   color: #b91c1c; }
.badge-late     { background: rgba(217,119,6,0.12);  color: #92400e; }
.badge-excused  { background: rgba(37,99,235,0.10);  color: #1d4ed8; }

/* ═══════════════════ FORMS ═══════════════════ */
.form-control, .form-select {
  background: #ffffff;
  border: 1px solid #d1d5db;
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  transition: var(--transition);
}

.form-control:focus, .form-select:focus {
  background: #ffffff;
  border-color: var(--primary-light);
  color: var(--text-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
  outline: none;
}

.form-control::placeholder { color: #9ca3af; }

.form-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.form-select option { background: #ffffff; color: var(--text-primary); }

/* ═══════════════════ BUTTONS ═══════════════════ */
.btn {
  font-size: 13.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  transition: var(--transition);
  border: none;
  letter-spacing: 0.1px;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(26,58,107,0.25);
}
.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(26,58,107,0.35);
  color: white;
}

.btn-success {
  background: var(--success);
  color: white;
  box-shadow: 0 2px 8px rgba(5,150,105,0.25);
}
.btn-success:hover { background: #047857; transform: translateY(-1px); color: white; }

.btn-warning {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 8px rgba(217,119,6,0.25);
}
.btn-warning:hover { background: var(--accent-dark); transform: translateY(-1px); color: white; }

.btn-danger {
  background: var(--danger);
  color: white;
  box-shadow: 0 2px 8px rgba(220,38,38,0.25);
}
.btn-danger:hover { background: #b91c1c; transform: translateY(-1px); color: white; }

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

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

/* ═══════════════════ PAGE HEADER ═══════════════════ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-header h1 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 24px;
  font-weight: 800;
  color: var(--primary-dark);
}

.page-header .subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ═══════════════════ STUDENT AVATAR ═══════════════════ */
.student-avatar {
  width: 44px; height: 44px;
  border-radius: 10px;
  object-fit: cover;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

.student-avatar-lg {
  width: 80px; height: 80px;
  border-radius: 16px;
  font-size: 26px;
}

/* ═══════════════════ STREAM CARD ═══════════════════ */
.stream-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 18px;
  transition: var(--transition);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.stream-card:hover {
  border-color: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stream-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px; height: 52px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  font-size: 18px;
  font-weight: 800;
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: var(--accent-light);
  margin-bottom: 10px;
  box-shadow: 0 4px 12px rgba(26,58,107,0.3);
}

/* ═══════════════════ PROGRESS BARS ═══════════════════ */
.progress {
  background: #e2e8f0;
  border-radius: 10px;
  height: 8px;
}
.progress-bar {
  border-radius: 10px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

/* ═══════════════════ ALERTS ═══════════════════ */
.alert {
  border-radius: var(--radius);
  border: none;
  font-size: 14px;
}

.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger  { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-warning { background: #fef3c7; color: #78350f; border: 1px solid #fde68a; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* ═══════════════════ LOGIN PAGE ═══════════════════ */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-dark) 0%, #1a3a6b 50%, #1e3a8a 100%);
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 40px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  color: white;
  margin: 0 auto 20px;
  box-shadow: 0 8px 20px rgba(217,119,6,0.35);
}

/* ═══════════════════ DROPDOWN ═══════════════════ */
.dropdown-menu {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.dropdown-item {
  color: var(--text-secondary);
  font-size: 13.5px;
  padding: 10px 16px;
}
.dropdown-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.dropdown-header { color: var(--text-muted); font-size: 11px; }
.dropdown-divider { border-color: var(--border-color); }

/* ═══════════════════ DATATABLES ═══════════════════ */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  background: #ffffff;
  border: 1px solid #d1d5db;
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_filter label,
.dataTables_wrapper .dataTables_length label {
  color: var(--text-secondary);
  font-size: 13px;
}

/* ═══════════════════ PAGINATION ═══════════════════ */
.page-link {
  background: #ffffff;
  border-color: var(--border-color);
  color: var(--text-secondary);
}
.page-link:hover,
.page-item.active .page-link {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* ═══════════════════ RECEIPT ═══════════════════ */
.receipt-header {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 24px;
  text-align: center;
  color: white;
}

/* ═══════════════════ CHART CONTAINERS ═══════════════════ */
.chart-container { position: relative; }

/* ═══════════════════ TIMETABLE ═══════════════════ */
.timetable-cell {
  background: rgba(26,58,107,0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12px;
  margin: 2px;
}
.timetable-cell .subject-name { font-weight: 600; color: var(--primary-dark); }
.timetable-cell .teacher-name { color: var(--text-muted); font-size: 11px; }

/* ═══════════════════ GRADE LEVEL COLOURS ═══════════════════ */
.level-pre-primary { color: #be185d; }
.level-primary     { color: var(--info); }
.level-junior      { color: var(--accent); }

/* ═══════════════════ NAV ACTIVE GLOW (subtle) ═══════════════════ */
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245,158,11,0.45); }
  50%       { box-shadow: 0 0 0 7px rgba(245,158,11,0); }
}
.nav-item.active i { animation: pulse-glow 2.5s ease-in-out infinite; border-radius: 50%; }

/* ═══════════════════ FADE-IN ANIMATIONS ═══════════════════ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in-up { animation: fadeInUp 0.4s ease forwards; }

.stat-card, .stream-card, .card {
  animation: fadeInUp 0.3s ease forwards;
}

.stat-card:nth-child(1) { animation-delay: 0.04s; }
.stat-card:nth-child(2) { animation-delay: 0.08s; }
.stat-card:nth-child(3) { animation-delay: 0.12s; }
.stat-card:nth-child(4) { animation-delay: 0.16s; }
.stat-card:nth-child(5) { animation-delay: 0.20s; }

/* ═══════════════════ UTILITY ═══════════════════ */
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }

/* ═══════════════════ RESPONSIVE ═══════════════════ */
@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 30px rgba(0,0,0,0.2);
  }
  .main-wrapper { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .school-info-pill { display: none; }
  .page-content { padding: 16px; }
}

@media (max-width: 576px) {
  .page-header { flex-direction: column; align-items: flex-start; }
  .stat-value  { font-size: 26px; }
}
