/* ══════════════════════════════════════
   BASE.CSS — Variables, Reset, Layout, Topbar, Bottom Nav
══════════════════════════════════════ */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --black: #0a0a0a;
  --red: #ED5145;
  --blue: #1A4E86;
  --lime: #D2ED15;
  --white: #ffffff;
  --off: #f7f7f5;
  --border: #ebebeb;
  --mid: #999;
  --text: #1a1a1a;
  --green: #2da05a;
  --orange: #f59e0b;
}

html, body { height: 100%; }

body {
  font-family: 'Montserrat', sans-serif;
  color: var(--text);
  min-height: 100vh;
  background: var(--off);
}

/* ══════════════════════════════════════
   MOBILE — full width app
══════════════════════════════════════ */
#app-shell {
  background: var(--white);
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 84px;
  position: relative;
}

/* ─── TOPBAR ─── */
.topbar {
  padding: 18px 22px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--white);
  z-index: 10;
  border-bottom: 1px solid var(--border);
}
.logo { display: flex; align-items: center; gap: 9px; }
.logo svg { width: 32px; height: 32px; }
.logo-wordmark {
  font-size: 13px; font-weight: 300;
  letter-spacing: 3px; text-transform: uppercase; color: var(--black);
}
.logo-wordmark b { font-weight: 900; }
.topbar-tag {
  font-size: 9px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--mid);
  border: 1px solid var(--border); padding: 4px 9px; border-radius: 20px;
  transition: all 0.2s;
}
.topbar-tag.teacher-mode {
  background: var(--blue); color: var(--white); border-color: var(--blue);
}

/* ─── PAGES ─── */
.page { display: none; }
.page.active { display: block; }

/* ─── SHARED COMPONENTS ─── */
.slabel {
  padding: 26px 22px 10px;
  font-size: 9px; font-weight: 700; letter-spacing: 2.5px;
  text-transform: uppercase; color: var(--mid);
  display: flex; align-items: center; justify-content: space-between;
}
.slabel-btn {
  background: none; border: 1px solid var(--border); border-radius: 20px;
  padding: 4px 12px; font-size: 9px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--blue); cursor: pointer;
  font-family: 'Montserrat', sans-serif;
}
.slabel-btn:hover { background: var(--off); }

.list { padding: 0 22px; display: flex; flex-direction: column; gap: 8px; }
.row {
  background: var(--off); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px;
  display: flex; align-items: center; gap: 14px;
  text-decoration: none; cursor: pointer; transition: transform 0.12s;
}
.row:active { transform: scale(0.98); }
.row:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.05); }
.row-icon { font-size: 22px; flex-shrink: 0; }
.row-body { flex: 1; }
.row-title { font-size: 13px; font-weight: 700; color: var(--text); }
.row-sub { font-size: 11px; color: var(--mid); margin-top: 2px; font-weight: 400; }
.row-arrow { font-size: 14px; color: var(--mid); }

.div { height: 1px; background: var(--border); margin: 24px 22px 0; }
.spacer { height: 24px; }

/* ─── BOTTOM NAV (mobile) ─── */
.bnav {
  position: fixed; bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%; max-width: 480px;
  background: var(--white); border-top: 1px solid var(--border);
  display: flex; padding: 10px 0 16px; z-index: 20;
}
.nbtn {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; gap: 3px; cursor: pointer;
  background: none; border: none; padding: 4px 0; transition: transform 0.1s;
}
.nbtn:active { transform: scale(0.88); }
.ni { font-size: 20px; }
.nl { font-size: 8px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: #ccc; transition: color 0.15s; }
.ndot { width: 4px; height: 4px; border-radius: 50%; background: var(--blue); margin: 0 auto; opacity: 0; transition: opacity 0.15s; }
.nbtn.active .nl { color: var(--blue); }
.nbtn.active .ndot { opacity: 1; }

/* ─── Sidebar brand (desktop only) ─── */
.sidebar-brand {
  display: none; /* hidden on mobile */
}

@media (min-width: 900px) {
  .sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 24px;
    height: 70px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
  }
  /* Remove the ::before pseudo-element we no longer need */
  .bnav::before { display: none; }
}
@media (min-width: 900px) {

  body { background: #f0f0ed; }

  /* full-width wrapper that holds sidebar + content */
  #app-shell {
    max-width: 1140px;
    width: 100%;
    margin: 0 auto;
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "sidebar topbar"
      "sidebar content";
    background: var(--white);
    box-shadow: 0 0 60px rgba(0,0,0,0.08);
    padding-bottom: 0;
  }

  /* ── Topbar becomes a top strip on the right ── */
  .topbar {
    grid-area: topbar;
    position: sticky;
    top: 0;
    border-left: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    z-index: 10;
  }

  /* ── Pages fill the content area ── */
  .page {
    grid-area: content;
  }

  /* ── Bottom nav becomes a left sidebar ── */
  .bnav {
    position: sticky;
    top: 0;
    left: 0;
    grid-area: sidebar;
    width: 260px;
    max-width: 260px;
    height: 100vh;
    transform: none;
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    border-top: none;
    border-right: 1px solid var(--border);
    background: var(--black);
    justify-content: flex-start;
    z-index: 20;
  }

  /* sidebar header / branding */
  .bnav::before {
    content: '';
    display: block;
    height: 70px; /* matches topbar height */
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: var(--black);
  }

  .nbtn {
    flex: none;
    flex-direction: row;
    justify-content: flex-start;
    padding: 16px 24px;
    gap: 14px;
    border-radius: 0;
    border-left: 3px solid transparent;
    transition: background 0.15s, border-color 0.15s;
  }
  .nbtn:hover { background: rgba(255,255,255,0.05); }
  .nbtn.active {
    background: rgba(255,255,255,0.07);
    border-left-color: var(--lime);
  }
  .ni { font-size: 18px; }
  .nl {
    font-size: 11px; letter-spacing: 1.5px; color: rgba(255,255,255,0.4);
    text-align: left;
  }
  .nbtn.active .nl { color: var(--white); }
  .ndot { display: none; } /* hidden on desktop — active state shown by border */

  /* ── App shell needs to be full height ── */
  #app-shell { align-items: start; }

  /* ── Make pages scroll inside the content column ── */
  .page.active {
    min-height: calc(100vh - 70px);
  }

  /* ── Wider content: stretch grids and lists ── */
  .grid2 {
    grid-template-columns: repeat(4, 1fr);
  }

  .stats {
    grid-template-columns: repeat(6, 1fr);
  }

  .feat-card { margin: 0 32px; }
  .slabel    { padding-left: 32px; padding-right: 32px; }
  .list      { padding: 0 32px; }
  .hero, .about-hero, .exch-hero, .hw-hero { padding-left: 32px; padding-right: 32px; }
  .grid2     { padding: 0 32px; }
  .info-block { margin-left: 32px; margin-right: 32px; }
  .dest      { margin-left: 32px; margin-right: 32px; }
  .cta       { margin-left: 32px; margin-right: 32px; }
  .stats     { padding: 0 32px; }
  .hw-topic-list, .act-cards { padding: 0 32px; }
  .hw-hud-cell { padding: 20px 16px; }
  .act-question { margin-left: 32px; margin-right: 32px; }
  .act-nav      { padding-left: 32px; padding-right: 32px; }
  .act-results  { max-width: 560px; margin: 0 auto; }
  .class-list, .student-list { padding: 0 32px; }
  .grade-grid  { padding: 0 32px; grid-template-columns: repeat(3, 1fr); }
  .checklist   { padding: 0 32px; }
  .notes-area  { margin: 0 32px; }
  .lock-screen { max-width: 420px; margin: 0 auto; }
}