/*
 * MTIT Student & Examination Management — front-end exam engine styles.
 * Mobile-first, no framework dependency.
 */

.mtit-se-exam-app {
	box-sizing: border-box;
	max-width: 960px;
	margin: 0 auto;
	font-size: 15px;
	line-height: 1.5;
	color: #1d2327;
}

.mtit-se-exam-app *,
.mtit-se-exam-app *::before,
.mtit-se-exam-app *::after {
	box-sizing: border-box;
}

.mtit-se-exam-config-error {
	padding: 16px;
	background: #fbdcdc;
	color: #a13333;
	border-radius: 4px;
}

.mtit-se-panel {
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 6px;
	padding: 24px;
	margin: 16px 0;
}

.mtit-se-panel-center {
	text-align: center;
}

.mtit-se-alert {
	padding: 10px 14px;
	border-radius: 4px;
	margin-bottom: 16px;
}

.mtit-se-alert-error {
	background: #fbdcdc;
	color: #a13333;
}

.mtit-se-alert-info {
	background: #d6e4fb;
	color: #1a4b91;
}

.mtit-se-field {
	margin-bottom: 16px;
}

.mtit-se-field label {
	display: block;
	font-weight: 600;
	margin-bottom: 6px;
}

.mtit-se-field input[type='text'],
.mtit-se-field input[type='date'] {
	width: 100%;
	max-width: 320px;
	padding: 10px 12px;
	border: 1px solid #8c8f94;
	border-radius: 4px;
	font-size: 15px;
}

.mtit-se-field-actions {
	margin-top: 12px;
}

.mtit-se-btn {
	display: inline-block;
	padding: 10px 18px;
	margin: 4px 6px 4px 0;
	border: 1px solid #8c8f94;
	border-radius: 4px;
	background: #f6f7f7;
	color: #1d2327;
	font-size: 14px;
	cursor: pointer;
	min-height: 40px;
}

.mtit-se-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.mtit-se-btn-primary {
	background: #2271b1;
	border-color: #2271b1;
	color: #fff;
	font-weight: 600;
}

.mtit-se-btn-active {
	background: #fef3cd;
	border-color: #c9971f;
	color: #8a6400;
}

.mtit-se-btn-submit {
	background: #a13333;
	border-color: #a13333;
	color: #fff;
	font-weight: 600;
}

.mtit-se-instructions-meta {
	list-style: none;
	margin: 16px 0;
	padding: 0;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px 24px;
}

.mtit-se-instructions-meta li {
	display: flex;
	justify-content: space-between;
	border-bottom: 1px solid #f0f0f1;
	padding: 4px 0;
}

.mtit-se-meta-label {
	color: #646970;
}

.mtit-se-meta-value {
	font-weight: 600;
}

.mtit-se-instructions-text {
	background: #f6f7f7;
	border-radius: 4px;
	padding: 12px 16px;
	margin: 16px 0;
}

.mtit-se-agree {
	display: block;
	margin: 16px 0;
}

/* Exam screen */

.mtit-se-screen-exam {
	padding-bottom: 24px;
}

.mtit-se-topbar {
	position: sticky;
	top: 0;
	z-index: 10;
	display: flex;
	justify-content: space-between;
	align-items: center;
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 6px;
	padding: 10px 16px;
	margin: 12px 0;
	flex-wrap: wrap;
	gap: 8px;
}

.mtit-se-progress {
	font-weight: 600;
}

.mtit-se-timer-value {
	font-size: 20px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.mtit-se-timer-value.is-low {
	color: #a13333;
}

.mtit-se-offline-banner {
	background: #fef3cd;
	color: #8a6400;
	padding: 8px 14px;
	border-radius: 4px;
	margin-bottom: 12px;
}

.mtit-se-exam-body {
	display: flex;
	flex-direction: column-reverse;
	gap: 16px;
}

.mtit-se-question-panel {
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 6px;
	padding: 20px;
	flex: 1 1 auto;
}

.mtit-se-question-meta {
	display: flex;
	gap: 12px;
	margin-bottom: 8px;
	font-size: 13px;
	color: #646970;
}

.mtit-se-question-text {
	font-size: 17px;
	font-weight: 500;
	margin: 12px 0 20px;
	white-space: pre-wrap;
}

.mtit-se-options {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-bottom: 20px;
}

.mtit-se-option {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 12px 14px;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	cursor: pointer;
}

.mtit-se-option:hover {
	background: #f6f7f7;
}

.mtit-se-option input {
	margin-top: 3px;
	width: 18px;
	height: 18px;
	flex-shrink: 0;
}

.mtit-se-option-label {
	font-weight: 700;
	flex-shrink: 0;
}

.mtit-se-question-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
}

.mtit-se-palette-panel {
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 6px;
	padding: 16px;
	flex: 0 0 auto;
}

.mtit-se-palette-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 12px;
	font-size: 12px;
}

.mtit-se-legend-item {
	display: flex;
	align-items: center;
	gap: 4px;
}

.mtit-se-legend-swatch {
	width: 12px;
	height: 12px;
	border-radius: 2px;
	display: inline-block;
}

.mtit-se-swatch-current {
	background: #2271b1;
}

.mtit-se-swatch-answered {
	background: #1a7a3a;
}

.mtit-se-swatch-not-answered {
	background: #dcdcde;
}

.mtit-se-swatch-marked {
	background: #c9971f;
}

.mtit-se-palette-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
	gap: 6px;
}

.mtit-se-palette-item {
	min-height: 38px;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	background: #f0f0f1;
	color: #1d2327;
	cursor: pointer;
	font-weight: 600;
}

.mtit-se-palette-item.is-not-answered {
	background: #fff;
	border-color: #dcdcde;
}

.mtit-se-palette-item.is-answered {
	background: #d4f4dd;
	border-color: #1a7a3a;
	color: #1a7a3a;
}

.mtit-se-palette-item.is-marked {
	background: #fef3cd;
	border-color: #c9971f;
	color: #8a6400;
}

.mtit-se-palette-item.is-current {
	outline: 3px solid #2271b1;
	outline-offset: 1px;
}

/* Modal */

.mtit-se-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1000;
	padding: 16px;
}

.mtit-se-modal-box {
	background: #fff;
	border-radius: 6px;
	padding: 24px;
	max-width: 420px;
	width: 100%;
}

.mtit-se-modal-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	margin-top: 16px;
}

/* Tablet and up: palette beside the question panel */
@media (min-width: 768px) {
	.mtit-se-exam-body {
		flex-direction: row;
	}

	.mtit-se-question-panel {
		order: 1;
	}

	.mtit-se-palette-panel {
		order: 2;
		width: 280px;
	}

	.mtit-se-instructions-meta {
		grid-template-columns: 1fr 1fr 1fr;
	}
}

/* Small phones */
@media (max-width: 420px) {
	.mtit-se-palette-grid {
		grid-template-columns: repeat(auto-fill, minmax(32px, 1fr));
	}

	.mtit-se-btn {
		flex: 1 1 45%;
		text-align: center;
	}
}
