/* ========================================
   Quiz Platform — Gedeelde Stijlen
   Lefief Logistiek — Philippe Lefief
   ======================================== */

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

:root {
  --navy: #1a2332;
  --navy-light: #253347;
  --accent: #2e86de;
  --accent-hover: #2577c9;
  --success: #27ae60;
  --danger: #e74c3c;
  --warning: #f39c12;
  --gray-bg: #f5f7fa;
  --gray-border: #dde3ec;
  --text: #1a2332;
  --text-muted: #5a6a7e;
  --white: #ffffff;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-lg: 0 2px 8px rgba(0,0,0,0.10);
}

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--gray-bg);
  min-height: 100vh;
}

/* ── HEADER ── */
.site-header {
  background: var(--navy);
  color: var(--white);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  height: 100%;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--white);
}

.header-brand .brand-icon {
  font-size: 28px;
  line-height: 1;
}

.header-brand .brand-name {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.header-brand .brand-name span {
  color: var(--accent);
}

.header-brand .brand-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.7);
  display: block;
  margin-top: -2px;
}

.header-nav {
  display: flex;
  gap: 8px;
}

.header-nav a {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  transition: background 0.15s, color 0.15s;
}

.header-nav a:hover, .header-nav a.active {
  color: var(--white);
  background: rgba(255,255,255,0.1);
}

/* ── MAIN CONTAINER ── */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 32px 24px;
}

.container-sm {
  max-width: 680px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* ── PAGE TITLE ── */
.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 6px;
}

.page-sub {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 28px;
}

/* ── CARDS ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 16px;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
}

.card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--navy);
}

.card-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── BADGES ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  white-space: nowrap;
  vertical-align: middle;
}

.badge-blue { background: #e8f2fc; color: var(--accent); }
.badge-green { background: #e8f8f0; color: var(--success); }
.badge-orange { background: #fef6e8; color: #b37a00; }
.badge-gray { background: #eef1f5; color: var(--text-muted); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background 0.15s, box-shadow 0.15s;
  line-height: 1.4;
}

.btn-primary {
  background: var(--accent);
  color: var(--white);
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-success {
  background: var(--success);
  color: var(--white);
}
.btn-success:hover { background: #219a52; }

.btn-danger {
  background: var(--danger);
  color: var(--white);
}
.btn-danger:hover { background: #c0392b; }

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--gray-border);
}
.btn-outline:hover { background: var(--gray-bg); border-color: #c0c8d4; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--gray-border);
}
.btn-ghost:hover { background: var(--gray-bg); color: var(--text); }

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── FORM ELEMENTS ── */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--navy);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
textarea,
select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--gray-border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.15s;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(46,134,222,0.12);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

/* ── ALERTS ── */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-info { background: #dbeafe; color: #1e40af; border-left: 4px solid #3b82f6; }
.alert-success { background: #dcfce7; color: #166534; border-left: 4px solid #22c55e; }
.alert-warning { background: #fef9c3; color: #854d0e; border-left: 4px solid #eab308; }
.alert-error { background: #fee2e2; color: #991b1b; border-left: 4px solid #ef4444; }

/* ── PROGRESS BAR ── */
.progress-wrap {
  background: var(--gray-border);
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.4s ease;
}

.progress-label {
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
}

/* ── TABLES ── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  background: var(--navy);
  color: var(--white);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
}

td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--gray-border);
  vertical-align: top;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-bg); }

/* ── MODAL ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  animation: modalIn 0.2s ease;
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
}

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
  padding: 4px;
}

.modal-close:hover { color: var(--danger); }

/* ── QUESTION STYLES ── */
.question-block {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
  animation: fadeIn 0.3s ease;
  border-left: 4px solid var(--accent);
}

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

.question-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.question-num {
  font-weight: 700;
  font-size: 13px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.question-points {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
}

.question-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 16px;
  line-height: 1.5;
}

/* MC / TF Options */
.options-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.option-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--gray-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.option-item:hover {
  border-color: var(--accent);
  background: #f0f7ff;
}

.option-item.selected {
  border-color: var(--accent);
  background: #dbeafe;
}

.option-item.correct {
  border-color: var(--success);
  background: #dcfce7;
}

.option-item.wrong {
  border-color: var(--danger);
  background: #fee2e2;
}

.option-item input[type="radio"],
.option-item input[type="checkbox"] {
  width: auto;
  margin-top: 2px;
  flex-shrink: 0;
}

/* Matching */
.matching-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px 12px;
  align-items: center;
}

.match-left {
  padding: 10px 14px;
  background: var(--navy);
  color: var(--white);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 14px;
}

.match-arrow {
  color: var(--text-muted);
  font-size: 18px;
  text-align: center;
}

.match-select {
  width: 100%;
}

/* Fill table */
.fill-table {
  width: 100%;
  border-collapse: collapse;
}

.fill-table th {
  background: var(--navy);
  color: var(--white);
  padding: 10px 12px;
  font-size: 13px;
}

.fill-table td {
  border: 1px solid var(--gray-border);
  padding: 8px;
}

.fill-table td.fixed {
  background: var(--gray-bg);
  font-weight: 500;
  font-size: 13px;
  padding: 10px 12px;
}

.fill-table td.editable input {
  width: 100%;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  padding: 4px;
  border-bottom: 1.5px solid var(--gray-border);
}

.fill-table td.editable input:focus {
  outline: none;
  border-bottom-color: var(--accent);
}

/* Result styling */
.question-block.result-correct { border-left-color: var(--success); }
.question-block.result-partial { border-left-color: var(--warning); }
.question-block.result-wrong { border-left-color: var(--danger); }
.question-block.result-open { border-left-color: #9333ea; }

.result-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.result-badge.correct { background: #dcfce7; color: #166534; }
.result-badge.partial { background: #fef9c3; color: #854d0e; }
.result-badge.wrong { background: #fee2e2; color: #991b1b; }
.result-badge.open { background: #f3e8ff; color: #6b21a8; }

.explanation-box {
  margin-top: 14px;
  padding: 12px 14px;
  background: #f8fafc;
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
  font-size: 13px;
  color: var(--text-muted);
}

/* ── SCORE SUMMARY ── */
.score-summary {
  background: var(--navy);
  color: var(--white);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  margin-bottom: 24px;
}

.score-number {
  font-size: 56px;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 6px;
}

.score-label {
  font-size: 14px;
  opacity: 0.7;
}

.score-pct {
  font-size: 22px;
  font-weight: 700;
  margin-top: 8px;
}

/* ── ASSIGNMENT LIST (index) ── */
.assignment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.assignment-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
  border-top: 4px solid var(--accent);
  display: flex;
  flex-direction: column;
}

.assignment-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.assignment-card .ac-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 6px;
}

.assignment-card .ac-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.assignment-card .ac-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
  flex: 1;
}

.assignment-card .ac-footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--gray-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

/* ── STUDENT NAME MODAL ── */
.name-modal-wrap {
  position: fixed;
  inset: 0;
  background: rgba(26,35,50,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.name-modal {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 36px;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.name-modal h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
}

.name-modal p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 20px;
}

.name-modal input {
  text-align: center;
  font-size: 16px;
  margin-bottom: 14px;
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--navy);
}

/* ── FOOTER ── */
.site-footer {
  background: var(--navy);
  color: rgba(255,255,255,0.5);
  text-align: center;
  padding: 16px 24px;
  font-size: 13px;
  margin-top: auto;
}

.site-footer a {
  color: rgba(255,255,255,0.7);
}

.site-footer a:hover {
  color: #fff;
}

/* ── PRINT ── */
@media print {
  .site-header, .site-footer, .btn, .no-print { display: none !important; }
  body { background: white; }
  .question-block { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .site-header {
    padding: 0 16px;
    height: 50px;
  }
  .header-inner { padding: 0 16px; }
}

@media (max-width: 600px) {
  .container, .container-sm { padding: 16px; }
  .header-inner { flex-direction: column; align-items: flex-start; height: auto; padding: 12px 16px; }
  .site-header { height: auto; }
  .assignment-grid { grid-template-columns: 1fr; }
  .matching-grid { grid-template-columns: 1fr; }
  .match-arrow { display: none; }
}
