/* ============================================================
   FernUni Jura — 2026 Design System
   Clean, functional, modern academic tool
   ============================================================ */

:root {
  --p: #0f172a;       /* slate-900 */
  --pl: #1e293b;      /* slate-800 */
  --a: #f59e0b;       /* amber-500 */
  --al: #fef3c7;      /* amber-100 */
  --bg: #f8fafc;      /* slate-50 */
  --w: #ffffff;
  --t: #0f172a;
  --tl: #64748b;      /* slate-500 */
  --tm: #475569;      /* slate-600 */
  --b: #e2e8f0;       /* slate-200 */
  --bl: #f1f5f9;      /* slate-100 */
  --g: #10b981;       /* emerald-500 */
  --gl: #d1fae5;      /* emerald-100 */
  --r: #ef4444;
  --rl: #fee2e2;
  --sbw: 200px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--t);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--p); text-decoration: none; }
a:hover { color: var(--a); }

/* ═══════════════════════════════════════════
   SIDEBAR — slim, elegant
   ═══════════════════════════════════════════ */
#sidebar {
  width: var(--sbw);
  background: var(--p);
  color: #fff;
  position: fixed;
  inset: 0 auto 0 0;
  overflow-y: auto;
  z-index: 200;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,.05);
}
.sb-brand {
  padding: 1.4rem 1.2rem 1.6rem;
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: -.01em;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.sb-brand span {
  display: block;
  font-size: .58rem;
  color: var(--a);
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: .1rem;
  font-weight: 500;
}
.sb-link {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .48rem 1.2rem;
  color: rgba(255,255,255,.65);
  font-size: .78rem;
  cursor: pointer;
  transition: all .15s;
  border-left: 3px solid transparent;
  text-decoration: none;
}
.sb-link:hover { color: #fff; background: rgba(255,255,255,.04); text-decoration: none; }
.sb-link.active { color: #fff; background: rgba(255,255,255,.06); border-left-color: var(--a); font-weight: 600; }

.sb-folder .sb-toggle { position: relative; }
.sb-folder .sb-toggle::after {
  content: '▸';
  position: absolute;
  right: 1rem;
  font-size: .6rem;
  transition: transform .2s;
  opacity: .35;
}
.sb-folder.open .sb-toggle::after { transform: rotate(90deg); opacity: .7; }
.sb-folder .sb-sub {
  display: none;
  padding: .1rem 0 .3rem;
  background: rgba(0,0,0,.2);
  border-left: 2px solid rgba(255,255,255,.04);
  margin-left: 1rem;
  border-radius: 0 8px 8px 0;
}
.sb-folder.open .sb-sub { display: block; }
.sb-folder.open .sb-toggle { color: #fff; font-weight: 600; background: rgba(255,255,255,.03); }
.sb-sublink {
  display: block;
  padding: .28rem 1.2rem .28rem 1.4rem;
  color: rgba(255,255,255,.55);
  font-size: .72rem;
  text-decoration: none;
  transition: all .12s;
  border-left: 2px solid transparent;
}
.sb-sublink:hover { color: #fff; background: rgba(255,255,255,.04); border-left-color: var(--a); text-decoration: none; }
.sb-footer {
  margin-top: auto;
  padding: 1rem 1.2rem;
  border-top: 1px solid rgba(255,255,255,.06);
}
.sb-footer a { display: block; color: rgba(255,255,255,.35); font-size: .66rem; padding: .12rem 0; }
.sb-footer a:hover { color: var(--a); }

/* ═══════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════ */
#main {
  margin-left: var(--sbw);
  min-width: 0;
  padding: 2rem 2rem 4rem;
  max-width: 1100px;
}

/* ═══════════════════════════════════════════
   HAMBURGER
   ═══════════════════════════════════════════ */
.hb {
  display: none;
  position: fixed;
  top: .7rem; right: .8rem;
  z-index: 300;
  background: var(--p);
  color: #fff;
  border: none;
  font-size: 1.2rem;
  padding: .3rem .55rem;
  border-radius: 8px;
  cursor: pointer;
}

/* ═══════════════════════════════════════════
   HEADINGS
   ═══════════════════════════════════════════ */
h2 {
  color: var(--p);
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: .6rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--a);
}
h3 { color: var(--pl); font-size: 1rem; font-weight: 600; margin: 1rem 0 .5rem; }
h4 { font-size: .85rem; font-weight: 600; margin: .6rem 0 .3rem; }

/* ═══════════════════════════════════════════
   LANDING — dashboard cards
   ═══════════════════════════════════════════ */
.landing h2 {
  font-size: 1.5rem;
  border-bottom: none;
  margin-bottom: .2rem;
}

/* Tool cards */
.lcards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .7rem;
  margin: 1rem 0;
}
.lcard {
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  background: var(--w);
  border: 1px solid var(--b);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  transition: box-shadow .15s, transform .1s, border-color .15s;
  text-decoration: none;
  color: inherit;
}
.lcard:hover {
  box-shadow: 0 2px 16px rgba(0,0,0,.06);
  transform: translateY(-1px);
  border-color: var(--a);
  text-decoration: none;
  color: inherit;
}
.lcard .lc-icon { font-size: 1.4rem; flex-shrink: 0; width: 32px; text-align: center; }
.lcard h4 { font-size: .82rem; color: var(--p); margin: 0 0 .15rem; }
.lcard p { font-size: .7rem; color: var(--tl); line-height: 1.4; margin: 0; }

/* ═══════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════ */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: .7rem;
  margin: 1rem 0;
}
.card {
  background: var(--w);
  border: 1px solid var(--b);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  transition: box-shadow .15s;
}
.card:hover {
  box-shadow: 0 2px 16px rgba(0,0,0,.06);
}
.card h3 { margin-top: 0; }

/* ═══════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════ */
.tbl-wrap {
  overflow-x: auto;
  margin: .8rem 0;
  border-radius: 10px;
  border: 1px solid var(--b);
}
.tbl {
  width: 100%;
  border-collapse: collapse;
  background: var(--w);
  min-width: 800px;
  font-size: .77rem;
}
.tbl th {
  background: var(--bl);
  color: var(--tm);
  padding: .5rem .7rem;
  text-align: left;
  font-weight: 600;
  font-size: .66rem;
  white-space: nowrap;
  position: sticky;
  top: 0;
  cursor: pointer;
  user-select: none;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 2px solid var(--b);
}
.tbl th:hover { background: var(--b); }
.tbl th .srt { font-size: .5rem; margin-left: 2px; opacity: .4; }
.tbl th.srt-asc .srt, .tbl th.srt-desc .srt { opacity: 1; }
.tbl td {
  padding: .45rem .65rem;
  border-bottom: 1px solid var(--bl);
  vertical-align: top;
}
.tbl tbody tr { cursor: pointer; transition: background .08s; }
.tbl tbody tr:nth-child(even) { background: var(--bg); }
.tbl tbody tr:hover { background: #e8f0fe; }
.tbl .nr {
  font-family: 'SF Mono', 'Cascadia Code', Consolas, monospace;
  color: var(--pl);
  font-weight: 700;
  white-space: nowrap;
  font-size: .74rem;
}
.tbl .prof { font-size: .72rem; color: var(--tl); }

/* ═══════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════ */
.b {
  display: inline-block;
  padding: .06rem .35rem;
  border-radius: 4px;
  font-size: .6rem;
  font-weight: 600;
  margin-right: .1rem;
  white-space: nowrap;
}
.b-zivil { background: #dbeafe; color: #1d4ed8; }
.b-oeff  { background: #ffedd5; color: #c2410c; }
.b-straf { background: #fce7f3; color: #be185d; }
.b-wiwi  { background: #d1fae5; color: #047857; }
.b-ueber { background: #ede9fe; color: #6d28d9; }
.b-stats { background: #e0e7ff; color: #3730a3; }
.b-out   { background: #fee2e2; color: #b91c1c; }
.b-exam  { background: #e8eaf6; color: #4527a0; font-size: .66rem; padding: .08rem .4rem; }
.b-spb   { background: #e0e7ff; color: #1e3a5f; font-size: .66rem; padding: .1rem .4rem; border-radius: 10px; }

/* ═══════════════════════════════════════════
   FILTERS
   ═══════════════════════════════════════════ */
.fb { display: flex; gap: .25rem; margin: .6rem 0; flex-wrap: wrap; align-items: center; }
.fbtn {
  padding: .25rem .65rem;
  border: 1.5px solid var(--b);
  border-radius: 20px;
  background: var(--w);
  cursor: pointer;
  font-size: .72rem;
  font-weight: 500;
  transition: all .12s;
  color: var(--tm);
}
.fbtn:hover { border-color: var(--p); color: var(--p); }
.fbtn.on { background: var(--p); color: #fff; border-color: var(--p); }
.sbx {
  flex: 1;
  min-width: 160px;
  padding: .35rem .7rem;
  font-size: .8rem;
  border: 1.5px solid var(--b);
  border-radius: 20px;
  outline: none;
  background: var(--w);
}
.sbx:focus { border-color: var(--p); }
.rc { font-size: .7rem; color: var(--tl); margin-left: .4rem; white-space: nowrap; }

/* ═══════════════════════════════════════════
   STATS + PROF CARDS
   ═══════════════════════════════════════════ */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .5rem; margin: .8rem 0; }
.st { text-align: center; padding: .7rem; background: var(--w); border-radius: 10px; border: 1px solid var(--b); }
.st .n { font-size: 1.5rem; font-weight: 700; color: var(--p); display: block; }
.st .l { font-size: .66rem; color: var(--tl); margin-top: .1rem; }

.pc {
  background: var(--w);
  border: 1px solid var(--b);
  border-radius: 10px;
  padding: .8rem 1rem;
  margin-bottom: .5rem;
  transition: box-shadow .15s;
}
.pc:hover { box-shadow: 0 2px 12px rgba(0,0,0,.06); }
.pc h4 { color: var(--p); margin: 0 0 .2rem; }
.pc .mods { font-size: .72rem; color: var(--tl); margin-top: .3rem; }
.pt { display: inline-block; background: var(--bl); color: var(--tm); padding: .04rem .35rem; border-radius: 8px; font-size: .64rem; margin: .1rem; }

/* ═══════════════════════════════════════════
   META GRID + SECTION BADGES
   ═══════════════════════════════════════════ */
.mg { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .5rem; margin: 1rem 0; }
.mi { background: var(--w); border: 1px solid var(--b); border-radius: 10px; padding: .6rem .8rem; }
.mi .ml { font-size: .64rem; text-transform: uppercase; color: var(--tl); letter-spacing: .05em; font-weight: 600; }
.mi .mv { font-size: .85rem; font-weight: 600; color: var(--p); margin-top: .1rem; }

.sec-badge {
  display: inline-block;
  padding: .06rem .4rem;
  border-radius: 4px;
  font-size: .6rem;
  font-weight: 700;
  margin-right: .3rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.sec-pflicht { background: var(--p); color: #fff; }
.sec-wahl { background: var(--bl); color: var(--tm); }

/* ═══════════════════════════════════════════
   DROPDOWNS
   ═══════════════════════════════════════════ */
.exam-dd {
  position: absolute;
  z-index: 100;
  background: var(--w);
  border: 1px solid var(--b);
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,.1);
  min-width: 150px;
  padding: .25rem 0;
}
.exam-dd-item { padding: .35rem .9rem; font-size: .74rem; cursor: pointer; transition: background .08s; }
.exam-dd-item:hover { background: var(--bl); }
.exam-dd-item.sel { font-weight: 600; color: var(--p); }

/* ═══════════════════════════════════════════
   STATISTICS PAGE
   ═══════════════════════════════════════════ */
.sg { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .5rem; }
.sc2 {
  background: var(--w);
  border: 1px solid var(--b);
  border-radius: 10px;
  padding: .7rem .9rem;
  cursor: pointer;
  transition: box-shadow .15s;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto auto;
  gap: .1rem .5rem;
  align-items: center;
}
.sc2:hover { box-shadow: 0 2px 12px rgba(0,0,0,.06); }
.sc2-nr { font-family: 'SF Mono', Consolas, monospace; font-size: .66rem; color: var(--pl); font-weight: 700; grid-column: 1; }
.sc2-name { font-size: .78rem; font-weight: 500; grid-column: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc2-pct { font-size: 1.7rem; font-weight: 800; color: var(--g); grid-column: 2; grid-row: 1/4; text-align: right; line-height: 1; }
.sc2-pct small { font-size: .75rem; font-weight: 500; color: var(--tl); }
.sc2-sub { font-size: .64rem; color: var(--tl); grid-column: 1; }
.sc2-avg { font-size: .68rem; color: var(--pl); font-weight: 600; }
.sc2-n { font-size: .64rem; color: var(--tl); }

/* ═══════════════════════════════════════════
   RECHNER
   ═══════════════════════════════════════════ */
.rc-mcols { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.rc-col { background: var(--w); border: 1px solid var(--b); border-radius: 10px; padding: .9rem; }
.rc-col h4 { color: var(--p); margin: 0 0 .4rem; font-size: .8rem; border-bottom: 2px solid var(--a); padding-bottom: .3rem; }
.rc-row { display: flex; align-items: center; gap: .4rem; padding: .3rem .5rem; background: var(--bg); border: 1px solid var(--b); border-radius: 6px; margin-bottom: .2rem; }
.rc-row .rc-nr { font-family: 'SF Mono', Consolas, monospace; font-size: .7rem; color: var(--pl); font-weight: 700; width: 42px; flex-shrink: 0; }
.rc-row .rc-name { flex: 1; font-size: .74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-row .rc-ects { font-size: .66rem; color: var(--tl); width: 40px; text-align: center; flex-shrink: 0; }
.rc-row input { width: 55px; padding: .2rem .25rem; border: 1.5px solid var(--b); border-radius: 6px; text-align: center; font-size: .8rem; font-weight: 600; color: var(--p); flex-shrink: 0; background: var(--w); }
.rc-row input:focus { outline: none; border-color: var(--p); }
.rc-calc { padding: .45rem 1.3rem; background: var(--p); color: #fff; border: none; border-radius: 8px; cursor: pointer; font-size: .78rem; font-weight: 600; transition: background .15s; }
.rc-calc:hover { background: var(--pl); }
.rc-ejp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.rc-ejp-box { background: var(--w); border: 1px solid var(--b); border-radius: 10px; padding: .9rem; }
.rc-ejp-box h4 { color: var(--p); margin-top: 0; }
.rc-wg { border-top: 1px solid var(--b); padding-top: .35rem; margin-top: .35rem; }
.rc-wg strong { font-size: .7rem; color: var(--tm); }
.rc-sel { width: 100%; padding: .25rem .35rem; border: 1.5px solid var(--b); border-radius: 6px; font-size: .74rem; background: var(--w); margin-bottom: .25rem; }
.rc-sel:focus { outline: none; border-color: var(--p); }

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {
  .hb { display: block; }
  #app { flex-direction: column; }
  #sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    z-index: 250;
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  #sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.3); }
  #main { margin-left: 0; padding: 1rem; }
  .cards, .lcards { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .sg { grid-template-columns: 1fr; }
  .rc-ejp-grid { grid-template-columns: 1fr; }
  .rc-mcols { grid-template-columns: 1fr !important; }
}
