/* The teachers' department: the question composer and the review cards.
   Paper for questions (soft blue-grey, roomy lines), green for answers and marking guides (the "answer sheet"),
   amber for new items, red for students' reports. */
:root {
  --paper: #f5f7fc; --paper-edge: #e1e7f5; --ans: #16834f; --ans-soft: #e9f7ef; --ans-edge: #b9e4cb;
  --new: #b9740a; --new-soft: #fff4dd; --warn: #c2410c; --warn-soft: #fff0e8; --ink2: #33415f;
}

/* ---- fields: the site's look for every input on the department pages ---- */
.dept-form input:not([type=radio]):not([type=checkbox]), .dept-form textarea, .dept-form select,
.dept-profile input, .dept-profile textarea, .rv-note {
  width: 100%; font: inherit; font-size: .95rem; color: var(--ink, #0f1a3d); background: #fff;
  border: 1.5px solid var(--paper-edge); border-radius: 10px; padding: 10px 12px; min-height: 44px;
  transition: border-color .15s, box-shadow .15s;
}
.dept-form textarea, .dept-profile textarea, .rv-note { line-height: 1.55; resize: vertical; }
.dept-form input:focus, .dept-form textarea:focus, .dept-form select:focus, .dept-profile input:focus, .dept-profile textarea:focus, .rv-note:focus {
  outline: none; border-color: var(--blue, #2f6bff); box-shadow: 0 0 0 3px rgba(47, 107, 255, .15);
}
.dept-form ::placeholder, .rv-note::placeholder { color: #8a96b3; }
.dept-form .field > span, .dept-profile .field > span { font-weight: 600; font-size: .85rem; color: var(--ink2); }

/* ---- the composer: four numbered steps ---- */
.dept-compose h2 { margin: 0 0 4px; }
.dept-compose > .muted { margin: 0 0 12px; }
.cmp-step { display: grid; grid-template-columns: 32px 1fr; gap: 12px; padding: 16px 0; border-top: 1px solid var(--paper-edge); }
.cmp-step:first-of-type { border-top: 0; }
.cmp-n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--navy, #0a1238); color: #fff; font-family: var(--display); font-weight: 700; font-size: .95rem; }
.cmp-body { display: grid; gap: 10px; min-width: 0; }
.cmp-body > h3 { margin: 4px 0 0; font-size: 1rem; }
.cmp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.cmp-label { display: block; font-weight: 600; font-size: .82rem; color: var(--ink2); margin-bottom: 6px; }

/* chips: a choice of a few values */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: inherit; font-size: .88rem; font-weight: 600; padding: 8px 14px; min-height: 40px; border-radius: 999px; border: 1.5px solid var(--paper-edge); background: #fff; color: var(--ink2); cursor: pointer; }
.chip:hover { border-color: var(--blue, #2f6bff); }
.chip[aria-pressed=true] { background: var(--navy, #0a1238); border-color: var(--navy, #0a1238); color: #fff; }
.chip:focus-visible { outline: 3px solid rgba(47, 107, 255, .4); outline-offset: 2px; }

/* the question and its live preview */
.cmp-q { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: stretch; }
.cmp-preview { background: var(--paper); border: 1px solid var(--paper-edge); border-radius: 12px; padding: 12px 14px; line-height: 1.65; overflow-x: auto; }
.cmp-preview > small { display: block; color: var(--mute, #5a6788); font-weight: 600; font-size: .75rem; margin-bottom: 6px; }
.cmp-preview .md:empty::before { content: 'It appears here as students will see it, with the maths drawn.'; color: #8a96b3; }
.cmp-tip { font-size: .8rem; color: var(--mute, #5a6788); }
.cmp-tip code { background: var(--paper); border: 1px solid var(--paper-edge); border-radius: 6px; padding: 1px 5px; font-size: .78rem; }

/* choices: tick the right one and it turns green */
.dept-opt { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; padding: 6px 8px 6px 6px; border: 1.5px solid var(--paper-edge); border-radius: 12px; background: #fff; transition: background .15s, border-color .15s; }
.dept-opt input[type=radio] { appearance: none; -webkit-appearance: none; margin: 0; width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--paper-edge); background: var(--paper); display: grid; place-items: center; cursor: pointer; font-family: var(--display); font-weight: 700; color: var(--ink2); }
.dept-opt input[type=radio]::before { content: attr(data-letter); }
.dept-opt input[type=radio]:checked { background: var(--ans); border-color: var(--ans); color: #fff; }
.dept-opt input[type=radio]:checked::before { content: '✓'; }
.dept-opt input[type=radio]:focus-visible { outline: 3px solid rgba(22, 131, 79, .35); outline-offset: 2px; }
.dept-form .dept-opt input:not([type=radio]) { border: 0; min-height: 36px; padding: 6px 4px; background: transparent; box-shadow: none; }
.dept-opt:has(input:checked) { background: var(--ans-soft); border-color: var(--ans-edge); }
.dept-opt:has(input:checked) { grid-template-columns: auto minmax(0, 1fr) auto; }
.dept-opt:has(input:checked)::after { content: 'Correct'; font-size: .74rem; font-weight: 700; color: var(--ans); padding-right: 6px; }

/* the answer sheet: green */
.ans-sheet { background: var(--ans-soft); border: 1px solid var(--ans-edge); border-left: 5px solid var(--ans); border-radius: 12px; padding: 12px 14px; display: grid; gap: 10px; }
.ans-sheet > b, .ans-head { color: var(--ans); font-size: .85rem; font-weight: 700; }
.dept-form .ans-sheet input:not([type=radio]), .dept-form .ans-sheet textarea { background: #fff; border-color: var(--ans-edge); }
.dept-form .ans-sheet input:focus, .dept-form .ans-sheet textarea:focus { border-color: var(--ans); box-shadow: 0 0 0 3px rgba(22, 131, 79, .15); }

/* structured parts */
.dept-part { display: grid; grid-template-columns: 36px minmax(0, 1fr) 96px; gap: 8px 10px; align-items: start; background: #fff; border: 1px solid var(--paper-edge); border-radius: 12px; padding: 10px; }
.dept-part .part-id { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--navy, #0a1238); color: #fff; font-family: var(--display); font-weight: 700; }
.dept-part .part-marks { display: grid; gap: 2px; }
.dept-part .part-marks small { font-size: .72rem; color: var(--mute, #5a6788); font-weight: 600; }
.dept-part .ans-sheet { grid-column: 2 / -1; padding: 8px 10px; }
.dept-part .part-del { grid-column: 3; justify-self: end; font: inherit; font-size: .78rem; color: var(--warn); background: none; border: 0; cursor: pointer; padding: 4px; }
.cmp-add { justify-self: start; }

.cmp-go { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding-top: 14px; border-top: 1px solid var(--paper-edge); }
.cmp-go .btn { min-width: 220px; }
.cmp-go .form-note { margin: 0; }

/* ---- review cards ---- */
.dept-train { display: grid; gap: 10px; }
.rv { border: 1px solid var(--paper-edge); border-radius: 14px; background: #fff; overflow: hidden; }
.rv > summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 14px; }
.rv > summary::-webkit-details-marker { display: none; }
.rv > summary::before { content: '▸'; color: var(--mute, #5a6788); transition: transform .15s; }
.rv[open] > summary::before { transform: rotate(90deg); }
.rv[open] > summary { border-bottom: 1px solid var(--paper-edge); background: #fbfcff; }
.rv-topic { font-weight: 700; color: var(--ink, #0f1a3d); }
.rv-tag { font-size: .74rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--paper); color: var(--ink2); }
.rv-tag.new { background: var(--new-soft); color: var(--new); }
.rv-tag.report { background: var(--warn-soft); color: var(--warn); }
.rv-tag.system { background: #e8f0ff; color: var(--blue-d, #1d4ed8); }
.rv-why { flex-basis: 100%; font-size: .82rem; color: var(--mute, #5a6788); margin-left: 18px; }
.rv-body { padding: 14px; display: grid; gap: 12px; }
.rv.done { opacity: .55; }
.rv-reports { margin: 0; padding: 10px 14px 10px 30px; background: var(--warn-soft); border-radius: 10px; color: var(--warn); }

/* the question on paper */
.rv-paper { background: var(--paper); border: 1px solid var(--paper-edge); border-radius: 12px; padding: 14px 16px; line-height: 1.7; color: var(--ink, #0f1a3d); overflow-x: auto; }
.rv-paper .md { max-width: 78ch; }
.rv-paper table { border-collapse: collapse; margin: 10px 0; background: #fff; border-radius: 8px; overflow: hidden; font-size: .92rem; }
.rv-paper th { background: #e6ecfa; text-align: left; white-space: nowrap; }
.rv-paper th, .rv-paper td { padding: 7px 12px; border: 1px solid var(--paper-edge); }
.rv-opts { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.rv-opts li { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 8px; align-items: center; background: #fff; border: 1px solid var(--paper-edge); border-radius: 10px; padding: 7px 10px; }
.rv-opts li b { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--paper); font-family: var(--display); font-size: .85rem; }
.rv-opts li.right { background: var(--ans-soft); border-color: var(--ans-edge); }
.rv-opts li.right b { background: var(--ans); color: #fff; }
.rv-opts li.right::after { content: 'Answer'; font-size: .72rem; font-weight: 700; color: var(--ans); }

/* the marking guide, as an answer sheet */
.rv-guide .rv-part { background: #fff; border: 1px solid var(--ans-edge); border-radius: 10px; padding: 10px 12px; display: grid; gap: 6px; }
.rv-part-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.rv-part-head { flex-wrap: nowrap; }
.rv-part-head > span:nth-child(2) { flex: 1 1 auto; min-width: 0; }
.rv-part-head .pid { font-family: var(--display); font-weight: 700; color: var(--ans); }
.rv-part-head .mk { margin-left: auto; font-size: .74rem; font-weight: 700; color: var(--ans); background: var(--ans-soft); border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.rv-expected { border-left: 3px solid var(--ans); padding: 2px 0 2px 10px; color: var(--ink, #0f1a3d); }
.rv-expected small { display: block; font-size: .72rem; font-weight: 700; color: var(--ans); }
.rv-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.rv-points li { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 6px; align-items: baseline; font-size: .92rem; color: var(--ink2); }
.rv-points li::before { content: '✓'; color: var(--ans); font-weight: 700; }
.rv-points li .pts { font-size: .72rem; font-weight: 700; color: var(--ans); }
.rv-whyline { background: var(--ans-soft); border-left: 4px solid var(--ans); border-radius: 8px; padding: 8px 12px; color: var(--ink, #0f1a3d); }

/* rating and decision */
.rv-rate { background: #fbfcff; border: 1px solid var(--paper-edge); border-radius: 12px; padding: 10px 14px; display: grid; gap: 6px; }
.rv-rate .room-stars { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; }
.rv-rate .room-stars > span { flex: 0 0 200px; }
.rv-rate .room-stars > span { font-size: .88rem; color: var(--ink2); }
.rv-rate .star { font-size: 1.35rem; background: none; border: 0; cursor: pointer; color: #cfd8ee; padding: 2px; min-width: 32px; min-height: 32px; }
.rv-rate .star.on { color: #f5a524; }
.rv-acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn.approve { background: var(--ans); border-color: var(--ans); color: #fff; }
.btn.approve:hover { background: #126c41; }
.btn.reject { background: #fff; border: 1.5px solid #f3c2ad; color: var(--warn); }
.btn.reject:hover { background: var(--warn-soft); }

@media (max-width: 760px) {
  .cmp-q { grid-template-columns: 1fr; }
  .cmp-step { grid-template-columns: 1fr; gap: 8px; }
  .dept-part { grid-template-columns: 34px minmax(0, 1fr) 80px; }
  .rv-rate .room-stars > span { flex-basis: 100%; }
  .cmp-go .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .rv > summary::before { transition: none; } }

/* a question or post from a photo: the photo box, then Gemini's solution to check */
.cmp-photo { border: 1.5px dashed var(--paper-edge, #d5def4); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; display: grid; gap: 6px; min-width: 0; }
.cmp-photo .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.cmp-ai { border-left: 4px solid var(--gold, #ffb547); background: #fffaf0; border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; display: grid; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.cmp-ai .md { overflow-x: auto; }
