/* Teacher page (teacher.html), on top of styles.css. Wider, for a laptop or a projector. */

.topbar, main { max-width: 860px; }
h3 { margin: 18px 0 8px; font-size: 1.15rem; }
.note { color: #475569; font-size: .95rem; }
.danger { padding: 0 18px; font-weight: 700; color: #fff; background: var(--tomato); box-shadow: 0 4px 0 #b91c1c; }

/* New class game */
.teacher-form fieldset { display: flex; flex-wrap: wrap; gap: 0 18px; margin: 0 0 10px; padding: 0; border: 0; }
.teacher-form legend { padding: 0; margin-bottom: 2px; font-weight: 800; }
.teacher-form label { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; cursor: pointer; }
.teacher-form input { width: 22px; height: 22px; margin: 0; accent-color: var(--grape); }
.chips { display: flex; flex-wrap: wrap; gap: 0 16px; }
.question-settings input, .question-settings select { width: auto; height: 44px; padding: 0 8px; font: inherit; color: inherit;
  background: #fff; border: 3px solid var(--soft); border-radius: 12px; }
.question-settings input { width: 4.5em; }
.question-settings label { flex-wrap: wrap; } /* on a phone the field may go under its label */

.session-list { padding: 0; list-style: none; }
.session-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 2px dashed var(--soft); }

/* Lobby and game: readable from the back of the classroom */
.code-hint { margin: 8px 0 0; text-align: center; font-size: 1.2rem; font-weight: 700; }
.big-code { margin: 4px 0 12px; text-align: center; font-size: clamp(3.5rem, 16vw, 7rem); font-weight: 900; letter-spacing: .06em; color: var(--grape); }
.clock { margin: 8px 0; text-align: center; font-size: 2rem; font-weight: 900; }
.clock:empty { display: none; }

.grid { width: 100%; margin: 8px 0 16px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.grid th, .grid td { padding: 6px 8px; text-align: right; border-bottom: 2px solid var(--soft); }
.grid th:first-child, .grid td:first-child { text-align: left; overflow-wrap: anywhere; }
.grid tfoot th, .grid tfoot td { font-weight: 800; border-bottom: 0; }
#students:not(.live) .live-col { display: none; }

/* Answer details: a student's answers under their row */
.link { min-height: 0; padding: 2px 0; font-weight: 700; text-align: left; color: var(--grape); background: none; border-radius: 0;
  text-decoration: underline dotted; text-underline-offset: 3px; }
.answer-list { width: 100%; max-width: 520px; margin: 0 0 8px; border-collapse: collapse; font-size: .9em; }
.answer-list th, .answer-list td { padding: 3px 6px; border-bottom: 1px solid var(--soft); }
.answer-list tr.wrong td { background: #fee2e2; }
.answer-list s { color: var(--tomato); }
.hardest { margin: 4px 0 8px; padding-left: 1.6em; }

.heatmap { width: 100%; max-width: 480px; margin: 8px 0 16px; border-collapse: collapse; table-layout: fixed; font-variant-numeric: tabular-nums; }
.heatmap th, .heatmap td { height: 2em; padding: 0; text-align: center; border: 1px solid var(--soft); }
.heatmap th { background: #f1f5f9; }
.heatmap td { font-size: .9rem; background: rgb(239 68 68 / calc(var(--heat, 0) * .85)); }
.heatmap button { width: 100%; height: 100%; min-height: 2em; padding: 0; font-weight: 700; background: none; border-radius: 0; }
.heatmap button[aria-pressed="true"] { outline: 3px solid var(--grape); outline-offset: -3px; }
.cell-details { margin: -8px 0 16px; }
.cell-details h4 { margin: 0 0 4px; }
.cell-details ul { margin: 0; padding-left: 1.4em; }

/* Interactive report (§6a): filter bar, sort buttons, the Print / PDF panel. Print-only parts stay hidden on screen. */
.print-only { display: none; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin: 8px 0 4px; }
.filters .search { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 700; }
.filters input { width: 11em; max-width: 100%; height: 40px; padding: 0 10px; font: inherit; font-weight: 400; color: inherit;
  background: #fff; border: 3px solid var(--soft); border-radius: 12px; }
.filters .chips { align-items: center; gap: 6px; }
.filters .chips > span { font-weight: 700; }
.chip { min-height: 36px; padding: 0 12px; font-size: .9rem; font-weight: 700; white-space: nowrap; background: var(--soft); border-radius: 999px; }
.chip[aria-pressed="true"] { color: #fff; background: var(--grape); }
.count-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; min-height: 36px; margin: 0; color: #475569; font-size: .95rem; }
.count-line .small { min-height: 36px; }
#results thead th { position: sticky; top: 0; z-index: 2; background: var(--card); } /* the header row stays in view */
#results .sort { min-height: 0; padding: 0; font-weight: inherit; text-align: inherit; background: none; border-radius: 0; }
#results th[aria-sort="ascending"] .sort::after { content: "\00a0▲"; } /* kept on the header's last line */
#results th[aria-sort="descending"] .sort::after { content: "\00a0▼"; }
.print-panel { margin: 4px 0 8px; padding: 12px 16px; border: 3px solid var(--soft); border-radius: 18px; }
.print-panel fieldset { display: flex; flex-wrap: wrap; gap: 0 16px; margin: 0 0 6px; padding: 0; border: 0; }
.print-panel legend { padding: 0; font-weight: 800; }
.print-panel label { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; cursor: pointer; }
.print-panel input { width: 20px; height: 20px; margin: 0; accent-color: var(--grape); }

main > .privacy { margin-top: 16px; padding: 4px 20px 16px; background: var(--card); border-radius: 28px; box-shadow: 0 12px 30px #0002; }

/* Phones: whole words only. A table wider than the screen scrolls sideways inside its card; the names stay in place. */
@media (max-width: 520px) {
  .grid { font-size: .8rem; }
  .grid th, .grid td { padding: 4px; }
  .grid td { white-space: nowrap; }
  .table-scroll { overflow-x: auto; }
  .grid > * > tr:not(.answers-row) > :first-child { position: sticky; left: 0; z-index: 1; overflow-wrap: normal; white-space: normal;
    background: var(--card); box-shadow: 1px 0 0 var(--soft); }
  .answer-list { width: auto; } /* narrow enough to read without swiping */
  .heatmap td { font-size: .7rem; }
}

/* Print view (A4): its own header, then the parts and columns chosen in the Print / PDF panel, following the
   table's sort and filter. The student table of up to 30 students fits on one page; hardest tasks + heatmap on one. */
@media print {
  @page { size: A4; margin: 12mm; }
  body { min-height: 0; font-size: 10pt; background: #fff; }
  .topbar, .no-print, #lobby-part, #students-part, .clock, #session-title, #deleted-on { display: none !important; }
  .print-only { display: block; }
  main { max-width: none; padding: 0; }
  section { padding: 0; border-radius: 0; box-shadow: none; }
  h2 { font-size: 14pt; }
  h3 { margin: 10px 0 4px; font-size: 11pt; }
  #print-header h2 { margin: 0 0 2px; }
  #print-header p { margin: 0 0 2px; }
  .grid { margin: 6px 0 10px; font-size: 9.5pt; }
  .grid th, .grid td { padding: 1px 6px; border-bottom-width: 1px; }
  #results thead th { position: static; }
  .grid tr, .heatmap, #tasks-part, .print-answers-block { break-inside: avoid; }
  .answers-row { display: none; } /* opened lists print only through "Each student's answers" */
  .link { padding: 0; color: inherit; text-decoration: none; }
  .heatmap { max-width: 120mm; }
  .heatmap td { font-size: 8pt; }
  .heatmap td { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .print-answers-block h4 { margin: 8px 0 2px; }
  #results-part.print-hide-table #table-part, #results-part.print-hide-hardest #hardest-part,
  #results-part.print-hide-heatmap #heatmap-part, #results-part.print-hide-notfinished #not-finished-part,
  #results-part.print-hide-answers #print-answers { display: none !important; }
  #results-part.print-hide-col-answered [data-col="answered"], #results-part.print-hide-col-correct [data-col="correct"],
  #results-part.print-hide-col-accuracy [data-col="accuracy"], #results-part.print-hide-col-completion [data-col="completion"],
  #results-part.print-hide-col-avgTime [data-col="avgTime"] { display: none; }
}
