/* ============================================================================
   AI report document (cc-ai-report.css)
   ----------------------------------------------------------------------------
   The generated report as a document (prototype AIReportOutput), used on the
   logged-in report page and the public share page (/aireport/{guid}), which sits
   outside the logged-in shell. Self-contained: its own tokens, no dependency on
   cc-rework.css or Bootstrap beyond the reset. Markup: AiReportOutputShared.xsl.
   ========================================================================== */

/* tokens on the wrapper so the actions above the document share them */
.rw-ai-doc-wrap,
.rw-ai-doc {
	--ai-ink: #0E2732;
	--ai-slate: #64748B;
	--ai-border: #DCE1E7;
	/* header / footer bands: a step darker than the page grey (#F5F6F8) so they stand out from it */
	--ai-paper: #E9EDF1;
	--ai-blue: #0083CA;

	/* a document page: as wide as its reading column (760px text + 32px either side) and centred,
	   rather than a full-width card with the text stopping part way across */
	--ai-doc-width: 824px;
}
.rw-ai-doc {
	max-width: var(--ai-doc-width);
	margin: 24px auto;
	border: 1px solid var(--ai-border);
	border-radius: 24px;
	background: #fff;
	box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
	overflow: hidden;
	font-family: 'Inter', system-ui, -apple-system, 'Open Sans', sans-serif;
	color: var(--ai-ink);
}

/* header band: the title (with the selection pills under it) and the company logo, grey to match the footer */
.rw-ai-doc-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	padding: 28px 32px 24px;
	border-bottom: 1px solid var(--ai-border);
	background: var(--ai-paper);
}
.rw-ai-doc-head-main {
	min-width: 0;
}
.rw-ai-doc .rw-ai-doc-title {
	margin: 0;
	font-family: inherit;
	font-size: 22px;
	line-height: 1.3;
	font-weight: 700;
	color: var(--ai-ink);
}
/* facts behind the report (period, responses, words, run date): pills in the footer */
.rw-ai-doc-facts {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0 0 16px;
	padding: 0;
	list-style: none;
}
.rw-ai-doc-facts li {
	padding: 4px 10px;
	border: 1px solid var(--ai-border);
	border-radius: 999px;
	background: #fff;
	font-size: 12px;
	font-weight: 600;
	color: var(--ai-slate);
}
.rw-ai-doc-head-side {
	flex-shrink: 0;
}
.rw-ai-doc-logo {
	display: block;
	max-width: 160px;
	max-height: 56px;
	object-fit: contain;
}
/* share / print buttons: above the document, right-aligned with its edge */
.rw-ai-doc-actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 8px;
	max-width: var(--ai-doc-width);
	margin: 24px auto 0;
}
.rw-ai-doc-actions + .rw-ai-doc {
	margin-top: 12px;
}
.rw-ai-doc-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 7px 12px;
	border: 1px solid var(--ai-border);
	border-radius: 8px;
	background: #fff;
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	line-height: 18px;
	color: var(--ai-ink);
	cursor: pointer;
	transition: border-color 0.15s, color 0.15s;
}
.rw-ai-doc-btn:hover,
.rw-ai-doc-btn:focus-visible {
	border-color: var(--ai-blue);
	color: var(--ai-blue);
}
.rw-ai-doc-btn.is-done {
	border-color: #12A594;
	color: #12A594;
}

/* score rings: average out of 5, the ring split by how the ratings were spread, each star
   rating in its band colour (as the original doughnut charts and the Analysis pages) */
/* left-aligned with the text below: each ring sits centred in a 128px slot (8px either side of
   the 112px ring), so the row starts 8px left of the text's 32px inset */
.rw-ai-doc-scores {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-start;
	gap: 16px 40px;
	padding: 28px 32px 8px 24px;
}
.rw-ai-ring-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	width: 128px;
	text-align: center;
}
.rw-ai-ring {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 112px;
	height: 112px;
}
/* the ring is drawn with SVG strokes (prints even with background graphics off) */
.rw-ai-ring-svg {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}
.rw-ai-ring-svg circle {
	fill: none;
	stroke-width: 20;
}
.rw-ai-ring-track {
	stroke: #E5E8EC;
}
.rw-ai-ring-arc-5 { stroke: #4CAE4C; }
.rw-ai-ring-arc-4 { stroke: #A6B726; }
.rw-ai-ring-arc-3 { stroke: #FFBF00; }
.rw-ai-ring-arc-2 { stroke: #F1731B; }
.rw-ai-ring-arc-1 { stroke: #E32636; }
/* the share page (copy link) sits on the same grey as the report in the logged-in pages */
body:not(.rw-shell):has(.rw-ai-doc-wrap) {
	background: #F5F6F8;
}
.rw-ai-ring-value {
	position: relative;
	font-size: 26px;
	font-weight: 700;
	color: var(--ai-ink);
}
.rw-ai-ring-label {
	margin-top: 10px;
	font-size: 14px;
	font-weight: 600;
	color: var(--ai-ink);
}
.rw-ai-ring-sub {
	margin-top: 2px;
	font-size: 12px;
	color: var(--ai-slate);
}

/* the AI's text, set for reading: clear headings and lists; the card's width (.rw-ai-doc)
   keeps the line length comfortable */
.rw-ai-doc-body {
	padding: 24px 32px 8px;
	font-size: 15px;
	line-height: 1.65;
	color: #2B3A45;
}
.rw-ai-doc-body > :first-child {
	margin-top: 0;
}
.rw-ai-doc-body h3,
.rw-ai-doc-body h4 {
	margin: 24px 0 8px;
	font-family: inherit;
	font-size: 17px;
	line-height: 1.35;
	font-weight: 700;
	color: var(--ai-ink);
}
.rw-ai-doc-body h4 {
	font-size: 15px;
}
.rw-ai-doc-body p {
	margin: 0 0 12px;
}
.rw-ai-doc-body ul,
.rw-ai-doc-body ol {
	margin: 0 0 16px;
	padding-left: 22px;
}
.rw-ai-doc-body ul li {
	list-style: disc;
}
.rw-ai-doc-body ol li {
	list-style: decimal;
}
.rw-ai-doc-body li {
	margin-bottom: 6px;
}
/* numbers and bullets in the text colour, not a brand colour */
.rw-ai-doc-body li::marker {
	font-weight: 700;
	color: var(--ai-ink);
}
.rw-ai-doc-body li p {
	margin: 0;
}
.rw-ai-doc-body ol ul,
.rw-ai-doc-body ul ul {
	margin: 4px 0 0;
}
.rw-ai-doc-body strong,
.rw-ai-doc-body b {
	font-weight: 700;
	color: var(--ai-ink);
}

/* footer: the report's facts and the AI disclaimer */
.rw-ai-doc-foot {
	margin-top: 16px;
	padding: 20px 32px 24px;
	border-top: 1px solid var(--ai-border);
	background: var(--ai-paper);
}
/* the selection behind the report (period + filters): pills under the title */
.rw-ai-doc-criteria ul {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 12px 0 0;
	padding: 0;
	list-style: none;
}
.rw-ai-doc-criteria li {
	padding: 4px 10px;
	border: 1px solid var(--ai-border);
	border-radius: 999px;
	background: #fff;
	font-size: 12px;
	color: var(--ai-ink);
}
.rw-ai-doc-criteria li span {
	margin-right: 6px;
	font-weight: 600;
	color: var(--ai-slate);
}
.rw-ai-doc-disclaimer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
}
.rw-ai-doc-disclaimer p {
	max-width: 640px;
	margin: 0;
	font-size: 12px;
	line-height: 1.5;
	color: var(--ai-slate);
}
/* sign-off: "Powered by [logo]" as one line, kept small. "Powered by" is in the Coursecheck
   brand font (Gibson Light) where it's available, as the public homepage */
.rw-ai-doc-marks {
	display: flex;
	align-items: center;
	flex-shrink: 0;
	gap: 20px;
}
.rw-ai-doc .rw-ai-doc-cc {
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: 4px;
	text-decoration: none;
}
.rw-ai-doc-cc span {
	font-family: 'Gibson', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	font-size: 11px;
	line-height: 1;
	font-weight: 300;
	white-space: nowrap;
	color: var(--ai-slate);
}
.rw-ai-doc-cc img {
	display: block;
	height: 21px;
	width: auto;
}

@media (max-width: 767px) {
	.rw-ai-doc-head {
		flex-direction: column;
		align-items: flex-start;
		padding: 20px;
	}
	.rw-ai-doc-actions {
		justify-content: flex-start;
	}
	.rw-ai-doc-scores,
	.rw-ai-doc-body,
	.rw-ai-doc-foot {
		padding-left: 20px;
		padding-right: 20px;
	}
	.rw-ai-doc-scores {
		padding-left: 12px; /* the rings' 8px slot margin, as above */
	}
	.rw-ai-doc-disclaimer {
		flex-direction: column;
		align-items: flex-start;
	}
	.rw-ai-doc-marks {
		flex-wrap: wrap;
	}
}

/* print / save as PDF: just the document, no page chrome or buttons */
@media print {
	body * {
		visibility: hidden;
	}
	.rw-ai-doc,
	.rw-ai-doc * {
		visibility: visible;
	}
	.rw-ai-doc {
		position: absolute;
		top: 0;
		left: 0;
		right: 0;
		margin: 0;
		border: 0;
		box-shadow: none;
	}
	.rw-ai-doc-actions {
		display: none;
	}
	.rw-ai-doc-actions + .rw-ai-doc {
		margin-top: 0;
	}
	/* Bootstrap's print styles write each link's address after it ("a[href]:after"), which put
	   "(https://www.coursecheck.com/)" next to the Powered by logo */
	.rw-ai-doc a[href]::after {
		content: none;
	}
	.rw-ai-doc-head,
	.rw-ai-doc-foot,
	.rw-ai-doc-facts li {
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}
	/* Bootstrap's print styles clear every background (* { background: none !important }):
	   put the bands and pills back */
	.rw-ai-doc .rw-ai-doc-head,
	.rw-ai-doc .rw-ai-doc-foot {
		background: var(--ai-paper) !important;
	}
	.rw-ai-doc .rw-ai-doc-facts li,
	.rw-ai-doc .rw-ai-doc-criteria li {
		background: #fff !important;
	}
	.rw-ai-doc-body h3,
	.rw-ai-ring-item {
		break-inside: avoid;
	}
	/* keep headings with their text, the rings together, and the footer whole and with the end of
	   the report rather than on a page of its own */
	.rw-ai-doc-head,
	.rw-ai-doc-scores,
	.rw-ai-doc-foot {
		break-inside: avoid;
		page-break-inside: avoid;
	}
	.rw-ai-doc-head,
	.rw-ai-doc-body h2,
	.rw-ai-doc-body h3,
	.rw-ai-doc-body h4 {
		break-after: avoid;
		page-break-after: avoid;
	}
	.rw-ai-doc-foot {
		break-before: avoid;
		page-break-before: avoid;
	}
	.rw-ai-doc-body p,
	.rw-ai-doc-body li {
		orphans: 3;
		widows: 3;
	}
}
