/* PRODEFIS survey - TPMS theme, mobile friendly.
   Colours follow the TPMS application; change them here. */
:root {
	--colorTPMS: rgb(0, 136, 204);
	--colorDarkTPMS: rgb(0, 120, 180);
	--colorLightTPMS: rgb(29, 180, 255);
	--accent: var(--colorDarkTPMS);
	--barLine: var(--colorDarkTPMS); /* the app uses the user's role colour here */
	--text: rgb(34, 34, 34);
	--muted: rgb(85, 85, 85);
	--line: rgb(215, 215, 215);
	--fieldLine: rgb(140, 140, 140);
	--surface: rgb(241, 241, 241);
	--error: rgb(210, 0, 0);
	--radius: 6px;
	--shadow: 0 1px 5px rgba(0, 0, 0, 0.3);
}

*, *::before, *::after {
	box-sizing: border-box;
}

body {
	margin: 0;
	padding: 0;
	background: #fff;
	color: var(--text);
	font-family: "Open Sans", Arial, sans-serif;
	font-size: 16px;
	line-height: 1.5;
}

/* Top bar, matching the application. */
body::before {
	content: "";
	display: block;
	height: 14px;
	border-bottom: 5px solid var(--barLine);
	background: var(--colorTPMS);
	box-shadow: 0 1px 7px rgba(0, 0, 0, 0.35);
}

.container,
.containerSafari {
	width: 100%;
	max-width: 840px;
	margin: 0 auto;
	padding: 24px 20px;
}

/* Spacing is handled here, not by the <br> tags in the template. */
.container > br {
	display: none;
}

/* ---------- Header ---------- */

.surveyHeader,
.surveyHeader tbody {
	display: block;
}

.surveyHeader {
	margin-bottom: 24px;
}

.surveyHeader tr {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
}

.surveyHeader td {
	padding: 0;
}

.surveyHeaderText {
	color: var(--colorDarkTPMS);
	font-size: 26px;
	font-weight: 700;
	line-height: 1.2;
}

.surveyHeaderLogo {
	flex: none;
}

.surveyHeaderLogo img {
	display: block;
	width: auto;
	max-width: 180px;
	height: auto;
	max-height: 58px;
	border-radius: 4px;
}

/* ---------- Progress ---------- */

.surveyProgress {
	display: none;
	width: 100%;
	overflow: hidden;
	margin: 0 0 16px;
	font-size: 14px;
	color: var(--muted);
}

.surveyProgressDivleft {
	float: left;
	width: 10%;
}

.surveyProgressDivCenter {
	float: left;
	width: 80%;
	margin-top: 8px;
	height: 6px;
	overflow: hidden;
	border-radius: 3px;
	background: var(--line);
}

.surveyProgressDivCenterProgress {
	width: 75%;
	height: 6px;
	background: var(--accent);
}

.surveyProgressDivRight {
	float: left;
	width: 10%;
	text-align: right;
}

/* ---------- Intro and notices ---------- */

.surveyIntro {
	width: 100%;
	margin-bottom: 16px;
	border-radius: var(--radius);
	background: var(--surface);
}

.surveyIntroDiv {
	padding: 16px 20px;
}

/* Server message after a rejected submit, also used for "View only" and
   "Preview". Sticky, so it stays readable while scrolling to the question. */
.surveyMandatoryErrorBox {
	position: sticky;
	top: 8px;
	z-index: 10;
	width: 100%;
	margin: 16px 0;
	padding: 14px 16px 14px 54px;
	border: 1px solid rgba(210, 0, 0, 0.35);
	border-left: 5px solid var(--error);
	border-radius: var(--radius);
	background: rgb(253, 237, 235);
	box-shadow: var(--shadow);
	color: rgb(140, 0, 0);
	font-size: 15px;
	font-weight: 700;
	line-height: 1.35;
	text-align: left;
	animation: surveyErrorIn 0.25s ease-out;
}

/* Drawn here because web/error-icon.png is too small to scale up. */
.surveyMandatoryErrorBox img {
	display: none;
}

.surveyMandatoryErrorBox::before {
	content: "!";
	position: absolute;
	top: 50%;
	left: 14px;
	width: 26px;
	height: 26px;
	margin-top: -13px;
	border-radius: 50%;
	background: var(--error);
	color: #fff;
	font-size: 16px;
	line-height: 26px;
	text-align: center;
}

@keyframes surveyErrorIn {
	from {
		opacity: 0;
		transform: translateY(-6px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.surveyMandatoryErrorBox {
		animation: none;
	}
}

.surveyMandatoryElements {
	width: 100%;
	margin: 12px 0;
	color: var(--muted);
	font-size: 15px;
}

/* Parts are cards, so the separators only add spacing. */
hr.separatingLine {
	height: 0;
	margin: 0 0 32px;
	border: 0;
}

/* ---------- Survey details ---------- */

table.survey {
	width: 100%;
	margin-bottom: 16px;
	border-collapse: collapse;
}

.surveyTableHeader th {
	padding: 0 0 8px;
	border-bottom: 1px solid var(--line);
	color: var(--colorDarkTPMS);
	font-size: 16px;
	font-weight: 700;
	text-align: left;
}

td.SurveyMasterData {
	padding: 8px 16px 0 0;
	font-size: 15px;
}

td.SurveyMasterData:first-child {
	width: 88px;
	color: var(--muted);
}

.surveyTextFieldLong,
.surveyTextFieldMiddle {
	width: 100%;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
}

/* ---------- Parts ---------- */

#surveyPart {
	padding: 16px;
	border-radius: var(--radius);
	background: #fff;
	box-shadow: var(--shadow);
}

#surveyPart p {
	margin: 0;
}

#surveyPart table.survey {
	margin-bottom: 0;
}

#surveyPart .surveyPartHeader {
	margin-bottom: 8px;
	color: var(--colorDarkTPMS);
	font-size: 18px;
	font-weight: 700;
	line-height: 1.3;
}

.surveyInstructions {
	margin: 0 0 12px;
	color: var(--muted);
	font-size: 14px;
}

.surveyValueDescription {
	color: var(--muted);
	font-size: 12px;
}

/* ---------- Matrix ---------- */

.surveyTableHeaderMatrix td {
	padding: 8px 6px;
	border-bottom: 2px solid var(--line);
	color: var(--text);
	font-size: 14px;
	font-weight: 700;
	line-height: 1.25;
	text-align: center;
	vertical-align: bottom;
}

td.SurveyMatrixColumnValue {
	min-width: 52px;
}

td.SurveyMatrixRemarkHeader {
	width: 30%;
	text-align: left;
}

.tr1SurveyMatrix td,
.tr2SurveyMatrix td {
	border-bottom: 1px solid var(--line);
}

td.SurveyMatrixRowValue {
	width: 30%;
	padding: 8px 12px 8px 0;
	font-size: 16px;
	line-height: 1.35;
}

td.SurveyMatrix {
	padding: 4px;
	text-align: center;
}

td.SurveyMatrix label {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	cursor: pointer;
}

td.SurveyMatrixRemark label {
	cursor: auto;
}

input[type="radio"] {
	flex: none;
	width: 20px;
	height: 20px;
	margin: 0;
	accent-color: var(--accent);
}

/* Column name for each choice: read by screen readers, shown on phones. */
.surveyChoiceLabel {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* ---------- Text fields ---------- */

.surveyInputMiddle,
.surveyTextAreaMiddle,
.surveyTextAreaMatrix {
	display: block;
	width: 100%;
	padding: 8px 10px;
	border: 1px solid var(--fieldLine);
	border-radius: 6px;
	background: #fff;
	color: inherit;
	font: inherit;
}

.surveyTextAreaMiddle {
	min-height: 120px;
}

.surveyTextAreaMatrix {
	height: 40px;
	min-height: 40px;
	font-size: 15px;
}

input:focus-visible,
textarea:focus-visible,
.SurveyButton:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 1px;
}

/* ---------- Buttons and footer ---------- */

.SurveyButtonDiv {
	float: left;
	margin-bottom: 8px;
	padding-right: 8px;
}

.SurveyButtonDiv2 {
	float: right;
	margin-bottom: 8px;
	padding-left: 8px;
}

.SurveyButton {
	width: 150px;
	min-height: 44px;
	padding: 10px 16px;
	border: 1px solid var(--accent);
	border-radius: 6px;
	background: var(--accent);
	color: #fff;
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}

#butQuit,
#butBack {
	background: #fff;
	color: var(--accent);
}

.surveyFooter {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 4px 16px;
	clear: both;
	padding-top: 32px;
	color: var(--muted);
	font-size: 13px;
}

/* ---------- Phones ---------- */

@media (max-width: 640px) {
	body {
		font-size: 16px;
	}

	.container,
	.containerSafari {
		padding: 16px;
	}

	#surveyPart {
		padding: 12px;
	}

	.surveyHeader tr {
		gap: 16px;
	}

	.surveyHeaderText {
		font-size: 22px;
	}

	.surveyHeaderLogo img {
		max-width: 110px;
		max-height: 40px;
	}

	table.survey,
	table.survey tbody {
		display: block;
	}

	table.survey tr {
		display: flex;
		flex-wrap: wrap;
	}

	.surveyTableHeader th {
		flex: 1;
	}

	td.SurveyMasterData:first-child {
		flex: 0 0 72px;
		width: auto;
	}

	td.SurveyMasterData:last-child {
		flex: 1;
		min-width: 0;
		padding-right: 0;
	}

	/* The column headers can't line up here: each choice carries its own label. */
	table.survey tr.surveyTableHeaderMatrix {
		display: none;
	}

	/* Each matrix row becomes a stacked block inside the part card. */
	table.survey tr.tr1SurveyMatrix,
	table.survey tr.tr2SurveyMatrix {
		gap: 4px;
		padding: 12px 0;
		border-bottom: 1px solid var(--line);
	}

	table.survey tr.tr1SurveyMatrix:last-child,
	table.survey tr.tr2SurveyMatrix:last-child {
		padding-bottom: 0;
		border-bottom: 0;
	}

	.tr1SurveyMatrix td,
	.tr2SurveyMatrix td {
		border: 0;
	}

	td.SurveyMatrixRowValue {
		flex: 0 0 100%;
		width: auto;
		padding: 0 0 4px;
		font-size: 16px;
		font-weight: 700;
	}

	td.SurveyMatrix {
		flex: 1 1 auto;
		padding: 0;
	}

	td.SurveyMatrix label {
		gap: 4px;
		padding: 6px 4px;
		border: 1px solid var(--fieldLine);
		border-radius: 6px;
		background: #fff;
	}

	td.SurveyMatrix label:has(input:checked) {
		border-color: var(--accent);
		box-shadow: inset 0 0 0 1px var(--accent);
	}

	.surveyChoiceLabel {
		position: static;
		width: auto;
		height: auto;
		overflow: visible;
		clip-path: none;
		font-size: 15px;
		line-height: 1.2;
		text-align: left;
		white-space: normal;
	}

	/* Remarks sit under the choices, full width. */
	td.SurveyMatrixRemark {
		flex: 0 0 100%;
		order: 1;
	}

	td.SurveyMatrixRemark label {
		display: block;
		padding: 0;
		border: 0;
		background: none;
	}

	td.SurveyMatrixRemark .surveyChoiceLabel {
		display: block;
		margin: 4px 0;
		color: var(--muted);
		font-size: 14px;
	}

	.surveyTextAreaMatrix {
		height: 44px;
		font-size: 16px;
	}

	.SurveyButtonDiv,
	.SurveyButtonDiv2 {
		width: 50%;
	}

	.SurveyButton {
		width: 100%;
	}
}
