/* ═══════════════════════════════════════════════════════════
   EduSpark — Portal Layout
   layout.css · Sidebar shell, topbar, nav items.
   Used by: dashboard.html, teachers-portal.html,
            superteachers-portal.html, institution-portal.html
   Load after vars.css + reset.css.
   ═══════════════════════════════════════════════════════════ */


/* ═══════════════════════════════════════════════════════════
   APP SHELL
   ═══════════════════════════════════════════════════════════ */

.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Main content area offset by the fixed sidebar */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.page-content {
  padding: 1.75rem 2rem;
  flex: 1;
}

/* Page sections — toggled with .active */
.page         { display: none; }
.page.active  { display: block; }


/* ═══════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════ */

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar, #0f172a);
  min-height: 100vh;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 50;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
}

/* ── Sidebar brand / logo block ── */
.sidebar-brand {
  padding: 1.4rem 1.5rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.brand-logo {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-weight: 800;
  font-size: 0.85rem;
  color: #fff;
  flex-shrink: 0;
}

.brand-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  letter-spacing: -0.01em;
}
.brand-name span { color: #60a5fa; }

/* ── Role chip below brand ── */
.role-badge {
  margin: 0.75rem 1.5rem 0.25rem;
  background: rgba(37,99,235,0.15);
  border: 1px solid rgba(37,99,235,0.25);
  color: #93c5fd;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 50px;
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Nav groups ── */
.nav-group       { padding: 0.4rem 0; }
.nav-group-label {
  padding: 0.5rem 1.5rem 0.25rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.22);
}

/* ── Nav item ── */
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.58rem 1.5rem;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 0.875rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  margin: 1px 0;
  user-select: none;
}
.nav-item:hover {
  color: rgba(255,255,255,0.88);
  background: rgba(255,255,255,0.04);
}
.nav-item.active {
  color: #fff;
  background: rgba(37,99,235,0.18);
  border-left-color: var(--accent);
}

.nav-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 0.63rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 50px;
  line-height: 1.4;
}

/* ── Sidebar footer (user card + logout) ── */
.sidebar-footer {
  margin-top: auto;
  padding: 0.85rem 1.25rem 1rem;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  padding: 0.4rem 0.25rem;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.user-card:hover { background: rgba(255,255,255,0.04); }

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: #fff;
  flex-shrink: 0;
}

.user-name { font-size: 0.85rem; font-weight: 600; color: #fff; }
.user-role { font-size: 0.7rem; color: rgba(255,255,255,0.38); }

.logout-btn {
  width: 100%;
  margin-top: 0.65rem;
  padding: 0.52rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  font-family: inherit;
  display: block;
}
.logout-btn:hover {
  background: rgba(220,38,38,0.15);
  border-color: rgba(220,38,38,0.35);
  color: #fca5a5;
}


/* ═══════════════════════════════════════════════════════════
   TOPBAR
   ═══════════════════════════════════════════════════════════ */

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
  gap: 1rem;
}

.topbar-title {
  font-family: var(--display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

/* Search box inside topbar */
.topbar-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.42rem 0.8rem;
}
.topbar-search input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.84rem;
  color: var(--text);
  width: 180px;
}
.topbar-search input::placeholder { color: var(--text3); }

/* Notification button */
.notif-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--text2);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
}
.notif-dot {
  position: absolute;
  top: 7px; right: 7px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--red);
  border: 1.5px solid var(--card);
}


/* ═══════════════════════════════════════════════════════════
   SECTION HEADER  (inside page content areas)
   ═══════════════════════════════════════════════════════════ */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.section-title {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.section-subtitle {
  font-size: 0.8rem;
  color: var(--text3);
  margin-top: 0.15rem;
}


/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE SIDEBAR
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.25);
  }
  .main {
    margin-left: 0;
  }
  .topbar {
    padding: 0 1rem;
  }
  .page-content {
    padding: 1.25rem 1rem;
  }

  /* Overlay behind open sidebar on mobile */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 49;
  }
  .sidebar-overlay.open { display: block; }
}

@media (max-width: 480px) {
  .topbar-search { display: none; }
}
