/* app.css – Qcollect · Chalk & Sunlight */
:root {
  --header-bg:   #1a1a1a;
  --accent:      #f59e0b;
  --accent-dark: #d97706;
  --bg:          #faf7f0;
  --surface:     #ffffff;
  --surface-warm:#fdf8ef;
  --border:      #e8e0d0;
  --border-dark: #d4c9b4;
  --text:        #1a1a1a;
  --text-muted:  #8a7f6a;
  --text-light:  #b8a98a;
  --success:     #2d7a4f;
  --success-bg:  #edf7f2;
  --danger:      #b83232;
  --danger-bg:   #fdf2f2;
  --warning:     #f59e0b;
  --info:        #2563a8;
  --info-bg:     #eff5ff;
  --radius:      12px;
  --radius-sm:   8px;
  --radius-lg:   16px;
  --shadow:      0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
  --shadow-md:   0 4px 16px rgba(0,0,0,.1);
  --font-main:   'Nunito', sans-serif;
  --font-display:'Syne', sans-serif;
  --font-mono:   'JetBrains Mono', monospace;
  --transition:  0.18s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── NAVBAR ───────────────────────────────────── */
.navbar {
  background: var(--header-bg);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  height: 58px;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 2px solid var(--accent);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none;
  flex-shrink: 0;
}
.nav-logo { height: 30px; border-radius: 4px; }
.nav-icon { font-size: 1.3rem; }
.nav-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  letter-spacing: -.01em;
}
.nav-title span { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: .15rem;
  flex: 1;
  padding-left: 1rem;
}
.nav-link {
  color: rgba(255,255,255,.65);
  text-decoration: none;
  padding: .3rem .7rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
  transition: var(--transition);
}
.nav-link:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-link.active { background: rgba(245,158,11,.18); color: var(--accent); }

.nav-user {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-shrink: 0;
}
.nav-username { font-size: .8rem; color: rgba(255,255,255,.6); }

.nav-badge {
  font-size: .68rem;
  font-weight: 700;
  padding: .15rem .45rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.role-admin     { background: #dc2626; color: #fff; }
.role-schuladmin{ background: #7c3aed; color: #fff; }
.role-lehrer    { background: #059669; color: #fff; }

/* ── LAYOUT ───────────────────────────────────── */
.main-content {
  flex: 1;
  padding: 1.75rem 1.5rem;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}

.app-footer {
  text-align: center;
  padding: 1rem;
  color: var(--text-muted);
  font-size: .78rem;
  border-top: 1.5px solid var(--border);
  margin-top: auto;
  background: var(--surface-warm);
}

/* ── PAGE HEADER ──────────────────────────────── */
.page-header {
  margin-bottom: 1.75rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-header h1 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}
.page-header p { color: var(--text-muted); font-size: .875rem; margin-top: .25rem; }

/* ── CARDS ────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: .9rem 1.25rem;
  border-bottom: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  background: var(--surface-warm);
}
.card-header h2 {
  font-family: var(--font-display);
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
}
.card-body { padding: 1.25rem; }

/* ── GRID ─────────────────────────────────────── */
.grid   { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

/* ── STAT CARDS ───────────────────────────────── */
.stat-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent);
  border-radius: var(--radius) var(--radius) 0 0;
}
.stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  margin: .5rem 0 .25rem;
  color: var(--text);
}
.stat-label { color: var(--text-muted); font-size: .85rem; }
.stat-icon  { font-size: 1.4rem; margin-bottom: .25rem; }

/* ── BUTTONS ──────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
  font-family: var(--font-main);
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
  line-height: 1.4;
}
.btn:hover   { filter: brightness(1.06); transform: translateY(-1px); }
.btn:active  { transform: translateY(0); }

.btn-primary  { background: var(--header-bg); color: #fff; border-color: var(--header-bg); }
.btn-success  { background: var(--success);   color: #fff; border-color: var(--success); }
.btn-danger   { background: var(--danger);    color: #fff; border-color: var(--danger); }
.btn-warning  { background: var(--accent);    color: var(--header-bg); border-color: var(--accent); font-weight: 700; }
.btn-secondary{ background: #6b6353; color: #fff; border-color: #6b6353; }
.btn-ghost    { background: transparent; color: #fff; border-color: rgba(255,255,255,.4); }
.btn-outline  { background: transparent; color: var(--header-bg); border-color: var(--border-dark); }
.btn-outline:hover { background: var(--surface-warm); }
.btn-sm  { padding: .28rem .6rem; font-size: .78rem; }
.btn-lg  { padding: .7rem 1.5rem; font-size: 1rem; }

/* ── FORMS ────────────────────────────────────── */
.form-group  { margin-bottom: 1rem; }
.form-label  {
  display: block;
  font-size: .82rem;
  font-weight: 700;
  margin-bottom: .3rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.form-label .required { color: var(--danger); margin-left: .2rem; }

.form-control {
  width: 100%;
  padding: .55rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-family: var(--font-main);
  background: var(--surface);
  color: var(--text);
  transition: var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245,158,11,.15);
  background: #fffdf7;
}
.form-control::placeholder { color: var(--text-light); }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: .78rem; color: var(--text-light); margin-top: .25rem; }
.form-row  { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* Checkboxes */
.check-group {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.check-group:hover { background: var(--surface-warm); }
.check-group input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }
.check-group label { cursor: pointer; font-size: .9rem; }

/* ── TABLES ───────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th {
  background: var(--surface-warm);
  padding: .6rem 1rem;
  text-align: left;
  font-weight: 700;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  border-bottom: 1.5px solid var(--border);
}
td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-warm); }

/* ── BADGES ───────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .18rem .55rem;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
}
.badge-green  { background: #dcf5e8; color: #1a5c35; }
.badge-red    { background: #fde8e8; color: #7f1d1d; }
.badge-blue   { background: #dbeafe; color: #1e3a8a; }
.badge-yellow { background: #fef3c7; color: #78350f; }
.badge-gray   { background: #f0ede6; color: #4a4438; }
.badge-purple { background: #ede9fe; color: #4c1d95; }

/* ── ALERTS ───────────────────────────────────── */
.alert {
  padding: .8rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  border-left: 3px solid;
  font-size: .875rem;
  font-weight: 500;
}
.alert-success { background: var(--success-bg); border-color: var(--success); color: #1a4d32; }
.alert-error   { background: var(--danger-bg);  border-color: var(--danger);  color: #7f1d1d; }
.alert-info    { background: var(--info-bg);    border-color: var(--info);    color: #1e3a8a; }
.alert-warning { background: #fffbeb;           border-color: var(--accent);  color: #78350f; }

/* ── QUESTION CARD (Student) ──────────────────── */
.question-entry {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  position: relative;
  transition: var(--transition);
}
.question-entry:hover { border-color: var(--accent); box-shadow: var(--shadow-md); }
.question-entry .qe-number {
  position: absolute;
  top: -11px; left: 14px;
  background: var(--header-bg);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  padding: .1rem .5rem;
  border-radius: 20px;
}

.answers-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: .75rem; }
.answer-option {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  padding: .6rem .75rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
  background: var(--surface);
}
.answer-option:hover   { border-color: var(--accent); background: #fffdf7; }
.answer-option.correct { border-color: var(--accent); background: #fdf3dc; }
.answer-option input[type="checkbox"] { margin-top: .15rem; flex-shrink: 0; accent-color: var(--accent); }
.answer-option textarea {
  flex: 1; border: none; background: transparent;
  resize: none; outline: none;
  font-family: var(--font-main); font-size: .875rem; min-height: 40px;
  color: var(--text);
}

.answer-label {
  width: 24px; height: 24px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 700;
  flex-shrink: 0;
  margin-top: .1rem;
}
.answer-a { background: #fde8d8; color: #7c3208; }
.answer-b { background: #fdf3dc; color: #78350f; }
.answer-c { background: #dcf5e8; color: #1a5c35; }
.answer-d { background: #dbeafe; color: #1e3a8a; }

/* ── SESSION CODE DISPLAY ─────────────────────── */
.session-code-display {
  font-family: var(--font-mono);
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: .3em;
  color: var(--header-bg);
  background: var(--surface-warm);
  padding: 1rem 2rem;
  border-radius: var(--radius);
  border: 2px dashed var(--border-dark);
  text-align: center;
  margin: 1rem 0;
}

/* ── QUESTION REVIEW (Lehrer) ─────────────────── */
.q-review-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1rem;
  background: var(--surface);
}
.q-review-header {
  padding: .7rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  background: var(--surface-warm);
  border-bottom: 1.5px solid var(--border);
}
.q-review-body { padding: 1rem; }
.q-review-answers { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: .75rem; }
.q-answer-pill {
  padding: .4rem .75rem;
  border-radius: var(--radius-sm);
  font-size: .83rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.q-answer-pill.correct { background: #fdf3dc; border: 1.5px solid #f5d98a; color: #78350f; }
.q-answer-pill.wrong   { background: var(--surface-warm); border: 1.5px solid var(--border); color: var(--text-muted); }

/* ── LOGIN PAGE ───────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 1.5rem;
}
.login-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-md);
}
.login-logo { text-align: center; margin-bottom: 1.5rem; }
.login-logo .logo-icon { font-size: 2.5rem; display: block; margin-bottom: .5rem; }
.login-logo h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--header-bg);
}
.login-logo p { color: var(--text-muted); font-size: .875rem; margin-top: .25rem; }

/* ── STUDENT ENTRY PAGE ───────────────────────── */
.student-page { background: var(--bg); min-height: 100vh; }
.student-page .main-content { padding: 1rem; }
.student-header {
  text-align: center;
  color: var(--text);
  padding: 1.5rem 0 1rem;
}
.student-header h1 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
}
.student-header .session-info {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: var(--surface-warm);
  border: 1.5px solid var(--border);
  padding: .3rem .85rem;
  border-radius: 20px;
  margin-top: .5rem;
  font-size: .83rem;
  color: var(--text-muted);
}

/* ── MODALS ───────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26,26,26,.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  border: 1.5px solid var(--border);
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
  animation: slideUp .22s ease;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.modal-header h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
}
.modal-close {
  background: none; border: none; font-size: 1.2rem;
  cursor: pointer; padding: .25rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}
.modal-close:hover { background: var(--surface-warm); }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── EMPTY STATE ──────────────────────────────── */
.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 2.75rem; margin-bottom: 1rem; }
.empty-state h3 { font-size: 1.05rem; margin-bottom: .5rem; color: var(--text); font-family: var(--font-display); }

/* ── TABS ─────────────────────────────────────── */
.tabs { display: flex; border-bottom: 1.5px solid var(--border); margin-bottom: 1.5rem; }
.tab {
  padding: .6rem 1.2rem;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1.5px;
  text-decoration: none;
  color: var(--text-muted);
  transition: var(--transition);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--header-bg); border-bottom-color: var(--accent); }

/* ── UTILITIES ────────────────────────────────── */
.flex   { display: flex; }
.flex-col { flex-direction: column; }
.items-center   { align-items: center; }
.justify-between{ justify-content: space-between; }
.gap-1  { gap: .5rem; }
.gap-2  { gap: 1rem; }
.mt-1   { margin-top: .5rem; }
.mt-2   { margin-top: 1rem; }
.mt-3   { margin-top: 1.5rem; }
.mb-1   { margin-bottom: .5rem; }
.mb-2   { margin-bottom: 1rem; }
.text-sm     { font-size: .85rem; }
.text-muted  { color: var(--text-muted); }
.text-center { text-align: center; }
.w-full      { width: 100%; }
.font-bold   { font-weight: 700; }
.truncate    { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── RESPONSIVE ───────────────────────────────── */
@media (max-width: 768px) {
  .navbar { padding: 0 1rem; }
  .nav-links { display: none; }
  .nav-links.open {
    display: flex; flex-direction: column;
    position: absolute; top: 58px; left: 0; right: 0;
    background: var(--header-bg);
    padding: 1rem; z-index: 99; gap: .25rem;
  }
  .nav-username { display: none; }
  .form-row { grid-template-columns: 1fr; }
  .answers-grid, .q-review-answers { grid-template-columns: 1fr; }
  .main-content { padding: 1rem; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .session-code-display { font-size: 1.8rem; letter-spacing: .2em; }
  .btn-group-mobile { flex-direction: column; }
  .hamburger { display: block !important; }
}
.hamburger {
  display: none;
  background: none; border: none;
  color: #fff; font-size: 1.4rem;
  cursor: pointer; margin-left: auto;
}
