/* ============================================================
   CSE 231 – Intro to Programming with Python
   Michigan State University | Spring 2026
   styles.css
   ============================================================ */

/* ── CUSTOM PROPERTIES ── */
:root {
  --bg: #fff;
  --surf: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #4b5563;
  --green: #18453b;
  --green-d: #0f2e26;
  --green-l: #f0faf7;
  --green-b: #a7d4c8;
  --focus: #2563eb;
  --nav: 70px;
  --sb: 185px;
  --r: 8px;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}
ul[role="list"] { list-style: none; padding: 0; margin: 0; }

/* ── ACCESSIBILITY ── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--green);
  color: #fff;
  padding: .5rem 1.1rem;
  border-radius: var(--r);
  font-weight: 700;
  font-size: .9rem;
  z-index: 9999;
  text-decoration: none;
  transition: top .15s;
}
.skip-link:focus { top: 1rem; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }

/* ── HEADER ── */
.top-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav);
  background: linear-gradient(135deg, var(--green-d), var(--green) 60%, #1e6b56);
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 0 1.25rem;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  color: #fff;
}
.hamburger {
  display: none;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: var(--r);
  cursor: pointer;
  font-size: 1.1rem;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: inherit;
}
.nav-s {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,.18);
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 900;
  font-family: Georgia, serif;
  flex-shrink: 0;
}
.nav-div { width: 1px; height: 36px; background: rgba(255,255,255,.2); flex-shrink: 0; }
.nav-uni { line-height: 1.35; flex-shrink: 0; }
.nav-uni-name { font-size: .7rem; font-weight: 700; }
.nav-uni-dept { font-size: .61rem; opacity: .85; }
.nav-info { flex: 1; min-width: 0; }
.nav-info-top { display: flex; align-items: center; gap: .45rem; }
.nav-chip {
  background: rgba(255,255,255,.2);
  border: 1px solid rgba(255,255,255,.3);
  font-size: .7rem;
  font-weight: 700;
  padding: .15rem .5rem;
  border-radius: 4px;
  letter-spacing: .04em;
  flex-shrink: 0;
}
.nav-course { font-size: .85rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-sub { font-size: .62rem; opacity: .75; margin-top: .1rem; }
.nav-metas { display: flex; gap: 1rem; flex-shrink: 0; }
.nav-meta { font-size: .72rem; opacity: .85; white-space: nowrap; }
.analytics-btn {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
  padding: .35rem .75rem;
  border-radius: var(--r);
  cursor: pointer;
  font-size: .75rem;
  white-space: nowrap;
  font-family: inherit;
}
.analytics-btn:hover { background: rgba(255,255,255,.22); }

/* ── LAYOUT SHELL ── */
.shell { display: flex; margin-top: var(--nav); min-height: calc(100vh - var(--nav)); }

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sb);
  flex-shrink: 0;
  background: var(--surf);
  border-right: 1px solid var(--border);
  position: sticky;
  top: var(--nav);
  height: calc(100vh - var(--nav));
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  transition: transform .25s ease;
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.sb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  top: var(--nav);
  background: rgba(0,0,0,.45);
  z-index: 89;
  cursor: pointer;
}
.sb-overlay.show { display: block; }
.sb-label {
  padding: .85rem 1rem .5rem;
  font-size: .63rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.sb-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .72rem 1rem;
  cursor: pointer;
  color: var(--text);
  font-size: .84rem;
  font-weight: 500;
  border: none;
  border-left: 3px solid transparent;
  border-bottom: 1px solid var(--border);
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: background .12s;
}
.sb-item:hover { background: var(--green-l); color: var(--green); }
.sb-item.on { background: var(--green-l); color: var(--green); border-left-color: var(--green); font-weight: 700; }
.sb-num {
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: var(--border);
  color: var(--muted);
  font-size: .64rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all .12s;
}
.sb-item.on .sb-num { background: var(--green); color: #fff; }
.sb-arr { margin-left: auto; font-size: .7rem; display: inline-block; transition: transform .2s; }
.sb-sub {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .52rem 1rem .52rem 2.1rem;
  cursor: pointer;
  color: var(--muted);
  font-size: .78rem;
  border: none;
  border-left: 3px solid transparent;
  border-bottom: 1px solid var(--border);
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: background .12s;
}
.sb-sub:hover { background: var(--green-l); color: var(--green); }
.sb-sub.on { background: var(--green-l); color: var(--green); border-left-color: var(--green); font-weight: 600; }
.sb-sub-lbl { font-size: .62rem; font-weight: 700; color: var(--green); min-width: 42px; flex-shrink: 0; }

/* ── MAIN CONTENT ── */
.content { flex: 1; min-width: 0; width: 100%; }
.pg { display: none; width: 100%; }
.wrap { width: 100%; padding: 2rem clamp(1rem, 3vw, 2.5rem); }
.sec-tag { font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--green); margin-bottom: .3rem; }
.sec-h { font-size: clamp(1.25rem, 3vw, 1.6rem); font-weight: 800; margin-bottom: .35rem; }
.sec-d { color: var(--muted); font-size: .875rem; margin-bottom: 1.75rem; }
.sec-sub { font-size: 1.1rem; font-weight: 700; margin: 2rem 0 .75rem; padding-bottom: .4rem; border-bottom: 2px solid var(--border); }
.sec-breakdown-desc { color: var(--muted); font-size: .875rem; margin-bottom: 1.25rem; }

/* ── CARDS ── */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px,100%), 1fr)); gap: 1rem; }
.card { background: var(--surf); border: 1px solid var(--border); border-radius: var(--r); padding: 2rem 1.75rem; }
.card-icon { font-size: 2rem; margin-bottom: .75rem; }
.card h2 { font-size: 1.05rem; font-weight: 700; margin-bottom: .4rem; }
.card p { font-size: .88rem; color: var(--muted); line-height: 1.7; }

/* ── TABLES ── */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; width: 100%; border-radius: var(--r); }
.tbl { width: 100%; border-collapse: collapse; font-size: .83rem; min-width: 380px; }
.tbl-narrow { max-width: 420px; }
.tbl th {
  background: var(--green);
  color: #fff;
  padding: .6rem .85rem;
  text-align: left;
  font-weight: 600;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.tbl th:first-child { border-radius: var(--r) 0 0 0; }
.tbl th:last-child  { border-radius: 0 var(--r) 0 0; }
.tbl td { padding: .65rem .85rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:hover td { background: var(--green-l); }
.tbl tr:last-child td { border-bottom: none; }
.tbl-total { background: var(--green-l); }
.wk { font-weight: 700; color: var(--green); }
.bdg { display: inline-block; padding: .1rem .42rem; border-radius: 20px; font-size: .67rem; font-weight: 600; }
.bdg-exam  { background: #fef3c7; color: #7c3d00; }
.bdg-break { background: #f0fdf4; color: #14532d; }

/* ── POLICY CARDS ── */
.policy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px,100%), 1fr)); gap: 1rem; }
.policy-card { background: var(--surf); border: 1px solid var(--border); border-radius: var(--r); padding: 1.25rem; }
.policy-card h3 { font-size: .9rem; font-weight: 700; margin-bottom: .5rem; }
.policy-card p, .policy-card li { font-size: .82rem; color: var(--muted); line-height: 1.7; }
.policy-card ul { padding-left: 1.1rem; }

/* ── INFO BOX ── */
.info-box {
  background: var(--green-l);
  border: 1px solid var(--green-b);
  border-radius: var(--r);
  padding: 1.4rem 1.6rem;
  display: flex;
  gap: 1.1rem;
  flex-wrap: wrap;
}
.info-icon { font-size: 1.75rem; flex-shrink: 0; }
.info-title { font-weight: 700; font-size: .95rem; margin-bottom: .28rem; }
.info-desc { font-size: .84rem; color: var(--muted); line-height: 1.65; margin-bottom: .85rem; }
.info-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--green);
  color: #fff;
  text-decoration: none;
  padding: .42rem .95rem;
  border-radius: var(--r);
  font-size: .82rem;
  font-weight: 600;
}
.info-btn:hover { background: var(--green-d); }

/* ── RESOURCE CARDS ── */
.res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(200px,100%), 1fr)); gap: .9rem; }
.res-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.05rem;
  text-decoration: none;
  color: var(--text);
  display: block;
  transition: all .15s;
}
.res-card:hover { border-color: var(--green); transform: translateY(-2px); box-shadow: 0 4px 14px rgba(24,69,59,.1); }
.rc-i { font-size: 1.25rem; margin-bottom: .55rem; }
.rc-n { font-weight: 600; font-size: .84rem; margin-bottom: .16rem; }
.rc-d { font-size: .75rem; color: var(--muted); line-height: 1.55; }

/* ── ASSIGNMENT CARD ── */
.asgn-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: .95rem 1.25rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .65rem;
  align-items: center;
}
.asgn-card:hover { border-color: var(--green); }
.asgn-num  { font-size: .63rem; font-weight: 700; color: var(--green); text-transform: uppercase; letter-spacing: .07em; margin-bottom: .16rem; }
.asgn-title { font-weight: 600; font-size: .875rem; margin-bottom: .16rem; }
.asgn-desc { font-size: .8rem; color: var(--muted); }
.asgn-meta { text-align: right; flex-shrink: 0; }
.asgn-due  { font-size: .74rem; color: var(--muted); white-space: nowrap; margin-bottom: .25rem; }

/* ── WEEK PAGE ── */
.wk-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5rem 2rem;
  text-align: center;
  color: var(--muted);
}
.wk-empty-icon  { font-size: 3rem; margin-bottom: 1rem; opacity: .25; }
.wk-empty-title { font-size: 1rem; font-weight: 600; margin-bottom: .4rem; }
.wk-empty-sub   { font-size: .85rem; }
.wk-hdr { padding: 1.5rem clamp(1rem, 3vw, 2.5rem); border-bottom: 1px solid var(--border); background: var(--surf); }
.wk-hdr-title { font-size: clamp(1.1rem, 3vw, 1.4rem); font-weight: 800; margin-bottom: .2rem; }
.wk-hdr-sub   { font-size: .82rem; color: var(--muted); }

/* ── WEEK TABS ── */
.wtabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  padding: 0 clamp(1rem, 3vw, 2.5rem);
  background: var(--bg);
  flex-wrap: wrap;
}
.wtab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: .65rem 1.1rem;
  font-size: .875rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: -2px;
  transition: all .15s;
  font-family: inherit;
}
.wtab:hover { color: var(--green); }
.wtab.on { color: var(--green); border-bottom-color: var(--green); font-weight: 700; }
.wtab-body { padding: clamp(1rem, 3vw, 2rem); }

/* ── LECTURE CHANNEL ── */
.ch-wrap { display: grid; grid-template-columns: clamp(200px,30%,300px) 1fr; gap: 1.25rem; align-items: start; }
.ch-list { border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.ch-list-head { padding: .8rem 1rem; background: var(--green); color: #fff; }
.ch-list-head h2 { font-size: .82rem; font-weight: 700; }
.ch-list-head p  { font-size: .67rem; opacity: .85; margin-top: .03rem; }
.lec-card {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  padding: .65rem 1rem;
  cursor: pointer;
  border: none;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: background .12s;
}
.lec-card:last-child { border-bottom: none; }
.lec-card:hover { background: var(--green-l); }
.lec-card.on { background: var(--green-l); border-left-color: var(--green); }
.lec-n {
  width: 22px; height: 22px;
  border-radius: 4px;
  background: var(--surf);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .67rem;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
  margin-top: .1rem;
  transition: all .12s;
}
.lec-card.on .lec-n { background: var(--green); border-color: var(--green); color: #fff; }
.lec-t { font-size: .82rem; font-weight: 600; line-height: 1.35; }
.lec-s { font-size: .69rem; color: var(--muted); margin-top: .03rem; display: block; }
.ch-main { display: flex; flex-direction: column; gap: .9rem; min-width: 0; }
.vid-box { background: #000; border-radius: var(--r); overflow: hidden; aspect-ratio: 16/9; width: 100%; }
.vid-box iframe { width: 100%; height: 100%; border: none; }
.vid-ph {
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  color: #fff;
  text-align: center;
  padding: 2rem;
}
.vph-i { font-size: 2rem; opacity: .3; margin-bottom: .6rem; }
.vph-w { font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; opacity: .5; margin-bottom: .3rem; }
.vph-t { font-size: 1rem; font-weight: 700; margin-bottom: .3rem; }
.vph-n { font-size: .7rem; opacity: .45; }
.vid-info { background: var(--surf); border: 1px solid var(--border); border-radius: var(--r); padding: 1rem; }
.vi-top  { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; flex-wrap: wrap; }
.vi-title { font-size: .9rem; font-weight: 700; flex: 1; min-width: 150px; }
.vi-bdg  { font-size: .66rem; font-weight: 700; background: var(--green-l); color: var(--green); border: 1px solid var(--green-b); padding: .16rem .5rem; border-radius: 20px; white-space: nowrap; flex-shrink: 0; }
.vi-hr   { height: 1px; background: var(--border); margin: .75rem 0; }
.res-lbl { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin-bottom: .5rem; display: block; }
.res-items { display: flex; flex-direction: column; gap: .35rem; }
.res-a {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .45rem .6rem;
  border: 1px solid var(--border);
  border-radius: var(--r);
  text-decoration: none;
  color: var(--text);
  font-size: .8rem;
  transition: all .15s;
}
.res-a:hover { border-color: var(--green); background: var(--green-l); color: var(--green); }
.res-a span  { flex: 1; }
.res-none { font-size: .8rem; color: var(--muted); font-style: italic; }

/* ── ANALYTICS MODAL ── */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.overlay.show { display: flex; }
.modal {
  background: var(--bg);
  border-radius: 12px;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.22);
}
.modal-hdr {
  padding: 1.2rem 1.4rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--bg);
}
.modal-hdr h2 { font-size: 1rem; font-weight: 700; }
.modal-close {
  background: none;
  border: 1px solid var(--border);
  font-size: .9rem;
  cursor: pointer;
  color: var(--muted);
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}
.modal-close:hover { background: var(--surf); }
.modal-body { padding: 1.35rem; display: flex; flex-direction: column; gap: 1.4rem; }
.modal-sec-title { font-size: .84rem; font-weight: 700; margin-bottom: .6rem; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: .85rem; }
.stat-c { background: var(--surf); border: 1px solid var(--border); border-radius: var(--r); padding: .95rem; text-align: center; }
.stat-v { font-size: 1.75rem; font-weight: 800; color: var(--green); line-height: 1; }
.stat-l { font-size: .68rem; color: var(--muted); margin-top: .22rem; }
.a-tbl { width: 100%; border-collapse: collapse; font-size: .79rem; }
.a-tbl th { background: var(--surf); padding: .48rem .65rem; text-align: left; font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.a-tbl td { padding: .48rem .65rem; border-bottom: 1px solid var(--border); }
.a-tbl tr:last-child td { border-bottom: none; }
.bar   { height: 5px; background: var(--green-l); border-radius: 3px; margin-top: .22rem; }
.bar-f { height: 100%; background: var(--green); border-radius: 3px; }
.reset-btn {
  background: none;
  border: 1px solid #dc2626;
  color: #b91c1c;
  padding: .38rem .9rem;
  border-radius: var(--r);
  cursor: pointer;
  font-size: .78rem;
  font-family: inherit;
}
.reset-btn:hover { background: #fef2f2; }

/* ── RESPONSIVE BREAKPOINTS ── */
@media (max-width: 900px) {
  .ch-wrap { grid-template-columns: 220px 1fr; }
}

@media (max-width: 768px) {
  .hamburger { display: flex; }
  .nav-metas { display: none; }
  .nav-course { max-width: 180px; }
  .sidebar {
    position: fixed;
    top: var(--nav); left: 0; bottom: 0;
    z-index: 90;
    transform: translateX(-100%);
  }
  .sidebar.mobile-open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,.18); }
  .content { width: 100%; }
  .ch-wrap { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .asgn-card { grid-template-columns: 1fr; }
  .asgn-meta { text-align: left; }
}

@media (max-width: 480px) {
  :root { --nav: 60px; }
  .nav-chip { display: none; }
  .stat-row { grid-template-columns: 1fr; }
  .wrap { padding: 1.25rem 1rem; }
  .wtab-body { padding: 1rem; }
  .wk-hdr { padding: 1rem; }
}
