/*
 * Bright Start Academy – Portal Stylesheet
 * Theme: Orange (#F47B20) + Navy Blue (#1E3A8A) matching school logo
 */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --sp-primary:      #F47B20;   /* orange from logo */
  --sp-primary-dark: #C9620F;
  --sp-primary-light:#FEF0E6;
  --sp-navy:         #1E3A8A;   /* navy blue from logo */
  --sp-navy-dark:    #162C6D;
  --sp-navy-light:   #E8EDF8;
  --sp-accent:       #F47B20;
  --sp-text:         #1a1a2e;
  --sp-muted:        #6c757d;
  --sp-sidebar-w:    260px;
  --sp-navbar-h:     62px;
  --sp-border:       #dee2e6;
  --sp-card-shadow:  0 2px 10px rgba(0,0,0,.09);

  /* legacy aliases used in PHP templates */
  --sp-green:        #1E3A8A;
  --sp-green-dark:   #162C6D;
  --sp-green-light:  #E8EDF8;
  --sp-green-mid:    #2e5acc;
}

/* ── Reset / Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: .9rem;
  background: #f4f6f9;
  color: var(--sp-text);
  min-height: 100vh;
}

/* ── Navbar ─────────────────────────────────────────────────── */
.sp-navbar {
  background: linear-gradient(135deg, var(--sp-navy-dark) 0%, var(--sp-navy) 100%);
  height: var(--sp-navbar-h);
  position: sticky;
  top: 0;
  z-index: 1040;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.sp-navbar .navbar-brand {
  font-size: 1.1rem;
  letter-spacing: .02em;
  font-weight: 700;
}
.sp-navbar .navbar-brand img.school-logo {
  height: 42px;
  width: 42px;
  object-fit: contain;
  border-radius: 4px;
  background: white;
  padding: 2px;
}
.sp-role-badge {
  background: var(--sp-primary);
  color: #fff;
  font-size: .65rem;
  letter-spacing: .08em;
  padding: .25em .6em;
  border-radius: 4px;
  text-transform: uppercase;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sp-sidebar {
  width: var(--sp-sidebar-w);
  min-height: calc(100vh - var(--sp-navbar-h));
  background: #fff;
  border-right: 1px solid var(--sp-border);
  position: sticky;
  top: var(--sp-navbar-h);
  height: calc(100vh - var(--sp-navbar-h));
  overflow-y: auto;
  flex-shrink: 0;
}
.sp-sidebar .nav-link {
  color: var(--sp-text);
  padding: .55rem 1.25rem;
  display: flex;
  align-items: center;
  gap: .6rem;
  transition: background .15s, color .15s;
  font-size: .875rem;
  border-left: 3px solid transparent;
}
.sp-sidebar .nav-link:hover {
  background: var(--sp-primary-light);
  color: var(--sp-primary-dark);
}
.sp-sidebar .nav-link.active {
  background: var(--sp-primary-light);
  color: var(--sp-primary-dark);
  font-weight: 600;
  border-left-color: var(--sp-primary);
}
.sp-sidebar .sidebar-heading {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--sp-muted);
  padding: 1rem 1.25rem .35rem;
}

/* ── Main content ───────────────────────────────────────────── */
.sp-main { flex: 1; padding: 1.5rem; min-width: 0; }
.sp-page-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--sp-navy);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.sp-page-title::before {
  content: "";
  display: inline-block;
  width: 4px; height: 28px;
  background: var(--sp-primary);
  border-radius: 2px;
}

/* ── Stat Cards ─────────────────────────────────────────────── */
.sp-stat-card {
  background: #fff;
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  box-shadow: var(--sp-card-shadow);
  display: flex;
  align-items: center;
  gap: 1rem;
  border-left: 4px solid var(--sp-navy);
  transition: transform .18s, box-shadow .18s;
}
.sp-stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.sp-stat-card .stat-icon {
  width: 52px; height: 52px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  background: var(--sp-navy-light);
  color: var(--sp-navy);
  flex-shrink: 0;
}
.sp-stat-card .stat-val { font-size: 1.8rem; font-weight: 700; line-height: 1; color: var(--sp-navy); }
.sp-stat-card .stat-lbl { font-size: .78rem; color: var(--sp-muted); margin-top: .1rem; }
.sp-stat-card.accent { border-left-color: var(--sp-primary); }
.sp-stat-card.accent .stat-icon { background: var(--sp-primary-light); color: var(--sp-primary-dark); }
.sp-stat-card.accent .stat-val { color: var(--sp-primary-dark); }

/* ── Cards ──────────────────────────────────────────────────── */
.sp-card { background: #fff; border-radius: 10px; box-shadow: var(--sp-card-shadow); border: none; }
.sp-card .card-header {
  background: linear-gradient(135deg, var(--sp-navy) 0%, var(--sp-navy-dark) 100%);
  color: #fff;
  font-weight: 600;
  border-radius: 10px 10px 0 0 !important;
  padding: .8rem 1.25rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* ── Tables ─────────────────────────────────────────────────── */
.sp-table { font-size: .85rem; }
.sp-table thead th {
  background: var(--sp-navy-light);
  color: var(--sp-navy-dark);
  font-weight: 600;
  border-bottom: 2px solid var(--sp-navy);
  white-space: nowrap;
}
.sp-table tbody tr:hover { background: #fff8f3; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn-sp-primary {
  background: var(--sp-primary);
  border-color: var(--sp-primary);
  color: #fff;
  font-weight: 500;
}
.btn-sp-primary:hover {
  background: var(--sp-primary-dark);
  border-color: var(--sp-primary-dark);
  color: #fff;
}
.btn-sp-outline {
  border-color: var(--sp-navy);
  color: var(--sp-navy);
  font-weight: 500;
}
.btn-sp-outline:hover { background: var(--sp-navy); color: #fff; }
.bg-sp-green { background: var(--sp-navy) !important; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-label { font-weight: 600; font-size: .825rem; }
.form-control:focus, .form-select:focus {
  border-color: var(--sp-primary);
  box-shadow: 0 0 0 .2rem rgba(244,123,32,.25);
}

/* ── Grade badges ────────────────────────────────────────────── */
.grade-1  { background:#d4edda; color:#155724; }
.grade-3  { background:#cce5ff; color:#004085; }
.grade-5  { background:#fff3cd; color:#856404; }
.grade-7  { background:#fde8d8; color:#7d3a0b; }
.grade-9  { background:#f8d7da; color:#721c24; }

/* ── Alerts / Flash ─────────────────────────────────────────── */
.sp-flash {
  position: fixed;
  top: calc(var(--sp-navbar-h) + 10px);
  right: 16px;
  z-index: 9999;
  min-width: 300px;
  animation: slideIn .3s ease;
}
@keyframes slideIn { from { transform: translateX(120%); } to { transform: translateX(0); } }

/* ── Login page ─────────────────────────────────────────────── */
.sp-login-wrap {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--sp-navy-dark) 0%, var(--sp-navy) 50%, var(--sp-primary) 100%);
  display: flex; align-items: center; justify-content: center;
}
.sp-login-card {
  background: #fff;
  border-radius: 14px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 430px;
  box-shadow: 0 12px 40px rgba(0,0,0,.28);
}
.sp-login-logo {
  width: 90px; height: 90px;
  object-fit: contain;
  margin: 0 auto 1rem;
  display: block;
}
.sp-login-card h2 { color: var(--sp-navy); font-weight: 700; }
.sp-login-divider {
  height: 3px;
  background: linear-gradient(90deg, var(--sp-navy), var(--sp-primary));
  border-radius: 2px;
  margin: .75rem 0 1.5rem;
}

/* ── Footer ─────────────────────────────────────────────────── */
.sp-footer { background: #fff; border-top: 1px solid var(--sp-border); margin-top: auto; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sp-sidebar { position: fixed; left: -260px; z-index: 1035; transition: left .25s; }
  .sp-sidebar.show { left: 0; }
  .sp-main { padding: 1rem .75rem; }
  .sp-stat-card .stat-val { font-size: 1.4rem; }
}

/* ── Utilities ──────────────────────────────────────────────── */
.text-green   { color: var(--sp-navy) !important; }
.text-primary-sp { color: var(--sp-primary) !important; }
.border-sp    { border-color: var(--sp-navy) !important; }
.cursor-pointer { cursor: pointer; }
.sp-divider   { border-top: 2px solid var(--sp-navy-light); margin: 1rem 0; }

/* ── Upload zone ─────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--sp-primary);
  border-radius: 10px;
  padding: 2rem;
  text-align: center;
  transition: background .2s;
  cursor: pointer;
}
.upload-zone:hover { background: var(--sp-primary-light); }
.upload-zone .upload-icon { font-size: 2.5rem; color: var(--sp-primary); }
