/* ============ STEMLabs Kenya — global styles ============ */
:root {
    --brand: #0b7a4b;         /* Kenyan green */
    --brand-dark: #085736;
    --accent: #f5a623;
    --danger: #d64545;
    --ink: #1c2430;
    --muted: #64748b;
    --bg: #f4f7f5;
    --card: #ffffff;
    --line: #e2e8f0;
    --radius: 12px;
    --shadow: 0 2px 10px rgba(15, 40, 30, .08);
    font-size: 16px;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.55;
}
h1, h2, h3 { line-height: 1.25; }
a { color: var(--brand); }
code { background: #eef2f0; padding: 2px 6px; border-radius: 6px; }

/* ---------- logo ---------- */
.logo { font-size: 1.5rem; font-weight: 800; text-decoration: none; color: var(--ink); letter-spacing: -.5px; }
.logo span { color: var(--brand); }

/* ---------- buttons ---------- */
.btn {
    display: inline-block; border: 0; cursor: pointer; text-decoration: none;
    padding: .65rem 1.3rem; border-radius: 999px; font-size: 1rem; font-weight: 600;
    transition: filter .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-accent { background: var(--accent); color: #3a2a00; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-sm { padding: .3rem .8rem; font-size: .85rem; }

/* ---------- forms ---------- */
label { display: block; font-weight: 600; margin: .9rem 0 .25rem; font-size: .92rem; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=tel], input[type=file], select, textarea {
    width: 100%; padding: .6rem .8rem; border: 1px solid var(--line);
    border-radius: 8px; font-size: 1rem; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
.form-row { display: flex; gap: 1rem; } .form-row > * { flex: 1; }
.hint { color: var(--muted); font-size: .85rem; margin-top: .2rem; }

/* ---------- alerts ---------- */
.alert { padding: .8rem 1rem; border-radius: 8px; margin: 0 0 1rem; font-size: .95rem; }
.alert-success { background: #e5f5ec; color: #0c5e3c; border: 1px solid #b7e2cc; }
.alert-error { background: #fceaea; color: #99312f; border: 1px solid #f2c4c4; }
.alert-info { background: #e8f1fb; color: #1e4e79; border: 1px solid #c4dcf2; }

/* ---------- auth pages (login/register) ---------- */
.auth-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #0b7a4b 0%, #063d26 100%); padding: 2rem 1rem;
}
.auth-card {
    background: var(--card); border-radius: 16px; box-shadow: 0 10px 40px rgba(0,0,0,.25);
    padding: 2.2rem; width: 100%; max-width: 440px;
}
.auth-card.wide { max-width: 620px; }
.auth-card h2 { margin: .4rem 0 1rem; }
.auth-links { margin-top: 1.2rem; text-align: center; font-size: .92rem; }
.auth-links a { display: inline-block; margin: 0 .5rem; }

/* ---------- landing page ---------- */
.landing header.hero {
    position: relative; overflow: hidden;
    background: linear-gradient(135deg, #0b7a4b, #063d26);
    color: #fff; padding: 0 1.5rem 5rem;
}
/* decorative floating STEM unicode icons behind the banner content */
.hero-bg { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.hero-bg span {
    position: absolute; color: #ffffff; opacity: .09;
    font-size: 3.4rem; line-height: 1; user-select: none;
    animation: heroFloat 9s ease-in-out infinite;
}
@keyframes heroFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-16px) rotate(6deg); }
}
.hero-nav, .hero-inner { position: relative; z-index: 1; }
.hero .logo, .hero .logo span { color: #fff; }
.hero .logo span { color: #ffd066; }
.hero-nav { display: flex; align-items: center; justify-content: space-between; max-width: 1080px; margin: 0 auto; padding: 1.2rem 0; }
.hero-nav .links { display: flex; align-items: center; }
.hero-nav .links a { color: #e8f5ee; text-decoration: none; margin-left: 1.4rem; font-weight: 600; }
.hero-menu-toggle { display: none; background: none; border: 0; color: #fff; font-size: 1.7rem; cursor: pointer; line-height: 1; padding: .2rem .4rem; }
.hero-inner { max-width: 1080px; margin: 3rem auto 0; text-align: center; }
.hero-inner h1 { font-size: clamp(1.9rem, 4.5vw, 3.2rem); margin: 0 0 1rem; }
.hero-inner p { font-size: 1.15rem; color: #d5ecdf; max-width: 720px; margin: 0 auto 2rem; }
.section { max-width: 1080px; margin: 0 auto; padding: 3.5rem 1.5rem; }
.section h2 { text-align: center; font-size: 2rem; margin-bottom: 2rem; }
.grid { display: grid; gap: 1.3rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card {
    background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 1.4rem; border: 1px solid var(--line);
}
.card h3 { margin: .2rem 0 .5rem; }
.card .icon { font-size: 2rem; }
.pricing-box {
    max-width: 460px; margin: 0 auto; text-align: center;
    background: var(--card); border: 2px solid var(--brand); border-radius: 16px; padding: 2rem;
}
.pricing-box .price { font-size: 2.6rem; font-weight: 800; color: var(--brand); }
.landing footer { background: #06301e; color: #a7cbb8; text-align: center; padding: 1.6rem; font-size: .9rem; }

/* ---------- app shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 250px; flex-shrink: 0; background: #0d3524; color: #dceee4;
    display: flex; flex-direction: column; padding: 1.2rem 1rem; gap: 1rem;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .logo, .sidebar .logo span { color: #fff; }
.sidebar .logo span { color: #ffd066; }
.school-chip { background: rgba(255,255,255,.08); border-radius: 10px; padding: .6rem .8rem; }
.school-chip strong { display: block; font-size: .92rem; }
.school-chip small { color: #9fc7b2; letter-spacing: 1px; }
.sidebar nav { display: flex; flex-direction: column; gap: .15rem; flex: 1; }
.sidebar nav a {
    color: #cfe8da; text-decoration: none; padding: .55rem .8rem; border-radius: 8px; font-size: .95rem;
}
.sidebar nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.sidebar-footer { display: flex; flex-direction: column; gap: .6rem; }
.sidebar-footer .btn-ghost { color: #dceee4; border-color: rgba(255,255,255,.25); font-size: .88rem; }
.sub-badge { font-size: .8rem; padding: .35rem .6rem; border-radius: 8px; text-align: center; font-weight: 600; }
.sub-badge.ok { background: #14532d; color: #86efac; }
.sub-badge.bad { background: #581c1c; color: #fca5a5; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    background: var(--card); border-bottom: 1px solid var(--line);
    padding: .9rem 1.6rem; display: flex; align-items: center; gap: 1rem;
}
.topbar h1 { font-size: 1.25rem; margin: 0; }
.menu-toggle { display: none; background: none; border: 0; font-size: 1.4rem; cursor: pointer; }
.content { padding: 1.6rem; flex: 1; }
.app-footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 1rem; }

/* ---------- dashboard widgets ---------- */
.stat-grid { display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 1.6rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; box-shadow: var(--shadow); }
.stat .num { font-size: 2rem; font-weight: 800; color: var(--brand); }
.stat .lbl { color: var(--muted); font-size: .9rem; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.data th, table.data td { padding: .65rem .9rem; text-align: left; border-bottom: 1px solid var(--line); }
table.data th { background: #f8faf9; font-size: .82rem; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
table.data tr:last-child td { border-bottom: 0; }
.pill { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.pill-green { background: #e5f5ec; color: #0c5e3c; }
.pill-red { background: #fceaea; color: #99312f; }
.pill-grey { background: #eef2f6; color: #475569; }

/* ---------- sim cards & sim page ---------- */
/* Virtual Labs subject cards: 3 per row, the last row's cards stretch to
   fill the width evenly (flex-grow), giving a 3-then-2 balanced layout. */
.subject-grid { display: flex; flex-wrap: wrap; gap: 1.3rem; }
.subject-grid > .card { flex: 1 1 300px; }
.sim-card { display: flex; flex-direction: column; }
.sim-card .concepts { font-size: .8rem; color: var(--muted); margin: .4rem 0 .8rem; }
.sim-card .btn { margin-top: auto; align-self: flex-start; }
.subject-banner {
    border-radius: var(--radius); padding: 1.6rem; color: #fff; margin-bottom: 1.5rem;
    background: linear-gradient(120deg, var(--brand), #0a5c3a);
}
.subject-banner h2 { margin: 0 0 .3rem; }
.subject-banner p { margin: 0; opacity: .9; }

.sim-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.3rem; align-items: start; }
.sim-stage { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.sim-stage canvas { width: 100%; height: auto; display: block; border-radius: 8px; background: #0e1726; }
.sim-panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; box-shadow: var(--shadow); }
.sim-panel h3 { margin: 0 0 .8rem; font-size: 1rem; }
.ctl { margin-bottom: .9rem; }
.ctl label { display: flex; justify-content: space-between; font-size: .88rem; margin: 0 0 .25rem; }
.ctl label output { color: var(--brand); font-weight: 700; }
.ctl input[type=range] { width: 100%; accent-color: var(--brand); }
.ctl-buttons { display: flex; gap: .5rem; flex-wrap: wrap; }
.sim-readout { background: #0e1726; color: #7ee0a3; font-family: Consolas, monospace; font-size: .88rem;
    border-radius: 8px; padding: .8rem; margin-top: .8rem; white-space: pre-wrap; }
.sim-note { font-size: .88rem; color: var(--muted); margin-top: .9rem; }

/* ---------- credentials print sheet ---------- */
.cred-sheet table.data td { font-family: Consolas, monospace; }
@media print {
    .sidebar, .topbar, .app-footer, .no-print { display: none !important; }
    .content { padding: 0; }
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
    .sidebar {
        position: fixed; z-index: 50; left: -260px; transition: left .25s;
        height: 100vh;
    }
    body.nav-open .sidebar { left: 0; }
    .menu-toggle { display: block; }
    .sim-layout { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; gap: 0; }
}

/* landing page mobile navigation menu */
@media (max-width: 720px) {
    .hero-menu-toggle { display: block; }
    .hero-nav { flex-wrap: wrap; }
    .hero-nav .links {
        display: none; flex-direction: column; align-items: stretch;
        width: 100%; order: 3; margin-top: .8rem; gap: .3rem;
    }
    .hero-nav.open .links { display: flex; }
    .hero-nav .links a {
        margin: 0; padding: .7rem .9rem; border-radius: 8px;
        background: rgba(255,255,255,.08); text-align: center;
    }
    .hero-nav .links a.btn { background: var(--accent); }
    .hero-bg span { font-size: 2.4rem; }
}
