/* ============================================================
   GradeMaster – Stylesheet
   Dark Theme: matches the original React / Tailwind design
   ============================================================ */

:root {
  --bg:           #0f1115;
  --sidebar:      #1a1d23;
  --card:         #252a33;
  --accent:       #3b82f6;
  --accent-10:    rgba(59,130,246,.10);
  --accent-20:    rgba(59,130,246,.20);
  --text-primary: #f1f5f9;
  --text-sec:     #94a3b8;
  --border:       #334155;
  --success:      #22c55e;
  --error:        #ef4444;
  --purple:       #a78bfa;
  --purple-10:    rgba(167,139,250,.10);
  --purple-20:    rgba(167,139,250,.20);
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-sec); }

/* ── Layout ─────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: 220px;
  height: 100%;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  z-index: 100;
}
.main-content {
  margin-left: 220px;
  padding: 24px;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Sidebar internals ──────────────────────────────────────── */
.sidebar-logo {
  padding: 0 20px 28px;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.logo-text    { font-size: 1.2rem; font-weight: 700; color: var(--accent); }
.logo-version { font-size: .6rem; opacity: .55; }

.sidebar-nav { display: flex; flex-direction: column; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  font-size: .9rem;
  color: var(--text-sec);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.nav-item:hover,
.nav-item.active {
  background: #2d333d;
  color: var(--text-primary);
}
.nav-item.active { border-left-color: var(--accent); }
.nav-item svg    { flex-shrink: 0; }

.sidebar-footer {
  margin-top: auto;
  margin: auto 16px 0;
  padding: 12px;
  background: #12141a;
  border-radius: 8px;
  font-size: .65rem;
  color: var(--text-sec);
  line-height: 1.8;
}
.sidebar-footer strong { color: var(--text-primary); display: block; margin-bottom: 2px; }
.sidebar-footer code   { color: var(--accent); font-size: .6rem; display: block; }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}
.card-sm { border-radius: 8px; padding: 16px; }

/* ── Page header ────────────────────────────────────────────── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  margin-bottom: 24px;
}
.page-header h1 {
  font-size: 1.4rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  font-style: italic;
}
.page-header p { font-size: .85rem; color: var(--text-sec); margin-top: 2px; }

/* ── Typography helpers ─────────────────────────────────────── */
.label {
  display: block;
  font-size: .7rem;
  font-weight: 700;
  color: var(--text-sec);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 6px;
}
.label-accent { color: var(--accent); }

/* ── Form elements ──────────────────────────────────────────── */
input, select, textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: .95rem;
  color: var(--text-primary);
  font-family: inherit;
  width: 100%;
  outline: none;
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 80px; }
input[type="checkbox"] {
  width: 16px; height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
  flex-shrink: 0;
}
input::placeholder, textarea::placeholder { color: var(--text-sec); opacity: .6; }

.form-group { display: flex; flex-direction: column; gap: 6px; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 600;
  font-family: inherit;
  transition: opacity .15s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .3; cursor: not-allowed; transform: none; }

.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:hover  { opacity: .88; }
.btn-ghost    { background: transparent; color: var(--text-sec); border: 1px solid var(--border); }
.btn-ghost:hover    { background: #2d333d; color: var(--text-primary); }
.btn-danger   { background: var(--error); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: .8rem; }
.btn-icon { padding: 8px; border-radius: 6px; }

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
thead tr {
  background: var(--bg);
  color: var(--text-sec);
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 1px solid var(--border);
}
thead th { padding: 14px 16px; white-space: nowrap; }
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--accent-10); }
tbody td { padding: 12px 16px; font-size: .88rem; vertical-align: middle; }
tfoot tr { background: var(--bg); border-top: 2px solid rgba(59,130,246,.3); }
tfoot td { padding: 14px 16px; font-weight: 700; }

.sort-btn {
  background: none; border: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  color: inherit; font: inherit; font-weight: 700;
  text-transform: uppercase; font-size: .7rem; letter-spacing: .06em;
  padding: 0; white-space: nowrap;
  transition: color .12s;
}
.sort-btn:hover { color: var(--accent); }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: .65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  line-height: 1.6;
}
.badge-voe    { background: var(--accent-10);  color: var(--accent);  border: 1px solid var(--accent-20); }
.badge-mau    { background: var(--purple-10);  color: var(--purple);  border: 1px solid var(--purple-20); }
.badge-success { background: rgba(34,197,94,.15); color: var(--success); border: 1px solid rgba(34,197,94,.3); }

/* ── Student chip / tag ─────────────────────────────────────── */
.student-chip {
  display: inline-block;
  background: rgba(51,65,85,.5);
  border: 1px solid var(--border);
  color: var(--text-sec);
  font-size: .73rem;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  transition: background .12s, color .12s;
  white-space: nowrap;
}
.student-chip:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Grid helpers ───────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── Project entry specific ─────────────────────────────────── */
.projekt-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
}
.student-select-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  height: 420px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.student-search {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
}
.student-search input { border: none; background: transparent; padding: 4px 6px; font-size: .9rem; }
.student-list { overflow-y: auto; flex: 1; }
.student-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  font-size: .85rem;
  cursor: pointer;
  transition: background .1s;
}
.student-list-item:last-child { border-bottom: none; }
.student-list-item:hover { background: var(--accent-10); }
.student-list-item input[type="checkbox"] { pointer-events: none; }

/* ── Filter bar ─────────────────────────────────────────────── */
.filter-bar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.filter-bar select,
.filter-bar input { width: auto; min-width: 140px; font-size: .82rem; padding: 6px 10px; }
.filter-label {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-sec);
}

/* ── Stat cards ─────────────────────────────────────────────── */
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  transition: transform .15s;
}
.stat-card:hover { transform: scale(1.02); }
.stat-card .stat-label { font-size: .6rem; font-weight: 700; color: var(--text-sec); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; }
.stat-card .stat-value { font-size: 1.8rem; font-weight: 700; font-family: monospace; color: var(--accent); }

/* ── Toast ──────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 32px;
  right: 32px;
  background: #059669;
  color: #fff;
  padding: 14px 22px;
  border-radius: 10px;
  font-weight: 500;
  font-size: .9rem;
  box-shadow: 0 8px 30px rgba(0,0,0,.5);
  border: 1px solid #10b981;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 9999;
  transform: translateY(120%);
  transition: transform .3s cubic-bezier(.175,.885,.32,1.275);
  pointer-events: none;
}
.toast.show  { transform: translateY(0); }
.toast.error { background: var(--error); border-color: #f87171; }

/* ── CSV import ─────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 60px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  position: relative;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-10);
}
.drop-zone input[type="file"] {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer; width: 100%; height: 100%;
  background: transparent; border: none; padding: 0;
}
.drop-zone-icon { font-size: 3rem; margin-bottom: 12px; }
.drop-zone h3   { font-size: 1.1rem; font-weight: 700; text-transform: uppercase; font-style: italic; }
.drop-zone p    { font-size: .85rem; color: var(--text-sec); margin-top: 4px; }

/* ── Schülermaske navigation ─────────────────────────────────── */
.student-nav-btns { display: flex; align-items: center; gap: 8px; }
.student-nav-btns button {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  color: var(--text-sec);
  cursor: pointer;
  transition: background .12s, color .12s;
}
.student-nav-btns button:hover:not(:disabled) { background: var(--accent-10); color: var(--text-primary); }
.student-nav-btns button:disabled { opacity: .25; cursor: not-allowed; }

/* ── Highlight zone (calculation area) ─────────────────────── */
.calc-zone {
  background: rgba(59,130,246,.05);
  border: 1px solid rgba(59,130,246,.1);
  border-radius: 12px;
  padding: 24px;
}

/* ── Universal table inputs ─────────────────────────────────── */
.uni-table input {
  font-size: .8rem;
  padding: 6px 8px;
  border-radius: 4px;
  width: 100%;
}
.uni-table input.narrow { width: 68px; }

/* ── Status area for CSV import ─────────────────────────────── */
.import-result { margin-top: 16px; }
.import-stat {
  padding: 20px;
  border-radius: 12px;
  font-weight: 700;
}
.import-stat-ok    { background: rgba(34,197,94,.15); border: 1px solid rgba(34,197,94,.3); color: var(--success); }
.import-stat-err   { background: rgba(239,68,68,.12);  border: 1px solid rgba(239,68,68,.25); color: var(--error); }
.import-stat .big  { font-size: 2.2rem; display: block; margin-top: 4px; }

/* ── Mono values ────────────────────────────────────────────── */
.mono { font-family: monospace; font-weight: 700; }
.accent { color: var(--accent); }

/* ── Misc utilities ─────────────────────────────────────────── */
.hidden    { display: none !important; }
.flex      { display: flex; }
.flex-col  { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2     { gap: 8px; }
.gap-3     { gap: 12px; }
.gap-4     { gap: 16px; }
.mt-2      { margin-top: 8px; }
.mt-4      { margin-top: 16px; }
.mb-2      { margin-bottom: 8px; }
.text-sm   { font-size: .85rem; }
.text-xs   { font-size: .75rem; }
.text-right { text-align: right; }
.truncate  { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.overflow-x-auto { overflow-x: auto; }
.w-full    { width: 100%; }
.link-accent { color: var(--accent); font-weight: 600; text-decoration: none; cursor: pointer; background: none; border: none; font: inherit; }
.link-accent:hover { text-decoration: underline; }
.space-y > * + * { margin-top: 16px; }
.space-y-sm > * + * { margin-top: 10px; }

/* ── Responsive fixes ───────────────────────────────────────── */
@media (max-width: 960px) {
  .projekt-layout { grid-template-columns: 1fr; }
  .student-select-box { height: 260px; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
