/* TM Learning — Question Exam taking page (3 panels: Question,
   Case Study, Notepad+Calculator). Builds on tml-quiz.css
   (palette-btn base styles, calculator, notepad, Finish/Submit
   buttons, .tml-quiz-side-panel sizing) — this file adds what's
   specific to Questions. */

.tml-header {
	position: relative;
	padding: 0 20px;
}

.tml-header-actions {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-left: auto;
}

.tml-quiz-timer {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
}

.tml-case-study-btn {
	font-weight: bold;
}

/* Panel 1 — the palette/prev/next bar merged into this panel's own
   title bar (not a separate panel), per the reference layout. Panel 1
   itself splits the remaining width 50/50 with Panel 2 (Case Study). */
.tml-question-center {
	flex: 1 1 0;
	min-width: 0;
}

.tml-question-nav-bar {
	flex: 0 0 34px;
	height: 34px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 0 16px;
	overflow-x: auto;
}

.tml-question-nav-bar .tml-quiz-prev,
.tml-question-nav-bar .tml-quiz-next {
	flex: 0 0 auto;
}

.tml-question-palette-nums {
	flex: 0 1 auto;
	display: flex;
	align-items: center;
	gap: 8px;
	overflow-x: auto;
}

.tml-palette-round {
	border-radius: 50%;
	width: 28px;
	height: 28px;
	padding: 0;
	flex: 0 0 auto;
	border: none;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
}

.tml-scenario-heading {
	font-size: 20px;
	font-weight: bold;
	margin: 0 0 4px 0;
	line-height: 1.25;
}

/* Scenario + Question + answer area */
.tml-question-scenario {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.6;
	margin-bottom: 20px;
}

.tml-question-scenario table {
	border-collapse: collapse;
	margin: 12px 0;
}

.tml-question-scenario table td,
.tml-question-scenario table th {
	border: 1px solid var(--tml-border);
	padding: 0 12px !important;
	height: 30px !important;
	line-height: 30px;
}

.tml-question-heading {
	font-size: 18px;
	font-weight: bold;
	margin: 0 0 4px 0;
	line-height: 1.25;
}

.tml-question-text {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
	font-size: 16px;
	margin: 0 0 16px 0;
}

.tml-question-text table {
	border-collapse: collapse;
	margin: 12px 0;
}

.tml-question-text table td,
.tml-question-text table th {
	border: 1px solid var(--tml-border);
	padding: 0 12px !important;
	height: 30px !important;
	line-height: 30px;
}

.tml-answer-textarea {
	width: 100%;
	min-height: 140px;
	box-sizing: border-box;
	border: 1px solid var(--tml-border);
	border-radius: 4px;
	padding: 10px;
	font-family: inherit;
	font-size: 15px;
	resize: vertical;
}

.tml-answer-box-item {
	position: relative;
	margin-bottom: 20px;
}

.tml-answer-box-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 6px;
}

.tml-answer-box-number {
	font-size: 15px;
	color: var(--tml-text);
}

.tml-answer-box-marks-badge {
	background: var(--tml-header-bg);
	color: #fff;
	font-size: 12px;
	font-weight: bold;
	padding: 4px 12px;
	border-radius: 14px;
	white-space: nowrap;
}

.tml-answer-table-marks {
	display: flex;
	justify-content: flex-end;
	margin-bottom: 6px;
}

.tml-given-value {
	background: #f0f0f0;
	color: #555;
	font-weight: bold;
	cursor: default;
}

.tml-answer-table {
	border-collapse: collapse;
	width: auto;
	table-layout: auto;
}

.tml-answer-table td {
	border: 1px solid var(--tml-border);
	padding: 0 8px !important;
	height: var(--tml-answer-row-height, 34px) !important;
	line-height: var(--tml-answer-row-height, 34px);
	text-align: left;
}

.tml-answer-table th {
	border: 1px solid var(--tml-border);
	padding: 0 10px !important;
	height: var(--tml-answer-row-height, 34px) !important;
	line-height: var(--tml-answer-row-height, 34px);
	background: #f0f0f0;
	font-weight: bold;
	text-align: left;
	white-space: nowrap;
}

.tml-answer-table-cell {
	height: var(--tml-answer-row-height, 34px) !important;
	line-height: normal;
	border: none;
	padding: 0 4px;
	font-size: 14px;
	text-align: left;
	box-sizing: content-box;
}

/* Panel 2 — embedded Case Study PDF, with its own small title bar
   (label + expand-to-full-view button) above the frame. Splits the
   remaining width 50/50 with Panel 1 (Question), after the fixed-
   width Notepad+Calculator panel and the page margins are removed. */
.tml-question-pdf-panel {
	flex: 1 1 0;
	width: auto;
	min-width: 0;
	padding: 0;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.tml-question-pdf-title-bar {
	flex: 0 0 34px;
	height: 34px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 12px;
	border-bottom: 1px solid var(--tml-border);
}

.tml-pdf-expand-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	color: var(--tml-header-bg);
	background: none;
	border: none;
	cursor: pointer;
	text-decoration: none;
	font-size: 15px;
	line-height: 1;
	padding: 0;
}

/* Two independent toggles, each controlled by its own button:
   - Header "Case Study" button: hides the Case Study panel entirely,
     letting Panel 1 fill the space.
   - The Case Study panel's own title-bar button: expands the Case
     Study panel to fill the space, hiding Panel 1 instead.
   Each click clears the other state, so only one is ever active. */
.tml-case-study-hidden .tml-question-pdf-panel {
	display: none;
}

.tml-case-study-hidden .tml-question-center {
	flex: 1 1 auto;
	width: auto;
	min-width: 0;
}

/* Plain Questions (bank) page — no Case Study panel at all, ever, so
   Panel 2 always takes the space Panel 3 would have used. */
.tml-question-no-pdf .tml-question-center {
	flex: 1 1 auto;
	width: auto;
	min-width: 0;
}

.tml-case-study-expanded .tml-question-center {
	display: none;
}

.tml-case-study-expanded .tml-quiz-side-panel {
	display: none;
}

.tml-case-study-expanded .tml-question-pdf-panel {
	flex: 1 1 auto;
	width: auto;
	min-width: 0;
}

.tml-question-pdf-frame {
	flex: 1 1 auto;
	width: 100%;
	border: none;
	display: block;
}

@media (max-width: 1100px) {
	.tml-question-pdf-panel {
		display: none;
	}
}


/* ---------- Model Answers page (read-only, answers filled in) ---------- */
.tml-ma-panel[hidden] {
	display: none !important;
}

.tml-ma-answer-heading {
	font-size: 18px;
	font-weight: bold;
	line-height: 1.25;
	margin: 26px 0 4px 0;
	color: var(--tml-quiz-correct, #1a7f37);
}

.tml-ma-answer-box {
	border: 1px solid var(--tml-border);
	border-radius: 4px;
	padding: 10px;
	background: #f3faf5;
	font-size: 15px;
	min-height: 44px;
	box-sizing: border-box;
}

.tml-ma-answer-box.tml-ma-empty {
	color: #888;
}

.tml-answer-table-cell.tml-ma-filled {
	background: #f3faf5;
	color: #1a5e2e;
	font-weight: 600;
	cursor: default;
}

/* ---------- Tighter gap under the headings ----------
   The scoped rules below make sure the theme's own paragraph and heading
   spacing cannot add extra space between a heading and the text under it. */
.tml-dashboard .tml-scenario-heading,
.tml-dashboard .tml-question-heading,
.tml-dashboard .tml-ma-answer-heading {
	margin-bottom: 4px;
	line-height: 1.25;
}

.tml-dashboard .tml-question-scenario > :first-child,
.tml-dashboard .tml-question-text > :first-child,
.tml-dashboard .tml-ma-answer-box > :first-child {
	margin-top: 0;
}

/* ---------- Formatted Model Answers ----------
   Compact, like the editor the answer was typed in. Scoped under
   .tml-dashboard so the theme's own paragraph, list and spacing rules
   cannot open the lines up. */
.tml-dashboard .tml-ma-rich,
.tml-dashboard .tml-ma-rich * {
	white-space: normal;
}

.tml-dashboard .tml-ma-rich {
	line-height: 1.5;
}

.tml-dashboard .tml-ma-rich p {
	margin: 0 0 6px 0;
}

.tml-dashboard .tml-ma-rich ul,
.tml-dashboard .tml-ma-rich ol {
	margin: 0 0 6px 22px;
	padding: 0;
}

.tml-dashboard .tml-ma-rich li {
	margin: 0 0 2px 0;
	padding: 0;
}

.tml-dashboard .tml-ma-rich li > ul,
.tml-dashboard .tml-ma-rich li > ol {
	margin: 2px 0 2px 22px;
}

.tml-dashboard .tml-ma-rich li > p {
	margin: 0;
}

.tml-dashboard .tml-ma-rich > :last-child {
	margin-bottom: 0;
}

.tml-dashboard .tml-ma-rich table {
	border-collapse: collapse;
	margin: 6px 0;
}

.tml-dashboard .tml-ma-rich table td,
.tml-dashboard .tml-ma-rich table th {
	border: 1px solid var(--tml-border);
	padding: 4px 10px;
}

/* ---------- Title bar with the lesson name (Questions and Model Answers) ----------
   The lesson name on the left and the numbers on the right, 12px apart; there
   are no « » arrows (the numbers are the way to move). Exams use the original
   bar and are not affected: these rules only apply to the --titled variant. */
.tml-question-nav-bar--titled {
	justify-content: flex-start;
	gap: 12px;
	overflow: hidden;
}

/* The numbers come first: they keep the width they need (and scroll if there
   are very many). The lesson name takes whatever space is left, and shows
   "…" when it is too long, or disappears on a very narrow phone. */
.tml-question-nav-bar--titled .tml-question-nav-title {
	flex: 1 1 0;
	min-width: 0;
	text-align: left;
}

.tml-question-nav-bar--titled .tml-question-palette-nums {
	flex: 0 1 auto;
	min-width: 0;
}

/* ---------- Bottom bar of the Practice panel ----------
   Submit, then Model Answer, together in the centre of the panel, with exactly
   the same button look as the header. A normal part of the panel (not floating
   over it), so nothing is ever hidden behind it: the scrolling area simply
   ends above it. */
.tml-question-actionbar {
	flex: 0 0 34px;
	height: 34px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 0 16px;
	border-top: 1px solid var(--tml-border);
	background: #f7f7f7;
	box-sizing: border-box;
}

@media (max-width: 768px) {
	.tml-question-actionbar {
		flex-basis: 40px;
		height: 40px;
	}

	.tml-question-actionbar .tml-nav-btn {
		padding: 9px 20px;
	}
}
